multipolygon fix
authorRichard Fairhurst <richard@systemed.net>
Wed, 30 Jun 2010 12:52:01 +0000 (12:52 +0000)
committerRichard Fairhurst <richard@systemed.net>
Wed, 30 Jun 2010 12:52:01 +0000 (12:52 +0000)
TODO.txt
net/systemeD/halcyon/EntityUI.as
net/systemeD/halcyon/WayUI.as
net/systemeD/potlatch2/TagViewer.mxml

index c7d68f3..19d2cde 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,7 +4,6 @@ Potlatch 2: main outstanding issues
 
 == Core geometry ==
 
-** Dragging/creating multipolygons (or constituent nodes) doesn't force redraw of all ways - need to hook something up to WAY_NODE_MOVED
 * Make parallelise properly undoable
 * Make Quadralatalawhatsit properly undoable
 * Splitway + undo leaves way marked dirty
index 14578e7..2c82fe7 100644 (file)
@@ -65,12 +65,12 @@ package net.systemeD.halcyon {
             }
                }
 
-               private function relationAdded(event:RelationMemberEvent):void {
+               protected function relationAdded(event:RelationMemberEvent):void {
                    event.relation.addEventListener(Connection.TAG_CHANGED, relationTagChanged);
                    redraw();
                }
                
-               private function relationRemoved(event:RelationMemberEvent):void {
+               protected function relationRemoved(event:RelationMemberEvent):void {
                    event.relation.removeEventListener(Connection.TAG_CHANGED, relationTagChanged);
                    redraw();
                }
index a29fe49..7b70fd7 100755 (executable)
@@ -47,6 +47,7 @@ package net.systemeD.halcyon {
                private function wayNodeAdded(event:WayNodeEvent):void {
                    event.node.addEventListener(Connection.NODE_MOVED, nodeMoved);
                    redraw();
+                       redrawMultis();
                }
                    
                private function wayNodeRemoved(event:WayNodeEvent):void {
@@ -55,22 +56,39 @@ package net.systemeD.halcyon {
                                paint.nodeuis[event.node.id].redraw();
                        }
                    redraw();
+                       redrawMultis();
                }
                    
         private function nodeMoved(event:NodeMovedEvent):void {
                        recalculate();
             redraw();
+                       redrawMultis();
         }
                private function wayDeleted(event:EntityEvent):void {
                        redraw();
+                       redrawMultis();
                }
         private function wayReordered(event:EntityEvent):void {
             redraw();
+                       redrawMultis();
         }
                private function wayDragged(event:WayDraggedEvent):void {
                        offsetSprites(event.xDelta,event.yDelta);
                }
 
+               override protected function relationAdded(event:RelationMemberEvent):void {
+                       super.relationAdded(event);
+                       redrawMultis();
+               }
+               override protected function relationRemoved(event:RelationMemberEvent):void {
+                       super.relationRemoved(event);
+                       redrawMultis();
+               }
+               override protected function relationTagChanged(event:TagEvent):void {
+                       super.relationTagChanged(event);
+                       redrawMultis();
+               }
+
                override public function suspendRedraw(event:EntityEvent):void {
                        super.suspendRedraw(event);
                        recalculateDue=false;
@@ -82,6 +100,18 @@ package net.systemeD.halcyon {
                        super.resumeRedraw(event);
                }
 
+               private function redrawMultis():void {
+                       var multis:Array=entity.findParentRelationsOfType('multipolygon','inner');
+                       for each (var m:Relation in multis) {
+                               var outers:Array=m.findMembersByRole('outer');
+                               for each (var e:Entity in outers) { 
+                                       if (e is Way && paint.wayuis[e.id]) {
+                                               paint.wayuis[e.id].redraw();
+                                       }
+                               }
+                       }
+               }
+
                // ------------------------------------------------------------------------------------------
                // Calculate length etc.
                // ** this could be made scale-independent - would speed up redraw
@@ -273,6 +303,7 @@ package net.systemeD.halcyon {
                }
 
                private function solidLine(g:Graphics,w:Way):void {
+                       if (w.length==0) { return; }
             var node:Node = w.getNode(0);
                        g.moveTo(paint.map.lon2coord(node.lon), paint.map.latp2coord(node.latp));
                        for (var i:uint = 1; i < w.length; i++) {
index 3d10594..160cbc9 100644 (file)
                editorStackTabNavigator.creationPolicy="auto";
                editorStackTabNavigator.percentWidth=100;
                editorStackTabNavigator.percentHeight=100;
-               editorStackTabNavigator.paddingLeft=1;
-               editorStackTabNavigator.paddingRight=1;
 
                editorStackAccordion = new Accordion();
                editorStackAccordion.percentWidth=100;