From 9dd06fefff5262947d42e99f518706d4a068d654 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 23 Jun 2021 11:27:14 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap

---
 widgets/spatialAnalysis/Widget.js |  247 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 183 insertions(+), 64 deletions(-)

diff --git a/widgets/spatialAnalysis/Widget.js b/widgets/spatialAnalysis/Widget.js
index 0f285c1..92882b0 100644
--- a/widgets/spatialAnalysis/Widget.js
+++ b/widgets/spatialAnalysis/Widget.js
@@ -31,7 +31,54 @@
 				var that = this;
 				// 暴露在外的接口
 
-				var domHtmls = [
+				topic.subscribe("closeOnceUse", lang.hitch(this, this.closeOnceUse));
+
+				// function createTooltip(frameDiv) {//抄录createTooltip函数
+
+				// 	var tooltip = function (frameDiv) {
+
+				// 		var div = document.createElement('DIV');
+				// 		div.className = "twipsy right";
+
+				// 		var arrow = document.createElement('DIV');
+				// 		arrow.className = "twipsy-arrow";
+				// 		div.appendChild(arrow);
+
+				// 		var title = document.createElement('DIV');
+				// 		title.className = "twipsy-inner";
+				// 		div.appendChild(title);
+
+				// 		this._div = div;
+				// 		this._title = title;
+				// 		this.message = '';
+
+				// 		// add to frame div and display coordinates
+				// 		frameDiv.appendChild(div);
+				// 		var that = this;
+				// 		div.onmousemove = function (evt) {
+				// 			that.showAt({ x: evt.clientX, y: evt.clientY }, that.message);
+				// 		};
+				// 	};
+
+				// 	tooltip.prototype.setVisible = function (visible) {
+				// 		this._div.style.display = visible ? 'block' : 'none';
+				// 	};
+
+				// 	tooltip.prototype.showAt = function (position, message) {
+				// 		if (position && message) {
+				// 			this.setVisible(true);
+				// 			this._title.innerHTML = message;
+				// 			this._div.style.left = position.x + 10 + "px";
+				// 			this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
+				// 			this.message = message;
+				// 		}
+				// 	};
+
+				// 	return new tooltip(frameDiv);
+				// }
+				// window.MYcreateTooltip = createTooltip;//全局使用
+
+				var domHtmls = [//默认
 					{
 						name: '可视分析',
 						classs: 'visibleArea-tool',
@@ -52,70 +99,105 @@
 					// 	classs: 'slope-tool',
 					// 	img: './images/addL/pdpx.png'
 					// }
-					, {//SQL查询,//做好
-						name: 'SQL查询',
-						classs: 'SQLQuery-tool',
+					// , {//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);
 
-				$('.ccsliu').click(() => {//测试开关 点击图例其他的图片
-					var domHtmls = [
-						{
-							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: 'modesssssllll',
-							img: './images/addL/pdpx.png'
-						}
-						,
-						{//清除模型
-							name: '清除模型',
-							classs: 'modesssss2222',
-							img: './images/addL/pdpx.png'
-						}
-					];
-					that.beginSpatialAnalysis(domHtmls);
-					var promise = false;
-					$('.modesssssllll').click(() => {
-						var URL_CONFIG = {
-							SCENE_CBD: 'http://www.supermapol.com/realspace/services/3D-CBDCache20200416/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)
-								}
-							})
-						}
-					})
+				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-CBDCache20200416/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;
 				})
 
 			},
@@ -160,7 +242,7 @@
 					that.closeOnceUse();
 
 					$(".jimu-widget-slope").show();
-					topic.publish('getbeginSlope', this.beginSlope);
+					topic.publish('getbeginSlope', 'this.beginSlope');
 				})
 				//模型
 				$('.modelDiagram-tool').click(function () {
@@ -171,8 +253,29 @@
 				$('.SQLQuery-tool').click(function () {
 					that.closeOnceUse();
 					$(".jimu-widget-SQLQuery").show();
-					topic.publish('beginSQL', this.beginSQL);
+					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');
 				})
 
 			},
@@ -181,7 +284,7 @@
 					$('.tool-y-box').hide();
 				}
 			},
-			closeOnceUse: function () {
+			closeOnceUse: function (who) {
 				var that = this;
 				that.map.scene.globe.depthTestAgainstTerrain = true;
 				// 关闭量算
@@ -214,6 +317,22 @@
 				//清除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 () {

--
Gitblit v1.9.3