Prechádzať zdrojové kódy

修改提取铺面元素

haojianlong 4 rokov pred
rodič
commit
a9f68241e4

+ 24 - 3
src/components/baseEditer.vue

@@ -14,6 +14,7 @@ import { EditScence } from "./mapClass/EditScence";
 import bus from "@/bus";
 import { saveGroup, readGroup } from "@/api/editer.js";
 import { STopologyParser } from "./../lib/parsers/STopologyParser";
+import { uuid } from "@/components/mapClass/until"
 export default {
   props: {
     cmdType: {
@@ -56,7 +57,7 @@ export default {
       this.scene = new EditScence();
       this.fmap = new SFengParser(
         "fengMap",
-        this.mapServerURL+'/1001724_29',
+        this.mapServerURL + '/1001724_29',
         this.key,
         this.appName,
         null
@@ -176,10 +177,30 @@ export default {
         });
       });
       bus.$on("exportByKey", val => {
-        this.fParser.spaceList.forEach(t => {
+        const list = this.fParser.spaceList.map(t => {
           if (t.data.Type == val.key) {
-            t.selected = true;
+            return {
+              ID: uuid(),
+              Name: t.name,
+              GraphElementType: 'Zone',
+              GraphElementId: "273d633cc5c54a4882794b34843d1a00",
+              AttachObjectIds:[],
+              Pos: { x: t.x, y: t.y },
+              OutLine: t.pointArr,
+              Properties: {
+                strokeColor: '#3d73c0',
+                fillColor: '#eda986'
+              },
+              Num: 123
+            };
           }
+        }).filter(item => item);
+        console.log(list)
+        const parserData = new STopologyParser(null);
+        parserData.parseData({ Nodes: list });
+        parserData.zoneLegendList.forEach(t => {
+          this.scene.addItem(t);
+          this.scene.Nodes.push(t)
         });
       });
       // 设备图例样式对象

+ 8 - 4
src/lib/items/SZoneLegendItem.ts

@@ -67,10 +67,14 @@ export class SZoneLegendItem extends SPolygonItem {
             this.setPointList = [];
             let setPointList: SPoint[];
             if (data.OutLine) {
-                setPointList = data.OutLine[0].map(i => {
-                    return (new SPoint(i.X, i.Y))
-                })
-                this.setPointList = setPointList;
+                if (data.OutLine[0][0] instanceof SPoint) {
+                    this.setPointList = data.OutLine[0];
+                } else {
+                    setPointList = data.OutLine[0].map(i => {
+                        return (new SPoint(i.X, i.Y))
+                    })
+                    this.setPointList = setPointList;
+                }
             }
 
             // 设置线宽