Temporary "nuke from orbit" remapping button
authorRichard Fairhurst <richard@systemeD.net>
Fri, 16 Mar 2012 14:19:18 +0000 (14:19 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Fri, 16 Mar 2012 14:19:18 +0000 (14:19 +0000)
(plus fix a bug with orphaned POIs not being registered)

net/systemeD/halcyon/connection/actions/DeleteWayAction.as
net/systemeD/potlatch2/Toolbox.mxml

index f2fd1bc..59d91a3 100644 (file)
@@ -30,6 +30,8 @@ package net.systemeD.halcyon.connection.actions {
                                way.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_REMOVED, node, way, 0));
                 if (!node.hasParents && !node.hasInterestingTags()) { //need to trigger redraw of new POIs?
                   node.remove(effects.push);
+                } else {
+                  if (!node.hasParentWays) node.connection.registerPOI(node);
                 }
                        }
                        effects.doAction();
@@ -61,6 +63,7 @@ package net.systemeD.halcyon.connection.actions {
             for each(var node:Node in oldNodeList) {
                 nodeList.push(node);
                node.addParent(way);
+               node.connection.unregisterPOI(node);
                 way.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_ADDED, node, way, 0));
             }
                        way.resume();
index 5ed66ea..a58c97b 100644 (file)
@@ -14,7 +14,7 @@
                <!-- Top row -->
 
                <s:Button icon="@Embed('../../../embedded/delete.svg')"
-                       click='doDelete();' 
+                       click='doDelete(event.ctrlKey,event.shiftKey);' 
                        enabled="{canDo('delete')}" 
                        alpha="{getAlpha('delete')}" 
                        toolTip="{deleteToolTipText()}" 
                // --------------------------------------------------------------------------------
                // Individual toolbox actions
 
-               public function doDelete():void {
+               public function doDelete(controlKey:Boolean,shiftKey:Boolean):void {
                        var undo:CompositeUndoableAction = new CompositeUndoableAction("Delete objects");
-                       for each (var entity:Entity in controller.state.selection) {
-                               if (entity is Node) { entity.connection.unregisterPOI(Node(entity)); }
-                               entity.remove(undo.push);
-                       }
-                       MainUndoStack.getGlobalStack().addAction(undo);
-
-                       if (controller.state is SelectedWayNode) {
-                               controller.setState(new SelectedWay(SelectedWayNode(controller.state).selectedWay));
-                       } else {
+                       if (controlKey) {
+                               // Temporary function to delete everything with non-accepting status
+                               var conn:Connection=controller.state.selection[0].connection;
+                               var o:Object=conn.getObjectsByBbox(controller.map.edge_l, controller.map.edge_r, controller.map.edge_t, controller.map.edge_b);
+                               for each (var way:Way in o.waysInside) {
+                                       if (way.status=='no' || (shiftKey && way.status=='partial')) { way.remove(undo.push); }
+                               }
+                               for each (var poi:Node in o.poisInside) {
+                                       if (poi.status=='no' || (shiftKey && way.status=='partial')) { poi.connection.unregisterPOI(poi); poi.remove(undo.push); }
+                               }
+                               MainUndoStack.getGlobalStack().addAction(undo);
                                controller.setState(new NoSelection());
+                               
+                       } else {
+                               // Standard delete function
+                               for each (var entity:Entity in controller.state.selection) {
+                                       if (entity is Node) { entity.connection.unregisterPOI(Node(entity)); }
+                                       entity.remove(undo.push);
+                               }
+                               MainUndoStack.getGlobalStack().addAction(undo);
+
+                               if (controller.state is SelectedWayNode) {
+                                       controller.setState(new SelectedWay(SelectedWayNode(controller.state).selectedWay));
+                               } else {
+                                       controller.setState(new NoSelection());
+                               }
                        }
                }