Minor change to the instantiation of VectorSourceDialog, in order the close button...
[potlatch2.git] / net / systemeD / potlatch2 / BackgroundSelector.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:VBox
3         xmlns:mx="http://www.adobe.com/2006/mxml"
4         paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
5         horizontalAlign="left" backgroundColor="white" borderStyle="inset">
6         
7         <mx:List width="100%" height="100%" id="background" change="updateBackground();" verticalScrollPolicy="on"> 
8             <!-- This should be pulled in from an XML file rather than sitting in the source -->
9             <mx:dataProvider>
10                 <mx:Object label="None" data="" />
11                 <mx:Object label="Yahoo!" data="yahoo" />
12             <mx:Object label="OSM - Mapnik" data="http://tile.openstreetmap.org/$z/$x/$y.png" />
13             <mx:Object label="OSM - Osmarender" data="http://tah.openstreetmap.org/Tiles/tile/$z/$x/$y.png" />
14             <mx:Object label="OSM - Maplint (errors)" data="http://tah.openstreetmap.org/Tiles/maplint/$z/$x/$y.png" />
15             <mx:Object label="OpenCycleMap" data="http://andy.sandbox.cloudmade.com/tiles/cycle/$z/$x/$y.png" />
16             <mx:Object label="UK historic: 1:25k" data="http://ooc.openstreetmap.org/os1/$z/$x/$y.png" />
17             <mx:Object label="UK historic: 7th" data="http://ooc.openstreetmap.org/os7/$z/$x/$y.png" />
18             <mx:Object label="UK historic: NPE" data="http://ooc.openstreetmap.org/npe/$z/$x/$y.png" />
19             <mx:Object label="Australia: NearMap" data="http://www.nearmap.com/maps/nml=Vert&amp;zxy=$z,$x,$y" />
20             </mx:dataProvider>
21         </mx:List>
22         <mx:CheckBox width="100%" label="Dim background" selected="true" id="dim"
23             change="Globals.vars.root.tileset.setDimming(dim.selected); Globals.vars.yahoo.alpha = dim.selected ? 0.5 : 1" />
24
25         <mx:Button label="Load vector file..." click="new VectorSourceDialog().init();"/>
26
27         <mx:Script><![CDATA[
28                 import net.systemeD.halcyon.*;
29                 import net.systemeD.halcyon.connection.*;
30                 import net.systemeD.potlatch2.*;
31                 import mx.core.*;
32                 import mx.managers.PopUpManager;
33                 import com.yahoo.maps.api.YahooMap;
34                 import com.yahoo.maps.api.YahooMapEvent;
35                 import com.yahoo.maps.api.core.location.LatLon;
36
37                 private function updateBackground():void {
38             var theMap:Map = Globals.vars.root;
39             var yahoo:YahooMap = Globals.vars.yahoo;
40                         var bg:String=background.selectedItem.data;
41                         if (bg=='yahoo') {
42                                 theMap.tileset.init('',false);
43                                 yahoo.visible=true;
44                                 yahoo.zoomLevel = 18-theMap.scale;
45                                 yahoo.centerLatLon = new LatLon(theMap.centre_lat, theMap.centre_lon);
46                         } else {
47                                 theMap.tileset.init(background.selectedItem.data,true);
48                                 yahoo.visible=false;
49                         }
50                 }
51                 
52
53     ]]></mx:Script>     
54 </mx:VBox>
55