zhitong.yu
2025-02-14 c4cce49f5e6fd1f74b9962cd86dd201694c3765e
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
//工具栏
// 切换为二维视图
function to2d() {
    map.scene.morphTo2D(0)
    document.getElementById("to3d").checked = false
    document.getElementById("toGLB").checked = false
    let data  = "erwei=1&sanwei=0&qingxie=0";
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
// 切换为三维视图
function to3d() {
    map.scene.morphTo3D(0)
    document.getElementById("to2d").checked = false
    document.getElementById("toGLB").checked = false
    let data  = "erwei=0&sanwei=1&qingxie=0";
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
// 切换为2.5D维视图
function toGLB() {
    map.scene.morphToColumbusView(0)
    document.getElementById("to3d").checked = false
    document.getElementById("to2d").checked = false
    let data  = "erwei=0&sanwei=0&qingxie=1";
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
//双屏对比
function createControl() {
    let ShuangPing = document.getElementById("ShuangPing").checked
    let show;
    if (!ShuangPing){
        show = 0;
        destroyControl()
    }else{
        if (mapSplit) {
            globalMsg("控件已存在,请勿重复创建!")
            return
        }
 
        // 修改已有地图为50%
        var mapOld = document.getElementById("mars3dContainer")
        mapOld.style.width = "50%"
 
        // 获取原来地图的参数
        var mapOptions2 = map.toJSON()
        mapOptions2.control.baseLayerPicker = true // basemaps底图切换按钮
        mapOptions2.control.sceneModePicker = false
 
        // 用于双屏同图层,不同配置展示
        for (var i = 0, len = mapOptions2.layers.length; i < len; i++) {
            var item = mapOptions2.layers[i]
            if (item.compare) {
                for (var key in item.compare) {
                    item[key] = item.compare[key] // 存在compare属性时
                }
            }
        }
        console.log("分屏地图配置", mars3d.Util.clone(mapOptions2))
 
        mapSplit = new mars3d.control.MapCompare({
            ...mapOptions2,
            parentContainer: document.body
        })
        map.addControl(mapSplit)
 
        // 修改对比地图
        mapSplit.mapEx.basemap = "天地图电子"
        show = 1;
    }
    let data  = "shuangping="+show;
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
//销毁双屏对比
function destroyControl() {
    if (!mapSplit) {
        globalMsg("控件已销毁,无需重复销毁!")
        return
    }
    map.removeControl(mapSplit)
    mapSplit = null
    var mapOld = document.getElementById("mars3dContainer")
    mapOld.style.width = "100%"
}
//卷帘对比
function createControlJuan() {
    let JuanLian = document.getElementById("JuanLian").checked
    let show;
    if (!JuanLian){
        show = 0;
        destroyControlJuan()
    }else{
        if (mapSplit1) {
            return
        }
        map.basemap = null
        mapSplit1 = new mars3d.control.MapSplit({
            rightLayer: [
                { name: "天地图卫星", type: "tdt", layer: "img_d" },
            ],
            leftLayer: [
                { name: "天地图电子", type: "tdt", layer: "vec_d" },
                { name: "天地图注记", type: "tdt", layer: "vec_z" },
            ]
        })
        map.addControl(mapSplit1)
 
        mapSplit1.on(mars3d.EventType.mouseMove, function (event) {
            console.log("拖动了mapSplit1控件", event)
        })
        window.mapSplit1 = mapSplit1 // only for test
 
        mapSplit1.container.appendChild(splitter)
        show = 1;
    }
    let data  = "juanlian="+show;
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
function destroyControlJuan() {
    if (mapSplit1) {
        map.removeControl(mapSplit1)
        mapSplit1 = null
        map.basemap = "ArcGIS影像"
    }
}
function ChuShiGongJuLan(){
    $.get("/hxzkuwb/findHomeSetting",function (data){
        if (data.erwei == "1"){
            map.scene.morphTo2D(0)
            document.getElementById("to3d").checked = false
            document.getElementById("toGLB").checked = false
            document.getElementById("to2d").checked = true
        }
        if (data.sanwei == "1"){
            map.scene.morphTo3D(0)
            document.getElementById("to2d").checked = false
            document.getElementById("toGLB").checked = false
            document.getElementById("to3d").checked = true
        }
        if (data.qingxie == "1"){
            map.scene.morphToColumbusView(0)
            document.getElementById("to3d").checked = false
            document.getElementById("to2d").checked = false
            document.getElementById("toGLB").checked = true
        }
        if (data.quanping == "1"){
            map.control.fullscreenButton.show = true
            document.getElementById("showFullScreen").checked = true
        }else{
            map.control.fullscreenButton.show = false
            document.getElementById("showFullScreen").checked = false
        }
        if (data.shijiao == "1"){
            map.control.homeButton.show = true
            document.getElementById("showGoHome").checked = true
        }else{
            map.control.homeButton.show = false
            document.getElementById("showGoHome").checked = false
        }
        if (data.sousuo == "1"){
            map.control.geocoder.show = true
            document.getElementById("showLocationSearch").checked = true
        }else{
            map.control.geocoder.show = false
            document.getElementById("showLocationSearch").checked = false
        }
        if (data.suofang == "1"){
            map.control.zoom.show = true
            document.getElementById("zoomButton").checked = true
        }else{
            map.control.zoom.show = false
            document.getElementById("zoomButton").checked = false
        }
        if (data.weizhi == "1"){
            map.control.locationBar.show = true
            document.getElementById("showLocation").checked = true
        }else{
            map.control.locationBar.show = false
            document.getElementById("showLocation").checked = false
        }
        // if (data.shizhong == "1"){
        //     map.control.clockAnimate.show = true
        //     document.getElementById("showClock").checked = true
        // }else{
        //     map.control.clockAnimate.show = false
        //     document.getElementById("showClock").checked = false
        // }
        // if (data.timeline == "1"){
        //     map.control.timeline.show = true
        //     document.getElementById("showTimeLine").checked = true
        // }else{
        //     map.control.timeline.show = false
        //     document.getElementById("showTimeLine").checked = false
        // }
        if (data.rule == "1"){
            map.control.distanceLegend.show = true
            document.getElementById("showLegend").checked = true
        }else{
            map.control.distanceLegend.show = false
            document.getElementById("showLegend").checked = false
        }
        if (data.daohang == "1"){
            map.control.compass.show = true
            document.getElementById("showNav").checked = true
        }else{
            map.control.compass.show = false
            document.getElementById("showNav").checked = false
        }
        if (data.zhuti == "1"){
            document.getElementById("AnHeiMoShi").checked = true
        }else{
            document.getElementById("AnHeiMoShi").checked = false
        }
        if (data.bangzhu == "1"){
            map.control.navigationHelpButton.show = true
            document.getElementById("showHelpButton").checked = true
        }else{
            map.control.navigationHelpButton.show = false
            document.getElementById("showHelpButton").checked = false
        }
        if (data.gaojingxinxi == "1"){
            $("#GaoJingXinXi").fadeIn(1000);
             document.getElementById('ToGaoJing').checked = true;
        }else{
            document.getElementById('ToGaoJing').checked = false;
            $("#GaoJingXinXi").fadeOut(1000);
        }
        if (data.jinritongji == "1"){
            $("#JinRiTongJi").fadeIn(1000);
            document.getElementById('ToTongJi').checked = true;
        }else{
            document.getElementById('ToTongJi').checked = false;
            $("#JinRiTongJi").fadeOut(1000);
        }
        if (data.jishitongxun == "1"){
            $("#JiShiTongXun").fadeIn(1000);
            document.getElementById('ToTongXun').checked = true;
        }else{
            document.getElementById('ToTongXun').checked = false;
            $("#JiShiTongXun").fadeOut(1000);
        }
        if (data.quyutongji == "1"){
            $("#QuYuTongJi").fadeIn(1000);
            document.getElementById('ToQuYu').checked = true;
        }else{
            document.getElementById('ToQuYu').checked = false;
            $("#QuYuTongJi").fadeOut(1000);
        }
    })
}
 
function GongJuLanShow(){
    $("#GongJuLan").animate({right: "1%"},1000); // 动画持续时间,单位是毫秒(1秒)
    $("#JinRiTongJi").animate({right: "22%"},1000)
    $("#QuYuTongJi").animate({right: "22%"},1000)
}
function GongJuLanHide(){
    $("#GongJuLan").animate({right: "-20%"},1000); // 动画持续时间,单位是毫秒(1秒)
    $("#JinRiTongJi").animate({right: "1%"},1000)
    $("#QuYuTongJi").animate({right: "1%"},1000)
}
 
 
//信息展示
 
 
function ChuShiXinXiZhanShi(){
 
}
function XinXiZhanShiShow(){
    $("#XinXiZhanShi").animate({left: "2%"},1000); // 动画持续时间,单位是毫秒(1秒)
    $("#GaoJingXinXi").animate({left: "23%"},1000);
    $("#JiShiTongXun").animate({left: "23%"},1000);
}
function XinXiZhanShiHide(){
    $("#XinXiZhanShi").animate({left: "-20%"},1000); // 动画持续时间,单位是毫秒(1秒)
    $("#GaoJingXinXi").animate({left: "1%"},1000);
    $("#JiShiTongXun").animate({left: "1%"},1000);
}
function ToGaoJing(){
    var checkbox = document.getElementById('ToGaoJing');
    var show;
    var isChecked = checkbox.checked;
    if (isChecked){
        $("#GaoJingXinXi").fadeIn(1000)
        show = 1
    }else{
        $("#GaoJingXinXi").fadeOut(1000)
        show = 0;
    }
    let data  = "gaojingxinxi="+show;
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
function ToTongJi(){
    var checkbox = document.getElementById('ToTongJi');
    var show;
    var isChecked = checkbox.checked;
    if (isChecked){
        $("#JinRiTongJi").fadeIn(1000)
        show = 1
    }else{
        $("#JinRiTongJi").fadeOut(1000)
        show = 0;
    }
    let data  = "jinritongji="+show;
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
function ToQuYu(){
    var checkbox = document.getElementById('ToQuYu');
    var show;
    var isChecked = checkbox.checked;
    if (isChecked){
        $("#QuYuTongJi").fadeIn(1000)
        show = 1
    }else{
        $("#QuYuTongJi").fadeOut(1000)
        show = 0;
    }
    let data  = "quyutongji="+show;
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}
function ToTongXun(){
    var checkbox = document.getElementById('ToTongXun');
    var show;
    var isChecked = checkbox.checked;
    if (isChecked){
        $("#JiShiTongXun").fadeIn(1000)
        show = 1
    }else{
        $("#JiShiTongXun").fadeOut(1000)
        show = 0;
    }
    let data  = "jishitongxun="+show;
    $.post("/hxzkuwb/UpdateHomeSettingShow",data,function (data){
        if (data == 1){
            notify.success("设置成功")
        }else{
            notify.error("设置失败")
        }
    })
}