//工具栏 // 切换为二维视图 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("设置失败") } }) }