From f4f772e4689016a79b3746a9afcc29811b0066d4 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 11 Jun 2021 16:20:34 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap

---
 widgets/LeftNavigationBar/Widget.js |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/widgets/LeftNavigationBar/Widget.js b/widgets/LeftNavigationBar/Widget.js
index 1a7e5ac..c9ef115 100644
--- a/widgets/LeftNavigationBar/Widget.js
+++ b/widgets/LeftNavigationBar/Widget.js
@@ -198,6 +198,7 @@
 				})
 			},
 			changeData: function (val, type) { //重写数据
+				var that = this;
 				var data = [],
 					i = 1,
 					inits = (d, childData) => {
@@ -227,6 +228,21 @@
 								a.model = true
 							}
 
+							if (a.model) {
+
+								if (that[a.id]) {
+									Cesium.when(that[a.id], function (layer) {
+										that.map.scene.layers.remove(layer[0].name)
+									})
+								}
+
+							} else {
+
+								if (that[a.id]) { 
+									that.map.imageryLayers.remove(that[a.id]);
+								}
+
+							}
 
 							b.push(a);
 							i++;
@@ -234,7 +250,7 @@
 								b[k].children = [];
 								b[k].who = 'father';
 								inits(d[k].children, b[k].children)
-							}
+							} 
 						}
 
 					};

--
Gitblit v1.9.3