From: Richard Fairhurst Date: Sun, 10 Jan 2010 11:31:17 +0000 (+0000) Subject: more delete X-Git-Tag: 0.5~547 X-Git-Url: https://git.openstreetmap.org/potlatch2.git/commitdiff_plain/63418d27488ac994e8f680be39b05b8c7cad06be?hp=292c89dd1e5ff3650cff2effca4f05cd67290796 more delete --- diff --git a/net/systemeD/halcyon/WayUI.as b/net/systemeD/halcyon/WayUI.as index ced3c611..3f1f22b9 100755 --- a/net/systemeD/halcyon/WayUI.as +++ b/net/systemeD/halcyon/WayUI.as @@ -32,6 +32,7 @@ package net.systemeD.halcyon { way.addEventListener(Connection.TAG_CHANGE, wayTagChanged); way.addEventListener(Connection.WAY_NODE_ADDED, wayNodeAdded); way.addEventListener(Connection.WAY_NODE_REMOVED, wayNodeRemoved); + way.addEventListener(Connection.WAY_DELETED, wayDeleted); attachNodeListeners(); } @@ -57,6 +58,10 @@ package net.systemeD.halcyon { private function nodeMoved(event:NodeMovedEvent):void { redraw(); } + private function wayDeleted(event:EntityEvent):void { + Globals.vars.root.addDebug("waydeleted fired on "+way.length+":"+event.entity); + redraw(); + } private function init():void { recalculate(); @@ -75,6 +80,7 @@ package net.systemeD.halcyon { var cx:Number=0, cy:Number=0; pathlength=0; patharea=0; + if (way.length==0) { return; } lx = way.getNode(way.length-1).lon; ly = way.getNode(way.length-1).latp; @@ -190,6 +196,7 @@ package net.systemeD.halcyon { // Draw icons // ** there should be huge potential to optimise this - at present we're // running getStyles for every node in the way on every redraw + // ** fix r/heading behaviour - that doesn't look right var r:Number; var nodetags:Object; var nodeSelected:int=stateClasses["nodeSelected"]; diff --git a/net/systemeD/halcyon/connection/Way.as b/net/systemeD/halcyon/connection/Way.as index 2dd503fa..de13b55c 100644 --- a/net/systemeD/halcyon/connection/Way.as +++ b/net/systemeD/halcyon/connection/Way.as @@ -97,7 +97,6 @@ package net.systemeD.halcyon.connection { public function mergeWith(way:Way,topos:int,frompos:int):void { var i:int; - Globals.vars.root.addDebug("way "+id+", merging with "+way.id+", adding to "+topos+" , from "+frompos); // merge relations for each (var r:Relation in way.parentRelations) { @@ -123,11 +122,10 @@ package net.systemeD.halcyon.connection { else { for (i=way.length-1; i>=0; i--) { addToEnd(topos,way.getNode(i)); } } // delete way - + way.remove(); } private function addToEnd(topos:int,node:Node):void { - Globals.vars.root.addDebug("adding "+node.id+" at "+topos); if (topos==0) { if (nodes[0]==node) { return; } prependNode(node); diff --git a/net/systemeD/potlatch2/controller/SelectedWay.as b/net/systemeD/potlatch2/controller/SelectedWay.as index d4d4f7e7..217bf118 100644 --- a/net/systemeD/potlatch2/controller/SelectedWay.as +++ b/net/systemeD/potlatch2/controller/SelectedWay.as @@ -84,6 +84,7 @@ package net.systemeD.potlatch2.controller { // ** needs to prefer positive to negative IDs // find common point + if (way==selectedWay) { return false; } if (selectedWay.getNode(0) ==way.getNode(0) ) { selectedWay.mergeWith(way,0,0); } else if (selectedWay.getNode(0) ==way.getLastNode()) { selectedWay.mergeWith(way,0,way.length-1); } else if (selectedWay.getLastNode()==way.getNode(0) ) { selectedWay.mergeWith(way,selectedWay.length-1,0); }