arcgis api for flex之三、开门见山

版本:flash builder 4  &&  arcgis api for flex 2.5

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:esri="http://www.esri.com/2008/ags"
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	<fx:Declarations>  
		<!--创建空间参考为4326,为gps坐标参考系-->
		<esri:SpatialReference id="sr" wkid="4326" />
		<!--创建控制条-->
		<esri:NavigationTool  id="navToolbar" map="{myMap}" /> 
		<!--创建绘图工具条drawToolbar--> 
		<esri:DrawTool id="drawToolbar" map="{myMap}" graphicsLayer="{myGraphicsLayer}"/>
	</fx:Declarations>

		<esri:Map crosshairVisible="true" id="myMap" >
			
			<esri:extent>
				<esri:Extent  id = "esriMapExtent" xmin="116" ymin="39.5" xmax="116.5" ymax="40.5"/>
			</esri:extent>
			
			<esri:ArcGISTiledMapServiceLayer
				url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
			<esri:GraphicsLayer id="myGraphicsLayer" spatialReference="{sr}"/>
		</esri:Map> 
		
	<mx:ControlBar horizontalGap="0" paddingBottom="0" paddingTop="0"  label="地图控制栏">
		<mx:Button label="放大" click="navToolbar.activate(NavigationTool.ZOOM_IN)"/>
		<mx:Button label="缩小" click="navToolbar.activate(NavigationTool.ZOOM_OUT)"/>
		<mx:Button label="漫游" click="navToolbar.activate(NavigationTool.PAN)"/>
		<mx:Button label="上级窗口" click="navToolbar.zoomToPrevExtent()" enabled="{!navToolbar.isFirstExtent}"/>
		<mx:Button label="下级窗口" click="navToolbar.zoomToNextExtent()" enabled="{!navToolbar.isLastExtent}"/>
		<mx:Button label="复位" click="navToolbar.map.zoomToInitialExtent()" />
	</mx:ControlBar>
	<mx:ControlBar horizontalGap="0" paddingBottom="0" paddingTop="20" label="绘图工具条">
		<mx:Button label="点" click="drawToolbar.activate(DrawTool.MAPPOINT)"/>
		<mx:Button label="线" click="drawToolbar.activate(DrawTool.POLYLINE)"/>
		<mx:Button label="流线" click="drawToolbar.activate(DrawTool.FREEHAND_POLYLINE)" />
		<mx:Button label="绘面" click="drawToolbar.activate(DrawTool.POLYGON)"/>
		<mx:Button label="流面" click="drawToolbar.activate(DrawTool.FREEHAND_POLYGON)"/>
		<mx:Button label="结束绘制" click="drawToolbar.deactivate()"/>
	</mx:ControlBar>
</s:Application>


 

你可能感兴趣的:(arcgis api for flex之三、开门见山)