<?xml version="1.0" encoding="utf-8"?> <viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009" ????????????? ?? xmlns:s="library://ns.adobe.com/flex/spark" ????????????? ?? xmlns:mx="library://ns.adobe.com/flex/mx" ??? ?????????? ?? xmlns:viewer="com.esri.viewer.*" ????????????? ?? widgetConfigLoaded="init()"> ??? <fx:Script> ?????? <![CDATA[ ?????????? import com.esri.ags.events.DrawEvent; ?????????? import com.esri.ags.layers.GraphicsLayer; ?????????? import com.esri.ags.tools.DrawTool; ?????????? import com.esri.ags.tools.NavigationTool; ?????????? import com.esri.viewer.ViewerContainer; ? ?????????? private var helloContent:String; ?????????? private var graphicsLayer:GraphicsLayer; ? ?????????? private function init():void{ ????????????? if (configXML){ ????????????????? helloContent=String(configXML.hellocontent); ????????????? } ????????????? graphicsLayer=new GraphicsLayer(); ????????????? map.addLayer(graphicsLayer);① ?????????? } ? ?????????? private function sayHiToMapManager():void{② var infoData:Object={content: helloContent,point: map.extent.center}; ????????????? this.showInfoWindow(infoData); ?????????? } ? ?????????? private function activateMapNavigation(tool:String):void{③ ????????????? this.setMapNavigation(tool,null); ?????????? } ? ?????????? private function draw(shape:String):void{④ ????????????? this.setMapAction(shape,null,drawEnd); ?????????? } ?????????? private function drawEnd(event:DrawEvent):void{⑤ ????????????? graphicsLayer.add(event.graphic); ?????????? } ?????? ]]> ??? </fx:Script> ??? <viewer:WidgetTemplate width="680" height="200"> ?????? <s:VGroup width="100%" height="100%" ????????????? ? verticalAlign="middle" horizontalAlign="center"> ?????????? <s:HGroup width="100%"> ????????????? <s:Button label="Say Hi to MapManager" ???????????????????? ? click="sayHiToMapManager()"/> ?????????? </s:HGroup> ?????????? <s:HGroup width="100%">⑥ ?????????? ?? <s:Button label="Zoom In" ?????????? ?? click="activateMapNavigation(NavigationTool.ZOOM_IN)"/> ?????????? ?? <s:Button label="Zoom Out" ?????????? ?? click="activateMapNavigation(NavigationTool.ZOOM_OUT)"/> ?????????? ?? <s:Button label="Pan" ?????????? ?? click="activateMapNavigation(NavigationTool.PAN)"/> ???????????? <s:Button label="Previous View" click="activateMapNavigation(ViewerContainer.NAVIGATION_ZOOM_PREVIOUS)"/> ???????????? <s:Button label="Next View"? click="activateMapNavigation(ViewerContainer.NAVIGATION_ZOOM_NEXT)"/> ???????????? <s:Button label="Full Extent"???????????????????? ? click="activateMapNavigation(ViewerContainer.NAVIGATION_ZOOM_FULL)"/> ?????????? </s:HGroup> ?????????? <s:HGroup width="100%">⑦ ????????????? <s:Button label="Point" ???????????????????? ? click="draw(DrawTool.MAPPOINT)"/> ????????????? <s:Button label="Polyline" ???????????????????? ? click="draw(DrawTool.POLYLINE)"/> ????????????? <s:Button label="Polygon" ???????????????????? ? click="draw(DrawTool.POLYGON)"/> ????????????? <s:Button label="Extent" ???????????????????? ? click="draw(DrawTool.EXTENT)"/> ????????????? <s:Button label="Circle" ???????????????????? ? click="draw(DrawTool.CIRCLE)"/> ????????????? <s:Button label="Freehand Polyline" ???????????????????? ? click="draw(DrawTool.FREEHAND_POLYLINE)"/> ????????????? <s:Button label="Freehand Polygon" ???????????????????? ? click="draw(DrawTool.FREEHAND_POLYGON)"/> ?????????? </s:HGroup> ?????? </s:VGroup> ??? </viewer:WidgetTemplate> </viewer:BaseWidget> |