123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- <?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:ic="http://www.supermap.com/iclient/2010"
- xmlns:is="http://www.supermap.com/iserverjava/2010"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- xmlns:tree="com.tree.*"
- creationComplete="init();"
- xmlns:main="com.main.*" xmlns:server="com.server.*" xmlns:show="com.show.*" xmlns:detail="com.view.detail.*" xmlns:view="com.view.*">
-
- <fx:Declarations>
- <server:XMLDecoder id="xmlDecoder" mapConfigLoad="xmlDecoder_configloadHandler(event)"
- menuConfigLoad="xmlDecoder_menuConfigLoadHandler(event)"/>
- <!-- 将非可视元素(例如服务、值对象)放在此处 -->
- <s:Move id="toolsCtMove" target="{toolsCt}" duration="500"/>
- <s:Move id="btnMove" target="{arrowLeft}" duration="500"/>
-
- <server:Service/>
- </fx:Declarations>
- <fx:Metadata>
- [ResourceBundle("select")]
- </fx:Metadata>
- <fx:Script source="com/main/infoWindowHandle.as"/>
- <fx:Script source="com/main/show.as"/>
- <fx:Script source="com/main/bufferAnalyst.as"/>
- <fx:Script>
- <![CDATA[
- import com.common.ConfigUtil;
- import com.events.DataConfigEvent;
- import com.events.MenusEvent;
- import com.server.QueryAction;
- import com.supermap.framework.events.BaseEventDispatcher;
- import com.supermap.web.actions.DrawLine;
- import com.supermap.web.actions.DrawPoint;
- import com.supermap.web.actions.DrawPolygon;
- import com.supermap.web.actions.Edit;
- import com.supermap.web.core.Feature;
- import com.supermap.web.core.geometry.GeoLine;
- import com.supermap.web.core.geometry.GeoPoint;
- import com.supermap.web.core.geometry.GeoRegion;
- import com.supermap.web.core.styles.PictureMarkerStyle;
- import com.supermap.web.events.DrawEvent;
- import com.supermap.web.events.LayerEvent;
- import com.supermap.web.mapping.FeaturesLayer;
- import com.supermap.web.mapping.TiledDynamicRESTLayer;
- import com.supermap.web.utils.CoordinateReferenceSystem;
- import com.view.AqtcWindow;
- import com.view.ExpertWindow;
- import com.view.YjyaViewWindow;
- import com.view.detail.PointDetail;
- import com.view.tjcx.ResourceNode;
- import com.view.tjcx.TjcxWindow;
- import com.view.tjcx.ZydwWindow;
-
- import mx.binding.utils.BindingUtils;
- import mx.collections.ArrayCollection;
- import mx.containers.Grid;
- import mx.controls.Alert;
- import mx.core.FlexGlobals;
- import mx.core.UIComponent;
- import mx.events.CloseEvent;
- import mx.events.FlexEvent;
- import mx.managers.PopUpManager;
- import mx.rpc.events.ResultEvent;
- import mx.utils.Base64Decoder;
- import mx.utils.Base64Encoder;
- import mx.utils.URLUtil;
-
- import spark.components.CheckBox;
- import spark.components.TitleWindow;
- private var point:String = "1";
- private var line:String = "2";
- private var polygon:String = "3";
- /** 当前是否显示了工具窗口 */
- private var toolsShow:Boolean = true;
- private var gkzyLayer:TiledDynamicRESTLayer;
- private var layer:TiledDynamicRESTLayer;
-
- private var layerDOM:TiledDynamicRESTLayer = null;
- private var baseFLayer:FeaturesLayer;
-
- private var fLayer:FeaturesLayer;
- private var currSelectedLayerId:String;
- public var mapConfig:XML = null;
- public var menuConfig:XML = null;
- public var serverName:String = null;
- public var port:Number;
- private var expertWin:ExpertWindow =new ExpertWindow();
- private var tjcxWindow:TjcxWindow = new TjcxWindow;
- private var zydwWindow:ZydwWindow = new ZydwWindow;
- private var aqtcWindow:AqtcWindow = new AqtcWindow;
- [Bindable]
- public var menuXML:XML = null;
- [Bindable]
- private var queryData:ArrayCollection = new ArrayCollection();
- private var crs:CoordinateReferenceSystem = new CoordinateReferenceSystem(4326);
- private function init():void
- {
- var url:String = this.parent.loaderInfo.url;;
- port = URLUtil.getPort(url);
- serverName= URLUtil.getServerName(url);
- this.menuXML = ConfigUtil.getMenuXML("M_AQXT",this.menuConfig);
- BindingUtils.bindProperty(aqtcWindow,"menuXML",this,"menuXML");
- aqtcWindow.checkBoxClickHandler = checkBox_click;
- BaseEventDispatcher.getInstance().addEventListener(QueryLayerEvent.QUERY_SUCCESS, queryLayerSuccess);
- BaseEventDispatcher.getInstance().addEventListener(QueryLayerEvent.QUERY_SUCCESS, queryLayerFault);
- BaseEventDispatcher.getInstance().addEventListener(MenusEvent.MENUHIDE, movePenal);
- CommonUtility.callRemote("gisController","getLoginUser",getLoginUserResultHandler);
- }
- protected function getLoginUserResultHandler(event:ResultEvent):void
- {
- var ret:Object=event.result;
- ConstUtil.currSzd=ret.szd.id;
- this.initDomLayer();
- }
- private function movePenal(e:MenusEvent = null):void
- {
- this.toolsCtMove.end();
- if(toolsShow)
- {
- this.toolsCtMove.xTo=FlexGlobals.topLevelApplication.width;
- }else
- {
- this.toolsCtMove.xTo=FlexGlobals.topLevelApplication.width-this.toolsCt.width;
- }
- this.toolsCtMove.play();
-
- // 移动显示按钮
- this.btnMove.end();
- if(toolsShow)
- {
- this.btnMove.xTo=FlexGlobals.topLevelApplication.width-19;
- }else
- {
- this.btnMove.xTo=FlexGlobals.topLevelApplication.width;
- }
- this.btnMove.play();
-
- toolsShow = !toolsShow;
- }
-
- private function initLocation():void
- {
- mapIcon_clickHandler(null,"dom");
- var args:Object = getParams();
- // 定位处理
- if(args.action=="location")
- {
- var conditions:String = "";
- if(args.id)
- {
- conditions="ID="+args.id;
- }
-
- if(args.name)
- {
- conditions="Name='"+decodeURIComponent(args.name)+"'";
- }
- var scale:Number = 175000;
- if(args.scale)
- {
- scale = new Number(args.scale);
- }
- var showDom:Boolean = true;
- if(args.dom)
- {
- showDom = "true"==args.dom;
- }
- if(args.layer)
- {
- this.location(args.layer,conditions,scale,showDom);
- }
- }
- }
-
- private function initDomLayer():void
- {
- this.layerDOM = this.createTiledDynamicRESTLayer("dom",ConstUtil.SERVICE_ID_DOM,false,256,false);
- this.layerDOM.addEventListener(LayerEvent.LOAD_ERROR,addLayerError);
- this.map.addLayer(this.layerDOM);
-
- this.initZYLayer();
- }
-
- private function initZYLayer():void
- {
- this.layer = this.createTiledDynamicRESTLayer("dzdt",ConstUtil.SERVICE_ID_SLDT,true,256,true);
- this.map.addLayer(this.layer);
- this.gkzyLayer = this.createTiledDynamicRESTLayerWithSpecialLay("gkzy",ConstUtil.SERVICE_ID_GKZY,256,true);
- this.map.addLayer(this.gkzyLayer);
- if(!this.baseFLayer)
- this.baseFLayer = new FeaturesLayer();
- this.map.addLayer(this.baseFLayer);
- if(!this.fLayer)
- this.fLayer = new FeaturesLayer();
- this.map.addLayer(this.fLayer);
- this.initLocation();
- }
-
- private function addLayerError(event:LayerEvent):void
- {
- var layer:TiledDynamicRESTLayer = event.currentTarget as TiledDynamicRESTLayer;
- if(layer.id == "dom")
- this.initZYLayer();
- else if(layer.id == "dzdt")
- Alert.show("加载电子地图失败!","异常");
- else if(layer.id == "sydt")
- this.initDomLayer();
- }
-
- private function createTiledDynamicRESTLayer(id:String,serviceId:String,emptyLaysID:Boolean=false,tileSize:int = 256,visible:Boolean = true):TiledDynamicRESTLayer
- {
- var tiledLayer:TiledDynamicRESTLayer = new TiledDynamicRESTLayer();
- tiledLayer.transparent = true;
- tiledLayer.url = ConfigUtil.getMapServiceUrl(serviceId);
- tiledLayer.id = id;
- tiledLayer.CRS = crs;
- if(emptyLaysID)
- tiledLayer.layersID="";
- tiledLayer.tileSize = tileSize;
- tiledLayer.enableServerCaching = true;
- tiledLayer.visible = visible;
- return tiledLayer;
- }
- private function createTiledDynamicRESTLayerWithSpecialLay(id:String,serviceId:String,tileSize:int = 256,visible:Boolean = true):TiledDynamicRESTLayer
- {
- var tiledLayer:TiledDynamicRESTLayer = new TiledDynamicRESTLayer();
- tiledLayer.transparent = true;
- tiledLayer.url = ConfigUtil.getMapServiceUrl(serviceId);
- tiledLayer.id = id;
- tiledLayer.CRS = crs;
- tiledLayer.layersID="[0:68,79,82]";
- tiledLayer.tileSize = tileSize;
- tiledLayer.enableServerCaching = true;
- tiledLayer.visible = visible;
- return tiledLayer;
- }
-
-
- private function getParams():Object {
- var params:Object = {};
- var query:String = ExternalInterface.call("window.location.search.substring", 1);
- if(query) {
- var pairs:Array = query.split("&");
- for(var i:uint=0; i < pairs.length; i++) {
- var pos:int = pairs[i].indexOf("=");
- //Alert.show(String(pos));
- if(pos != -1) {
- var argname:String = pairs[i].substring(0, pos);
- var value:String = pairs[i].substring(pos+1);
- params[argname] = value;
- }
- }
- }
- return params;
- }
- protected function mapIcon_clickHandler(event:MouseEvent = null,type:String = null):void
- {
- var parmStr:String = "layer";
- if(type)
- {
- if((type == "dom" && this.mapIcon.source == "images/map/map.png") ||
- (type == "layer" && this.mapIcon.source == "images/map/satellite.png"))
- {
- return;
- }
- if(type == "dom")
- {
- this.mapIcon.source="images/map/map.png";
- this.layer.visible = false;
- this.layerDOM.visible = true;
- }
- else
- {
- this.mapIcon.source="images/map/satellite.png";
- this.layerDOM.visible = false;
- this.layer.visible = true;
- }
- parmStr = type;
- }
- else
- {
- if(this.mapIcon.source.toString() == "images/map/map.png")
- {
- this.mapIcon.source="images/map/satellite.png";
- this.layerDOM.visible = false;
- this.layer.visible = true;
- }
- else
- {
- parmStr = "dom";
- this.mapIcon.source="images/map/map.png";
- this.layer.visible = false;
- this.layerDOM.visible = true;
- }
- }
- }
- public function getMap():Map
- {
- return this.map;
- }
- protected function xmlDecoder_configloadHandler(event:DataConfigEvent):void
- {
- this.mapConfig = event.data as XML;
- }
- protected function xmlDecoder_menuConfigLoadHandler(event:DataConfigEvent):void
- {
- this.menuConfig = event.data as XML;
- this.featureStyle = ConfigUtil.getFeatureStyle(this.menuConfig);
- }
- /** 统计查询处理 */
- protected function tjcx_clickHandler(event:MouseEvent = null,type:String = null):void
- {
- PopUpManager.addPopUp(tjcxWindow,FlexGlobals.topLevelApplication as DisplayObject,false);
- PopUpManager.centerPopUp(tjcxWindow);
- }
- /** 统计查询处理 */
- protected function zydw_clickHandler(event:MouseEvent = null,type:String = null):void
- {
- if(zydwWindow.resourceNodes == null)
- {
- CommonUtility.callRemote("gisController","getZyNodes",resultHandler);
- }
- else
- {
- PopUpManager.addPopUp(zydwWindow,FlexGlobals.topLevelApplication as DisplayObject,false);
- PopUpManager.centerPopUp(zydwWindow);
- }
- }
- protected function resultHandler(event:ResultEvent):void
- {
- var ret:ArrayCollection=event.result as ArrayCollection;
- zydwWindow.resourceNodes = ret;
- PopUpManager.addPopUp(zydwWindow,FlexGlobals.topLevelApplication as DisplayObject,false);
- PopUpManager.centerPopUp(zydwWindow);
- }
- /** 应急专家 */
- public function expert_clickHandler(event:MouseEvent = null,type:String = null):void
- {
- showExpert();
- }
- public function showExpert(comp:String=null,dwid:Number = 0):void
- {
- expertWin.dwmc=comp;
- expertWin.szd=dwid;
- expertWin.doSearch();
- PopUpManager.addPopUp(expertWin,FlexGlobals.topLevelApplication as DisplayObject,false);
- PopUpManager.centerPopUp(expertWin);
- }
- /** 安全系统图层 */
- protected function aqtc_clickHandler(event:MouseEvent = null,type:String = null):void
- {
- PopUpManager.addPopUp(aqtcWindow,FlexGlobals.topLevelApplication as DisplayObject,false);
- PopUpManager.centerPopUp(aqtcWindow);
- }
- /** 定位经营人 */
- public function locateJyr(id:String,nm:String):void
- {
- var conditions:String ="ID="+id;
- var scale:Number = 5000;
- this.location("L_ID_AQ_WXHWQY",conditions,scale,true,false);
- // this.detailCt.recordId = id;
- // this.detailCt.gkjyr = nm;
- // this.detailCt.show = true;
- }
- protected function hiddenLable_clickHandler(event:MouseEvent):void
- {
- BaseEventDispatcher.getInstance().dispatchEvent(new MenusEvent(MenusEvent.MENUHIDE,"hide"));
- }
- ]]>
- </fx:Script>
- <ic:Map id="map" viewBounds="{new Rectangle2D(116.78815757821073,31.25328451029112,122.42101218345877,33.85528396557042)}" >
- </ic:Map>
- <main:MapOperateModel top="10" right="10"/>
- <!-- 安全系统图层 -->
- <s:Image id="aqtc" click="aqtc_clickHandler(event)" source="images/aqtc.png" useHandCursor="true" buttonMode="true" top="45" right="10" toolTip="安全系统图层"/>
- <s:Image id="mapIcon" click="mapIcon_clickHandler(event)" source="images/map/satellite.png" useHandCursor="true" buttonMode="true" bottom="15" left="15" visible="false"/>
- <s:Image id="tjcx" click="tjcx_clickHandler(event)" source="images/map/cxtj.png" useHandCursor="true" buttonMode="true" top="15" left="15" toolTip="统计查询"/>
- <!-- 资源定位 -->
- <s:Image id="zydw" click="zydw_clickHandler(event)" source="images/map/yjcz.png" useHandCursor="true" buttonMode="true" top="15" left="80" toolTip="资源定位"/>
- <s:Image id="arrowLeft" click="hiddenLable_clickHandler(event)" source="images/arrowRight.png" useHandCursor="true" buttonMode="true" y="100" x="{FlexGlobals.topLevelApplication.width}" />
- <detail:MapTools id="toolsCt" y="100" x="{FlexGlobals.topLevelApplication.width-280}" width="280" height="520" menuXML="{this.menuXML}" treeClickFun="checkBox_click" />
- </s:Application>
|