南沙政府应急系统之GIS一张图arcgisapiforflex讲解五地图切换以及图层显示模块

config.xml文件的配置如下:

<widget right="20" top="55"
        config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf" />

源代码目录如下:

南沙政府应急系统之GIS一张图arcgisapiforflex讲解五地图切换以及图层显示模块

该模块的源代码原理解析,详细的代码在下载的开源flexviewer自带的:

南沙政府应急系统之GIS一张图arcgisapiforflex讲解五地图切换以及图层显示模块

大概的思路如下:MapSwitcherWidget.xml是模块的配置文件,MapSwitcherWidget.mxml是widget;

MapSwitcherWidget.xml:layerlist是图层列表里面的图层数据,excludelayer是选择排除的图层

1 <?xml version="1.0" ?>
2 <configuration>
3     <layerlist visible="true">
4         <!-- <excludelayer>The Label Of Some Layer In Main Config File</excludelayer> -->
5     </layerlist>
6 </configuration>

config.xml文件:map节点里面配置

 1 <operationallayers>
 2             <layer label="企业" type="feature" visible="false" alpha="1.0"
 3                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/7"
 4                 popupconfig="popups/PopUp_Ecoomy.xml">
 5             </layer>
 6             <layer label="物资装备" type="feature" visible="false" alpha="1.0"
 7                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/2"
 8                 popupconfig="popups/PopUp_Materials_equipment.xml">
 9             </layer>
10             <layer label="庇护场所" type="feature" visible="true" alpha="1.0"
11                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/4"
12                 popupconfig="popups/PopUp_Refuge.xml">
13             </layer>
14             <layer label="保护对象" type="feature" visible="true" alpha="1.0"
15                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/5"
16                 popupconfig="popups/PopUp_Protection.xml">
17             </layer>
18              <layer label="应急仓库" type="feature" visible="false" alpha="1.0"
19                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/6"
20                 popupconfig="popups/PopUp_Warehouse.xml">
21             </layer> 
22             <layer label="救援队伍" type="feature" visible="false" alpha="1.0"
23                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/3"
24                 popupconfig="popups/PopUp_Rescue_teams.xml">
25             </layer>
26             <layer label="应急专家" type="feature" visible="false" alpha="1.0"
27                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/1"
28                 popupconfig="popups/PopUp_Experts.xml">
29             </layer>
30             <layer label="危险隐患" type="feature" visible="true" alpha="1.0"
31                 url="http://localhost:6080/arcgis/rest/services/nsBusiness/FeatureServer/0"
32                 popupconfig="popups/PopUp_DangerSource.xml">
33             </layer>
34         </operationallayers>

这里配置图层列表的具体图层数据

1         <basemaps>
2             <layer label="南沙地图" type="tiled" visible="true" alpha="1" url="http://localhost:6080/arcgis/rest/services/ns_new/MapServer" /> 
3         </basemaps>

这里可以配置不同的切换底图

备注:

GIS技术交流QQ群:432512093

更多相关文章
一周排行