zpf 1 rok pred
rodič
commit
035056f717

+ 13 - 12
src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

@@ -147,8 +147,8 @@ export default {
         go(item) {
             let arr = [];
             const that = this;
-            BoxCommonVector_entity = new Cesium.CustomDataSource("BoxCommonVector_entity");
-            viewer.dataSources.add(BoxCommonVector_entity);
+            // BoxCommonVector_entity = new Cesium.CustomDataSource("BoxCommonVector_entity");
+            // viewer.dataSources.add(BoxCommonVector_entity);
 
             Object.keys(item).forEach(key => {
 
@@ -194,6 +194,9 @@ export default {
                                 zIndex: 10
                             }
                         });
+
+
+
                         // 注意:polygon首尾坐标要一致
                         var polygon = turf.polygon([geojson.coordinates[0]]);
 
@@ -224,17 +227,15 @@ export default {
                         that.switch_show(flag);
                     }, 500);
                     setTimeout(() => {
-                        // clearInterval(time);
-                        console.log(BoxCommonVector_entity);
-                        try {
-                            viewer.dataSources.remove(BoxCommonVector_entity);
-                        } catch (error) {
-                            console.log('error: ', error);
+                        clearInterval(time);
+                        BoxCommonVector_entity.entities.values.forEach((res) => {
 
-                        }
+                            BoxCommonVector_entity.entities.remove(res);
+
+                        })
 
 
-                    }, 1000)
+                    }, 6000)
 
 
 
@@ -300,8 +301,8 @@ export default {
         const that = this;
         this.$nextTick(() => {
 
-            // BoxCommonVector_entity = new Cesium.CustomDataSource("BoxCommonVector_entity");
-            // viewer.dataSources.add(BoxCommonVector_entity);
+            BoxCommonVector_entity = new Cesium.CustomDataSource("BoxCommonVector_entity");
+            viewer.dataSources.add(BoxCommonVector_entity);
 
         });
     }