feat:新增自由导览
parent
c9a45ca8f6
commit
9eecbf8fdb
|
@ -9,7 +9,7 @@ export default class PlayerUtils{
|
||||||
const player = new acapi.DigitalTwinPlayer(process.env.VUE_APP_PALYER_URL,{
|
const player = new acapi.DigitalTwinPlayer(process.env.VUE_APP_PALYER_URL,{
|
||||||
domId,
|
domId,
|
||||||
iid,
|
iid,
|
||||||
// reset:true,
|
reset:true,
|
||||||
apiOptions:{
|
apiOptions:{
|
||||||
onReady: this.onReady,
|
onReady: this.onReady,
|
||||||
onLog: this.onLog, //可选参数,日志输出回调函数
|
onLog: this.onLog, //可选参数,日志输出回调函数
|
||||||
|
@ -34,7 +34,7 @@ export default class PlayerUtils{
|
||||||
onKeyPress:this.onKeyPress,
|
onKeyPress:this.onKeyPress,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
keyEventTarget: 'none',
|
keyEventTarget: 'video',
|
||||||
})
|
})
|
||||||
this.api = player.getAPI();
|
this.api = player.getAPI();
|
||||||
return player
|
return player
|
||||||
|
|
|
@ -45,6 +45,7 @@ export default class BaseComponent extends Vue {
|
||||||
this.$message.error("视口未加载完成")
|
this.$message.error("视口未加载完成")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.player.api.settings.setInteractiveMode(0)
|
||||||
this.player.api.camera.lookAt(
|
this.player.api.camera.lookAt(
|
||||||
11660869.788125,
|
11660869.788125,
|
||||||
3692656.110371,
|
3692656.110371,
|
||||||
|
@ -114,83 +115,14 @@ export default class BaseComponent extends Vue {
|
||||||
}),(res)=>{
|
}),(res)=>{
|
||||||
console.log(res)
|
console.log(res)
|
||||||
});
|
});
|
||||||
this.player.api.customObject.moveTo(layer.data.map(async(item)=>{
|
|
||||||
const position = (await this.player.utils.getLonLat(item.position))[0]
|
|
||||||
const newPosition = turf.destination(turf.point(position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates
|
|
||||||
const newLocation = (await this.player.utils.getPosition(newPosition))[0];
|
|
||||||
if(!newLocation[2]){
|
|
||||||
newLocation[2] = 0
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
id:item.id,
|
|
||||||
location:newLocation,
|
|
||||||
"smoothTime": 5
|
|
||||||
}
|
|
||||||
}),(data)=>{
|
|
||||||
console.log(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
this.timerList[layer.value] = setInterval(()=>{
|
|
||||||
this.player.api.customObject.moveTo(layer.data.map(async(item)=>{
|
|
||||||
const position = (await this.player.utils.getLonLat(item.position))[0]
|
|
||||||
const newPosition = turf.destination(turf.point(position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates
|
|
||||||
const newLocation = (await this.player.utils.getPosition(newPosition))[0];
|
|
||||||
if(!newLocation[2]){
|
|
||||||
newLocation[2] = 0
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
id:item.id,
|
|
||||||
location:newLocation,
|
|
||||||
"smoothTime": 5
|
|
||||||
}
|
|
||||||
}),(data)=>{
|
|
||||||
console.log(data)
|
|
||||||
})
|
|
||||||
},5000)
|
|
||||||
}else{
|
|
||||||
layer.ids = options.map(item=>item.id);
|
|
||||||
}
|
}
|
||||||
|
layer.ids = options.map(item=>item.id);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
if(layer.selected){
|
if(layer.selected){
|
||||||
this.player.api.marker.show(layer.ids)
|
this.player.api.marker.show(layer.ids)
|
||||||
if(trackCustom){
|
|
||||||
this.player.api.customObject.moveTo(layer.data.map(async(item)=>{
|
|
||||||
const position = (await this.player.utils.getLonLat(item.position))[0]
|
|
||||||
const newPosition = turf.destination(turf.point(position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates
|
|
||||||
const newLocation = (await this.player.utils.getPosition(newPosition))[0];
|
|
||||||
if(!newLocation[2]){
|
|
||||||
newLocation[2] = 0
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
id:item.id,
|
|
||||||
location:newLocation,
|
|
||||||
"smoothTime": 5
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
this.timerList[layer.value] = setInterval(()=>{
|
|
||||||
this.player.api.customObject.moveTo(layer.data.map(async(item)=>{
|
|
||||||
const position = (await this.player.utils.getLonLat(item.position))[0]
|
|
||||||
const newPosition = turf.destination(turf.point(position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates
|
|
||||||
const newLocation = (await this.player.utils.getPosition(newPosition))[0];
|
|
||||||
if(!newLocation[2]){
|
|
||||||
newLocation[2] = 0
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
id:item.id,
|
|
||||||
location:newLocation,
|
|
||||||
"smoothTime": 5
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
},5000)
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
if(trackCustom){
|
|
||||||
clearInterval(this.timerList[layer.value]);
|
|
||||||
this.timerList[layer.value] = null;
|
|
||||||
}
|
|
||||||
this.player.api.marker.hide(layer.ids)
|
this.player.api.marker.hide(layer.ids)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,24 +129,25 @@ export default class OverViewComponent extends BaseComponent {
|
||||||
}
|
}
|
||||||
layer.selected = !layer.selected;
|
layer.selected = !layer.selected;
|
||||||
if(layer.type === "moveMarker"){
|
if(layer.type === "moveMarker"){
|
||||||
this.addCustom(layer,true)
|
this.addMarker(layer,true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//进入自由导览
|
//进入自由导览
|
||||||
showView(){
|
async showView (){
|
||||||
this.toggleAllPanel();
|
this.toggleAllPanel();
|
||||||
this.player.api.camera.lookAt(
|
await this.player.api.camera.lookAt(
|
||||||
11660667.474375,
|
11660670.518125,
|
||||||
3692632.815,
|
3692632.854824,
|
||||||
11.3054,
|
15.530475,
|
||||||
0,
|
0,
|
||||||
-0.822798,
|
9.213877,
|
||||||
88.42289,
|
85.199608,
|
||||||
2,
|
2
|
||||||
()=>{
|
)
|
||||||
this.player.api.settings.setInteractiveMode(1);
|
setTimeout(()=>{
|
||||||
this.player.api.settings.setMainUIVisibility(false)
|
this.player.api.settings.setInteractiveMode(1);
|
||||||
})
|
this.player.api.settings.setMainUIVisibility(false)
|
||||||
|
},2000)
|
||||||
|
|
||||||
//todo 进入自由导览
|
//todo 进入自由导览
|
||||||
}
|
}
|
||||||
|
@ -191,7 +192,6 @@ export default class OverViewComponent extends BaseComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(layers)
|
|
||||||
return layers
|
return layers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue