|
@@ -19,7 +19,8 @@ import RoomBox from '@/views/room/index'
|
|
import canvasFun from '@/components/floorMap/canvasFun'
|
|
import canvasFun from '@/components/floorMap/canvasFun'
|
|
import { readGroup } from '@/api/public'
|
|
import { readGroup } from '@/api/public'
|
|
import { STopologyParser } from '@/lib/parsers/STopologyParser'
|
|
import { STopologyParser } from '@/lib/parsers/STopologyParser'
|
|
-import { mapGetters } from 'vuex'
|
|
|
|
|
|
+import { mapGetters, mapActions } from 'vuex'
|
|
|
|
+import { SImageItem } from '@saga-web/graph/lib'
|
|
// import { uuid } from "@/components/mapClass/until";
|
|
// import { uuid } from "@/components/mapClass/until";
|
|
let fengmap = null
|
|
let fengmap = null
|
|
|
|
|
|
@@ -34,31 +35,45 @@ export default {
|
|
loading: false,
|
|
loading: false,
|
|
view: null,
|
|
view: null,
|
|
isQuerying: false, // 限制重复查询
|
|
isQuerying: false, // 限制重复查询
|
|
- urlMsg: {}
|
|
|
|
|
|
+ urlMsg: {},
|
|
|
|
+ // fmapID:'1001012_42'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: { RoomBox, canvasFun },
|
|
components: { RoomBox, canvasFun },
|
|
computed: {
|
|
computed: {
|
|
- ...mapGetters(['plazaId', 'fmapID'])
|
|
|
|
|
|
+ ...mapGetters(['plazaId','fmapID']),
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ ...mapActions(['getfmapID']),
|
|
init(floorid) {
|
|
init(floorid) {
|
|
|
|
+ if(!this.fmapID){
|
|
|
|
+ this.getfmapID().then(()=>{
|
|
|
|
+ this.urlMsg.fmapID = this.fmapID
|
|
|
|
+ this.getMap(floorid)
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.getMap(floorid)
|
|
|
|
+ },
|
|
|
|
+ getMap(floorid){
|
|
if (this.isQuerying) {
|
|
if (this.isQuerying) {
|
|
console.log('正在查询...')
|
|
console.log('正在查询...')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- console.log(this.fmapID)
|
|
|
|
this.isQuerying = true
|
|
this.isQuerying = true
|
|
this.clearGraphy()
|
|
this.clearGraphy()
|
|
this.scene = new FloorScene()
|
|
this.scene = new FloorScene()
|
|
this.scene.selectContainer.connect('listChange', this, this.listChange)
|
|
this.scene.selectContainer.connect('listChange', this, this.listChange)
|
|
if (!fengmap) {
|
|
if (!fengmap) {
|
|
- fengmap = new SFengParser('fengMap', `${this.mapServerURL}/${this.fmapID}`, this.key, this.appName, null)
|
|
|
|
-
|
|
|
|
|
|
+ fengmap = new SFengParser('fengMap', `${this.mapServerURL}/fmap/${this.fmapID}`, this.key, this.appName, null)
|
|
fengmap.loadMap(this.fmapID, res => {
|
|
fengmap.loadMap(this.fmapID, res => {
|
|
this.floorList = res
|
|
this.floorList = res
|
|
this.parserData(floorid)
|
|
this.parserData(floorid)
|
|
})
|
|
})
|
|
|
|
+ // 获取主题数据
|
|
|
|
+ fengmap.loadTheme(`${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`).then(res => {
|
|
|
|
+ console.log('获取rf成功', res)
|
|
|
|
+ })
|
|
this.readGroup().then(data => {
|
|
this.readGroup().then(data => {
|
|
const parserData = new STopologyParser(null)
|
|
const parserData = new STopologyParser(null)
|
|
parserData.parseData(data.data.Data[0].Elements)
|
|
parserData.parseData(data.data.Data[0].Elements)
|
|
@@ -100,36 +115,46 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
parserData(floor) {
|
|
parserData(floor) {
|
|
- if (this.floorList[floor]) {
|
|
|
|
- console.log(this.floorList[floor])
|
|
|
|
- fengmap.parseData(this.floorList[floor], res => {
|
|
|
|
- if (res.err) {
|
|
|
|
- console.log(res.err)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- const fParser = new SFloorParser(null)
|
|
|
|
- fParser.parseData(res)
|
|
|
|
- fParser.spaceList.forEach(t => {
|
|
|
|
- t.selectable = true
|
|
|
|
- this.scene.addItem(t)
|
|
|
|
- })
|
|
|
|
- fParser.wallList.forEach(t => this.scene.addItem(t))
|
|
|
|
- fParser.virtualWallList.forEach(t => this.scene.addItem(t))
|
|
|
|
- fParser.doorList.forEach(t => this.scene.addItem(t))
|
|
|
|
- fParser.columnList.forEach(t => this.scene.addItem(t))
|
|
|
|
- fParser.casementList.forEach(t => this.scene.addItem(t))
|
|
|
|
|
|
+ if (floor == 'g80') {
|
|
|
|
+ // 屋顶
|
|
|
|
+ if (fengmap.frImg) {
|
|
|
|
+ let imgItem = new SImageItem(null,`${this.mapServerURL}/webtheme/${this.fmapID}/${fengmap.frImg}`)
|
|
|
|
+ this.scene.addItem(imgItem)
|
|
this.view.scene = this.scene
|
|
this.view.scene = this.scene
|
|
this.view.fitSceneToView()
|
|
this.view.fitSceneToView()
|
|
this.loading = false
|
|
this.loading = false
|
|
this.isQuerying = false
|
|
this.isQuerying = false
|
|
- console.log('success')
|
|
|
|
- })
|
|
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- console.log('楼层不正确')
|
|
|
|
|
|
+ if (this.floorList[floor]) {
|
|
|
|
+ fengmap.parseData(this.floorList[floor], res => {
|
|
|
|
+ if (res.err) {
|
|
|
|
+ console.log(res.err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ const fParser = new SFloorParser(null)
|
|
|
|
+ fParser.parseData(res)
|
|
|
|
+ fParser.spaceList.forEach(t => {
|
|
|
|
+ t.selectable = true
|
|
|
|
+ this.scene.addItem(t)
|
|
|
|
+ })
|
|
|
|
+ fParser.wallList.forEach(t => this.scene.addItem(t))
|
|
|
|
+ fParser.virtualWallList.forEach(t => this.scene.addItem(t))
|
|
|
|
+ fParser.doorList.forEach(t => this.scene.addItem(t))
|
|
|
|
+ fParser.columnList.forEach(t => this.scene.addItem(t))
|
|
|
|
+ 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('楼层不正确')
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
clearGraphy() {
|
|
clearGraphy() {
|
|
- console.log(new FloorView('canvas'))
|
|
|
|
if (this.view) {
|
|
if (this.view) {
|
|
this.view.scene = null
|
|
this.view.scene = null
|
|
return
|
|
return
|
|
@@ -156,7 +181,6 @@ export default {
|
|
},
|
|
},
|
|
// 保存为json
|
|
// 保存为json
|
|
saveJson() {
|
|
saveJson() {
|
|
- console.log(2222)
|
|
|
|
this.view.saveFloorJson(`1.json`)
|
|
this.view.saveFloorJson(`1.json`)
|
|
},
|
|
},
|
|
// 缩放
|
|
// 缩放
|
|
@@ -175,24 +199,9 @@ export default {
|
|
}
|
|
}
|
|
return readGroup(data)
|
|
return readGroup(data)
|
|
}
|
|
}
|
|
- // handleFmapID(fmapID) {
|
|
|
|
- // if (fmapID) {
|
|
|
|
- // this.fmapID = fmapID
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- },
|
|
|
|
- watch: {
|
|
|
|
- // '$store.state.fmapID': 'handleFmapID'
|
|
|
|
},
|
|
},
|
|
|
|
+ watch: { },
|
|
mounted() {
|
|
mounted() {
|
|
- this.$nextTick(() => {
|
|
|
|
- // console.log('-------------')
|
|
|
|
- // console.log(this.$store.state.fmapID)
|
|
|
|
- // console.log('-------------')
|
|
|
|
- })
|
|
|
|
- setTimeout(() => {
|
|
|
|
- console.log(this.$store.state.fmapID)
|
|
|
|
- }, 50000)
|
|
|
|
if (window.screen.height == '768') {
|
|
if (window.screen.height == '768') {
|
|
this.canvasWidth = this.$refs.graphy.offsetWidth
|
|
this.canvasWidth = this.$refs.graphy.offsetWidth
|
|
this.canvasHeight = this.$refs.graphy.offsetHeight - 100
|
|
this.canvasHeight = this.$refs.graphy.offsetHeight - 100
|