guonan
2025-06-10 f0a0f01ca70e852caf0300fd47d1840799c4d65d
src/utils/map.js
@@ -58,15 +58,15 @@
}
let entities = [];
// 假设你有一个全局存储 entities 的结构(建议用 Map 提高性能查找)
const pointEntityMap = new Map(); // key: id, value: entity
export function createPoint(option) {
  const { id, type = "", name = "默认名称", view, latitude, longitude, height, callback, imgWidth = 56, imgHeight = 67, showBillboard = true, showLabel = true, className = "device" } = option;
  // 如果已经存在该 id 的 entity,则跳过创建
  if (pointEntityMap.has(id)) {
    clearAllPoints()
    console.log(`点 ${id} 已存在,跳过创建`);
    return;
    // return;
  }
  let position = Cesium.Cartesian3.fromDegrees(longitude, latitude, height || 50);