提交
This commit is contained in:
73
example/路径规划.html
Normal file
73
example/路径规划.html
Normal file
@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>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="planning">路径规划</button>
|
||||
<button class="button" @Click="ClearAllRoutePlanning">清除全部路径规划</button>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: "#app",
|
||||
data: {
|
||||
sdk: null,
|
||||
i: 0
|
||||
},
|
||||
async mounted() {
|
||||
await YJ.on({
|
||||
ws: true,
|
||||
host: '127.0.0.1:8888',
|
||||
})
|
||||
this.createEarth()
|
||||
},
|
||||
methods: {
|
||||
async createEarth() {
|
||||
this.sdk = await new YJ.YJEarth("app")
|
||||
let tileset = await new YJ.Obj.Tileset(this.sdk, {
|
||||
show: true,
|
||||
url: "http://localhost:8891/yjearth4.0/data/tileset/bc3c8f4f3196896b8d7376fe951ce46b/tileset.json",
|
||||
id: "123456",
|
||||
// position: { lng: 106, lat: 30.03883, alt: 10 },
|
||||
})
|
||||
await tileset.on()
|
||||
tileset.flyTo()
|
||||
},
|
||||
|
||||
planning() {
|
||||
this.i++
|
||||
let routePlanning = new YJ.Obj.RoutePlanning(this.sdk, {gps: true})
|
||||
routePlanning.Dialog.queryCallBack = () => {
|
||||
routePlanning.createRoute(
|
||||
[
|
||||
{ lng: 100 + this.i, lat: 30 + this.i },
|
||||
{ lng: 101 + this.i, lat: 30 + this.i },
|
||||
{ lng: 102 + this.i, lat: 30 + this.i },
|
||||
{ lng: 103 + this.i, lat: 31 + this.i },
|
||||
{ lng: 104 + this.i, lat: 32 + this.i },
|
||||
]
|
||||
)
|
||||
}
|
||||
},
|
||||
ClearAllRoutePlanning() {
|
||||
YJ.ClearAllRoutePlanning()
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
Reference in New Issue
Block a user