1
13693261870
2022-09-16 762f2fb45db004618ba099aa3c0bd89dba1eb843
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
    <title>专题数据</title>
    <script src="./js/lodash.min.js"></script>
    <link rel="stylesheet" href="./css/index.css">
    <link rel="stylesheet" href="./js/ztreev3/css/bootstrapStyle/bootstrapStyle.css">
    <link rel="stylesheet" href="./css/layui-table.css">
 
    <script>
        window.onload = function () {
            var zNodes = [
                { id: 1, pId: 0, name: "东部海域地貌", open: true },
                { id: 12, pId: 1, name: "生态分区0506" },
                { id: 121, pId: 12, name: "一级分区线", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E4%B8%80%E7%BA%A7%E5%88%86%E5%8C%BA%E7%BA%BF" },
                { id: 122, pId: 12, name: "二级分区线", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E4%BA%8C%E7%BA%A7%E5%88%86%E5%8C%BA%E7%BA%BF" },
                { id: 123, pId: 12, name: "三级分区线", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E4%B8%89%E7%BA%A7%E5%88%86%E5%8C%BA%E7%BA%BF" },
                { id: 13, pId: 1, name: "50m等深线" },
                { id: 131, pId: 13, name: "近岸浅海交错带", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%BF%91%E5%B2%B8%E6%B5%85%E6%B5%B7%E4%BA%A4%E9%94%99%E5%B8%A6" },
                { id: 2, pId: 1, name: "陆" },
                { id: 20, pId: 2, name: "台湾潮间带", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E5%8F%B0%E6%B9%BE%E6%BD%AE%E9%97%B4%E5%B8%A61" },
                { id: 3, pId: 1, name: "908潮间带范围" },
                { id: 31, pId: 3, name: "潮间带", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms111/%E6%BD%AE%E9%97%B4%E5%B8%A6" },
                { id: 4, pId: 1, name: "海岸带数据整合" },
                { id: 41, pId: 4, name: "海草床0318", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E6%B5%B7%E8%8D%89%E5%BA%8A0318" },
                { id: 5, pId: 1, name: "生物分区" },
                { id: 51, pId: 5, name: "底栖生物群落类型", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E5%BA%95%E6%A0%96%E7%94%9F%E7%89%A9%E7%BE%A4%E8%90%BD" },
                { id: 52, pId: 5, name: "底栖生物群落", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E5%BA%95%E6%A0%96%E7%94%9F%E7%89%A9%E7%BE%A4%E8%90%BD" },
                { id: 53, pId: 5, name: "底栖生物分区", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E5%BA%95%E6%A0%96%E7%94%9F%E7%89%A9%E5%88%86%E5%8C%BA" },
                { id: 6, pId: 1, name: "生物" },
                { id: 61, pId: 6, name: "赤潮-黄藻", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%B5%A4%E6%BD%AE-%E9%BB%84%E8%97%BB" },
                { id: 62, pId: 6, name: "赤潮-蓝藻", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%B5%A4%E6%BD%AE-%E8%93%9D%E8%97%BB" },
                { id: 63, pId: 6, name: "赤潮-定鞭藻", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%B5%A4%E6%BD%AE-%E5%AE%9A%E9%9E%AD%E8%97%BB" },
                { id: 64, pId: 6, name: "赤潮-原生动物", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%B5%A4%E6%BD%AE-%E5%8E%9F%E7%94%9F%E5%8A%A8%E7%89%A9" },
                { id: 65, pId: 6, name: "赤潮-金藻", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%B5%A4%E6%BD%AE-%E9%87%91%E8%97%BB" },
                { id: 66, pId: 6, name: "赤潮-硅藻", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%B5%A4%E6%BD%AE-%E7%A1%85%E8%97%BB" },
                { id: 67, pId: 6, name: "赤潮-甲藻", map: 'http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%B5%A4%E6%BD%AE-%E7%94%B2%E8%97%BB' },
                { id: 68, pId: 6, name: "赤潮-藻华", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E8%97%BB%E5%8D%8E" },
                { id: 7, pId: 1, name: "其它" },
                { id: 71, pId: 7, name: "图层6", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E5%9B%BE%E5%B1%826" },
                { id: 72, pId: 7, name: "图层", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E5%9B%BE%E5%B1%82" },
                { id: 73, pId: 7, name: "征求意见修改上报版0702", map: "http://18.1.2.15:8090/iserver/services/map-v10/wms130/%E5%BE%81%E6%B1%82%E6%84%8F%E8%A7%81%E4%BF%AE%E6%94%B9%E4%B8%8A%E6%8A%A5%E7%89%880702" },
            ];
 
            var zNodes = [
                { id: 12, pId: 1, name: "生态区" },
                { id: 121, pId: 12, name: "一级分区线", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/5" },
                { id: 122, pId: 12, name: "二级分区线", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/6" },
                { id: 123, pId: 12, name: "三级分区线", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/7" },
                { id: 124, pId: 12, name: "近岸浅海交错带", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/10" },
                { id: 125, pId: 12, name: "潮间带", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/12" },
                { id: 13, pId: 1, name: "水体组" },
                { id: 131, pId: 13, name: "海流" },
                { id: 132, pId: 13, name: "温度" },
                { id: 133, pId: 13, name: "盐度" },
                { id: 3, pId: 1, name: "底质组" },
                { id: 31, pId: 3, name: "粒度" },
                { id: 32, pId: 3, name: "沉积物" },
                // { id: 31, pId: 3, name: "潮间带", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/12" },
                // { id: 4, pId: 1, name: "生物组" },
                // { id: 41, pId: 4, name: "海草床0318", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/13" },
                // { id: 5, pId: 1, name: "生物分区" },
                // { id: 51, pId: 5, name: "底栖生物群落类型", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/15" },
                // { id: 52, pId: 5, name: "底栖生物群落", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/16" },
                // { id: 53, pId: 5, name: "底栖生物分区", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/19" },
                { id: 6, pId: 1, name: "生物组" },
                { id: 61, pId: 6, name: "赤潮-黄藻", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/21" },
                { id: 62, pId: 6, name: "赤潮-蓝藻", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/22" },
                { id: 63, pId: 6, name: "赤潮-定鞭藻", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/23" },
                { id: 64, pId: 6, name: "赤潮-原生动物", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/24" },
                { id: 65, pId: 6, name: "赤潮-金藻", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/25" },
                { id: 66, pId: 6, name: "赤潮-硅藻", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/26" },
                { id: 67, pId: 6, name: "赤潮-甲藻", map: 'http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/27' },
                { id: 68, pId: 6, name: "赤潮-藻华", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/28" },
                { id: 69, pId: 6, name: "底栖生物群落类型", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/16" },
                { id: 691, pId: 6, name: "底栖生物群落类型", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/16" },
                // { id: 7, pId: 1, name: "其它" },
                // { id: 73, pId: 7, name: "征求意见修改上报版0702", map: "http://71.3.251.50:6080/arcgis/rest/services/HYHD/linshi/MapServer/0" },
                { id: 2, pId: 1, name: "地形地貌组" },
                { id: 21, pId: 2, name: "地形图", type: "terrain" },
            ];
 
            var setting = {
                data: {
                    view: {
                        showLine: false,
 
                    },
                    simpleData: {
                        enable: true //开启简单数据模式
                    },
                },
                view: {
                    addHoverDom: addHoverDom,
                    removeHoverDom: removeHoverDom,
                },
                edit: {
                    enable: true,
                    showRemoveBtn: false,
                    showRenameBtn: false,
                },
 
                check: {
                    enable: true, //开启复选框
                    chkStyle: 'checkbox',
                    chkboxType: {
                        "Y": "ps",
                        "N": "ps"
                    },
                },
                callback: {
                    onCheck: NodeCheckEvent
                }
            }
 
 
            // 查询专题菜单,初始化树结构
            zTreeObj = $.fn.zTree.init($("#treeDemo"), setting, zNodes); //初始化树
 
 
            $(".leftclosebtn").on("click", function () {
                if (parseInt($(this).parent("div").css("left")) >= 0)
                    $(this).parent("div").animate({ "left": "-340px" })
                else
                    $(this).parent("div").animate({ "left": "10px" })
            });
 
        }
 
 
        // 树的勾选事件
        var tempTerrain;
        function NodeCheckEvent(e, treeId, treeNode) {
 
            if (treeNode.type == "terrain") {
                var terrainProvidernew = new SFSTerrainProvider({
                    url: 'http://71.3.110.200/sg/Elevation',
                    layerName: 'jgptdem0601hfdx.418648.mpt',
                    requestVertexNormals: true
                });
                tempTerrain = sgworld._Viewer.terrainProvider;
                sgworld._Viewer.terrainProvider = terrainProvidernew;
 
                return;
            }
 
            console.log(treeNode);
            let obj = {
                url: 'http://71.3.110.202:6080/arcgis/rest/services/HYHD/HAX/MapServer/0'
                // url:treeNode.url
            }
            // 父节点
            if (treeNode.isParent && treeNode.checked) {
                EachChildNode(treeNode, addLayer)
            }
 
            if (treeNode.isParent && treeNode.checked == false) {
                EachChildNode(treeNode, Removelayer)
            }
            // 子节点
            if (treeNode.isParent == false && treeNode.checked) {
                EachChildNode(treeNode, addLayer)
            }
 
            if (treeNode.isParent == false && treeNode.checked == false) {
                EachChildNode(treeNode, Removelayer)
            }
        }
 
        function EachChildNode(node, callback) {
            // console.log(node.name);
            if (node.children) {
                node.children.map(function (item) {
                    EachChildNode(item, callback)
                })
            } else {
                let obj = {
                    url: node.map
                }
                callback && callback(obj)
            }
        }
        //图层创建
        var Existimglayer = [],
            ExistimglayerId = []
        var viewer = window.sgworld.Viewer
        function addLayer(option) {
 
            var urlStr = option.url;
            var layerId = "";
            // requestLegend(urlStr, option.div);
            var lastStr = urlStr.substring(urlStr.lastIndexOf("/"));
            if (lastStr == "WMSServer" || lastStr == "WFSServer" || lastStr == "MapServer") {
                urlStr = urlStr;
            } else {
                layerId = lastStr.substring(1);
                urlStr = urlStr.substring(0, urlStr.lastIndexOf('/'));
            }
 
            if (option.id != undefined) {
                layerId = option.id
            }
 
            if (typeof layerId != 'object') {
                layerId = [layerId]
            }
 
            var layer = new Cesium.ArcGisMapServerImageryProvider({
                url: urlStr,
                layers: layerId,
                // enablePickFeatures: false
            });
 
            // var layer = new Cesium.WebMapServiceImageryProvider({
            //     //url: "http://18.1.2.15:8090/iserver/services/map-MXDtoSMWU_1/arcgisrest/%E5%9B%BE%E5%B1%82/MapServer",
            //     url: option.url,
            //     enablePickFeatures: false,
            //     layers: "0",
            //     proxy: new Cesium.DefaultProxy('/proxy/')
            // });
 
 
            var imaglayer = new Cesium.ImageryLayer(layer, {})
            Existimglayer.push(imaglayer)
            window.sgworld._Viewer.imageryLayers.add(imaglayer);
 
        };
 
        //图层删除
        function Removelayer(option) {
            if (option.id == undefined) {
                Existimglayer.forEach(function (params) {
                    if (option.url == params.imageryProvider.url + params.imageryProvider.layers[0]) {
                        window.sgworld._Viewer.imageryLayers.remove(params);
                    }
                })
            } else {
                Existimglayer.forEach(function (params) {
                    if (params.imageryProvider.layers == option.id) {
                        window.sgworld._Viewer.imageryLayers.remove(params);
                    }
                })
            }
 
        }
 
    </script>
 
<body>
    <!-- 左侧树部分 -->
    <div id="containbox">
        <div class="leftclosebtn" style="top:35%"></div>
        <!-- 专题数据描述 -->
        <div class="leftwindow" id="leftwindow">
            <div class="ztms">生态特征层</div>
            <div id="treeDemo" class="ztree"></div>
        </div>
    </div>
    <!-- 球体 -->
    <div id="cesiumContainer"></div>
 
 
    <script src="./SmartEarthSDK/Workers/jquery-2.0.3.js"></script>
    <script src="./SmartEarthSDK/Cesium/Cesium.js"></script>
    <script src="./SmartEarthSDK/SmartEarth.min.js"></script>
    <script src="./2d/js/TETerrainProviderSeven.js"></script>
    <script src="./js/ztreev3/js/jquery.ztree.all.min.js"></script>
    <script src="./js/layui-v2.6.7/layui/layui.js"></script>
    <script src="./js/jquery-ui.min.js"></script>
    <script src="./js/echarts.min.js"></script>
    <script src="./js/tanchaung.js"></script>
    <script src="./js/index1.js"></script>
</body>
 
</html>