1 package net.systemeD.halcyon.connection.actions {
3 import net.systemeD.halcyon.connection.*;
5 public class DeleteWayAction extends UndoableEntityAction {
6 private var setDeleted:Function;
7 private var effects:CompositeUndoableAction;
8 private var nodeList:Array;
9 private var oldNodeList:Array;
11 public function DeleteWayAction(way:Way, setDeleted:Function, nodeList:Array) {
13 this.setDeleted = setDeleted;
14 this.nodeList = nodeList;
17 public override function doAction():uint {
18 var way:Way = entity as Way;
19 if ( way.isDeleted() )
22 effects = new CompositeUndoableAction("Delete refs");
25 way.removeFromParents(effects.push);
26 oldNodeList = nodeList.slice();
27 while (nodeList.length > 0) {
29 way.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_REMOVED, node, way, 0));
30 node.removeParent(way);
31 if (!node.hasParents && !node.hasInterestingTags()) { //need to trigger redraw of new POIs?
32 node.remove(effects.push);
38 // see note in DeleteNodeAction
44 way.dispatchEvent(new EntityEvent(Connection.WAY_DELETED, way));
50 public override function undoAction():uint {
51 var way:Way = entity as Way;
59 way.dispatchEvent(new EntityEvent(Connection.NEW_WAY, way));
61 for each(var node:Node in oldNodeList) {
63 way.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_ADDED, node, way, 0));