From f263e0396359ac7686e68ce0e1a2e2ef6419906d Mon Sep 17 00:00:00 2001
From: lixuliang <lixuliang_hd@126.com>
Date: 星期三, 15 十一月 2023 23:24:31 +0800
Subject: [PATCH] 解决冲突

---
 src/components/map/viewer.vue |   74 ++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 41 deletions(-)

diff --git a/src/components/map/viewer.vue b/src/components/map/viewer.vue
index 33d48fa..b01caeb 100644
--- a/src/components/map/viewer.vue
+++ b/src/components/map/viewer.vue
@@ -2,54 +2,30 @@
   <div>
     <div id="sdkContainer"></div>
     <div class="listBox" v-show="viewer1Show && !isLand">
-      <ul>
-        <li
-          v-for="(item, index) in arr"
-          :key="index"
-          @click="changeLeftMap($event, item, index)"
-        >
+      <ul id="viewer_lsyx">
+        <li v-for="(item, index) in arr" :key="index" @click="changeLeftMap($event, item, index)">
           {{ item }}
         </li>
       </ul>
     </div>
     <layerTreeTwoScreen v-if="layerTreeTwoScreen" />
     <!-- <div id="bottomInfo" v-html="bottomInfo"></div> -->
-    <div
-      id="switchImagerLayer"
-      :style="{
-        transform: `scale(${scale}) translate(${offset},${offset})`,
-        '-webkit-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-moz-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-o-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-ms-transform': `scale(${scale}) translate(${offset},${offset})`,
-      }"
-    >
-      <transition
-        name="animate__animated animate__bounce"
-        @click="switchImagerLayerShowOrHide"
-        enter-active-class="animate__backInRight"
-        leave-active-class="animate__backOutRight"
-        appear
-      >
+    <div id="switchImagerLayer" :style="{
+      transform: `scale(${scale}) translate(${offset},${offset})`,
+      '-webkit-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-moz-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-o-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-ms-transform': `scale(${scale}) translate(${offset},${offset})`,
+    }">
+      <transition name="animate__animated animate__bounce" @click="switchImagerLayerShowOrHide"
+        enter-active-class="animate__backInRight" leave-active-class="animate__backOutRight" appear>
         <switchImagerLayer ref="switchImagerLayer" v-show="switchImagerLayer" />
       </transition>
 
-      <img
-        class="swichImg"
-        @click="switchImagerLayerShowOrHide"
-        :src="switchImage"
-      />
+      <img class="swichImg" @click="switchImagerLayerShowOrHide" :src="switchImage" />
       <div class="bgbox">
-        <img
-          class="swichImg"
-          @click="switchImagerLayerShowOrHide"
-          src="@/assets/img/new/shiliang.png"
-        />
-        <img
-          class="swichImg bgbox"
-          @click="switchImagerLayerShowOrHide"
-          src="@/assets/img/new/shiliang.png"
-        />
+        <img class="swichImg" @click="switchImagerLayerShowOrHide" src="@/assets/img/new/shiliang.png" />
+        <img class="swichImg bgbox" @click="switchImagerLayerShowOrHide" src="@/assets/img/new/shiliang.png" />
       </div>
     </div>
   </div>
@@ -101,11 +77,17 @@
     viewer1Show(newvalue, oldvalue) {
       if (!newvalue) {
         this.destroyImageLayer();
+      } else {
+        if (!this.isLand) {
+          this.initLSYX();
+        }
       }
     },
     isLand(newvalue, oldvalue) {
       if (newvalue) {
         this.destroyImageLayer();
+      } else {
+        this.initLSYX();
       }
     },
   },
@@ -162,8 +144,8 @@
         }
       );
       window.Viewer = sgworld._Viewer;
-      
-      window.sgwfs = new SmartEarth.WFSTool(sgworld._Viewer,Cesium);
+
+      window.sgwfs = new SmartEarth.WFSTool(sgworld._Viewer, Cesium);
       Viewer.shadows = false;
       //娣卞害妫�娴�
       sgworld.Analysis.depthTestAgainstTerrain(true);
@@ -279,6 +261,11 @@
         this.destroyImageLayer();
       }
     },
+    initLSYX() {
+      let ul = document.getElementById("viewer_lsyx");
+      let lis = ul.getElementsByTagName('li');
+      lis[19].click();
+    },
     destroyImageLayer() {
       if (activeLi) {
         activeLi.classList.remove("active");
@@ -309,9 +296,14 @@
         nLayer = null;
       }
       nLayer = this.loadBJ54ImageLayer(year);
-      if (!LWLayer) {
+      if (!LWLayer||Viewer.imageryLayers.indexOf(LWLayer)<0) {
+        if(LWLayer)
+        {
+          LWLayer.destroy();
+        }
         LWLayer = this.loadBJ54LWLayer();
       }
+
     },
     loadBJ54LWLayer() {
       let url = "http://172.26.64.84/service/ImageEngine/picdis/abc";

--
Gitblit v1.9.3