提交
This commit is contained in:
103
example/shp.html
Normal file
103
example/shp.html
Normal file
@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>shp</title>
|
||||
<!-- <script src="https://cdn.bootcdn.net/ajax/libs/pako/2.0.4/pako.es5.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.7.2/base64.min.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: {
|
||||
async createEarth() {
|
||||
// "disaster_type": "雪灾灾害",
|
||||
// "fxdj": "fxdj",
|
||||
// {
|
||||
// "ID": 11,
|
||||
// "CreatedAt": "2024-07-29T11:33:10.370265196+08:00",
|
||||
// "UpdatedAt": "2024-07-29T11:33:10.370265196+08:00",
|
||||
// "DeletedAt": null,
|
||||
// "p_id": 9,
|
||||
// "sourceId": "3ce46e0ea8826ad05e400afe418becd6",
|
||||
// "name": "雪灾人口风险评估图",
|
||||
// "type": "vector",
|
||||
// "path": "resource/data/数据2/气象/雪灾/雪灾灾害人口风险评估图(市级成果)_370100_20230217_01.shp",
|
||||
// "disaster_type": "雪灾灾害",
|
||||
// "fxdj": "fxdj",
|
||||
// "children": []
|
||||
// }
|
||||
this.sdk = new YJ.YJEarth("app")
|
||||
YJ.Global.MouseRightMenu(this.sdk, true, (key, object) => {
|
||||
console.log(key, object)
|
||||
switch (key) {
|
||||
case 'rotateAround':
|
||||
YJ.Global.rotateAround(this.sdk, object.position)
|
||||
break
|
||||
case '属性':
|
||||
break
|
||||
}
|
||||
})
|
||||
window.sdk = this.sdk
|
||||
YJ.Global.CesiumContainer(this.sdk, {
|
||||
compass: true, // 罗盘
|
||||
legend: true, // 比例尺
|
||||
info: true, // 信息栏
|
||||
frame: true // 刷新率
|
||||
})
|
||||
// let terrain = await new YJ.Obj.Terrain(this.sdk, {
|
||||
// url: "http://127.0.0.1:8891/yjearth4.0/data/pak/1aa55c41643a44e079c4a6af03fd301c"
|
||||
// })
|
||||
let openLeftClick = await new YJ.Global.openLeftClick(this.sdk)
|
||||
let openRightClick = await new YJ.Global.openRightClick(this.sdk)
|
||||
let layer = new YJ.Obj.ArcgisWXImagery(this.sdk, {
|
||||
id: 123,
|
||||
show: true,
|
||||
layer_index: 1
|
||||
})
|
||||
let shp = await new YJ.Obj.Vector(this.sdk, {
|
||||
id: '1111111',
|
||||
host: 'http://127.0.0.1:8891',
|
||||
path: 'D:\\我的资源\\平安区.kml',
|
||||
field: 'id',
|
||||
// opacity: 0.2,
|
||||
// color: '#00c8ff'
|
||||
})
|
||||
await shp.on()
|
||||
window.shp = shp
|
||||
shp.load(() => {
|
||||
shp.onClick = (a, b, c) => {
|
||||
console.log(a, b, c)
|
||||
}
|
||||
shp.onRightClick = (a, b, c) => {
|
||||
console.log(a, b, c)
|
||||
}
|
||||
console.log(11111)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
Reference in New Issue
Block a user