haojianlong 4 年 前
コミット
428387f67d
4 ファイル変更157 行追加1 行削除
  1. 68 0
      package-lock.json
  2. 7 0
      package.json
  3. 73 1
      src/components/baseEditer.vue
  4. 9 0
      vue.config.js

+ 68 - 0
package-lock.json

@@ -1061,6 +1061,43 @@
       "integrity": "sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=",
       "dev": true
     },
+    "@saga-web/base": {
+      "version": "2.1.9",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/base/-/base-2.1.9.tgz",
+      "integrity": "sha512-DE0rH2m25O3yCK1b1VXSX3tYUHBBEcQnrkjh72SctsFGK2jdS7XBE4+1x8szajvPIOkH05wMoUC2EsmJsZAhvQ=="
+    },
+    "@saga-web/big": {
+      "version": "1.0.6",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/big/-/big-1.0.6.tgz",
+      "integrity": "sha512-YG3KlxfUGN1oBlbIUzC2WiGMia6lwlc+oOXubeMvUC1t5EUA+XwVGlOj26opoAacmDrEaGVzcaG3gclWY0uDaQ==",
+      "requires": {
+        "@saga-web/graphy": "2.1.52"
+      }
+    },
+    "@saga-web/draw": {
+      "version": "2.1.80",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/draw/-/draw-2.1.80.tgz",
+      "integrity": "sha512-zKhtKo2MHHf0Bwn1ShSzNV5xb25Ebcs4D3ctMAQlxLhPPQzSkUV7RxiOngcJ1Bb3SDyAC4tDKBaLxLn1rN7vsQ==",
+      "requires": {
+        "@saga-web/base": "^2.1.9"
+      }
+    },
+    "@saga-web/feng-map": {
+      "version": "1.0.4",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/feng-map/-/feng-map-1.0.4.tgz",
+      "integrity": "sha512-p3QbLTuDkXPSnPQNNp790Of3JbkdshOfEyguW3xj7Y+zzY9BgryR1elwY1zPU0JdayPCPcUvi9bvhRvsmrfd/A==",
+      "requires": {
+        "@saga-web/big": "1.0.6"
+      }
+    },
+    "@saga-web/graphy": {
+      "version": "2.1.52",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/graphy/-/graphy-2.1.52.tgz",
+      "integrity": "sha512-65lxavb4btJluSFnZ4KCqOZcsH2ksXfHy6XMWNZzTqxqgjP15ZJvT4uLxBdP+2G8SkStVRNkXIAstnroo9XLjA==",
+      "requires": {
+        "@saga-web/draw": "2.1.80"
+      }
+    },
     "@soda/friendly-errors-webpack-plugin": {
       "version": "1.7.1",
       "resolved": "https://registry.npm.taobao.org/@soda/friendly-errors-webpack-plugin/download/@soda/friendly-errors-webpack-plugin-1.7.1.tgz",
@@ -5328,6 +5365,12 @@
         "websocket-driver": ">=0.5.1"
       }
     },
+    "fengmap": {
+      "version": "2.5.3",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/fengmap/-/fengmap-2.5.3.tgz",
+      "integrity": "sha512-l/9XANZ9FXHbT4m04qjLg1t9UIalghuxUfOECMFIdKPgLISZr3dpJkxvew11Qz8MrPVSzS5pCNQtzCdl34zB2w==",
+      "dev": true
+    },
     "figgy-pudding": {
       "version": "3.5.2",
       "resolved": "https://registry.npm.taobao.org/figgy-pudding/download/figgy-pudding-3.5.2.tgz",
@@ -8349,6 +8392,12 @@
         "ts-pnp": "^1.1.6"
       }
     },
+    "polybooljs": {
+      "version": "1.2.0",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/polybooljs/-/polybooljs-1.2.0.tgz",
+      "integrity": "sha1-tDkMLgedTCYtOyUExiiNlbp6R1g=",
+      "dev": true
+    },
     "portfinder": {
       "version": "1.0.26",
       "resolved": "https://registry.npm.taobao.org/portfinder/download/portfinder-1.0.26.tgz",
@@ -10483,6 +10532,15 @@
       "integrity": "sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=",
       "dev": true
     },
+    "svg-to-vue": {
+      "version": "0.6.0",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/svg-to-vue/-/svg-to-vue-0.6.0.tgz",
+      "integrity": "sha512-SYGJMBq5EHt/nIJxZ4kA9A6bilaFXtOPFJRoMQ2ml/jFP4N9L7HVFTm+5WCFN3QFnEUXtH6BHzpoOlwP1/5+2A==",
+      "dev": true,
+      "requires": {
+        "svgo": "^1.3.2"
+      }
+    },
     "svgo": {
       "version": "1.3.2",
       "resolved": "https://registry.npm.taobao.org/svgo/download/svgo-1.3.2.tgz?cache=0&sync_timestamp=1572433377078&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsvgo%2Fdownload%2Fsvgo-1.3.2.tgz",
@@ -11364,6 +11422,16 @@
         }
       }
     },
+    "vue-svg-loader": {
+      "version": "0.15.0",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/vue-svg-loader/-/vue-svg-loader-0.15.0.tgz",
+      "integrity": "sha512-698GfXu9k2wPxI382Qf7MfrtBXjIjThqmOsksVKHqeTvVO+Ary9q69SVzA6EEJmj5vmF5u1KRVb/I1BDh4fPTQ==",
+      "dev": true,
+      "requires": {
+        "loader-utils": "^1.2.3",
+        "svg-to-vue": "^0.6.0"
+      }
+    },
     "vue-template-compiler": {
       "version": "2.6.11",
       "resolved": "https://registry.npm.taobao.org/vue-template-compiler/download/vue-template-compiler-2.6.11.tgz",

+ 7 - 0
package.json

@@ -8,6 +8,11 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
+    "@saga-web/base": "2.1.9",
+    "@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.6.0",
     "core-js": "^3.6.4",
     "vue": "^2.6.11",
@@ -28,8 +33,10 @@
     "@vue/eslint-config-typescript": "^5.0.2",
     "eslint": "^6.7.2",
     "eslint-plugin-vue": "^6.2.2",
+    "fengmap": "^2.5.3",
     "less": "^3.0.4",
     "less-loader": "^5.0.0",
+    "polybooljs": "^1.2.0",
     "typescript": "~3.8.3",
     "vue-svg-loader": "^0.15.0",
     "vue-template-compiler": "^2.6.11"

+ 73 - 1
src/components/baseEditer.vue

@@ -1,10 +1,82 @@
 <template>
-  <div id="baseEditer"></div>
+  <div id="baseEditer">
+    <a-button type="primary" @click="init" style="position:absolute"> Primary </a-button>
+    <div id="fengMap"></div>
+
+    <div class="canvas-container" ref="graphy">
+      <canvas id="canvas" :width="canvasWidth" :height="canvasHeight"></canvas>
+    </div>
+
+  </div>
 </template>
+<script>
+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 {
+      appName: "万达可视化系统",
+      key: "23f30a832a862c58637a4aadbf50a566",
+      mapServerURL: "/wanda",
+      fmapID: '1001724_29',
+      fmap: null,
+      canvasWidth: 800,
+      canvasHeight: 800,
+      fParser: null
+    };
+  },
+  mounted() {
+    this.canvasWidth = this.$refs.graphy.offsetWidth;
+    console.log(this.$refs.graphy.offsetWidth)
+    this.canvasHeight = this.$refs.graphy.offsetHeight;
+  },
+  methods: {
+    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 => 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");
+    },
+    changeFloor() { }
+  }
+}
+</script>
 <style lang="less" scoped>
 #baseEditer {
   background: #ccc;
   width: 100%;
   height: 100%;
+  #fengMap {
+    position: absolute;
+    width: 100px;
+    height: 100px;
+    z-index: -1;
+  }
+  .canvas-container {
+    width: 100%;
+    height: 100%;
+  }
 }
 </style>

+ 9 - 0
vue.config.js

@@ -5,6 +5,15 @@ module.exports = {
             warnings: false,
             errors: false
         },
+        proxy: {
+            "/wanda": {
+                    target: "http://map.wanda.cn/editor/fmap/1001724_29",
+                    changeOrigin: true,
+                    pathRewrite: {
+                        "^/wanda": ""
+                }
+            }
+        }
     },
     chainWebpack: (config) => {
         const svgRule = config.module.rule('svg');