90 lines
2.5 KiB
HTML
90 lines
2.5 KiB
HTML
<!--
|
||
* @name:
|
||
* @author: zh
|
||
* @date: Do not edit
|
||
* @update: Do not edit
|
||
* @description:
|
||
-->
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>飞行漫游</title>
|
||
<script src="../sdk/YJEarth.min.js"></script>
|
||
<script src="vue.js"></script>
|
||
<style>
|
||
body {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<div id="app" class="fullSize">
|
||
<button class="button" @Click="open">飞行漫游</button>
|
||
<button class="button" @Click="cease">停止</button>
|
||
<button class="button" @Click="edit">修改</button>
|
||
<button class="button" @Click="setRepeat(Infinity)">循环</button>
|
||
<button class="button" @Click="setRepeat()">取消循环</button>
|
||
</div>
|
||
</body>
|
||
|
||
</html>
|
||
|
||
<script>
|
||
new Vue({
|
||
el: "#app",
|
||
data: {
|
||
},
|
||
async mounted() {
|
||
await YJ.on({ host: "http://localhost:8894" })
|
||
this.createEarth()
|
||
await this.addTileset()
|
||
},
|
||
methods: {
|
||
createEarth() {
|
||
this.sdk = new YJ.YJEarth("app")
|
||
},
|
||
async addTileset() {
|
||
},
|
||
|
||
open() {
|
||
// 飞行漫游
|
||
let options = {
|
||
id: '123456',
|
||
points: [
|
||
{
|
||
duration: 0, // 时长
|
||
orientation: {heading: 6.283185307179586, pitch: -1.5707963267948966, roll: 0}, // 方向
|
||
position: {lng: 99.95, lat: 35.85036104783509, alt: 9128642.615825752} // 位置
|
||
}
|
||
], // 视点数组
|
||
repeat: 0 // 循环次数,0为不循环,Infinity为无限循环
|
||
}
|
||
this.FlyRoam = YJ.Global.FlyRoam.open(this.sdk, options, {
|
||
clickSavePath: (e)=>{
|
||
console.log(JSON.stringify(e))
|
||
},
|
||
changeRepeatStateCallBack: (v)=>{
|
||
console.log(v)
|
||
}
|
||
})
|
||
|
||
this.FlyRoam.edit(true)
|
||
},
|
||
edit() {
|
||
this.FlyRoam.edit(true) // 编辑
|
||
},
|
||
cease() {
|
||
this.FlyRoam.cease() // 停止
|
||
// this.FlyRoam.remove() // 删除
|
||
},
|
||
|
||
setRepeat(v) {
|
||
this.FlyRoam.repeat = v // 循环次数,0为不循环,Infinity为无限循环
|
||
}
|
||
}
|
||
})
|
||
</script> |