From 81f54040c2cb65537c6c6e1db8358a39a57dea0d Mon Sep 17 00:00:00 2001
From: mayisheng <admin>
Date: Mon, 15 Aug 2022 16:14:01 +0800
Subject: [PATCH] 1
---
src/store/modules/popupParams.js | 91 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 76 insertions(+), 15 deletions(-)
diff --git a/src/store/modules/popupParams.js b/src/store/modules/popupParams.js
index 7e8a95a..3789451 100644
--- a/src/store/modules/popupParams.js
+++ b/src/store/modules/popupParams.js
@@ -153,7 +153,7 @@
// item: item,
// });
// });
- new global.DC.DivForms(state.viewer, {
+ var box = new global.DC.DivForms(state.viewer, {
domId: 'divFormsDomBox',
position: [
global.DC.Transform.transformWGS84ToCartesian(
@@ -269,6 +269,10 @@
)
// 订阅事件
window.divIcononces.on(global.DC.MouseEventType.CLICK, (e) => {
+ if (state.pinchFlag == true) {
+ return
+ }
+
// console.log(e);
// return;
// 定制化窗体
@@ -318,7 +322,7 @@
}, val) {
const list = val.list
if (!window.labelLayer) {
- window.labelLayer = new global.DC.HtmlLayer('labelLayer')
+ window.labelLayer = new global.DC.VectorLayer('labelLayer')
global.viewer.addLayer(window.labelLayer)
// state.myviewer = val.mviewer
}
@@ -331,25 +335,36 @@
return
}
for (const i in list) {
- window.divIcon = new global.DC.DivIcon(
+ const billboard = new global.DC.Billboard(
+ new global.DC.Position(
+ Number(list[i].jd),
+ Number(list[i].wd),
+ 0
+ ), 'https://map.hit.edu.cn/images/tarrow_xq.png')
+
+ const label = new global.DC.Label(
new global.DC.Position(
Number(list[i].jd),
Number(list[i].wd),
0
),
- `
- <div class="tag-entitys-box">
- <div class="tag-content">
- ${list[i].name}
- </div>
- <div class="tag-angle-content">
- <img src="https://map.hit.edu.cn/images/tarrow_xq.png">
- </div>
- </div>
- `
+ list[i].name
)
+
+ label.setStyle({
+ fillColor: global.DC.Color.RED,
+ style: global.DC.Namespace.Cesium.LabelStyle.FILL_AND_OUTLINE,
+ outlineColor: global.DC.Color.WHITE, // 边框颜色
+ outlineWidth: 8, // 边框大小,
+ font: '12px sans-serif',
+ pixelOffset: { x: 0, y: -24 }
+ })
+
// 订阅事件
- window.divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+ billboard.on(global.DC.MouseEventType.CLICK, (e) => {
+ if (state.pinchFlag == true) {
+ return
+ }
// console.log(e);
// return;
// 定制化窗体
@@ -389,7 +404,53 @@
data: list[i]
})
})
- window.labelLayer.addOverlay(window.divIcon)
+
+ label.on(global.DC.MouseEventType.CLICK, (e) => {
+ if (state.pinchFlag == true) {
+ return
+ }
+ // console.log(e);
+ // return;
+ // 定制化窗体
+ // const position = e.position
+ const lntLat = [e.overlay._position._lng, e.overlay._position._lat]
+ // console.log(position, lntLat, list[i], state.myviewer, "see")
+ var box = new global.DC.DivForms(global.viewer, {
+ domId: 'labelLayerid',
+ position: [
+ global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(
+ Number(lntLat[0]),
+ Number(lntLat[1]),
+ Number(0)
+ )
+ )
+ ]
+ })
+ global.viewer.camera.setView({
+ // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ lntLat[0],
+ lntLat[1],
+ 950.0
+ ),
+ orientation: {
+ // 指向
+ heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0
+ }
+ })
+ commit('openLabelLayer', {
+ show: true,
+ data: list[i]
+ })
+ })
+
+ window.labelLayer.addOverlay(billboard) // 加入图标
+ window.labelLayer.addOverlay(label)
}
}
}
--
Gitblit v1.9.3