打造精彩纷呈的WebGIS应用-ArcGISAPIforFlex篇Esri中国信息技术有限公司韩兴刚ArcGISAPIforFlex简介精彩应用展示ArcGISViewerforFlex总结主要内容ArcGISAPIforFlex简介FlexAPI的角色WebBrowserMobileAirArcGISServer(s)APIMapsEditingQueryingGeoprocessing.etcFlexAPI的功能MapsQueryNetWorkAnalystGeoprocessingEditGeometryTaskAPIAPI组织结构layerstasksagsgeometrysymbolscomponentstoolsMap是API中最为核心的组件Event:MouseEvent&KeyboardEvent&NavigationComponents:Scalebar&Panarrows&ZoomsliderProperties:Collectionoflayers&Spatialreference&ScalelevelsFunctions:AddLayer&RemoveLayeretc.常用对象——Map常用对象——LayerDynamicMapServiceLayer–ArcGISDynamicMapServiceLayer–ArcGISImageServiceLayer–ArcIMSMapServiceLayerTiledMapServiceLayer–ArcGISTiledMapServiceLayerGraphicsLayer–FeatureLayerGPResultImageLayerKMLLayerMapImageLayerOpenStreetMapLayerWMSLayer常用对象——GraphicsGraphicsgeometrysymbolExtent(矩形范围)MapPoint(点)Multipoints(多点)Polygon(多边形)Polyline(折线)InfoSymbolTextSymbolMarkerSymbolLineSymbolFillSymbolCompositeSymbol{“name”:”EsriChina”,“address”:”东直门南大街甲3号居然大厦19层”}常用对象——TasksQuery,Find(Search),IdentifyGeoprocessingServicesRoute,ServiceArea,ClosestFacilityGeometryServiceLocatorServiceFlexAPI帮助精彩应用展示ArcGIS10.1forServer新特性新特性-服务端打印esri:PrintTaskid=printTaskexecuteComplete=printTask_executeCompleteHandler(event)fault=Alert.show(event.fault.faultString,'printerror')”getResultDataComplete=printTask_getResultDataCompleteHandler(event)jobComplete=printTask_jobCompleteHandler(event)”showBusyCursor=trueurl={url}/printTask.execute(printParameters);privatefunctionprintTask_executeCompleteHandler(event:PrintEvent):void{varparamValue:ParameterValue=event.executeResult.results[0];vardataFile:DataFile=paramValue.valueasDataFile;varmaprUrl:String=dataFile.url;navigateToURL(newURLRequest(mapUrl));}新特性-动态渲染esri:ArcGISDynamicMapServiceLayerid=usaLayerurl=esri:layerDrawingOptionsesri:LayerDrawingOptionslayerId=0esri:SimpleRendereresri:SimpleMarkerSymbolcolor=0x9C968B“size=5”style=circleesri:SimpleLineSymbolalpha=0.2color=0x8A4442//esri:SimpleMarkerSymbol/esri:SimpleRendereresri:labelClassesesri:LabelClassid=labelExpressionOne”labelExpression=[POP2000]labelPlacement=esriServerPointLabelPlacementAboveCenter”minScale=36112”where=POP2000<=61esri:LabelOptionscolor=0xFF0000”fontSize=11”fontStyle=italic”fontWeight=bold”haloAlpha=1haloColor=0xDCDCDC”haloSize=2//esri:LabelClass/esri:labelClasses/esri:LayerDrawingOptions/esri:layerDrawingOptions/esri:ArcGISDynamicMapServiceLayerprotectedfunctiongenerateRendererTask_executeCompleteHandler(event:GenerateRendererEvent):void{varrenderer:ClassBreaksRenderer=event.rendererasClassBreaksRenderer;createClassBreaksLegend(renderer);varlayerDrawingOptions:LayerDrawingOptions=newLayerDrawingOptions();layerDrawingOptions.layerId=layerMapSource.mapLayerId;//stateslayeridintheservicelayerDrawingOptions.renderer=renderer;demographicsLayer.alpha=0.7;varlayerDrawingOptionsArr:Array=[layerDrawingOptions];demographicsLayer.layerDrawingOptions=layerDrawingOptionsArr;}esri:GenerateRendererTaskid=generateRendererTaskexecuteComplete=generateRendererTask_executeCompleteHandler(event)fault=esriService_faultHandler(event)url={renderTaskURL}/新特性-查询统计privatefunctionexecStatistic():void{varquery:Query=newQuery();varstatsDef1:StatisticDefinition=newStatisticDefinition();statsDef1.onStatisticField=province_GDP_bn;statsDef1.outStatisticFieldName=GDP;statsDef1.statisticType=StatisticDefinition.TYPE_SUMMATION;//......varstatsDef4:StatisticDefinition=newStatisticDefinition();statsDef4.onStatisticField=NAME;statsDef4.outStatisticFieldName=COUNT;statsDef4.statisticType=StatisticDefinition.TYPE_COUNT;query.groupByFieldsForStatistics=[Zone];query.outStatistics=[statsDef1,statsDef2,statsDef3,statsDef4];queryTask.execute(query);}protectedfunctionqueryTask_executeCompleteHandler(event:QueryEvent):void{varfields:Array=event.featureSet.fields;varattributes:Array=event.featureSet.attributes;dg.dataProvider=newArrayCollection(attributes);}新特性-动态调序protectedfunctionlayerOrderButton_clickHandler(event:MouseEvent):void{vardynamicLayerInfo:DynamicLayerInfo=dynamicLayerInfos[0];dynamicLayerInfos.shift();dynamicLayerInfos.push(dynamicLayerInfo);usaLayer.dynamicLayerInfos=dynamicLayerInfos;layerList.removeItemAt(0);layerList.addItem(dynamicLayerInfo.name);}新特性-编辑追踪IdentityManager.instance.enabled=true;新特性-动态图层DynamicWorkspaceMapServiceClientrelateFindReturn新特性-动态图层!--LakesLayerDynamicLayerInfo--esri:DynamicLayerInfoid=lakesDynamicLayerInfolayerId=9999defaultVisibility=trueesri:LayerDataSource!--FeatureClasswithintheDynamicFileGDBWorkspace(followthelinkinthesampledescriptionformoreinformationondynamicworkspaces--esri:TableDataSourcedataSourceName=LakesworkspaceId=CensusFileGDBWorkspaceID//esri:LayerDataSource/esri:DynamicLayerInfovardynamicLayerInfos:Array=censusLayer.createDynamicLayerInfosFromLayerInfos();dynamicLayerInfos.unshift(lakesDynamicLayerInfo);censusLayer.dynamicLayerInfos=dynamicLayerInfos;物联网-企业监控系统客户端热点图渲染客户端热地图实现publicclassHeatmapLayerextendsFea