Use the name supplied in the config file for the vector layer
[potlatch2.git] / net / systemeD / potlatch2 / utils / BugLoader.as
1 package net.systemeD.potlatch2.utils {
2
3     import net.systemeD.halcyon.Map;
4     import net.systemeD.halcyon.VectorLayer;
5     import net.systemeD.halcyon.connection.Marker;
6     import net.systemeD.potlatch2.BugLayer;
7     import flash.net.*;
8     import flash.events.*;
9     import flash.system.Security;
10
11     public class BugLoader {
12
13         private var map:Map;
14         private var bugBaseURL:String;
15         private var bugApiKey:String;
16         private var _layer:VectorLayer;
17         private var name:String;
18         private static const STYLESHEET:String="bugs.css";
19
20
21         public function BugLoader(map:Map, url:String, bugApiKey:String, name:String):void {
22             this.map = map;
23             this.bugBaseURL = url;
24             this.bugApiKey = bugApiKey;
25             this.name = name;
26         }
27
28         public function load():void {
29             layer.loadBbox(map.edge_l, map.edge_r, map.edge_t, map.edge_b);
30         }
31
32
33         private function get layer():VectorLayer {
34             if (!_layer) {
35
36                 var policyFile:String = bugBaseURL+"crossdomain.xml";
37                 Security.loadPolicyFile(policyFile);
38
39                 _layer=new BugLayer(name,map,STYLESHEET,bugBaseURL,bugApiKey);
40                 map.addVectorLayer(_layer);
41             }
42             return _layer;
43         }
44     }
45 }