From d8d0f5fb17025c8ea92ef9f03ad5cc57d18b3b16 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Thu, 24 Jun 2021 09:08:54 +0800
Subject: [PATCH] xj

---
 widgets/LeftNavigationBar/Widget.js |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/widgets/LeftNavigationBar/Widget.js b/widgets/LeftNavigationBar/Widget.js
index 592e483..7494f73 100644
--- a/widgets/LeftNavigationBar/Widget.js
+++ b/widgets/LeftNavigationBar/Widget.js
@@ -376,18 +376,27 @@
                                         that.map.scene.globe.depthTestAgainstTerrain = false;
                                         obj.data.children.forEach(item => {
                                             Cesium.when(that[item.id], function (layer) {
+                                                topic.publish('removeTilt', 'Layermanagement', item);
+                                                topic.publish('removeTiltS', 'spatialAnalysis', item);
+                                                topic.publish('removeLayersLegends', 'legends', item);
                                                 that.map.scene.layers.remove(layer[0].name)
                                             })
                                             var host = that.returnStr(item.src).host;
                                             var scene = that.map.scene;
                                             var partOfUrl = that.returnStr(item.src).partOfUrl;
                                             //添加S3M图层服务
-                                            that[item.id] = scene.open(host + partOfUrl);
+                                            that[item.id] = scene.open(host + partOfUrl, undefined, {
+                                                autoSetView: false //不自动定位
+                                            });
+                                            topic.publish('appendTilt', 'Layermanagement', item);
+                                            topic.publish('appendTiltS', 'spatialAnalysis', item);
+                                            topic.publish('addLayersLegends', 'legends', item);
                                             //定位到场景
                                             Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
                                                 var sname = scenes[0].name;
                                                 Cesium.loadJson(host + partOfUrl + '/scenes/' + sname + '.json').then(function (jsonData) {
                                                     Cesium.when(that[item.id], function (layer) {
+
                                                         //设置相机位置、视角,便于观察场景
                                                         scene.camera.setView({
                                                             destination: new Cesium.Cartesian3.fromDegrees(Number(item.lon), Number(item.lat), Number(item.height)),
@@ -408,6 +417,8 @@
                                                     });
                                                 });
                                             });
+
+
                                         });
                                     } else {
 
@@ -421,6 +432,7 @@
                                                     });
                                                 });
                                                 topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
+                                                topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]);
                                                 topic.publish('addLayersLegends', 'legends', item);
                                             } else {
                                                 $.ajax({
@@ -434,6 +446,7 @@
                                                             url: res[0].path,
                                                         }));
                                                         topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
+                                                        topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]);
                                                         topic.publish('addLayersLegends', 'legends', item);
                                                         that[item.id].alpha = item.alpha;
                                                         that[item.id].getViewableRectangle().then(function (rectangle) {
@@ -458,6 +471,9 @@
                                     if (obj.data.model) {
                                         obj.data.children.forEach(item => {
                                             Cesium.when(that[item.id], function (layer) {
+                                                topic.publish('removeTilt', 'Layermanagement', item);
+                                                topic.publish('removeTiltS', 'spatialAnalysis', item);
+                                                topic.publish('removeLayersLegends', 'legends', item);
                                                 that.map.scene.layers.remove(layer[0].name)
                                             })
                                         });
@@ -465,6 +481,7 @@
                                         obj.data.children.forEach(item => {
                                             if (that[item.id]) {
                                                 topic.publish('removeItem', 'Layermanagement', item);
+                                                topic.publish('removeItemS', 'spatialAnalysis', item);
                                                 topic.publish('removeLayersLegends', 'legends', item);
                                                 that[item.id].show = false;
                                             }
@@ -482,6 +499,9 @@
 
                                     if (obj.data.model) {
                                         Cesium.when(that[obj.data.id], function (layer) {
+                                            topic.publish('removeTilt', 'Layermanagement', obj.data);
+                                            topic.publish('removeTiltS', 'spatialAnalysis', obj.data);
+                                            topic.publish('removeLayersLegends', 'legends', obj.data);
                                             that.map.scene.layers.remove(layer[0].name)
                                         })
 
@@ -491,9 +511,13 @@
                                         var partOfUrl = that.returnStr(obj.data.src).partOfUrl;
                                         //添加S3M图层服务
 
-                                        that[obj.data.id] = scene.open(host + partOfUrl);
+                                        that[obj.data.id] = scene.open(host + partOfUrl, undefined, {
+                                            autoSetView: false //不自动定位
+                                        });
+                                        topic.publish('appendTilt', 'Layermanagement', obj.data);
+                                        topic.publish('appendTiltS', 'spatialAnalysis', obj.data);
+                                        topic.publish('addLayersLegends', 'legends', obj.data);
                                         //定位到场景
-
                                         Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
                                             var sname = scenes[0].name;
                                             Cesium.loadJson(host + partOfUrl + '/scenes/' + sname + '.json').then(function (jsonData) {
@@ -529,6 +553,7 @@
                                                 });
                                             });
                                             topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
+                                            topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]);
                                             topic.publish('addLayersLegends', 'legends', obj.data);
                                         } else {
                                             $.ajax({
@@ -543,6 +568,7 @@
                                                     }));
 
                                                     topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
+                                                    topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]);
                                                     topic.publish('addLayersLegends', 'legends', obj.data);
 
                                                     that[obj.data.id].alpha = obj.data.alpha
@@ -565,6 +591,10 @@
 
                                     if (obj.data.model) {
                                         Cesium.when(that[obj.data.id], function (layer) {
+
+                                            topic.publish('removeTilt', 'Layermanagement', obj.data);
+                                            topic.publish('removeTiltS', 'spatialAnalysis', obj.data);
+                                            topic.publish('removeLayersLegends', 'legends', obj.data);
                                             that.map.scene.layers.remove(layer[0].name)
                                         })
 
@@ -572,6 +602,7 @@
 
                                         if (that[obj.data.id]) {
                                             topic.publish('removeItem', 'Layermanagement', obj.data);
+                                            topic.publish('removeItemS', 'spatialAnalysis', obj.data);
                                             topic.publish('removeLayersLegends', 'legends', obj.data);
                                             that[obj.data.id].show = false;
                                         }
@@ -585,6 +616,7 @@
 
                             }
 
+
                             for (var i = 0; i < that.dataAllArray.length; i++) {
 
                                 if (obj.data.id == that.dataAllArray[i].id) {

--
Gitblit v1.9.3