haojianlong 4 rokov pred
rodič
commit
c0e1508104

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 2070 - 2102
package-lock.json


+ 4 - 1
package.json

@@ -9,9 +9,10 @@
     },
     "dependencies": {
         "@saga-web/base": "2.1.9",
-        "@saga-web/cad-engine": "2.0.565",
+        "@saga-web/big": "1.0.6",
         "@saga-web/draw": "2.1.80",
         "@saga-web/graphy": "2.1.52",
+        "@saga-web/feng-map": "1.0.4",
         "ant-design-vue": "^1.4.10",
         "core-js": "^3.4.4",
         "element-ui": "^2.13.2",
@@ -32,6 +33,8 @@
         "eslint": "^5.16.0",
         "eslint-plugin-vue": "^5.0.0",
         "less": "^3.0.4",
+        "fengmap": "^2.5.3",
+        "polybooljs": "^1.2.0",
         "less-loader": "^5.0.0",
         "vue-template-compiler": "^2.6.10"
     }

+ 69 - 24
src/components/floorMap/floorBase.vue

@@ -1,39 +1,84 @@
 <!-- 底图 -->
 <template>
     <div id='floor_base'>
-        <canvas id='map' :width='initWidth' height='700'></canvas>
+        <div id="fengMap"></div>
+        <div class="canvas-container" ref="graphy">
+            <canvas id="canvas" :width="canvasWidth" :height="canvasHeight"></canvas>
+        </div>
     </div>
 </template>
 <script>
-import { ZoneScene } from '@saga-web/cad-engine/lib'
-import { FloorView } from '@saga-web/cad-engine/lib/FloorView'
-// import { SPainter, SPoint, SLinearGradient } from "@saga-web/draw/lib";
+import { SFengParser } from "@saga-web/feng-map";
+import { SFloorParser } from "@saga-web/big";
+import { SGraphyView, SGraphyScene } from "@saga-web/graphy/lib";
 export default {
     data() {
         return {
-            view: null, //视图
-            ZoneScene: null, //场景类
-            initWidth: null, //初始化得宽度
-            mapUrl: '/api/download/daas//b2b5a2130cf511eabf9667e7f714e00e.jsonz'
+            appName: "万达可视化系统",
+            key: "23f30a832a862c58637a4aadbf50a566",
+            mapServerURL: "/wanda",
+            fmapID: "1001724_29",
+            fmap: null,
+            canvasWidth: 700,
+            canvasHeight: 800,
+            fParser: null
         }
     },
     methods: {
-        //     clearImg() {
-        //   if (!this.ZoneScene) {
-        //     this.ZoneScene = new ZoneScene();
-        //   }
-        //   // this.ZoneScene.clearMap();
-        // },
+        init() {
+            this.clearGraphy();
+            this.scene = new SGraphyScene();
+            this.fmap = new SFengParser(
+                "fengMap",
+                this.mapServerURL,
+                this.key,
+                this.appName,
+                null
+            );
+            console.log(this.fmap);
+            this.fmap.parseData("1001724_29", 1, res => {
+                console.log(res);
+                this.fParser = new SFloorParser(null);
+                console.log(this.fParser);
+                this.fParser.parseData(res);
+                this.fParser.spaceList.forEach(t => {
+                t.connect('click', this, this.spaceClick)
+                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();
+            });
+        },
+        clearGraphy() {
+            if (this.view) {
+                this.view.scene = null;
+                return;
+            }
+            this.view = new SGraphyView("canvas");
+        },
     },
     mounted() {
-        //  将场景赋给view对图进行绘制
-        this.initWidth = document.documentElement.clientWidth
-        this.view = new FloorView(`map`)
-        this.ZoneScene = new ZoneScene()
-        // this.ZoneScene.loadUrl(this.mapUrl).then(res => {
-        //   this.view.scene = this.ZoneScene;
-        //   this.view.fitSceneToView();
-        // });
-    }
+        this.canvasWidth = this.$refs.graphy.offsetWidth;
+        this.canvasHeight = this.$refs.graphy.offsetHeight;
+    },
 }
-</script>
+</script>
+<style lang="less" scoped>
+    #floor_base{
+        #fengMap {
+            position: absolute;
+            width: 100px;
+            height: 100px;
+            z-index: -1;
+        }
+        .canvas-container {
+            width: 100%;
+            height: 100%;
+        }
+    }
+</style>

+ 6 - 2
src/components/floorMap/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="floor_map">
-    <floorBase></floorBase>
+    <floorBase ref="floorBase"></floorBase>
   </div>
 </template>
 <script>
@@ -10,7 +10,11 @@ export default {
   data() {
     return {};
   },
-  methods: {},
+  methods: {
+    init(){
+      this.$refs.floorBase.init();
+    }
+  },
   mounted() {}
 };
 </script>

+ 2 - 1
src/views/equipment/index.vue

@@ -24,7 +24,7 @@
                         <span>{{floorInfo.floorName}}</span>
                     </div>
                     <div class='eq-content'>
-                        <floorMap></floorMap>
+                        <floorMap ref="floorMap"></floorMap>
                         <bottomLayer></bottomLayer>
                     </div>
                     <floor-list :floors='floors' @emitFloor='emitFloor'></floor-list>
@@ -66,6 +66,7 @@ export default {
         },
         emitFloor(item) {
             this.floorInfo = item
+            this.$refs.floorMap.init();
         },
         dialogVisible(eve) {
             this.$refs.dialog.showModal(eve)

+ 7 - 0
vue.config.js

@@ -9,6 +9,13 @@ module.exports = {
                     "^/api": ''
                 }
             },
+            "/wanda": {
+                target: "http://map.wanda.cn/editor/fmap/1001724_29",
+                changeOrigin: true,
+                pathRewrite: {
+                    "^/wanda": ""
+                }
+            }
         },
         // 关闭esline
         overlay: {