|
@@ -1,23 +1,23 @@
|
|
|
<!-- 底图 -->
|
|
|
<template>
|
|
|
<div id='floor_base'>
|
|
|
- <div id="fengMap"></div>
|
|
|
- <div class="canvas-container" ref="graphy">
|
|
|
- <canvas id="canvas" :width="canvasWidth" :height="canvasHeight"></canvas>
|
|
|
+ <div id='fengMap'></div>
|
|
|
+ <div class='canvas-container' ref='graphy'>
|
|
|
+ <canvas id='canvas' :width='canvasWidth' :height='canvasHeight' tabindex='0'></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";
|
|
|
+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",
|
|
|
+ appName: '万达可视化系统',
|
|
|
+ key: '23f30a832a862c58637a4aadbf50a566',
|
|
|
+ mapServerURL: '/wanda',
|
|
|
+ fmapID: '1001724_29',
|
|
|
fmap: null,
|
|
|
canvasWidth: 700,
|
|
|
canvasHeight: 800,
|
|
@@ -26,59 +26,53 @@ export default {
|
|
|
},
|
|
|
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.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();
|
|
|
- });
|
|
|
+ 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.scene = null
|
|
|
+ return
|
|
|
}
|
|
|
- this.view = new SGraphyView("canvas");
|
|
|
- },
|
|
|
+ this.view = new SGraphyView('canvas')
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.canvasWidth = this.$refs.graphy.offsetWidth;
|
|
|
- this.canvasHeight = this.$refs.graphy.offsetHeight;
|
|
|
- },
|
|
|
+ this.canvasWidth = this.$refs.graphy.offsetWidth
|
|
|
+ this.canvasHeight = this.$refs.graphy.offsetHeight
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
- #floor_base{
|
|
|
- #fengMap {
|
|
|
- position: absolute;
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
- z-index: -1;
|
|
|
- }
|
|
|
- .canvas-container {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
+#floor_base {
|
|
|
+ #fengMap {
|
|
|
+ position: absolute;
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ z-index: -1;
|
|
|
}
|
|
|
+ .canvas-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|