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 6381feed972f362630c40710bca438e167a9d680..d33aac80adb35c10c71d0d62012e75446f43cee1 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 4d424eafb925b69cda7dac679c326a16fae9aa16..fcd899b7c4a9a6c545cdbd215d4e4cf33dcf0b2a 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);
         }