<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="http://bigemap.com/offline_data/newjunbiao/vue.js"></script>
<link
href="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/Widgets/widgets.css"
rel="stylesheet"
/>
<script src="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/bigemap-gl.js"></script>
<!-- elementui -->
<script src="http://bigemap.com/offline_data/newjunbiao/elementui.js"></script>
<link
rel="stylesheet"
href="http://bigemap.com/offline_data/newjunbiao/elementui.css"
/>
<title>加載billboard</title>
<style>
* {
margin: 0;
padding: 0;
}
html,
body {
width: 100%;
height: 100%;
}
#app {
width: 100%;
height: 100%;
}
#baseMap {
width: 100%;
height: 100%;
}
.tools {
position: absolute;
z-index: 9;
top: 40px;
right: 60px;
width: 200px;
height: 40px;
display: flex;
align-items: center;
}
</style>
</head>
<body>
<div id="app">
<div id="baseMap"></div>
</div>
<script>
let viewer = null;
window.onload = () => {
new Vue({
el: "#app",
data() {
return {};
},
mounted() {
this.initMap();
},
methods: {
//初始化地圖
initMap() {
bmgl.Config.HTTP_URL =
"http://ua.bigemap.com:30081/bmsdk/";
viewer = new bmgl.Viewer("baseMap", {
mapId: "bigemap.dc-tian-w-satellite",
infoBox: false,
selectionIndicator: false,
requestRenderMode: false,
// terrainId指定離線服務器上發布的高程服務的id
terrainId: "bigemap.dc-terrain",
});
this.loadBillboard();
},
// 添加廣告牌billboard
loadBillboard() {
viewer.entities.add({
//設置billboard的位置
position: bmgl.Cartesian3.fromDegrees(
102.95768738,
31.16639713,
6000
),
billboard: {
image: "/offline_data/food.png",
//設置固定寬高大小
width: 32,
height: 32,
// 設置圖標貼地
heightReference: bmgl.HeightReference.CLAMP_TO_GROUND,
},
});
viewer.entities.add({
position: bmgl.Cartesian3.fromDegrees(
103.04489136,
31.16052154,
6000
),
billboard: {
image: "/offline_data/point.png",
//設置廣告牌安裝圖片比例縮放大小
scale: 2,
},
});
viewer.flyTo(viewer.entities);
},
},
beforeDestroy() {
viewer.destroy();
viewer = null;
},
});
};
</script>
</body>
</html>