PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/ArcGISLink/src/StatePlane.mxml

http://gmaps-utility-library-flash.googlecode.com/
Macromedia eXtensible Markup Language | 72 lines | 63 code | 9 blank | 0 comment | 0 complexity | ed3fbacc842bb347cb411f067c572dee MD5 | raw file
 1<?xml version="1.0" encoding="utf-8"?>
 2<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
 3                layout="absolute"
 4                width="100%"
 5                height="100%">
 6  <mx:Panel title="State Plane Coordinate System: NC SP83 Feet"
 7            width="100%"
 8            height="100%">
 9    <mx:UIComponent id="mapHolder"
10                    creationComplete="onHolderCreated(event)"
11                    resize="onHolderResized(event)"
12                    width="100%"
13                    height="100%"/>
14  </mx:Panel>
15
16  <mx:Script>
17    <![CDATA[
18      import com.google.maps.*;
19      import com.google.maps.controls.*;
20      import com.google.maps.interfaces.*;
21      import flash.events.*;
22      import com.google.maps.extras.arcgislink.*;
23
24     
25      private var map:Map;
26      private var svc:MapService;
27      SpatialReferences.addSpatialReference(2264, 'PROJCS["NAD_1983_StatePlane_North_Carolina_FIPS_3200_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2000000.002616666],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-79.0],PARAMETER["Standard_Parallel_1",34.33333333333334],PARAMETER["Standard_Parallel_2",36.16666666666666],PARAMETER["Latitude_Of_Origin",33.75],UNIT["Foot_US",0.3048006096012192]]');
28
29      public function onHolderCreated(event:Event):void {
30        svc=new MapService('http://maps.ci.charlotte.nc.us/ArcGIS/rest/services/GET/BaseMap/MapServer');
31        svc.addEventListener(ServiceEvent.LOAD, onServiceLoad);
32      }
33
34      public function onHolderResized(event:Event):void {
35        if (map != null) {
36          map.setSize(new Point(mapHolder.width, mapHolder.height));
37        }
38      }
39
40      public function onServiceLoad(event:ServiceEvent):void {
41        // map should be constructed after service load instead from MXML, if you do not want load Google Tiles at all. 
42        map=new Map();
43        map.key="ABQIAAAA7QUChpcnvnmXxsjC7s1fCxQGj0PqsCtxKvarsoS-iqLdqZSKfxTd7Xf-2rEc_PC9o8IsJde80Wnj4g";
44        map.width=mapHolder.width;
45        map.height=mapHolder.height;
46		map.sensor="false";
47        mapHolder.addChild(map);
48        map.addEventListener(MapEvent.MAP_PREINITIALIZE, onMapPreinitialize);
49        map.addEventListener(MapEvent.MAP_READY, onMapReady);
50      }
51
52      private function onMapPreinitialize(event:Event):void {
53        var agsLayer:ArcGISTileLayer=new ArcGISTileLayer(svc);
54        var agsMapType:ArcGISMapType=new ArcGISMapType([agsLayer], new ArcGISMapTypeOptions({name: agsLayer.getName().replace(/ /g, '\n')}));
55        var bnds:LatLngBounds=agsLayer.getInitialBounds();
56        var opts:MapOptions=new MapOptions();
57        opts.zoom=11;
58        opts.center=new LatLng(35.227, -80.84); 
59        opts.mapTypes=[agsMapType];
60        map.setInitOptions(opts);
61      }
62
63      private function onMapReady(event:Event):void {
64        map.addControl(new com.google.maps.controls.MapTypeControl());
65        map.addControl(new NavigationControl());
66        map.enableContinuousZoom();
67        map.enableScrollWheelZoom();
68        
69      }
70    ]]>
71  </mx:Script>
72</mx:Application>