Files
sdk4_demo/example/添加椭圆.html

71 lines
1.6 KiB
HTML
Raw Permalink Normal View History

2025-07-03 15:12:58 +08:00
<!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: {
PolylineObject: null,
PolygonObject: null
},
async mounted() {
await YJ.on()
this.createEarth()
},
methods: {
async createEarth() {
this.sdk = new YJ.YJEarth("app")
window.sdk = this.sdk
YJ.Global.flyTo(this.sdk, {
position: {
lng: 110,
lat: 25,
alt: 100
}
})
let layer = new YJ.Obj.ArcgisWXImagery(this.sdk, {
id: 123,
show: true,
layer_index: 1
})
let Draw = new YJ.Draw.DrawElliptic(sdk)
Draw.start((a, options) => {
options.center.alt = options.center.alt
console.log('options', options)
let EllipseObject = new YJ.Obj.EllipseObject(sdk, {
center: options.center, //中心坐标
bearing: options.bearing, //旋转角度
semiMinorAxis: options.semiMinorAxis, // 短轴长度
semiMajorAxis: options.semiMajorAxis, // 长轴长度
heightMode: 2, // 高度模式 0海拔高度1相对地表2依附模式
})
EllipseObject.edit(true)
window.EllipseObject = EllipseObject
})
}
}
})
</script>