zpf hai 11 meses
pai
achega
ddce6f941b

+ 3 - 3
src/components/Query/clickQuery/pick_cockpit_vector.js

@@ -32,12 +32,12 @@ export const init_handler = () => {
             let obj = {}
             let arr = [];
             if (pickObj.primitive instanceof Cesium.Primitive && pickObj.id.properties && pickObj.id.properties.type == '国有建设用地完成项目') {//点击primitive
-                //primitive相关操作
+                primitive相关操作
                 let propertyNames = pickObj.id.properties.propertyNames
                 propertyNames.forEach((res) => {
                     arr.push({
-                        "name":res,
-                        "value":pickObj.id.properties[res]._value,
+                        "name": res,
+                        "value": pickObj.id.properties[res]._value,
                     });
                 })
 

+ 39 - 0
src/views/cockpit/js/tdsy.js

@@ -0,0 +1,39 @@
+let gy_jd_entity = {};
+let _viewer = {};
+
+export const init = (viewer) => {
+
+    gy_jd_entity = new Cesium.CustomDataSource("gy_jd_entity");
+    viewer.dataSources.add(gy_jd_entity);
+    gy_jd_entity.show = false;
+    _viewer = viewer;
+
+}
+
+export const add = (res, oneDArray) => {
+
+    gy_jd_entity.entities.add({
+        // position: Cesium.Cartesian3.fromDegrees(res_coordinates[0], res_coordinates[1], 0),
+        properties: res,
+        name: "国有建设用地完成项目",
+        polygon: {
+            zIndex: 1,
+            hierarchy: {
+                positions: Cesium.Cartesian3.fromDegreesArrayHeights(oneDArray),
+            },
+            // outline: false,
+            // material: Cesium.Color.fromCssColorString(xzqh_color),
+
+            height: 5,
+            extrudedHeight: 0,
+            outline: true,
+            // outlineColor : Cesium.Color.BLACK
+            outlineColor: Cesium.Color.fromCssColorString('#55A1E3'),
+        }
+    })
+}
+
+export const hidden = (flag) => {
+    gy_jd_entity.show = flag;
+
+}

+ 43 - 28
src/views/cockpit/tdsy.vue

@@ -134,7 +134,7 @@ import pie3d from "../../components/echartsTemplate/3dPie.vue";
 import DialWatch from './common/DialWatch.vue';
 import Graph3D from './common/Graph3D.vue';
 import parse from "wellknown";
-
+import * as tdsy from "./js/tdsy";
 export default {
   components: { pie3d, DialWatch, Graph3D },
   data() {
@@ -845,39 +845,52 @@ export default {
             let arrayt = [];
             if (res_coordinates.length == 1) {
               arrayt = res_coordinates[0]
-            }else{
+            } else {
               arrayt = res_coordinates
             }
 
             const twoDArray = arrayt;
             const oneDArray = twoDArray.reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);
 
-            this.gy_jd_entity.entities.add({
-              // position: Cesium.Cartesian3.fromDegrees(res_coordinates[0], res_coordinates[1], 0),
-              properties: res,
-              name: "国有建设用地完成项目",
-              polygon: {
-                zIndex: 1,
-                hierarchy: {
-                  positions: Cesium.Cartesian3.fromDegreesArrayHeights(oneDArray),
-                },
-                // outline: false,
-                // material: Cesium.Color.fromCssColorString(xzqh_color),
-
-                height: 5,
-                extrudedHeight: 0,
-                outline: true,
-                // outlineColor : Cesium.Color.BLACK
-                outlineColor: Cesium.Color.fromCssColorString('#55A1E3'),
-              }
-            })
+            // this.gy_jd_entity.entities.add({
+            //   // position: Cesium.Cartesian3.fromDegrees(res_coordinates[0], res_coordinates[1], 0),
+            //   properties: res,
+            //   name: "国有建设用地完成项目",
+            //   polygon: {
+            //     zIndex: 1,
+            //     hierarchy: {
+            //       positions: Cesium.Cartesian3.fromDegreesArrayHeights(oneDArray),
+            //     },
+            //     // outline: false,
+            //     // material: Cesium.Color.fromCssColorString(xzqh_color),
+
+            //     height: 5,
+            //     extrudedHeight: 0,
+            //     outline: true,
+            //     // outlineColor : Cesium.Color.BLACK
+            //     outlineColor: Cesium.Color.fromCssColorString('#55A1E3'),
+            //   }
+            // })
+
+            tdsy.add(res, oneDArray);
           })
         }
       })
     },
     switch_vector_tdgy_gy_jd(flag) {
-      this.gy_jd_entity.show = flag
-      console.log('flag: ', flag);
+      // this.gy_jd_entity.show = flag
+      // console.log('flag: ', flag);
+
+      tdsy.hidden(flag);
+      // if (flag) {
+      //   tdsy.add();
+      //   this.draw_vector_tdgy_gy_jd();
+
+      // } else {
+      //   tdsy.hidden(false);
+
+      // }
+
     },
     async init_vector(params) {
       const that = this;
@@ -893,8 +906,7 @@ export default {
 
       })
       this.vector_data = data.data;
-
-      this.draw_vector_tdgy_gy_jd();
+      this.draw_vector_tdgy_gy_jd()
     }
   },
   mounted() {
@@ -913,9 +925,12 @@ export default {
 
 
 
-      this.gy_jd_entity = new Cesium.CustomDataSource("gy_jd_entity");
-      viewer.dataSources.add(this.gy_jd_entity);
-      this.gy_jd_entity.show = false
+      // this.gy_jd_entity = new Cesium.CustomDataSource("gy_jd_entity");
+      // viewer.dataSources.add(this.gy_jd_entity);
+      // this.gy_jd_entity.show = false
+
+      tdsy.init(viewer);
+
 
     });
   },