From b90e5e6c38193a953fff12d55e6714080df5ca55 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Tue, 08 Apr 2025 08:36:23 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/drone/command-center-dashboard
---
src/views/Home/useMapAggregation/useMapAggregation.js | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/views/Home/useMapAggregation/useMapAggregation.js b/src/views/Home/useMapAggregation/useMapAggregation.js
index c3f6248..7d0da18 100644
--- a/src/views/Home/useMapAggregation/useMapAggregation.js
+++ b/src/views/Home/useMapAggregation/useMapAggregation.js
@@ -160,8 +160,6 @@
const splashedList = type === 'device'
? await getDeviceList(areaCode)
: eventList.map(i=>({eventId:i.id,latitude:Number(i.latitude),longitude:Number(i.longitude),type:'event'}))
- console.log(list, 'list');
- console.log(splashedList, 'splashedList');
const hierarchy = convertToHierarchy(areaCode.slice(0, 6));
const jsonPath = hierarchy.join('/');
const jsonPathPre = hierarchy.slice(0, hierarchy.length - 1).join('/');
@@ -217,8 +215,9 @@
//散点机巢
function splashed(row) {
- row.splashedList.forEach(item => {
+ row.splashedList.forEach((item,index) => {
viewer.entities.add({
+ id: `aggregation-splashed-${index}`,
position: Cesium.Cartesian3.fromDegrees(item.longitude, item.latitude),
label: {
// 随机整数
@@ -285,11 +284,12 @@
}
});
// 遍历特征并添加实体
- featuresList.forEach(feature => {
+ featuresList.forEach((feature,index) => {
if (!feature.position) return;
const position = Cesium.Cartesian3.fromDegrees(feature.position[0], feature.position[1]);
viewer.entities.add({
position: position,
+ id: `aggregation-name-${index}`,
label: {
text: feature.name,
font: '14pt Source Han Sans CN',
@@ -302,12 +302,13 @@
},
});
viewer.entities.add({
- id: feature.id,
+ id: `aggregation-count-${index}`,
position: position,
label: {
- text: feature.data.total_device_count.toString(),
+ text: (feature.data.total_device_count || 0).toString(),
font: '12pt Source Han Sans CN',
fillColor: Cesium.Color.BLACK,
+ outlineColor: Cesium.Color.BLACK,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
eyeOffset: new Cesium.Cartesian3(0, 0, -10), // 让label "浮" 在广告牌前面
},
@@ -416,7 +417,11 @@
// 移除 点 和 gjson 实体
const removeEntities = () => {
viewer.dataSources?.removeAll(true);
- viewer.entities?.removeAll();
+ // viewer.entities?.removeAll();
+ const entitiesIDs = viewer.entities.values.map(i=>i.id)
+ entitiesIDs.forEach(item => {
+ item.includes('aggregation-') && viewer.entities.removeById(item)
+ })
};
// 移除弹框标签
const removeLabel = () => {
@@ -426,6 +431,7 @@
// 移除所有监听事件,变量置空
const removeAll = () => {
+ if (!viewer) return
removeEntities();
removeLabel();
// viewer.camera.moveEnd.removeEventListener(determineScaling);
--
Gitblit v1.9.3