Ver código fonte

2.5d组件优化

彭宇 2 anos atrás
pai
commit
b98c5a78ea
1 arquivos alterados com 16 adições e 8 exclusões
  1. 16 8
      src/components/supermap-2.5d.vue

+ 16 - 8
src/components/supermap-2.5d.vue

@@ -52,9 +52,12 @@ export default {
   },
   props: {},
   methods: {
+    //清除所有
+    clearAll(){
+      this.viewer.entities.removeAll()
+    },
     //移除之前添加的点
     clearMRadius() {
-      this.viewer.entities.removeAll()
       if (this.markerboxEntityRadius != null) {
         this.viewer.entities.remove(this.markerboxEntityRadius)
         this.markerboxEntityRadius = []
@@ -62,8 +65,10 @@ export default {
     },
     //移除之前添加的线
     clearTwoC() {
-      // 查找ID为entityE的图形对象
-      this.viewer.entities.remove(this.connectBoxEntityTwo)
+      if (this.connectBoxEntityTwo != null) {
+        this.viewer.entities.remove(this.connectBoxEntityTwo)
+        this.connectBoxEntityTwo = []
+      }
     },
     /**
      * 地图落点-覆盖范围
@@ -127,7 +132,6 @@ export default {
     },
     //移除之前添加的点
     clearM() {
-      this.viewer.entities.removeAll()
       if (this.markerboxEntity != null) {
         this.viewer.entities.remove(this.markerboxEntity)
         this.markerboxEntity = []
@@ -135,13 +139,17 @@ export default {
     },
     //移除之前添加的线
     clearC() {
-      // 查找ID为entityE的图形对象
-      this.viewer.entities.remove(this.connectBoxEntity)
+      if (this.connectBoxEntity != null) {
+        this.viewer.entities.remove(this.connectBoxEntity)
+        this.connectBoxEntity = []
+      }
     },
     //移除之前添加的面
     clearG() {
-      // 查找ID为entityE的图形对象
-      this.viewer.entities.remove(this.graphicsBoxEntity)
+      if (this.graphicsBoxEntity != null) {
+        this.viewer.entities.remove(this.graphicsBoxEntity)
+        this.graphicsBoxEntity = []
+      }
     },
     superMapInfo(){
       getConfigKey('superMap.iServer').then(response => {