Explorar o código

定位方法修改

zpf hai 1 ano
pai
achega
fb6d7a0373
Modificáronse 1 ficheiros con 49 adicións e 6 borrados
  1. 49 6
      src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

+ 49 - 6
src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

@@ -54,7 +54,52 @@ export default {
         };
     },
     methods: {
+        multiPolygonToPolygons(multiPolygon) {
+            const polygons = [];
+            multiPolygon.coordinates.forEach(polygonCoordinates => {
+                polygons.push({
+                    type: 'Polygon',
+                    coordinates: polygonCoordinates
+                });
+            });
+            return polygons;
+        },
+        // draw_vector_tdgy_gy_jd(data) {
+        //     const that = this;
+        //     data.forEach((res) => {
+        //         res.type = this.title
+        //         if (res.geom) {
+        //             res.geom.coordinates.forEach((res_coordinates) => {
+        //                 // let arrayt = [];
+        //                 // if (res_coordinates.length == 1) {
+        //                 //     arrayt = res_coordinates[0]
+        //                 //     const twoDArray = arrayt;
+        //                 //     const oneDArray = twoDArray.reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);
+        //                 //     tdsy.add(res, oneDArray);
+        //                 // } else {
+        //                 //     // arrayt = res_coordinates
+        //                 // }
+
+        //                 // 多面转单面
+        //                 // if (res.geom.type == 'MultiPolygon') {
+        //                 //     let polygons = that.multiPolygonToPolygons(geojson);
+
+        //                 //     // 在
+        //                 //     polygons.forEach((res) => {
+        //                 //         that.add_viewer_for_vector(res, data);
+        //                 //         tdsy.add(res, oneDArray);
+
+        //                 //     })
+        //                 // } else {
+
+        //                 // }
+
+        //             })
+        //         }
+        //     })
+        // },
         draw_vector_tdgy_gy_jd(data) {
+            // tdsy.remove();
             data.forEach((res) => {
                 res.type = this.title
                 if (res.geom) {
@@ -62,19 +107,17 @@ export default {
                         let arrayt = [];
                         if (res_coordinates.length == 1) {
                             arrayt = res_coordinates[0]
-                            const twoDArray = arrayt;
-                            const oneDArray = twoDArray.reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);
-                            tdsy.add(res, oneDArray);
                         } else {
-                            // arrayt = res_coordinates
+                            arrayt = res_coordinates
                         }
 
-
+                        const twoDArray = arrayt;
+                        const oneDArray = twoDArray.reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);
+                        tdsy.add(res, oneDArray);
                     })
                 }
             })
         },
-
         close() {
 
             store.setViewerFlagb(true);