ArcGIS_Server_9_3_for_Flex_API_初级教程.pdf
GIS change our world, but Flash change my life 1 ArcGIS Server 9.3 for Flex API ESRI hhuduyang 2010-1-29 GIS change our world, but Flash change my life 2 1. .....................................................................................................................................3 2. .....................................................................................................................................6 3. ......................................................................................................................8 4. Draw ..........................................................................................................................10 5. ...........................................................................................................................................12 6. Identify ..............................................................................................................................16 7. Geometry Service ..........................................................................................................19 8.GP ...........................................................................................................................22 9. WebServices ..................................................................................................................25 GIS change our world, but Flash change my life 3 1. ArcGIS Server API for Flex2009RIAFlex ArcGIS Server9.3 ArcGIS API for Flex ArcGIS Server rich internet applications RIAs WEBGIS ArcGIS Server API for Flex ArcGIS Online mashups ArcGIS Server API for Flex download ArcGIS Server API for Flex Flex Flex SDK3 import java doQuery activescript private function doQuery void { queryTask.cute query, new AsyncResponder onResult, onFault ; } doQuery queryTask cute onResult onFault onResult onResult function onResult featureSet FeatureSet, token Object null void { var displayFieldName String featureSet.displayFieldName; for each var myGraphic Graphic in featureSet.features { // ToolTip myGraphic.toolTip “The 2007 population of “ GIS change our world, but Flash change my life 14 myGraphic.attributes[displayFieldName] “ was “ myNumberatter.atmyGraphic.attributes.POP2007 “\nMedian Age “ myGraphic.attributes.MED_AGE “.“; // show on map myGraphicsLayer.add myGraphic ; } } FeatureSet FeatureSet feature GraphicLayer onFault function onFault info Object, token Object null void { Alert.show info.toString ; } MED_AGE POP2007 GIS change our world, but Flash change my life 16 6. Identify identify GIS ArcGIS API for Flex esri Identify Task identify Identify Task identifyTask identifyComplete identify Graphic layer identify identify IdentifyParameters AS3 IdentifyParameters identify var identifyParams IdentifyParameters new IdentifyParameters; identifyParams.returnGeometry true; identifyParams.tolerance 3; identifyParams.width 600; identifyParams.height 550; identifyParams.geometry geometry; identifyParams.layerOption IdentifyParameters.LAYER_OPTION_ALL; identifyParams.mapExtent map.extent; identifyTask.cute identifyParams ; tolerance widthWidth of the map currently being viewed in pixels.height Height of the map currently being viewed in pixelsgeometry identify identifyTask.cute identifyParams ; ok identify Identify identify draw RIA identify identify GIS change our world, but Flash change my life 17 draw drawEnd drawEndHandlerevent draw as3 drawEndHandler identifyCompleteHandler private function drawEndHandlereventdrawEventvoid { var geometry Geometry event.geometry; var identifyParams IdentifyParameters new IdentifyParameters; identifyParams.returnGeometry true; identifyParams.tolerance 3; identifyParams.width 600; identifyParams.height 550; identifyParams.geometry geometry; identifyParams.layerOption IdentifyParameters.LAYER_OPTION_ALL; identifyParams.mapExtent map.extent; identifyTask.cute identifyParams ; private function identifyCompleteHandlereventIdentifyEventvoid { for each var resultIdentifyResult in event.identifyResults { myGraphicsLayer.addresult.feature; } } GIS change our world, but Flash change my life 19 7. Geometry Service Geometry service Project Simplify BufferAreas And Lengths Lengths http//sampleServer1.ArcGIS rver 5 Geometry service Flex Geometry service buffer GeometryService id GeometryServiceurl GeometryService identify buffer buffer BufferParameters buffer buffer GraphicsLayer BufferParameters distances buffer features buffer unit bufferSpatialReference buffer buffer EventListener buffer buffer AS3 var bufferParameters BufferParameters new BufferParameters; bufferParameters.features [point]; bufferParameters.distances [3000]; bufferParameters.unit BufferParameters.UNIT_METER; bufferParameters.bufferSpatialReference new SpatialReference 02113; myGeometryService.addEventListener GeometryServiceEvent.BUFFER_COMPLETE, bufferCompleteHandler; myGeometryService.buffer bufferParameters ; bufferParameters.features features buffer GraphicsLayer GIS change our world, but Flash change my life 20 GIS change our world, but Flash change my life 21 GIS change our world, but Flash change my life 22 8.GP ArcGIS API for Flex esri GP ARCGISONLINE gp CreateDriveTimePolygonsViewshed CreateDriveTimePolygons ArcGIS API for Flex GP gp url gp Geometry service gp ok GIS change our world, but Flash change my life 25 9. WebServices Flex webservices webservicesesri map webservices infowindow esri map infowindow webservices Flex webservices WebService id webservicewsdl webservice application webservice map private function Initvoid { weatherWS.addEventListenerResultEvent.RESULT, WSGetWeatherResult; weatherWS.getWeatherbyCityName““; } private function WSGetWeatherResulteventResultEventvoid { weatherWS.removeEventListenerResultEvent.RESULT,WSGetWeatherResult; var arrCArrayCollection event.result as ArrayCollection; ifarrC.length 0 { var strString arrC.getItemAt0.toString; // var infWd InfoWindow new InfoWindowEsriMap; var str2String arrC.getItemAt1.toString; myMap.infoWindow.title str“.“str2; var vbox VBox new VBox; var vbox2 VBox new VBox; var hbox HBox new HBox; var canvasCanvas new Canvas; var pathString “assets\\weather\\“; GIS change our world, but Flash change my life 26 var img1 Image new Image; img1.loadpatharrC.getItemAt8.toString; hbox.addChildimg1; var img2 Image new Image; img2.loadpatharrC.getItemAt9.toString; hbox.addChildimg2; var txtTem Text new Text; txtTem.text arrC.getItemAt5.toString; var txtWea Text new Text; txtWea.text arrC.getItemAt6.toString; var txtWind Text new Text; txtWind.text arrC.getItemAt7.toString; vbox.addChildtxtTem; vbox.addChildtxtWea; vbox.addChildtxtWind; vbox2.addChildhbox; vbox2.addChildvbox; canvas.addChildvbox2; myMap.infoWindow.content canvas; var mapPnt2MapPoint new MapPoint 114.1547298,30.5127677; myMap.infoWindow.showmapPnt2; myMap.centerAtmapPnt2; } } infoWindow infoWindow new myMap.infoWindow myMap.infoWindow.showmapPnt2; 0 { var strString arrC.getItemAt0.toString; // var infWd InfoWindow new InfoWindowEsriMap; var str2String arrC.getItemAt1.toString; myMap.infoWindow.title str“.“str2; var vbox VBox new VBox; var vbox2 VBox new VBox; GIS change our world, but Flash change my life 28 var hbox HBox new HBox; var canvasCanvas new Canvas; var pathString “assets\\weather\\“; var img1 Image new Image; img1.loadpatharrC.getItemAt8.toString; hbox.addChildimg1; var img2 Image new Image; img2.loadpatharrC.getItemAt9.toString; hbox.addChildimg2; var txtTem Text new Text; txtTem.text arrC.getItemAt5.toString; var txtWea Text new Text; txtWea.text arrC.getItemAt6.toString; var txtWind Text new Text; txtWind.text arrC.getItemAt7.toString; vbox.addChildtxtTem; vbox.addChildtxtWea; vbox.addChildtxtWind; vbox2.addChildhbox; vbox2.addChildvbox; canvas.addChildvbox2; myMap.infoWindow.content canvas; var mapPnt2MapPoint new MapPoint114.1547298,30.5127677; myMap.infoWindow.showmapPnt2; myMap.centerAtmapPnt2; } } ]]