Преглед на файлове

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

YaolongHan преди 4 години
родител
ревизия
554e15618b
променени са 2 файла, в които са добавени 44 реда и са изтрити 23 реда
  1. 1 1
      package-lock.json
  2. 43 22
      src/components/baseEditer.vue

+ 1 - 1
package-lock.json

@@ -1082,7 +1082,7 @@
     "@saga-web/feng-map": {
       "version": "1.0.10",
       "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/feng-map/-/feng-map-1.0.10.tgz",
-      "integrity": "sha512-TmalJ2Ka3B1z/aK1keD5E3drf4aRhdF3DEFqdZQ16qGIKnC6CXIlO3300iEKekbaqVxl3rBWTGrcHL/PrZZ0PQ==",
+      "integrity": "sha512-1eXrpI1fzohSxoGG/NZNHEfC4eH6HgApV6ahwik4JvpJdQvNoqJ7FVNr5puVTeqBC6RML3P+nOmGPn2cA/8axg==",
       "requires": {
         "@saga-web/big": "1.0.39"
       }

+ 43 - 22
src/components/baseEditer.vue

@@ -14,7 +14,10 @@ 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";
+import { uuid } from "@/components/mapClass/until"
+
+let fengmap = null;
+
 export default {
   props: {
     cmdType: {
@@ -34,12 +37,12 @@ export default {
       key: "23f30a832a862c58637a4aadbf50a566",
       mapServerURL: "/wdfn",
       fmapID: "1001724_29",
-      fmap: null,
       canvasWidth: 700,
       canvasHeight: 800,
       fParser: null,
       scene: null,
-      view: null
+      view: null,
+      floorList: {}
     };
   },
   mounted() {
@@ -55,30 +58,19 @@ export default {
       document.getElementById(`canvas`).focus();
       this.clearGraphy();
       this.scene = new EditScence();
-      this.fmap = new SFengParser(
+      fengmap = new SFengParser(
         "fengMap",
-        this.mapServerURL + "/1001724_29",
+        this.mapServerURL + '/'+this.fmapID,
         this.key,
         this.appName,
         null
       );
-      this.fmap.parseData("1001724_29", 6, res => {
-        this.fParser = new SFloorParser(null);
-        this.fParser.parseData(res);
-        this.fParser.wallList.forEach(t => this.scene.addItem(t));
-        this.fParser.virtualWallList.forEach(t => this.scene.addItem(t));
-        this.fParser.doorList.forEach(t => this.scene.addItem(t));
-        this.fParser.columnList.forEach(t => this.scene.addItem(t));
-        this.fParser.casementList.forEach(t => this.scene.addItem(t));
-        this.fParser.spaceList.forEach(t => {
-          t.selectable = true;
-          // t.connect("click", this, this.spaceClick);
-          this.scene.addItem(t);
-        });
-        this.view.scene = this.scene;
-        this.view.fitSceneToView();
-        // this.$loading.close(loadings);
-      });
+      const floorid = 'f1';
+      fengmap.loadMap(this.fmapID, resp => {
+        console.log('load-map-succ', resp)
+        this.floorList = resp
+        this.parserData(floorid)
+      })
       this.readGroup().then(data => {
         const parserData = new STopologyParser(null);
         parserData.parseData(data.data.Data[0].Elements);
@@ -105,6 +97,35 @@ export default {
       });
       this.scene.emitChange = this.emitChange;
     },
+    parserData(floor) {
+      if (this.floorList[floor]) {
+        fengmap.parseData(this.floorList[floor], res => {
+          console.log('parsedata', res)
+          if (res.err) {
+            console.log(res.err)
+            return
+          }
+          this.fParser = new SFloorParser(null)
+          this.fParser.parseData(res)
+          this.fParser.spaceList.forEach(t => {
+            t.selectable = true
+            this.scene.addItem(t)
+          })
+          this.fParser.wallList.forEach(t => this.scene.addItem(t))
+          this.fParser.virtualWallList.forEach(t => this.scene.addItem(t))
+          this.fParser.doorList.forEach(t => this.scene.addItem(t))
+          this.fParser.columnList.forEach(t => this.scene.addItem(t))
+          this.fParser.casementList.forEach(t => this.scene.addItem(t))
+          this.view.scene = this.scene
+          this.view.fitSceneToView()
+          this.loading = false
+          this.isQuerying = false
+          console.log('success')
+        })
+      } else {
+        console.log('楼层不正确')
+      }
+    },
     // 监听变化
     emitChange(itemMsg) {
       this.$emit("changeFocusItem", itemMsg);