|
@@ -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);
|