Merge branch 'master' into history
[potlatch2.git] / net / systemeD / potlatch2 / utils / BugLoader.as
index 5b70251..d9caabc 100644 (file)
@@ -1,9 +1,9 @@
 package net.systemeD.potlatch2.utils {
 
     import net.systemeD.halcyon.Map;
-    import net.systemeD.halcyon.VectorLayer;
+    import net.systemeD.halcyon.MapPaint;
     import net.systemeD.halcyon.connection.Marker;
-    import net.systemeD.potlatch2.BugLayer;
+    import net.systemeD.potlatch2.BugConnection;
     import flash.net.*;
     import flash.events.*;
     import flash.system.Security;
@@ -14,9 +14,10 @@ package net.systemeD.potlatch2.utils {
         private var bugBaseURL:String;
         private var bugApiKey:String;
         private var bugDetailsURL:String;
-        private var _layer:VectorLayer;
+        private var _layer:MapPaint;
         private var name:String;
         private static const STYLESHEET:String="stylesheets/bugs.css";
+        private var connection:BugConnection;
 
 
         public function BugLoader(map:Map, url:String, bugApiKey:String, name:String, details:String = ''):void {
@@ -25,23 +26,14 @@ package net.systemeD.potlatch2.utils {
             this.bugApiKey = bugApiKey;
             this.name = name;
             this.bugDetailsURL = details;
+            connection = new BugConnection(name, url, bugApiKey, details);
+            _layer = map.addLayer(connection, STYLESHEET, true, true);
+            _layer.visible = false;
         }
 
         public function load():void {
-            layer.loadBbox(map.edge_l, map.edge_r, map.edge_t, map.edge_b);
-        }
-
-
-        private function get layer():VectorLayer {
-                       // >>>> REFACTOR: VectorLayer commented out
-            // if (!_layer) {
-            //     var policyFile:String = bugBaseURL+"crossdomain.xml";
-            //     Security.loadPolicyFile(policyFile);
-            //     _layer=new BugLayer(name,map,STYLESHEET,bugBaseURL,bugApiKey,bugDetailsURL);
-            //     map.addVectorLayer(_layer);
-            // }
-            // return _layer;
-                       return null;
+            _layer.visible = true;
+            connection.loadBbox(map.edge_l, map.edge_r, map.edge_t, map.edge_b);
         }
     }
 }
\ No newline at end of file