/////////////////////////////////////////////////////////////////////////// // Copyright © 2019 zhongsong. All Rights Reserved. // 模块描述:显示坐标 /////////////////////////////////////////////////////////////////////////// define([ 'dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/_base/html', 'dojo/topic', 'jimu/BaseWidget', 'jimu/utils', 'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css', 'libs/zTree_v3/js/jquery.ztree.all' ], function (declare, lang, array, html, topic, BaseWidget, aspect, string, utils ) { return declare([BaseWidget], { baseClass: 'jimu-widget-spatialAnalysis', name: 'spatialAnalysis', layers: {}, startup: function () { var that = this; // 暴露在外的接口 topic.subscribe("closeOnceUse", lang.hitch(this, this.closeOnceUse)); var domHtmls = [//默认 { name: '可视分析', classs: 'visibleArea-tool', img: './images/addL/ksy.png' }, { name: '剖面分析', classs: 'profileAnalysis-tool', img: './images/addL/剖面分析.png' } // , {//做好静态, // name: '建造实体', // classs: 'modelDiagram-tool', // img: './images/addL/pdpx.png' // } // , {//https://blog.csdn.net/supermapsupport/article/details/100134590 // //需要iServer发布成三维服务 // name: '坡度分析', // classs: 'slope-tool', // img: './images/addL/pdpx.png' // } // , {//SQL查询,//做好 // name: 'SQL查询', // classs: 'SQLQuery-tool', // img: './images/addL/pdpx.png' // } , {//地形开挖,//做好 name: '地形开挖', classs: 'digTheEarth-tool', img: './images/addL/pdpx.png' } // , {//方量分析//做好 // name: '方量分析', // classs: 'volumeAnalysis-tool', // img: './images/addL/pdpx.png' // } ]; that.beginSpatialAnalysis(domHtmls); var isit = false; $('.ccslius').click(() => { isit = false; }) $('.ccsliu').dblclick(() => {//测试开关 点击图例其他的图片 if (isit) { var domHtmls2 = [ { name: '可视分析', classs: 'visibleArea-tool', img: './images/addL/ksy.png' }, { name: '剖面分析', classs: 'profileAnalysis-tool', img: './images/addL/剖面分析.png' } , {//https://blog.csdn.net/supermapsupport/article/details/100134590 //需要iServer发布成三维服务 name: '坡度分析', classs: 'slope-tool', img: './images/addL/pdpx.png' } , {//做好静态, name: '建造实体', classs: 'modelDiagram-tool', img: './images/addL/pdpx.png' } , {//SQL查询,//做好 name: 'SQL查询', classs: 'SQLQuery-tool', img: './images/addL/pdpx.png' } , {//地形开挖,//做好 name: '地形开挖', classs: 'digTheEarth-tool', img: './images/addL/pdpx.png' }, {//方量分析//做好 name: '方量分析', classs: 'volumeAnalysis-tool', img: './images/addL/pdpx.png' } , {//空间查询 name: '空间查询', classs: 'spatialQuery-tool', img: './images/addL/pdpx.png' } , {//建造模型 name: '建造模型', classs: 'modesssssllll', img: './images/addL/pdpx.png' } , {//清除模型 name: '清除模型', classs: 'modesssss2222', img: './images/addL/pdpx.png' } ]; that.beginSpatialAnalysis(domHtmls2); var promise = false; $('.modesssssllll').click(() => { var URL_CONFIG = { SCENE_CBD: 'http://www.supermapol.com/realspace/services/3D-niaochao/rest/realspace', } promise = this.map.scene.open(URL_CONFIG.SCENE_CBD); }) $('.modesssss2222').click(() => { if (promise) { Cesium.when(promise, function (layer) { for (var i = 0; i < layer.length; i++) { that.map.scene.layers.remove(layer[i].name) } }) } }) } else { that.beginSpatialAnalysis(domHtmls); } isit = !isit; }) }, beginSpatialAnalysis: function (domHtmls) { var that = this; var domHtmls = domHtmls; var dom = $('#spatialAnalysis-mains'); dom.empty(); var str = ''; dom.append(str); // console.log(dom, str) // dom.replaceWith(str); $('.closesspatialAnalysis').click(() => { that.closeOnceUse(); $('.jimu-widget-spatialAnalysis').hide(); }) // 可视分析 $('.visibleArea-tool').click(function () { that.closeOnceUse(); $(".jimu-widget-visibleArea").show(); }) // 剖面分析 $('.profileAnalysis-tool').click(function () { that.closeOnceUse(); $(".jimu-widget-profileAnalysis").show(); }) //坡度分析 $('.slope-tool').click(function () { that.closeOnceUse(); $(".jimu-widget-slope").show(); topic.publish('getbeginSlope', 'this.beginSlope'); }) //模型 $('.modelDiagram-tool').click(function () { that.closeOnceUse(); $('.jimu-widget-modelDiagram').show(); }) //sql查询 $('.SQLQuery-tool').click(function () { that.closeOnceUse(); $(".jimu-widget-SQLQuery").show(); topic.publish('beginSQL', 'this.beginSQL'); }) //地形开挖 $('.digTheEarth-tool').click(function () { that.closeOnceUse('digTheEarth'); $(".jimu-widget-digTheEarth").show(); // topic.publish('beginDigTheEarth', 'beginDigTheEarth'); }) //方量分析 $('.volumeAnalysis-tool').click(function () { that.closeOnceUse('volumeAnalysis'); $(".jimu-widget-volumeAnalysis").show(); topic.publish('beginVolumeAnalysis', 'beginVolumeAnalysis'); }) //空间查询 $('.spatialQuery-tool').click(function () { that.closeOnceUse(); $(".jimu-widget-spatialQuery").show(); topic.publish('beginSpatialQuery', 'beginSpatialQuery'); }) // var datas = [//layui舍弃 // { // title: '默认:天地图影像' // // , child: [ // // { // // title: 'menu item 3-2-1' // // , id: 105 // // } // // ] // } // ] // // that.beginRool(datas); // that.datas = datas; // // 注册添加工具事件--规定操作图层 // topic.subscribe("addSelectLayerTool", lang.hitch(this, this.addSelectLayerTool)); // // 注册删除工具事件--规定操作图层 // topic.subscribe("removeSelectLayerTool", lang.hitch(this, this.removeSelectLayerTool)); $('.SelectLayerTool').click(() => { $('#SelectLayerToolItem').toggle(); }) //参照Layemanagement topic.subscribe("appendItemS", lang.hitch(this, this.appendItemS)); topic.subscribe("removeItemS", lang.hitch(this, this.removeItemS)); topic.subscribe("appendTiltS", lang.hitch(this, this.appendTiltS)); topic.subscribe("removeTiltS", lang.hitch(this, this.removeTiltS)); this.liClick('默认:天地图影像', '默认:天地图影像'); }, liClick: function (itemid, name) {//点击事件 var liList = $(`[itemid='${itemid}s']`); // console.log(liList); liList.click(() => { // console.log(itemid) var dom = $('.SelectLayerTool'); layer.tips('选择了:' + name, dom, { tips: [1, '#5FB878'] }); dom.empty(); var str = `${name} ` dom.append(str); dom.attr("title", name); $('#SelectLayerToolItem').hide(); }) }, fakeName: 'Layermanagement', appendItemS: function (item, obj, layer) { // console.log('a1') var that = this; if (item == this.fakeName) { // $("#SelectLayerToolItemTitle .no-data").stop().hide(); var flag = true; var liList = $("#SelectLayerToolItemTitle li"); // console.log(liList) // console.log($('#SelectLayerToolItemTitle')) for (var i = 0; i < liList.length; i++) { if ($(liList[i]).attr('itemid') && $(liList[i]).attr('itemid') == obj.id + 's') { flag = false } } if (flag == true) { var liItem = $("
  • " + "" + obj.title + "" + "
  • "); that[obj.id] = layer; $("#SelectLayerToolItemTitle").append(liItem); } that.liClick(obj.id, obj.title); } }, removeItemS: function (item, obj) { // console.log('r1') if (item == this.fakeName) { var liList = $("#SelectLayerToolItemTitle li"); for (var i = 0; i < liList.length; i++) { if ($(liList[i]).attr('itemid') && $(liList[i]).attr('itemid') == obj.id + 's') { $(liList[i]).remove(); } } if ($("#SelectLayerToolItemTitle li").length == 1 && $("#SelectLayerToolItemTitle li").length == 0) { $("#SelectLayerToolItemTitle .no-data").stop().show(); $(".jimu-widget-spatialAnalysis .tree-layer-opcity").stop().hide(); } } // this.liClick(); }, appendTiltS: function (item, obj, layer) { // console.log('a2') var that = this; if (item == this.fakeName) { // $("#SelectLayerToolItemTitle .no-data").stop().hide(); var flag = true; var liList = $("#SelectLayerToolItemTitle li"); for (var i = 0; i < liList.length; i++) { if ($(liList[i]).attr('itemid') && $(liList[i]).attr('itemid') == obj.id + 's') { flag = false } } if (flag == true) { var liItem = $("
  • " + "" + obj.title + "" + "
  • "); $("#SelectLayerToolItemTitle").append(liItem); } that.liClick(obj.id, obj.title); } }, removeTiltS: function (item, obj) { // console.log('r2') if (item == this.fakeName) { var liList = $("#SelectLayerToolItemTitle li"); for (var i = 0; i < liList.length; i++) { if ($(liList[i]).attr('itemid') && $(liList[i]).attr('itemid') == obj.id + 's') { $(liList[i]).remove(); } } if ($("#SelectLayerToolItemTitle li").length == 1 && $("#SelectLayerToolItemTitle li").length == 0) { // $("#SelectLayerToolItemTitle .no-data").stop().show(); // $(".jimu-widget-spatialAnalysis .tree-layer-opcity").stop().hide(); } } }, // datas: [],//layui舍弃 // addSelectLayerTool: function (num, val) { // console.log(num, val); // var that = this // , d = that.datas; // //三维数据处理 添加全部 9 添加时删除 10 删除全部 6 //添加单个 9 添加时删除 10 删除全部 6 // // var sanwei = {}; // // if (num == 9) { // // sanwei.title = '三维倾斜数据' // // } // // d.push({ // // title: val.title // // }) // // that.beginRool(that.datas); // }, // removeSelectLayerTool: function (num, val) { // console.log(num, val) // }, beginRool: function (data) { //选择图层Layui layui.use(['dropdown', 'util', 'layer', 'table'], function () { var dropdown = layui.dropdown , layer = layui.layer; dropdown.render({ elem: '.SelectLayerTool' , data: data , click: function (obj) { layer.tips('选择了:' + obj.title, this.elem, { tips: [1, '#5FB878'] }); var dom = $('.SelectLayerTool'); dom.empty(); var str = `${obj.title} ` dom.append(str); } }); }); }, closeToolBox: function (item) { if (item != this.name) { $('.tool-y-box').hide(); } }, closeOnceUse: function (who) { var that = this; that.map.scene.globe.depthTestAgainstTerrain = true; // 关闭量算 topic.publish('closeMeasurement', 'Measurement'); // 关闭卷帘 topic.publish('closeRolling', 'Rolling'); // 关闭分屏 topic.publish('closeSplitScreen', 'SplitScreen'); // 关闭标记 topic.publish('closeSign', 'Sign'); topic.publish('closeFlyRoute', 'FlyRoute'); $('.jimu-widget-CoorPosition').hide(); $('.jimu-widget-MapPrinting').hide(); // 关闭可视 topic.publish('closev', ''); // 关闭剖面 topic.publish('closep', ''); // 关闭坡度 topic.publish('closes', ''); $(".jimu-widget-visibleArea").hide(); $(".jimu-widget-profileAnalysis").hide(); $(".jimu-widget-slope").hide(); $('.tool-y-box').stop().hide(); //关闭飞行 $('.jimu-widget-visualAngle').find('.v-a-Two').removeClass('on');//清楚样式 topic.publish('closeFly', 'closeFly'); //清除实体 this.map.entities.removeAll(); $(".jimu-widget-modelDiagram").hide(); //清除SQL查询 $(".jimu-widget-SQLQuery").hide(); topic.publish('closesSQL', 'closesSQL'); //关闭地形开挖 if ($(".jimu-widget-digTheEarth").is(":visible")) {//判断是否隐藏 $(".jimu-widget-digTheEarth").hide(); topic.publish('closesDigTheEarth'); } //关闭方量贩分析 if ($(".jimu-widget-volumeAnalysis").is(":visible")) {//判断是否隐藏 $(".jimu-widget-volumeAnalysis").hide(); topic.publish('closesVolumeAnalysis'); } //关闭空间查询 if ($(".jimu-widget-spatialQuery").is(":visible")) {//判断是否隐藏 $(".jimu-widget-spatialQuery").hide(); topic.publish('closesSpatialQuery'); } }, onOpen: function () { //面板打开的时候触发 (when open this panel trigger) // var domHtmls = [ // { // name: '可视分析', // classs: 'visibleArea-tool' // }, { // name: '剖面分析', // classs: 'profileAnalysis-tool' // }, { // name: '坡度分析', // classs: 'slope-tool' // }, // ]; // var dom = $('#spatialAnalysis-main'); // var str = ''; // for (var k in domHtmls) { // str += `
  • ${domHtmls[k].name}
  • ` // } // dom.replaceWith(str); }, onClose: function () { //面板关闭的时候触发 (when this panel is closed trigger) }, onMinimize: function () { this.resize(); }, onMaximize: function () { this.resize(); }, resize: function () { }, destroy: function () { //销毁的时候触发 //todo //do something before this func this.inherited(arguments); } }); });