Browse Source

解决鞍山顶楼问题

haojianlong 4 years ago
parent
commit
6dd6b5303e
1 changed files with 39 additions and 38 deletions
  1. 39 38
      src/components/baseEditer.vue

+ 39 - 38
src/components/baseEditer.vue

@@ -162,52 +162,53 @@ export default {
           });
           this.scene.addItem(imgItem);
           this.view.scene = this.scene;
-          // this.view.fitSceneToView();
-          // this.loading = false;
-          // this.isQuerying = false;
+        } else {
+          // 屋顶图不为图片
+          this.readBaseMap(floor);
         }
       } else {
         if (this.floorList[floor]) {
-          window.FENGMAP.parseData(this.floorList[floor], res => {
-            if (res.err) {
-              console.log(res.err);
-              return;
-            }
-            this.fParser = new SFloorParser(null);
-            this.fParser.parseData(res);
-            this.scene.fidToItem = {};
-            this.fParser.spaceList.forEach(t => {
-              t.nameColor = "#2a2a2a";
-              t.zOrder = t.zOrder + t.data.Height;
-              t.selectable = true;
-              this.scene.fidToItem[t.data.SourceId] = t;
-              this.scene.addItem(t);
-            });
-            this.scene.spaceList = this.fParser.spaceList;
-            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.pList = [];
-            res.PList.forEach(t => {
-              const item = new SCircleItem(null, t);
-              this.fParser.pList.push(item);
-              this.scene.fidToItem[t.SourceId] = item;
-              this.scene.addItem(item);
-            });
-            this.view.scene = this.scene;
-            // this.view.fitSceneToView();
-            // this.loading = false;
-            // this.isQuerying = false;
-            this.readGraph();
-            console.log("success");
-          });
+          this.readBaseMap(floor);
         } else {
           console.log("楼层不正确");
         }
       }
     },
+    // 解析底图
+    readBaseMap(floor){
+      window.FENGMAP.parseData(this.floorList[floor], res => {
+        if (res.err) {
+          console.log(res.err);
+          return;
+        }
+        this.fParser = new SFloorParser(null);
+        this.fParser.parseData(res);
+        this.scene.fidToItem = {};
+        this.fParser.spaceList.forEach(t => {
+          t.nameColor = "#2a2a2a";
+          t.zOrder = t.zOrder + t.data.Height;
+          t.selectable = true;
+          this.scene.fidToItem[t.data.SourceId] = t;
+          this.scene.addItem(t);
+        });
+        this.scene.spaceList = this.fParser.spaceList;
+        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.pList = [];
+        res.PList.forEach(t => {
+          const item = new SCircleItem(null, t);
+          this.fParser.pList.push(item);
+          this.scene.fidToItem[t.SourceId] = item;
+          this.scene.addItem(item);
+        });
+        this.view.scene = this.scene;
+        this.readGraph();
+        console.log("success");
+      });
+    },
     // 读取绘制数据
     readGraph() {
       this.readGroup().then(data => {