99 lines
3.1 KiB
HTML
99 lines
3.1 KiB
HTML
<!--
|
|
* @name:
|
|
* @author: zh
|
|
* @date: Do not edit
|
|
* @update: Do not edit
|
|
* @description:
|
|
-->
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>加载tileset</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 type="module">
|
|
import { LCCRender } from './js/lcc-0.4.0.js'
|
|
new Vue({
|
|
el: "#app",
|
|
data: {
|
|
// sdk: null,
|
|
},
|
|
async mounted() {
|
|
await YJ.on()
|
|
// YJ.Global.setCesiumIndexedDBMaxSize(1024*1024*1024) // 设置存储大小
|
|
// // YJ.Global.getCesiumIndexedDBMaxSize() // 获取存储大小
|
|
// YJ.Global.setCesiumManageIndexexDBState(true) // 设置存储状态(开启/关闭)
|
|
// // YJ.Global.getCesiumManageIndexexDBState() // 获取存储状态
|
|
// await YJ.Global.getCesiumIndexedDBCurrentSize() // 获取当前已存储大小
|
|
this.createEarth()
|
|
await this.addTileset()
|
|
},
|
|
methods: {
|
|
createEarth() {
|
|
window.sdk = new YJ.YJEarth("app")
|
|
return
|
|
|
|
let viewer = window.sdk.viewer
|
|
|
|
//设置相机飞向指定位置
|
|
viewer.scene.camera.flyTo({
|
|
destination: new Cesium.Cartesian3(-2402935.756416574, 5381763.382104505, 2429866.1827734606),
|
|
orientation: {
|
|
up: new Cesium.Cartesian3(-0.2689305478318041, 0.8007469133573548, 0.5352389570944504),
|
|
direction: new Cesium.Cartesian3(0.5919220429524843, -0.30097776828562117, 0.7476902286808116),
|
|
}
|
|
});
|
|
},
|
|
async addTileset() {
|
|
YJ.Global.CesiumContainer(sdk, {
|
|
frame: true, // 刷新率
|
|
info: true,
|
|
})
|
|
let terrain = await new YJ.Obj.Terrain(sdk, {
|
|
url: "http://localhost:8891/yjearth4.0/data/pak/1aa55c41643a44e079c4a6af03fd301c"
|
|
})
|
|
let openLeftClick = await new YJ.Global.openLeftClick(sdk, (e) => {
|
|
console.log(e)
|
|
})
|
|
|
|
window.tileset = new YJ.Obj.Tileset(window.sdk, {
|
|
show: true,
|
|
url: "http://localhost:8891/yjearth4.0/data/tileset/6dee5cc84e66a61231e3a0048fd6c25a/tileset.json",
|
|
id: "123456",
|
|
// transparency: 0.2
|
|
// position: { lng: 100, lat: 40, alt: 800 }
|
|
})
|
|
this.sdk = window.sdk
|
|
tileset.on().then((res) => {
|
|
tileset.flyTo()
|
|
tileset.Dialog.confirmCallBack = (v) => {
|
|
console.log(v)
|
|
}
|
|
tileset.edit(true)
|
|
}).catch(msg => {
|
|
console.log(msg)
|
|
})
|
|
|
|
},
|
|
}
|
|
})
|
|
</script> |