提交
This commit is contained in:
77
example/飞行漫游Global.html
Normal file
77
example/飞行漫游Global.html
Normal file
@ -0,0 +1,77 @@
|
||||
<!--
|
||||
* @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="setRepeat(Infinity)">循环</button>
|
||||
<button class="button" @Click="setRepeat()">取消循环</button>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: "#app",
|
||||
data: {
|
||||
sdk: null,
|
||||
tileset: null
|
||||
},
|
||||
async mounted() {
|
||||
await YJ.on({ host: "http://localhost:8894" })
|
||||
this.createEarth()
|
||||
await this.addTileset()
|
||||
},
|
||||
methods: {
|
||||
createEarth() {
|
||||
this.sdk = new YJ.YJEarth("app")
|
||||
},
|
||||
async addTileset() {
|
||||
this.tileset = new YJ.Obj.Tileset(this.sdk, {
|
||||
show: true,
|
||||
url: "https://earthsdk.com/v/last/Apps/assets/dayanta/tileset.json",
|
||||
id: "123456",
|
||||
position: { lng: 100, lat: 40, alt: 10 }
|
||||
})
|
||||
this.sdk = this.sdk
|
||||
await this.tileset.on()
|
||||
this.tileset.flyTo()
|
||||
YJ.Global.CameraController(this.sdk, true)
|
||||
},
|
||||
|
||||
open() {
|
||||
// 飞行漫游
|
||||
YJ.Global.FlyRoam.open(this.sdk, {repeat: Infinity})
|
||||
},
|
||||
cease() {
|
||||
YJ.Global.FlyRoam.cease(this.sdk)
|
||||
},
|
||||
|
||||
setRepeat(v) {
|
||||
YJ.Global.FlyRoam.setRepeat(v)
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
Reference in New Issue
Block a user