113 lines
2.8 KiB
TypeScript
113 lines
2.8 KiB
TypeScript
import {Component, Vue} from 'vue-property-decorator';
|
|
|
|
import("./overview.component.scss")
|
|
import template from "./overview.component.html"
|
|
import HeaderComponent from "@/components/header.component.vue"
|
|
import MapComponent from "@/components/map.component.vue"
|
|
import {getRandNumBetween} from "@/utils/utils"
|
|
import layerData from "@/mock/layer"
|
|
import boundsData from "@/mock/bounds"
|
|
import ParkFileService from '@/service/park.service';
|
|
import CloseService from '@/service/close.service';
|
|
import * as turf from "@turf/turf"
|
|
|
|
@Component({
|
|
template,
|
|
components: {
|
|
MapComponent,
|
|
// MapComponent: () => import("common/map"),
|
|
HeaderComponent,
|
|
|
|
}
|
|
})
|
|
export default class BaseComponent extends Vue {
|
|
public player!: any;
|
|
public layerData = layerData;
|
|
|
|
public lock = true;
|
|
|
|
public timerList = {} as any;
|
|
public pakFilePath = "@path:DTS_Library_V5.4.pak";
|
|
public currentWanning:any = null;
|
|
public currentEvent:any = null;
|
|
|
|
// dataList
|
|
public dataList = {} as any;
|
|
// service
|
|
public parkService = new ParkFileService()
|
|
public closeService = new CloseService()
|
|
|
|
|
|
|
|
// 重置视角
|
|
public async resetMap(time:number=1) {
|
|
if(this.lock){
|
|
this.$message.error("视口未加载完成")
|
|
return
|
|
}
|
|
this.player.api.camera.lookAt(
|
|
13312716.658437,
|
|
4098255.982695,
|
|
60.714346,
|
|
0,
|
|
-20,
|
|
-45
|
|
)
|
|
// this.player.api.camera.get((res)=>{
|
|
// console.log(res)
|
|
// })
|
|
|
|
// return await this.player.api.tileLayer.focus("48D390964B7F0D37D07DD8A2D5596E64",330,time)
|
|
|
|
}
|
|
|
|
// 添加电子围栏 // 安全线 // 实控线 // 规划线
|
|
public async toggleArea(layer){
|
|
if(!layer.ids.length){
|
|
const result = this.dataList[layer.value].map(item=>{
|
|
return {
|
|
id:item.id,
|
|
groupId:layer.value,
|
|
coordinates:item.area,
|
|
height:20,
|
|
color:layer.color,
|
|
style:4,
|
|
generateTop:false,
|
|
generateBottom:false
|
|
}
|
|
});
|
|
this.player.api.polygon3d.add(result,(data)=>{
|
|
if(data.resultMessage==="OK"){
|
|
layer.ids = result.map(item=>item.id)
|
|
}
|
|
})
|
|
}else{
|
|
if(layer.selected){
|
|
this.player.api.polygon3d.show(layer.ids)
|
|
}else{
|
|
this.player.api.polygon3d.hide(layer.ids)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public onFocus(data){
|
|
this.player.api[data.type].focus(data.id)
|
|
}
|
|
|
|
|
|
|
|
// 组件渲染完成
|
|
mounted() {
|
|
console.log(1)
|
|
}
|
|
beforeDestory(){
|
|
//
|
|
}
|
|
destroyed(){
|
|
//
|
|
}
|
|
|
|
|
|
}
|