南沙政府应急系统之GIS一张图(arcgis api for flex)讲解(五)地图切换以及图层显示模块

config.xml文件的配置如下:

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

源代码目录如下:

南沙政府应急系统之GIS一张图(arcgis api for flex)讲解(五)地图切换以及图层显示模块_第1张图片

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

南沙政府应急系统之GIS一张图(arcgis api for flex)讲解(五)地图切换以及图层显示模块_第2张图片

大概的思路如下: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

https://shop116521643.taobao.com/shop/view_shop.htm,GIS团队成员均来自各高校毕业的研究生,有着丰富的GIS开发与应用经验。店铺提供GIS开发源代码、技术文档、地图数据、软件包等多种产品。无论你是GIS专业在校生、GIS爱好者,还是GIS行业相关从业人员,相信你们均可在本店中找到令你满意的商品。 除了已经展示的产品外,本店也根据客户的需求提供相应产品的定制开发服务,包括GIS课程设计、GIS毕业设计以及GIS软件应用方面的开发等。联系方式:406503412

你可能感兴趣的:(arcgis,arcgisserver,flexview)