ArcGIS API for Flex(三) 地图之间的切换
发布时间:2020-12-15 03:35:52 所属栏目:百科 来源:网络整理
导读:最近在学习flex,因为我的专业就是GIS(地理信息系统),所以就尝试着从ESRI上学习相关的知识,有不足之处请多多关照 下面是我直接调用ArcGIS的API,功能是地图之间的切换,运行效果图如下 ?xml version="1.0" encoding="utf-8"?s:Application xmlns:fx="http
最近在学习flex,因为我的专业就是GIS(地理信息系统),所以就尝试着从ESRI上学习相关的知识,有不足之处请多多关照 下面是我直接调用ArcGIS的API,功能是地图之间的切换,运行效果图如下
<?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:esri="http://www.esri.com/2008/ags" pageTitle="地图切换效果"> <fx:Script> <![CDATA[ import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.TiledMapServiceLayer; import mx.events.FlexEvent; private function layerShowHandler(event:FlexEvent):void { // update the LODs/zoomslider to use/show the levels for the selected base map var tiledLayer:TiledMapServiceLayer = event.target as TiledMapServiceLayer; myMap.lods = tiledLayer.tileInfo.lods; } ]]> </fx:Script> <s:controlBarContent> <s:RichText width="100%" fontFamily="宋体" fontSize="16" fontWeight="bold" color="#006030"> 大家好,我叫陈洪磊,滁州学院地理信息与旅游与旅游学院2012级GIS专业学生,大学毕业后即将求职,有意聘用者请关注本博客,QQ937292955感谢您的关注 </s:RichText> </s:controlBarContent> <esri:Map id="myMap" level="4" load="myMap.centerAt(new MapPoint(-11713000,4822000))"> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" visible="{bb.selectedIndex == 0}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" visible="{bb.selectedIndex == 1}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" visible="{bb.selectedIndex == 2}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" visible="{bb.selectedIndex == 3}"/> <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)" url="http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" visible="{bb.selectedIndex == 4}"/> </esri:Map> <s:ButtonBar id="bb" right="5" top="5" fontFamily="宋体" fontSize="16" fontWeight="bold" color="#00A600" requireSelection="true"> <s:dataProvider> <s:ArrayList> <fx:String>街道</fx:String> <fx:String>地形图</fx:String> <fx:String>影像图</fx:String> <fx:String>海洋图</fx:String> <fx:String>国家地理</fx:String> </s:ArrayList> </s:dataProvider> </s:ButtonBar> </s:Application>下面是ersi官方代码,我稍作修改 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |