support putative new silent delete
authorRichard Fairhurst <richard@systemed.net>
Thu, 9 Dec 2010 12:16:46 +0000 (12:16 +0000)
committerRichard Fairhurst <richard@systemed.net>
Thu, 9 Dec 2010 12:16:46 +0000 (12:16 +0000)
net/systemeD/halcyon/connection/AMFConnection.as
net/systemeD/halcyon/connection/Connection.as
net/systemeD/halcyon/connection/Entity.as
net/systemeD/halcyon/connection/Node.as
net/systemeD/halcyon/connection/Relation.as
net/systemeD/halcyon/connection/Way.as
net/systemeD/halcyon/connection/XMLBaseConnection.as
net/systemeD/halcyon/connection/XMLConnection.as

index 6ea9bcb..37d243d 100644 (file)
@@ -153,7 +153,7 @@ package net.systemeD.halcyon.connection {
                     var nodeTags:Object = p[3];
                     node = new Node(nodeID, nodeVersion, nodeTags, true, lat, lon);
                 } else if (!node.loaded) {
-                                       node.update(nodeVersion, nodeTags, true, lat, lon);
+                                       node.update(nodeVersion, nodeTags, true, false, lat, lon);
                                }
                 setNode(node,true);
                 nodes.push(node);
@@ -162,7 +162,7 @@ package net.systemeD.halcyon.connection {
                        if (way==null) {
                way = new Way(id, version, tags, true, nodes);
                        } else {
-                               way.update(version, tags, true, nodes);
+                               way.update(version, tags, true, true, nodes);
                        }
                setWay(way,true);
                        gotRequest(id+"way");
@@ -214,7 +214,7 @@ package net.systemeD.halcyon.connection {
                        if (relation==null) {
                    relation = new Relation(id, version, tags, true, members);
                        } else {
-                               relation.update(version,tags,true,members);
+                               relation.update(version,tags,true,false,members);
                        }
             setRelation(relation,true);
                        gotRequest(id+"rel");
index 45c3a0a..e8663e7 100644 (file)
@@ -127,7 +127,7 @@ package net.systemeD.halcyon.connection {
                protected function setOrUpdateNode(newNode:Node, queue:Boolean):void {
                if (nodes[newNode.id]) {
                                var wasDeleted:Boolean=nodes[newNode.id].isDeleted();
-                               nodes[newNode.id].update(newNode.version, newNode.getTagsHash(), true, newNode.lat, newNode.lon, newNode.uid, newNode.timestamp);
+                               nodes[newNode.id].update(newNode.version, newNode.getTagsHash(), true, newNode.parentsLoaded, newNode.lat, newNode.lon, newNode.uid, newNode.timestamp);
                                if (wasDeleted) sendEvent(new EntityEvent(NEW_NODE, nodes[newNode.id]), false);
                        } else {
                                setNode(newNode, queue);
index 3a1491e..58d6639 100644 (file)
@@ -16,7 +16,7 @@ package net.systemeD.halcyon.connection {
                private var parents:Dictionary = new Dictionary();
                public var locked:Boolean = false;                                              // lock against purging when off-screen
                public var deleted:Boolean = false;
-//             public var parentsLoaded:Boolean = true;                                // are all its parents in memory?
+               public var parentsLoaded:Boolean = true;                                // are all its parents in memory?
 
         public function Entity(id:Number, version:uint, tags:Object, loaded:Boolean, uid:Number, timestamp:String) {
             this._id = id;
@@ -48,8 +48,8 @@ package net.systemeD.halcyon.connection {
                        return _timestamp;
                }
 
-               public function updateEntityProperties(version:uint, tags:Object, loaded:Boolean, uid:Number, timestamp:String):void {
-                       _version=version; this.tags=tags; _loaded=loaded; _uid = uid; _timestamp = timestamp;
+               public function updateEntityProperties(version:uint, tags:Object, loaded:Boolean, parentsLoaded:Boolean, uid:Number, timestamp:String):void {
+                       _version=version; this.tags=tags; _loaded=loaded; this.parentsLoaded=parentsLoaded; _uid = uid; _timestamp = timestamp;
                        deleted=false;
                }
 
index 4044331..7261b35 100644 (file)
@@ -14,8 +14,8 @@ package net.systemeD.halcyon.connection {
             this._lon = lon;
         }
 
-               public function update(version:uint, tags:Object, loaded:Boolean, lat:Number, lon:Number, uid:Number = NaN, timestamp:String = null):void {
-                       updateEntityProperties(version,tags,loaded,uid,timestamp); setLatLonImmediate(lat,lon);
+               public function update(version:uint, tags:Object, loaded:Boolean, parentsLoaded:Boolean, lat:Number, lon:Number, uid:Number = NaN, timestamp:String = null):void {
+                       updateEntityProperties(version,tags,loaded,parentsLoaded,uid,timestamp); setLatLonImmediate(lat,lon);
                }
 
         public function get lat():Number {
index 568027c..ea8902a 100644 (file)
@@ -13,12 +13,12 @@ package net.systemeD.halcyon.connection {
                            member.entity.addParent(this);
         }
 
-        public function update(version:uint, tags:Object, loaded:Boolean, members:Array, uid:Number = NaN, timestamp:String = null):void {
+        public function update(version:uint, tags:Object, loaded:Boolean, parentsLoaded:Boolean, members:Array, uid:Number = NaN, timestamp:String = null):void {
                        var member:RelationMember;
                        for each (member in this.members)
                            member.entity.removeParent(this);
 
-                       updateEntityProperties(version,tags,loaded,uid,timestamp);
+                       updateEntityProperties(version,tags,loaded,parentsLoaded,uid,timestamp);
                        this.members=members;
                        for each (member in members)
                            member.entity.addParent(this);
index f6cc174..f34fb89 100644 (file)
@@ -18,10 +18,10 @@ package net.systemeD.halcyon.connection {
                        calculateBbox();
         }
 
-               public function update(version:uint, tags:Object, loaded:Boolean, nodes:Array, uid:Number = NaN, timestamp:String = null):void {
+               public function update(version:uint, tags:Object, loaded:Boolean, parentsLoaded:Boolean, nodes:Array, uid:Number = NaN, timestamp:String = null):void {
                        var node:Node;
                        for each (node in this.nodes) { node.removeParent(this); }
-                       updateEntityProperties(version,tags,loaded,uid,timestamp); this.nodes=nodes;
+                       updateEntityProperties(version,tags,loaded,parentsLoaded,uid,timestamp); this.nodes=nodes;
                        for each (node in nodes) { node.addParent(this); }
                        calculateBbox();
                }
index 16cbeb2..ad6a391 100644 (file)
@@ -79,7 +79,7 @@ package net.systemeD.halcyon.connection {
                     if ( rel == null )
                         setRelation(new Relation(id, version, tags, true, members, uid, timestamp), false);
                     else {
-                        rel.update(version, tags, true, members, uid, timestamp);
+                        rel.update(version, tags, true, false, members, uid, timestamp);
                         sendEvent(new EntityEvent(NEW_RELATION, rel), false);
                     }
                 }
@@ -98,12 +98,11 @@ package net.systemeD.halcyon.connection {
                                                   nodeData.@timestamp);
                                
                                if ( node == null || !node.loaded) {
-//                                     newNode.parentsLoaded=newNode.within(minlon,maxlon,minlat,maxlat);
-//                                     ** updateEntityProperties will need to do parentsLoaded as well
+                                       newNode.parentsLoaded=newNode.within(minlon,maxlon,minlat,maxlat);
                                        setOrUpdateNode(newNode, true);
                                } else {
                                        // the node's already in memory, but store it in case one of the new ways needs it
-//                                     if (newNode.within(minlon,maxlon,minlat,maxlat)) newNode.parentsLoaded=true;
+                                       if (newNode.within(minlon,maxlon,minlat,maxlat)) newNode.parentsLoaded=true;
                                        unusedNodes[id]=newNode;
                                }
                        }
@@ -129,7 +128,7 @@ package net.systemeD.halcyon.connection {
                         setWay(new Way(id, version, tags, true, nodes, uid, timestamp),false);
                     } else {
                                                waycount++;
-                        way.update(version, tags, true, nodes, uid, timestamp);
+                        way.update(version, tags, true, true, nodes, uid, timestamp);
                         sendEvent(new EntityEvent(NEW_WAY, way), false);
                     }
                 }
index f3f44dd..1d1415a 100644 (file)
@@ -265,7 +265,7 @@ package net.systemeD.halcyon.connection {
                     continue;
                     
                 var xml:XML = serialise(entity);
-                // ** if parentsLoaded==false, do a soft delete only
+                if (!entity.parentsLoaded) xml.@silent = "true";
                 xml.@changeset = changeset.id;
                 del.appendChild(xml);
             }