<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:esri="http://www.esri.com/2008/ags"> <mx:Script> <![CDATA[ import com.esri.ags.layers.*; import mx.rpc.http.HTTPService; import mx.controls.TextInput; import mx.rpc.AsyncResponder; import mx.rpc.events.ResultEvent; import com.esri.serialization.json.JSON private var httpServ:HTTPService; private var canIdentify:Boolean = false; private var canFind:Boolean = false; private var tiledMS:Boolean = false; private var dynamicMS:Boolean = false; private var canQuery:Boolean = false; private var msURL:String = ""; private function SendReq():void { bdyn.selected = false; btiled.selected = false; bquery.selected = false; bfind.selected = false; bident.selected = false; dynamicMS = false; tiledMS = false; canQuery = false; canFind = false; canIdentify = false; httpServ = new HTTPService(); msURL = ""; var tSplit:Array = layURL.text.split("/"); if(String(tSplit[tSplit.length - 1]).toLowerCase() == "mapserver") { msURL = layURL.text; httpServ.url = layURL.text + "?f=json"; httpServ.addEventListener(ResultEvent.RESULT,xmlTypeResult); httpServ.send(); }else if(!isNaN(Number(tSplit[tSplit.length - 1]))){ msURL = layURL.text.replace(tSplit[tSplit.length - 1],""); httpServ.url = layURL.text + "/query?f=json"; httpServ.addEventListener(ResultEvent.RESULT,canQueryResult); httpServ.send(); } } private function canIdentResult(event:ResultEvent):void { var typeXML:Object; typeXML = JSON.decode(event.result.toString()); if(typeXML.error.details[0] != "Identify operation not supported on this service") canIdentify = true; httpServ = new HTTPService(); httpServ.url = msURL + "/find?f=json"; httpServ.addEventListener(ResultEvent.RESULT,canFindResult); httpServ.send(); } private function canQueryResult(event:ResultEvent):void { var typeXML:Object; typeXML = JSON.decode(event.result.toString()); if(typeXML.error.details[0] != "Query operation not supported on this service") canQuery = true; httpServ = new HTTPService(); httpServ.url = msURL + "?f=json"; httpServ.addEventListener(ResultEvent.RESULT,xmlTypeResult); httpServ.send(); } private function canFindResult(event:ResultEvent):void { var typeXML:Object; typeXML = JSON.decode(event.result.toString()); if(typeXML.error.details[0] != "Find operation is not supported on this service") canFind = true; bdyn.selected = dynamicMS; btiled.selected = tiledMS; bquery.selected = canQuery; bfind.selected = canFind; bident.selected = canIdentify; } private function xmlTypeResult(event:ResultEvent):void { var typeXML:Object; typeXML = JSON.decode(event.result.toString()); if(typeXML.hasOwnProperty("tileInfo")){ tiledMS = true; } else { dynamicMS = true; } httpServ = new HTTPService(); httpServ.url = msURL + "/identify?f=json"; httpServ.addEventListener(ResultEvent.RESULT,canIdentResult); httpServ.send(); } ]]> </mx:Script> <mx:TextInput id="layURL" x="26" y="24" width="579" text="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" /> <mx:Button x="613" y="24" label="Load..." click="SendReq()"/> <mx:CheckBox x="26" y="54" label="Dynamic" id="bdyn"/> <mx:CheckBox x="26" y="114" label="Query Supported" id="bquery"/> <mx:CheckBox x="26" y="144" label="Find Supported" id="bfind"/> <mx:CheckBox x="26" y="174" label="Identify Supported" id="bident"/> <mx:CheckBox x="26" y="84" label="Tiled" id="btiled"/> </mx:Application>
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.