Files
sdk4_demo/example/添加曲线.html
2025-07-03 15:12:58 +08:00

64 lines
1.5 KiB
HTML

<!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">
</div>
</body>
</html>
<script>
new Vue({
el: "#app",
data: {
sdk: null,
PolylineObject: null
},
async mounted() {
await YJ.on({
host: 'http://127.0.0.1:8888'
})
this.createEarth()
},
methods: {
async createEarth() {
this.sdk = new YJ.YJEarth("app")
window.tileset2 = new YJ.Obj.Tileset(this.sdk, {
show: true,
url: "http://localhost:8891/yjearth4.0/data/tileset/24b9be7e2cdfa679b3a77c6c51b47bdc/tileset.json",
id: "123456",
// position: { lng: 100, lat: 40, alt: 10 }
})
tileset2.on().then((res) => {
console.log(res)
tileset2.flyTo()
}).catch(msg => {
console.log(msg)
})
let Draw = new YJ.Draw.DrawPolyline(this.sdk, { curve: true })
Draw.start((a, positions) => {
console.log(positions)
let CurvelineObject = new YJ.Obj.CurvelineObject(this.sdk, { name: 'aswdwfd\nasefasefasef',positions: positions, heightMode: 2 })
CurvelineObject.edit(true)
CurvelineObject.flyTo()
window.CurvelineObject = CurvelineObject
})
// this.PolylineObject.edit(true)
}
}
})
</script>