77 lines
2.0 KiB
HTML
77 lines
2.0 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: {
|
|
},
|
|
async mounted() {
|
|
await YJ.on({ host: 'http://localhost:8890' })
|
|
this.createEarth()
|
|
},
|
|
methods: {
|
|
async createEarth() {
|
|
this.sdk = await new YJ.YJEarth("app")
|
|
window.sdk = this.sdk
|
|
// sdk.tabHide = ['属性信息']
|
|
|
|
YJ.Global.CesiumContainer(sdk, {
|
|
// compass: true, // 罗盘
|
|
// legend: true, // 比例尺
|
|
info: true, // 信息栏
|
|
frame: true // 刷新率
|
|
})
|
|
|
|
let openLeftClick = await new YJ.Global.openLeftClick(this.sdk)
|
|
let openRightClick = await new YJ.Global.openRightClick(this.sdk)
|
|
YJ.Global.MouseRightMenu(this.sdk, true, (text, object) => {
|
|
console.log(text, object)
|
|
switch (text) {
|
|
case '绕中心点旋转':
|
|
YJ.Global.rotateAround(this.sdk, object.position)
|
|
break
|
|
case '属性':
|
|
break
|
|
}
|
|
})
|
|
let Draw = new YJ.Draw.DrawPolygon(this.sdk)
|
|
Draw.start((a, positions) => {
|
|
let PolygonObject = new YJ.Obj.PolygonObject(this.sdk, { id: 1111, positions: positions })
|
|
PolygonObject.name = '啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊\n啊啊'
|
|
PolygonObject.edit(true)
|
|
this.PolygonObject = PolygonObject
|
|
window.PolygonObject = PolygonObject
|
|
PolygonObject.flyTo()
|
|
PolygonObject.onClick = (a, b, c) => {
|
|
console.log(a, b, c)
|
|
// PolygonObject.edit(true)
|
|
}
|
|
PolygonObject.onRightClick = (a, b, c) => {
|
|
console.log(a, b, c)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
</script> |