Take <style> parameter from config file for snapshot background layers
authorAndy Allan <andy@gravitystorm.co.uk>
Fri, 17 Jun 2011 15:20:33 +0000 (16:20 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Fri, 17 Jun 2011 15:20:33 +0000 (16:20 +0100)
net/systemeD/potlatch2/collections/VectorBackgrounds.as
net/systemeD/potlatch2/utils/SnapshotLoader.as

index 6381fee..d33aac8 100644 (file)
@@ -93,7 +93,7 @@ package net.systemeD.potlatch2.collections {
                 case "SnapshotLoader":
                   if (set.url) {
                     name ||= 'Snapshot Server'
-                    var snapshotLoader:SnapshotLoader = new SnapshotLoader(_map, String(set.url), name);
+                    var snapshotLoader:SnapshotLoader = new SnapshotLoader(_map, String(set.url), name, String(set.style));
                     if (set.@loaded == "true") {
                       snapshotLoader.load();
                     }
index 4d424ea..fcd899b 100644 (file)
@@ -10,16 +10,19 @@ package net.systemeD.potlatch2.utils {
         private var _layer:MapPaint;
         private static const STYLESHEET:String="stylesheets/snapshot.css"; //TODO take from xml
         private var connection:SnapshotConnection;
+        private var _stylesheet:String;
 
 
-        public function SnapshotLoader(map:Map, url:String, name:String):void {
+        public function SnapshotLoader(map:Map, url:String, name:String, stylesheet:String = null):void {
+            trace("*"+stylesheet+"*")
             this.map = map;
             connection = new SnapshotConnection(name, url, '');
+            _stylesheet = (stylesheet && stylesheet != '') ? stylesheet : STYLESHEET;
         }
 
         public function load():void {
             if (!_layer) {
-                _layer = map.addLayer(connection, STYLESHEET, true, true);
+                _layer = map.addLayer(connection, _stylesheet, true, true);
             }
             connection.loadBbox(map.edge_l, map.edge_r, map.edge_t, map.edge_b);
         }