New SnapshotLoader and associated connections
authorAndy Allan <andy@gravitystorm.co.uk>
Thu, 2 Jun 2011 13:38:04 +0000 (14:38 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Thu, 2 Jun 2011 13:38:04 +0000 (14:38 +0100)
net/systemeD/potlatch2/collections/VectorBackgrounds.as
net/systemeD/potlatch2/utils/SnapshotConnection.as [new file with mode: 0644]
net/systemeD/potlatch2/utils/SnapshotLoader.as [new file with mode: 0644]

index 0a120e9..6381fee 100644 (file)
@@ -90,6 +90,18 @@ package net.systemeD.potlatch2.collections {
                   }
                   break;
 
+                case "SnapshotLoader":
+                  if (set.url) {
+                    name ||= 'Snapshot Server'
+                    var snapshotLoader:SnapshotLoader = new SnapshotLoader(_map, String(set.url), name);
+                    if (set.@loaded == "true") {
+                      snapshotLoader.load();
+                    }
+                  } else {
+                    trace("VectorBackground: no url for SnapshotLoader");
+                  }
+                  break;
+
                 default:
                   trace("AutoVectorBackground: unknown loader");
               }
diff --git a/net/systemeD/potlatch2/utils/SnapshotConnection.as b/net/systemeD/potlatch2/utils/SnapshotConnection.as
new file mode 100644 (file)
index 0000000..5159e09
--- /dev/null
@@ -0,0 +1,14 @@
+package net.systemeD.potlatch2.utils {
+
+    import net.systemeD.halcyon.connection.XMLConnection;
+
+    public class SnapshotConnection extends XMLConnection {
+
+        public function SnapshotConnection(cname:String,api:String,policy:String,initparams:Object=null) {
+            super(cname,api,policy,initparams);
+        }
+
+        /* todo - stuff about marking nodes/ways as complete */
+
+    }
+}
\ No newline at end of file
diff --git a/net/systemeD/potlatch2/utils/SnapshotLoader.as b/net/systemeD/potlatch2/utils/SnapshotLoader.as
new file mode 100644 (file)
index 0000000..b0feaed
--- /dev/null
@@ -0,0 +1,27 @@
+package net.systemeD.potlatch2.utils {
+
+    import net.systemeD.halcyon.Map;
+    import net.systemeD.halcyon.MapPaint;
+    import net.systemeD.potlatch2.utils.SnapshotConnection;
+
+    public class SnapshotLoader {
+
+        private var map:Map;
+        private var _layer:MapPaint;
+        private static const STYLESHEET:String="stylesheets/wireframe.css"; //TODO take from xml
+        private var connection:SnapshotConnection;
+
+
+        public function SnapshotLoader(map:Map, url:String, name:String):void {
+            this.map = map;
+            connection = new SnapshotConnection(name, url, '');
+        }
+
+        public function load():void {
+            if (!_layer) {
+                _layer = map.addLayer(connection, STYLESHEET);
+            }
+            connection.loadBbox(map.edge_l, map.edge_r, map.edge_t, map.edge_b);
+        }
+    }
+}
\ No newline at end of file