Files
sdk4_demo/example/分析-地形开挖.html
2025-07-03 15:12:58 +08:00

64 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!-- <script src="../sdk/Cesium/Cesium.js"></script> -->
<script src="../sdk/YJEarth.min.js"></script>
<script src="vue.js"></script>
<style>
body {
width: 100%;
height: 100%;
margin: 0;
}
#app {
width: 100%;
height: 100vh;
}
</style>
</head>
<body>
<div id="app" class="fullSize">
<button class="button" @Click="analysis">分析</button>
<button class="button" @Click="clear">清除</button>
<button class="button" @Click="Measure">测量</button>
</div>
</body>
</html>
<script>
new Vue({
el: "#app",
data: {
},
async mounted() {
await YJ.on()
await this.createEarth()
},
methods: {
async createEarth() {
window.sdk = new YJ.YJEarth("app")
let terrain = await new YJ.Obj.Terrain(this.sdk, {
url: "http://127.0.0.1:8891/yjearth4.0/data/pak/1aa55c41643a44e079c4a6af03fd301c"
})
},
analysis() {
this.excavation = new YJ.Analysis.TerrainExcavation(window.sdk, { height: 10 })
},
clear() {
console.log(YJ.Analysis)
YJ.Analysis.Clear();
},
Measure() {
let Measure = new YJ.Measure.MeasureHeight(window.sdk)
Measure.start()
}
}
})
</script>