From 91a33c0933cdc26aa9bd6cc2d7edd7efa6e8b505 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Thu, 2 Jun 2011 14:38:04 +0100 Subject: [PATCH] New SnapshotLoader and associated connections --- .../collections/VectorBackgrounds.as | 12 +++++++++ .../potlatch2/utils/SnapshotConnection.as | 14 ++++++++++ .../potlatch2/utils/SnapshotLoader.as | 27 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 net/systemeD/potlatch2/utils/SnapshotConnection.as create mode 100644 net/systemeD/potlatch2/utils/SnapshotLoader.as diff --git a/net/systemeD/potlatch2/collections/VectorBackgrounds.as b/net/systemeD/potlatch2/collections/VectorBackgrounds.as index 0a120e94..6381feed 100644 --- a/net/systemeD/potlatch2/collections/VectorBackgrounds.as +++ b/net/systemeD/potlatch2/collections/VectorBackgrounds.as @@ -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 index 00000000..5159e095 --- /dev/null +++ b/net/systemeD/potlatch2/utils/SnapshotConnection.as @@ -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 index 00000000..b0feaed1 --- /dev/null +++ b/net/systemeD/potlatch2/utils/SnapshotLoader.as @@ -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 -- 2.36.1