فهرست منبع

修改viewer.dataSources与倾斜摄影影响失真问题

maxiaoxiao 1 سال پیش
والد
کامیت
6b0d477bb8
2فایلهای تغییر یافته به همراه12 افزوده شده و 11 حذف شده
  1. 5 4
      src/components/mapView/range.vue
  2. 7 7
      src/views/complianceAnalysis/components/scjg.vue

+ 5 - 4
src/components/mapView/range.vue

@@ -43,6 +43,7 @@ import { ElMessage } from "element-ui";
 // import { polygon } from "@turf/turf";
 import * as turf from "@turf/turf";
 import parse from "wellknown";
+let now_dataSources = null;
 export default {
   components: {},
   props: {
@@ -218,13 +219,13 @@ export default {
         // 将数据源添加到Cesium Viewer
         viewer.dataSources.add(dataSource);
         viewer.zoomTo(dataSource);
-        _this.dataSources = dataSource;
+        now_dataSources = dataSource;
       });
     },
     resetDataSources() {
-      if (this.dataSources) {
-        viewer.dataSources.remove(this.dataSources);
-        this.dataSources = null;
+      if (now_dataSources) {
+        viewer.dataSources.remove(now_dataSources);
+        now_dataSources = null;
       }
     },
     //绘制

+ 7 - 7
src/views/complianceAnalysis/components/scjg.vue

@@ -48,6 +48,7 @@
 import pie from "@/components/echartsTemplate/pie.vue";
 import { GetFxjg } from "@/api/ghss/hgxfx.js";
 import parse from "wellknown";
+let dataSourceList = {};
 let colors = [
   "#62ADED",
   "#DFE15A",
@@ -75,7 +76,6 @@ export default {
         xzmj: "",
         fileList: [],
       },
-      dataSources: {},
       fileid: 1,
     };
   },
@@ -124,8 +124,8 @@ export default {
       // emit("eyesChaneg");
     },
     changeDataSources({ geom, id, iseyes }, color) {
-      if (this.dataSources[id]) {
-        this.dataSources[id].show = iseyes;
+      if (dataSourceList[id]) {
+        dataSourceList[id].show = iseyes;
       } else if (geom) {
         this.addPolygon(geom, id, color);
       }
@@ -170,7 +170,7 @@ export default {
         // 将数据源添加到Cesium Viewer
         viewer.dataSources.add(dataSource);
         viewer.zoomTo(dataSource);
-        _this.dataSources[id] = dataSource;
+        dataSourceList[id] = dataSource;
         // 可以获取实体并进行操作
         // dataSource.entities.values.forEach((entity) => {
         //   // 你可以在这里设置实体的属性,例如位置、颜色等
@@ -186,8 +186,8 @@ export default {
       window.open(this.$props.scjgObj.fxbg.replace(".docx", ".pdf"), "_blank");
     },
     reset() {
-      if (Object.keys(this.dataSources).length) viewer.dataSources.removeAll();
-      this.dataSources = {};
+      if (Object.keys(dataSourceList).length) viewer.dataSources.removeAll();
+      dataSourceList = {};
     },
   },
 
@@ -221,7 +221,7 @@ export default {
       display: inline-block;
     }
     .export {
-      width:110px;
+      width: 110px;
       height: 32px;
       background: #0f7ac8;
       text-align: center;