1 package net.systemeD.halcyon.connection.actions {
3 import net.systemeD.halcyon.connection.*;
5 public class SplitWayAction extends CompositeUndoableAction {
7 private var selectedWay:Way;
8 private var selectedNode:Node;
9 private var newWay:Way;
11 public function SplitWayAction(selectedWay:Way, selectedNode:Node) {
12 super("Split way "+selectedWay.id);
13 this.selectedWay = selectedWay;
14 this.selectedNode = selectedNode;
17 public override function doAction():uint {
19 newWay = Connection.getConnection().createWay(
20 selectedWay.getTagsCopy(),
21 selectedWay.sliceNodes(selectedWay.indexOfNode(selectedNode),selectedWay.length),
24 selectedWay.deleteNodesFrom(selectedWay.indexOfNode(selectedNode)+1, push);
27 // FIXME make this reversible
28 // FIXME needs to copy roles as well
29 // FIXME needs to insert the new way in the correct position in
30 // the relation, in order to not destroy ordered route relations.
31 // This will either be before, or after, the selectedWay, depending
32 // on the relative sequence of the relation members compared to the
33 // direction of selectedWay.
34 for each (var r:Relation in selectedWay.parentRelations) {
35 r.appendMember(new RelationMember(newWay, ''));
39 selectedWay.suspend();
46 public override function undoAction():uint {
47 selectedWay.suspend();