fix horrid merge bug (yay!). Implement suspend/resume events for redrawing, to speed...
[potlatch2.git] / net / systemeD / halcyon / connection / Entity.as
index 78742f5..1d2feb4 100644 (file)
@@ -59,7 +59,7 @@ package net.systemeD.halcyon.connection {
                 else
                     tags[key] = value;
                 markDirty();
-                dispatchEvent(new TagEvent(Connection.TAG_CHANGE, this, key, key, old, value));
+                dispatchEvent(new TagEvent(Connection.TAG_CHANGED, this, key, key, old, value));
             }
         }
 
@@ -69,7 +69,7 @@ package net.systemeD.halcyon.connection {
                 delete tags[oldKey];
                 tags[newKey] = value;
                 markDirty();
-                dispatchEvent(new TagEvent(Connection.TAG_CHANGE, this, oldKey, newKey, value, value));
+                dispatchEvent(new TagEvent(Connection.TAG_CHANGED, this, oldKey, newKey, value, value));
             }
         }
 
@@ -135,10 +135,16 @@ package net.systemeD.halcyon.connection {
                
                public function addParent(parent:Entity):void {
                        parents[parent]=true;
+                       
+                       if ( parent is Relation )
+                           dispatchEvent(new RelationMemberEvent(Connection.ADDED_TO_RELATION, this, parent as Relation, -1));
                }
 
                public function removeParent(parent:Entity):void {
                        delete parents[parent];
+
+                       if ( parent is Relation )
+                           dispatchEvent(new RelationMemberEvent(Connection.REMOVED_FROM_RELATION, this, parent as Relation, -1));
                }
                
                public function get parentWays():Array {
@@ -161,6 +167,14 @@ package net.systemeD.halcyon.connection {
                        return false;
                }
                
+               public function get numParentWays():uint {
+                       var i:uint=0;
+                       for (var o:Object in parents) {
+                               if (o is Way) { i++; }
+                       }
+                       return i;
+               }
+               
                public function get parentRelations():Array {
                        var a:Array=[];
                        for (var o:Object in parents) {
@@ -178,7 +192,17 @@ package net.systemeD.halcyon.connection {
                public function hasParent(entity:Entity):Boolean {
             return parents[entity] == true;
         }
-        
+
+               // Resume/suspend redraw
+               
+               public function suspend():void {
+                       dispatchEvent(new EntityEvent(Connection.SUSPEND_REDRAW, this));
+               }
+               
+               public function resume():void {
+                       dispatchEvent(new EntityEvent(Connection.RESUME_REDRAW, this));
+               }
+
                // To be overridden
 
         public function getType():String {