将地图服务导出成经续度数组代码(supermap版本)
2013-03-26 16:24
309 查看
<?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:mx="library://ns.adobe.com/flex/mx" xmlns:ic="http://www.supermap.com/iclient/2010" xmlns:is="http://www.supermap.com/iserverjava/2010" width="100%" height="100%" creationComplete="initApp()"> <!--SQL查询--> <fx:Script> <![CDATA[ import com.supermap.web.actions.Edit; import com.supermap.web.actions.Pan; import com.supermap.web.components.FeatureDataGrid; import com.supermap.web.core.Feature; import com.supermap.web.core.Point2D; import com.supermap.web.core.geometry.GeoLine; import com.supermap.web.core.geometry.GeoRegion; import com.supermap.web.events.DrawEvent; import com.supermap.web.iServerJava6R.FilterParameter; import com.supermap.web.iServerJava6R.Recordset; import com.supermap.web.iServerJava6R.dataServices.EditFeaturesParameters; import com.supermap.web.iServerJava6R.dataServices.EditType; import com.supermap.web.iServerJava6R.queryServices.*; import com.supermap.web.iServerJava6R.serverTypes.*; import com.supermap.web.iServerJava6R.spatialAnalystServices.*; import com.supermap.web.mapping.HighlightLayer; import mx.controls.Alert; import mx.events.CloseEvent; import mx.events.ListEvent; import mx.rpc.AsyncResponder; import spark.events.IndexChangeEvent; [Bindable] private var queryLayers:Array = ["poerL@mapDB_pe"];//查询图层列表 private var highlayer:HighlightLayer;//高亮图层 private var recordGrid:FeatureDataGrid; private var currentQueryLayer:String = "poerL@mapDB_pe";//当前查询图层 [Bindable] private var mapUrl:String; private var resultFeatures:Array = []; private function initApp():void { mapUrl="http://192.1.0.162:8090/iserver/services/map-typeSQLserver192106/rest/maps/mapDB_pe"; map.addLayer(fl); } //查询 private function onExcuteQueryClick(event:MouseEvent):void { //定义 SQL 查询参数 var queryBySQLParam:QueryBySQLParameters = new QueryBySQLParameters(); var filter:FilterParameter = new FilterParameter(); filter.name = this.querylayer.selectedItem.toString(); filter.attributeFilter = this.txtSqlExpress.text; queryBySQLParam.filterParameters = [filter]; queryBySQLParam.returnContent = this.ishighLightLayer.selectedIndex == 0; /* 执行 SQL 查询 */ var queryByDistanceService:QueryBySQLService = new QueryBySQLService(mapUrl); queryByDistanceService.processAsync(queryBySQLParam, new AsyncResponder(this.dispalyQueryRecords, function (object:Object, mark:Object = null):void { Alert.show("与服务端交互失败", "抱歉", 4, this); }, null)); } private var editAction:Edit; public var fl:FeaturesLayer=new FeaturesLayer(); //显示查询结果 private function dispalyQueryRecords(queryResult:QueryResult, mark:Object = null):void { //使用要素图层 FeatureLayer 显示查询结果 if(this.ishighLightLayer.selectedIndex == 0) { var recordSets:Array = queryResult.recordsets; if(recordSets.length != 0) { for each(var recordSet:Recordset in recordSets) { var i:int=0; var txtXY:String=""; for each (var feature:Feature in recordSet.features) { fl.addFeature(feature); var name:String=feature.attributes.NAME; var snid:String=feature.attributes.SMID; var po:GeoLine=feature.geometry as GeoLine; //var po:GeoRegion=feature.geometry as GeoRegion; var z:int=0; txtXY=""; for(z=0;z<po.parts.length;z++) { var pArr:Array=po.parts[z]; for (var k:int=0;k<pArr.length;k++) { var p:Point2D=pArr[k] as Point2D; var o:Object=new Object(); o.x=p.x; o.y=p.y; //AC.addItem(o); txtXY+=p.x+","+p.y+";"; } txtXY+="/"; //AC.push(pArr); } Alert.show(txtXY); trace(snid+"-"+name+":"+txtXY); } } } editAction = new Edit(map,fl); editAction.addEventListener(DrawEvent.DRAW_END,executeEdit); map.action = editAction; } //使用高亮图层 HighlightLayer 显示查询结果 // else // { // if(this.recordGrid) // { // this.recordGrid.clear(); // } // this.featuresLayer.clear(); // this.result.visible = false; // if (queryResult.resourceInfo!= null) // { // highlayer.visible = true; // highlayer.queryResultID = queryResult.resourceInfo.newResourceID; // var serverstyle:ServerStyle = new ServerStyle(); // serverstyle.lineWidth = 0.5; // serverstyle.fillOpaqueRate = 80; // highlayer.style = serverstyle; // this.map.addLayer(highlayer); // } // } } //修改地物 private function executeEdit(event:DrawEvent):void { var editParams:EditFeaturesParameters = new EditFeaturesParameters(); editParams.features = [event.feature]; editParams.editType = EditType.UPDATE; var editIDs:Array = new Array; // for each(var i:int in this.ids) // { // var id:int = event.feature.attributes.SMID; // if(id == i) // editIDs.push(i); // } // editParams.IDs = editIDs; // // var editService:EditFeaturesService = new EditFeaturesService(this.editFeatureUrl); // editService.processAsync(editParams, new AsyncResponder(editComplete, excuteErros, null)); } //查询图层改变事件 private function onQueryLayerChange(event:ListEvent):void { featuresLayer.clear(); var queryLayer:String = ComboBox(event.target).selectedItem.toString(); currentQueryLayer = queryLayer; } //平移 private function pan(event:MouseEvent):void { map.action = new Pan(map); } //清除查询结果 private function clearFeature(event:MouseEvent):void { if(highlayer && highlayer.numChildren > 0) { this.map.removeLayer(highlayer); } if(this.featuresLayer.numFeatures > 0) { resultFeatures = []; if(this.recordGrid) { this.recordGrid.clear(); } this.featuresLayer.clear(); this.result.removeAllChildren(); this.result.visible = false; } } //查询参数设置窗口关闭事件 private function titleWinClose(event:CloseEvent):void { this.result.visible = false; } private function resultWin_mouseUp(event:MouseEvent):void { result.stopDrag(); } private function resultWin_mouseDown(event:MouseEvent):void { result.startDrag(); } protected function ishighLightLayer_changeHandler(event:IndexChangeEvent):void { if(this.ishighLightLayer.selectedIndex == 1) { this.bQueryResultSaved.enabled = false; this.bQueryResultSaved.selected = false; } else this.bQueryResultSaved.enabled = true; } ]]> </fx:Script> <!--添加地图--> <s:Panel fontFamily="宋体" width="100%" height="100%" fontSize="18" title="操作指南:直接点击“查询”"> <ic:Map id="map"> <is:TiledDynamicRESTLayer url="{this.mapUrl}"/> <ic:FeaturesLayer id="featuresLayer" /> </ic:Map> </s:Panel> <!--定义结果显示窗口--> <mx:TitleWindow id="result" right="50" left="50" height="150" title="查询结果:" visible="false" mouseDown="resultWin_mouseDown(event)" layout="absolute" showCloseButton="true" bottom="10" horizontalCenter="10" close="titleWinClose(event)" backgroundColor="#737171" backgroundAlpha="0.60" mouseUp="resultWin_mouseUp(event)"> </mx:TitleWindow> <!--查询参数设置窗口--> <s:Panel id="titlewin" title="SQL 查询:" fontFamily="宋体" fontSize="12" right="5" top="10" backgroundColor="#454343" backgroundAlpha="0.48"> <s:VGroup gap="10" left="5" top="5" bottom="5" right="5"> <s:HGroup> <mx:Label text="查询图层:"/> <mx:Spacer width="6"/> <mx:ComboBox id="querylayer" dataProvider="{queryLayers}" change="onQueryLayerChange(event)" width="160"/> </s:HGroup> <s:HGroup> <mx:Label text="SQL 语句:"/> <mx:Spacer width="3"/> <mx:TextInput id="txtSqlExpress" text="smid=247"/> </s:HGroup> <s:HGroup gap="30" horizontalAlign="center" width="100%" height="100%"> <s:DropDownList id="ishighLightLayer" horizontalCenter="0" fontSize="12" fontFamily="宋体" selectedIndex="0" width="162" change="ishighLightLayer_changeHandler(event)"> <s:ArrayList> <fx:String>使用要素图层显示结果</fx:String> <fx:String>使用高亮图层显示结果</fx:String> </s:ArrayList> </s:DropDownList> </s:HGroup> <s:HGroup gap="30" horizontalAlign="center" width="100%" height="100%"> <s:CheckBox id="bQueryResultSaved" label="保留查询结果" selected="false"/> </s:HGroup> <s:HGroup gap="10" width="100%" height="100%" horizontalAlign="center"> <mx:Button label="查询" id="excuteQuery" click="onExcuteQueryClick(event)"/> <mx:Button label="清除" id="clear" click="clearFeature(event)"/> <mx:Button label="平移" id="panMap" click="pan(event)"/> </s:HGroup> </s:VGroup> </s:Panel> </s:Application>
相关文章推荐
- 如何将SVN的版本库通过git导出代码
- 一个简单的echo服务模型(最原始版本,代码没有优化)
- 不通用版(从SVN取版本,通过MAVEN生成JAVA包,通过SALTSTACK传送到远程服务器并自动重启TOMCAT服务)PYTHON代码
- SuperMap iClient如何使用WMS地图服务
- GeoServer:代码实现批量发布地图服务
- geoserver 通过代码实现发布地图服务
- geoserver 通过代码实现发布地图服务
- supermap is.net winform client局域网内不能访问地图服务
- SuperMap iClient如何使用WMTS地图服务(转)
- superMap iMobile for iOS 使用代码在地图上画一条线
- ArcGIS API For Javascript GP工具 Printing Tools导出地图或者打印地图(一):GP 服务Printing Tools
- arcgis sever发布地图服务,使用arcmap版本不同发布不成功的探讨
- SuperMap iClient如何使用WMTS地图服务
- supermap objects 编程 显示 地图 (最简单的显示地图代码)
- Jfinal开发代码碎片_导出报表_配置druid数据源_使用guava_获取当前操作系统_JDK版本_jfinal-utils_jfinal验证码
- 代码重新启动地图服务
- superMap发布oracle地图服务
- ArcServer调用AO接口导出地图服务的图例
- SuperMap iServer整合第三方地图服务
- SuperMap iClient 如何使用 WMTS 地图服务