85 lines
2.5 KiB
HTML
85 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
<!-- <script src="https://cesium.com/downloads/cesiumjs/releases/1.117/Build/Cesium/Cesium.js"></script> -->
|
|
<script src="./js/pbf.js"></script>
|
|
<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()
|
|
this.createEarth()
|
|
},
|
|
methods: {
|
|
createEarth() {
|
|
|
|
window.sdk = new YJ.YJEarth("app")
|
|
|
|
|
|
window.tile = new VectorTile("https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/13/3389/6521.pbf")
|
|
tile.on().then(r => {
|
|
console.log(tile.features())
|
|
let features = tile.features()
|
|
console.log('features', features)
|
|
for (let i = 0; i < features.length; i++) {
|
|
const geoJsonDataSource = new Cesium.GeoJsonDataSource();
|
|
let promise = geoJsonDataSource.load(features[i], {
|
|
clampToGround: true,
|
|
});
|
|
promise.then(datasource => {
|
|
datasource.entities.values.forEach(enetity => {
|
|
sdk.viewer.entities.add(enetity)
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
// YJ.Global.setDefaultView(sdk, {
|
|
// destination: { lng: 100, lat: 30, alt: 10000000 },
|
|
// orientation: {
|
|
// heading: 0.0,
|
|
// pitch: -90.0,
|
|
// roll: 0.0
|
|
// }
|
|
// })
|
|
// new YJ.Tools(sdk).flyHome(0)
|
|
// let layer = new YJ.Obj.GeoJson(sdk, {
|
|
// id: 'e0223369eff70b38d19061e228c1fadf',
|
|
// show: true,
|
|
// url: `/example/json/重庆市.geoJson`
|
|
// })
|
|
// layer.on()
|
|
// setTimeout(() => {
|
|
// layer.flyTo()
|
|
// }, 2000);
|
|
// layer.flyTo()
|
|
}
|
|
}
|
|
})
|
|
</script> |