leiting-bim 2.1.133 → 2.1.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/leiting-bim.es.js +1 -1
  2. package/leiting-bim.umd.js +10 -10
  3. package/leitingbim.css +1 -1
  4. package/package.json +1 -1
  5. package/plugins/cesium-core/dist/cesium-core.mjs +1505 -1315
  6. package/plugins/cesium-core/dist/cesium-core.mjs.map +1 -1
  7. package/plugins/cesium-core/dist/cesium-core.umd.js +25 -25
  8. package/plugins/cesium-core/dist/cesium-core.umd.js.map +1 -1
  9. package/plugins/cesium-core/dist/components/HtmlOverlayLabelPool.d.ts +36 -0
  10. package/plugins/cesium-core/dist/components/draw/handlers/LineDrawer.d.ts +1 -0
  11. package/plugins/cesium-core/dist/components/draw/handlers/PolygonDrawer.d.ts +1 -0
  12. package/plugins/cesium-core/package.json +1 -1
  13. package/plugins/cesium-vue/dist/HtmlOverlayLabelPool-CbiNlyAM.js +510 -0
  14. package/plugins/cesium-vue/dist/HtmlOverlayLabelPool-CbiNlyAM.js.map +1 -0
  15. package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-bubble/index.d.ts +87 -1
  16. package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-manage/index.d.ts +12 -0
  17. package/plugins/cesium-vue/dist/cesium-vue/src/index.d.ts +3 -2
  18. package/plugins/cesium-vue/dist/components/marker-bubble.js +200 -73
  19. package/plugins/cesium-vue/dist/components/marker-bubble.js.map +1 -1
  20. package/plugins/cesium-vue/dist/components/marker-manage.js +536 -511
  21. package/plugins/cesium-vue/dist/components/marker-manage.js.map +1 -1
  22. package/plugins/cesium-vue/dist/components/measurement.js +1 -1
  23. package/plugins/cesium-vue/dist/index.js +39 -37
  24. package/plugins/cesium-vue/dist/index.js.map +1 -1
  25. package/plugins/cesium-vue/package.json +1 -1
  26. package/plugins/theme-chalk/dist/theme-chalk.css +33 -0
  27. package/plugins/theme-chalk/package.json +1 -1
  28. package/plugins/utils/package.json +1 -1
@@ -52,6 +52,24 @@ export { LabelOptions, LabelInstance, ThemeOptions };
52
52
  * 自定义事件与 DOM 事件的映射
53
53
  */
54
54
  export declare const DOM_EVENT_MAP: Record<MarkerEventKey, keyof HTMLElementEventMap>;
55
+ interface OcclusionOptions {
56
+ enabled: boolean;
57
+ throttleMs: number;
58
+ distanceEpsilon: number;
59
+ }
60
+ type OcclusionCheckReason = 'label-missing' | 'invalid-coordinate' | 'screen-position-undefined' | 'runtime-missing' | 'pick-unsupported' | 'pick-empty' | 'pick-error' | 'distance-compare';
61
+ interface OcclusionCheckLog {
62
+ timestamp: number;
63
+ id: string;
64
+ lon?: number;
65
+ lat?: number;
66
+ height?: number;
67
+ occluded: boolean;
68
+ reason: OcclusionCheckReason;
69
+ epsilon?: number;
70
+ labelDistance?: number;
71
+ pickedDistance?: number;
72
+ }
55
73
  /**
56
74
  * 用于管理 Cesium HTML 标签的池,支持主题渲染、事件分发、动态更新等功能
57
75
  */
@@ -61,8 +79,18 @@ export declare class HtmlOverlayLabelPool {
61
79
  private container;
62
80
  private labels;
63
81
  private activeIds;
82
+ private occludedIds;
64
83
  private _updateFn;
84
+ private _cameraChangedFn;
65
85
  private themes;
86
+ occlusionCheckLogs: OcclusionCheckLog[];
87
+ private occlusionLogEnabled;
88
+ private occlusionLogMax;
89
+ private occlusionOptions;
90
+ private _occlusionTimer;
91
+ private _lastOcclusionAt;
92
+ private _occlusionChecking;
93
+ private _occlusionPending;
66
94
  eventBus: MarkerEventBus;
67
95
  openWheel: boolean;
68
96
  /**
@@ -152,6 +180,14 @@ export declare class HtmlOverlayLabelPool {
152
180
  * 每帧刷新所有活跃标签的位置
153
181
  */
154
182
  private _update;
183
+ private _scheduleOcclusionCheck;
184
+ private _pushOcclusionLog;
185
+ private _computeLabelOccluded;
186
+ runOcclusionCheckNow(): void;
187
+ setOcclusionEnabled(enabled: boolean): void;
188
+ getOcclusionOptions(): OcclusionOptions;
189
+ setOcclusionOptions(options: Partial<Pick<OcclusionOptions, 'throttleMs' | 'distanceEpsilon'>>): void;
190
+ setOcclusionLogEnabled(enabled: boolean, clearExisting?: boolean): void;
155
191
  /**
156
192
  * 销毁标签池,清理监听器和 DOM
157
193
  */
@@ -8,6 +8,7 @@ export default class LineDrawer implements IDrawer {
8
8
  private tooltip;
9
9
  private tempPoints;
10
10
  constructor(Cesium: any, viewer: any);
11
+ private getPickPosition;
11
12
  startDrawing(options: DrawOptions): void;
12
13
  stopDrawing(): void;
13
14
  clear(): void;
@@ -8,6 +8,7 @@ export default class PolygonDrawer implements IDrawer {
8
8
  private tooltip;
9
9
  private tempPoints;
10
10
  constructor(Cesium: any, viewer: any);
11
+ private getPickPosition;
11
12
  startDrawing(options: DrawOptions): void;
12
13
  stopDrawing(): void;
13
14
  clear(): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leiting-bim/plugins-methods",
3
- "version": "0.0.3",
3
+ "version": "1.1.1",
4
4
  "main": "dist/cesium-core.umd.js",
5
5
  "module": "dist/cesium-core.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,510 @@
1
+ var m = /* @__PURE__ */ ((h) => (h.Click = "marker:click", h.DoubleClick = "marker:dblclick", h.RightClick = "marker:rightclick", h.MouseEnter = "marker:mouseenter", h.MouseLeave = "marker:mouseleave", h.MouseDown = "marker:mousedown", h.MouseUp = "marker:mouseup", h))(m || {});
2
+ class _ {
3
+ listenerMap = /* @__PURE__ */ new Map();
4
+ /**
5
+ * 添加监听器
6
+ * @param key 事件 key
7
+ * @param listener 监听器项
8
+ * @param overwrite 是否覆盖同名监听器
9
+ * @returns 是否成功添加
10
+ */
11
+ addListener(e, t, s = !1) {
12
+ let i = this.listenerMap.get(e);
13
+ return i || (i = /* @__PURE__ */ new Map(), this.listenerMap.set(e, i)), i.has(t.name) ? s ? (console.warn(
14
+ `[MarkerEventBus] Overwriting listener "${t.name}" for event "${e}".`
15
+ ), i.set(t.name, t), !0) : (console.warn(
16
+ `[MarkerEventBus] Listener "${t.name}" for event "${e}" already exists. Use overwrite=true to replace it.`
17
+ ), !1) : (i.set(t.name, t), !0);
18
+ }
19
+ /**
20
+ * 移除某个 key 的所有监听器
21
+ */
22
+ removeListenerByKey(e) {
23
+ const t = this.listenerMap.has(e);
24
+ return this.listenerMap.set(e, /* @__PURE__ */ new Map()), t;
25
+ }
26
+ /**
27
+ * 移除某个 key 下的指定名字的监听器
28
+ */
29
+ removeListenerByKeyAndName(e, t) {
30
+ const s = this.listenerMap.get(e);
31
+ return s ? s.delete(t) : !1;
32
+ }
33
+ /**
34
+ * 运行监听器
35
+ */
36
+ runListener(e, t, s) {
37
+ const i = this.listenerMap.get(e);
38
+ if (i)
39
+ for (const [o, l] of i.entries()) {
40
+ try {
41
+ l.fn(t, s);
42
+ } catch (n) {
43
+ console.error(`Error in listener "${o}" for event "${e}":`, n);
44
+ }
45
+ l.once && i.delete(o);
46
+ }
47
+ }
48
+ }
49
+ const O = {
50
+ [m.Click]: "click",
51
+ [m.DoubleClick]: "dblclick",
52
+ [m.RightClick]: "contextmenu",
53
+ [m.MouseEnter]: "mouseenter",
54
+ [m.MouseLeave]: "mouseleave",
55
+ [m.MouseDown]: "mousedown",
56
+ [m.MouseUp]: "mouseup"
57
+ };
58
+ class L {
59
+ viewer;
60
+ Cesium;
61
+ container;
62
+ labels = /* @__PURE__ */ new Map();
63
+ activeIds = /* @__PURE__ */ new Set();
64
+ occludedIds = /* @__PURE__ */ new Set();
65
+ _updateFn;
66
+ _cameraChangedFn;
67
+ themes = {};
68
+ occlusionCheckLogs = [];
69
+ occlusionLogEnabled = !1;
70
+ occlusionLogMax = 1e4;
71
+ occlusionOptions = {
72
+ enabled: !1,
73
+ throttleMs: 120,
74
+ distanceEpsilon: 1
75
+ };
76
+ _occlusionTimer = null;
77
+ _lastOcclusionAt = 0;
78
+ _occlusionChecking = !1;
79
+ _occlusionPending = !1;
80
+ eventBus;
81
+ openWheel = !0;
82
+ /**
83
+ * 构造函数
84
+ * @param Cesium Cesium 命名空间
85
+ * @param viewer Cesium Viewer 实例
86
+ * @param containerId HTML 容器 ID(默认:"html-label-container")
87
+ * @param eventBus 可选:自定义事件总线
88
+ */
89
+ constructor(e, t, s = "html-label-container", i, o = !0) {
90
+ this.Cesium = e, this.viewer = t, this.container = this._createContainer(s), this._updateFn = this._update.bind(this), this.viewer.scene.postRender.addEventListener(this._updateFn), this._cameraChangedFn = this._scheduleOcclusionCheck.bind(this), this.viewer.camera.changed.addEventListener(this._cameraChangedFn), this.eventBus = i || new _(), this.openWheel = o, this.runOcclusionCheckNow();
91
+ }
92
+ /**
93
+ * 创建标签容器
94
+ */
95
+ _createContainer(e) {
96
+ let t = document.getElementById(e);
97
+ return t || (t = document.createElement("div"), t.id = e, Object.assign(t.style, {
98
+ position: "absolute",
99
+ top: "0",
100
+ left: "0",
101
+ pointerEvents: "none",
102
+ width: "100%",
103
+ height: "100%",
104
+ zIndex: "100",
105
+ overflow: "hidden"
106
+ }), document.body.appendChild(t)), t;
107
+ }
108
+ /**
109
+ * 注册标签主题
110
+ */
111
+ registerTheme(e, t) {
112
+ this.themes[e] = t;
113
+ }
114
+ /**
115
+ * 添加单个标签
116
+ */
117
+ add(e, t) {
118
+ const {
119
+ id: s,
120
+ lon: i,
121
+ lat: o,
122
+ height: l = 0,
123
+ theme: n,
124
+ show: a = !0,
125
+ notCreateElement: r = !1,
126
+ style: f
127
+ } = t, u = this.themes[n];
128
+ if (!u) {
129
+ console.warn(`Theme "${n}" not registered`);
130
+ return;
131
+ }
132
+ let c = this.labels.get(s);
133
+ if (c) {
134
+ c.theme = n, c.data = e, c.notCreateElement = r;
135
+ try {
136
+ c.unload = u.createElement(c.el, { id: s, theme: n, data: e }, u), (!r || a) && this.container.appendChild(c.el);
137
+ } catch (d) {
138
+ console.error(`Error updating label element for id "${s}":`, d);
139
+ }
140
+ } else {
141
+ const d = document.createElement("div");
142
+ Object.assign(d.style, {
143
+ position: "absolute",
144
+ transform: "translate(0, 0)",
145
+ pointerEvents: "auto",
146
+ ...t.style || {}
147
+ });
148
+ for (const [C, v] of Object.entries(O)) {
149
+ d.addEventListener(v, (g) => {
150
+ g.stopPropagation();
151
+ const b = this.labels.get(s);
152
+ this.eventBus.runListener(C, b, g);
153
+ });
154
+ let w = 0;
155
+ d.addEventListener("wheel", (g) => {
156
+ if (!this.openWheel) return;
157
+ const b = g.currentTarget;
158
+ w = Date.now();
159
+ const y = w;
160
+ b.style.pointerEvents = "none", setTimeout(() => {
161
+ w === y && (b.style.pointerEvents = "auto");
162
+ }, 2e3);
163
+ });
164
+ }
165
+ let p = null;
166
+ if (!r || a) {
167
+ try {
168
+ p = u.createElement(d, { id: s, theme: n, data: e }, u) || {};
169
+ } catch (C) {
170
+ console.error(`Error updating label element for id "${s}":`, C);
171
+ }
172
+ this.container.appendChild(d);
173
+ }
174
+ c = { id: s, el: d, theme: n, data: e, notCreateElement: r, unload: p }, this.labels.set(s, c);
175
+ }
176
+ c.el.dataset.lon = String(i), c.el.dataset.lat = String(o), c.el.dataset.height = String(l), c.el.style.zIndex = f?.zIndex || "1", c.el.style.display = a ? "block" : "none", a && this.activeIds.add(s), a ? this._scheduleOcclusionCheck() : this.occludedIds.delete(s);
177
+ }
178
+ /**
179
+ * 批量添加标签
180
+ */
181
+ addBatch(e) {
182
+ for (const { data: t, options: s } of e)
183
+ this.add(t, s);
184
+ }
185
+ /**
186
+ * 根据 ID 批量移除标签
187
+ */
188
+ removeByIds(e) {
189
+ for (const t of e) {
190
+ const s = this.labels.get(t);
191
+ s && (this.unloadByLabel(s), this.labels.delete(t), this.activeIds.delete(t), this.occludedIds.delete(t));
192
+ }
193
+ }
194
+ unloadByLabel(e) {
195
+ e.el.remove(), e?.unload && typeof e.unload == "function" && e?.unload(), e.unload = null;
196
+ }
197
+ /**
198
+ * 移除所有标签
199
+ */
200
+ removeAll() {
201
+ for (const e of this.labels.values())
202
+ this.unloadByLabel(e);
203
+ this.labels.clear(), this.activeIds.clear(), this.occludedIds.clear();
204
+ }
205
+ /**
206
+ * 更新标签的数据并刷新内容
207
+ */
208
+ update(e, t) {
209
+ const s = this.labels.get(e);
210
+ if (!s) {
211
+ console.warn(`Label with id "${e}" not found for update.`);
212
+ return;
213
+ }
214
+ const i = this.themes[s.theme];
215
+ if (!i) {
216
+ console.warn(`Theme "${s.theme}" not registered.`);
217
+ return;
218
+ }
219
+ try {
220
+ i.createElement(s.el, { id: e, theme: s.theme, data: t }, i);
221
+ } catch (o) {
222
+ console.error(`Failed to update label "${e}":`, o);
223
+ }
224
+ }
225
+ /**
226
+ * 根据 ID 批量隐藏标签
227
+ */
228
+ hideByIds(e) {
229
+ for (const t of e) {
230
+ const s = this.labels.get(t);
231
+ s && (s.notCreateElement && this.unloadByLabel(s), s.el.style.display = "none", this.activeIds.delete(t), this.occludedIds.delete(t));
232
+ }
233
+ }
234
+ /**
235
+ * 隐藏所有标签
236
+ */
237
+ hideAll() {
238
+ for (const e of this.labels.values())
239
+ e.notCreateElement && this.unloadByLabel(e), e.el.style.display = "none", this.activeIds.delete(e.id), this.occludedIds.delete(e.id);
240
+ }
241
+ /**
242
+ * 条件过滤隐藏标签
243
+ */
244
+ hideFilter(e) {
245
+ for (const t of this.labels.values())
246
+ e(t.data) && (t.notCreateElement && this.unloadByLabel(t), t.el.style.display = "none", this.activeIds.delete(t.id), this.occludedIds.delete(t.id));
247
+ }
248
+ /**
249
+ * 根据 ID 显示标签
250
+ */
251
+ showByIds(e) {
252
+ for (const t of e) {
253
+ const s = this.labels.get(t);
254
+ if (s) {
255
+ if ((s.notCreateElement || !s.el.parentNode) && this.container.appendChild(s.el), !s.unload)
256
+ try {
257
+ const i = this.themes[s.theme];
258
+ if (!i) {
259
+ console.warn(`Theme "${s.theme}" not registered`);
260
+ return;
261
+ }
262
+ s.unload = i.createElement(
263
+ s.el,
264
+ { id: t, theme: s.theme, data: s.data },
265
+ i
266
+ ) || {};
267
+ } catch (i) {
268
+ console.error(`Error creating label element for theme "${s.theme}":`, i);
269
+ return;
270
+ }
271
+ s.el.style.display = "block", this.activeIds.add(t), this.occludedIds.delete(t);
272
+ }
273
+ }
274
+ this._scheduleOcclusionCheck();
275
+ }
276
+ /**
277
+ * 检查标签是否存在
278
+ */
279
+ has(e) {
280
+ return this.labels.has(e);
281
+ }
282
+ /**
283
+ * 清空活跃 ID 列表(不影响 DOM)
284
+ */
285
+ reset() {
286
+ for (const e of this.activeIds.values()) {
287
+ let t = this.labels.get(e);
288
+ t && this.unloadByLabel(t);
289
+ }
290
+ this.activeIds.clear();
291
+ }
292
+ /**
293
+ * 清理当前未活跃的标签(隐藏而不移除 DOM)
294
+ */
295
+ cleanup() {
296
+ for (const [e, t] of this.labels.entries())
297
+ this.activeIds.has(e) || (t.el.style.display = "none", this.occludedIds.delete(e));
298
+ }
299
+ /**
300
+ * 经纬度 -> 自动地形高度修正 -> Cartesian3 -> 屏幕坐标
301
+ */
302
+ async toWindowPositionByLonLat(e, t) {
303
+ const s = this.Cesium, i = this.viewer.scene, o = [s.Cartographic.fromDegrees(e, t)];
304
+ let l;
305
+ try {
306
+ l = await i.clampToHeightMostDetailed(o);
307
+ } catch {
308
+ console.warn("clampToHeightMostDetailed failed, fallback to ellipsoid height.");
309
+ }
310
+ let n = 0;
311
+ l && l[0] && l[0].height != null ? n = l[0].height : n = 0;
312
+ const a = s.Cartesian3.fromDegrees(e, t, n);
313
+ return this.toWindowCoordinates(a);
314
+ }
315
+ /**
316
+ * 坐标转换:经纬度 -> 屏幕像素坐标
317
+ */
318
+ toWindowCoordinates(e) {
319
+ const t = this.viewer.scene, s = this.Cesium.SceneTransforms;
320
+ if (typeof s?.wgs84ToWindowCoordinates == "function")
321
+ return s.wgs84ToWindowCoordinates(t, e);
322
+ if (typeof s?.worldToWindowCoordinates == "function")
323
+ return s.worldToWindowCoordinates(t, e);
324
+ console.warn("No compatible window coordinate transform function found.");
325
+ }
326
+ /**
327
+ * 检查经纬度是否有效
328
+ * @param lon 经度
329
+ * @param lat 纬度
330
+ * @returns 是否有效
331
+ */
332
+ _isValidCoordinate(e, t) {
333
+ return !(Number.isNaN(e) || Number.isNaN(t) || e === 0 && t === 0 || e < -180 || e > 180 || t < -90 || t > 90);
334
+ }
335
+ /**
336
+ * 每帧刷新所有活跃标签的位置
337
+ */
338
+ async _update() {
339
+ for (const e of this.activeIds) {
340
+ const t = this.labels.get(e);
341
+ if (!t) continue;
342
+ const s = parseFloat(t.el.dataset.lon), i = parseFloat(t.el.dataset.lat), o = parseFloat(t.el.dataset.height || "0");
343
+ if (!this._isValidCoordinate(s, i)) {
344
+ t.el.style.display = "none";
345
+ continue;
346
+ }
347
+ const l = this.Cesium.Cartesian3.fromDegrees(s, i, o), n = this.toWindowCoordinates(l);
348
+ if (this.Cesium.defined(n)) {
349
+ const r = this.themes[t.theme].options?.offset || {}, f = r.x || 0, u = r.y || 0, c = this.occludedIds.has(e);
350
+ t.el.style.left = `${n.x}px`, t.el.style.top = `${n.y}px`, t.el.style.transform = `translate(${f}px, ${u}px)`, t.el.style.display = c ? "none" : "block";
351
+ } else
352
+ t.el.style.display = "none";
353
+ }
354
+ }
355
+ _scheduleOcclusionCheck() {
356
+ if (!this.occlusionOptions.enabled) return;
357
+ const e = Date.now(), t = Math.max(0, Number(this.occlusionOptions.throttleMs) || 0), s = e - this._lastOcclusionAt, i = Math.max(0, t - s);
358
+ if (i === 0) {
359
+ this.runOcclusionCheckNow();
360
+ return;
361
+ }
362
+ this._occlusionTimer === null && (this._occlusionTimer = window.setTimeout(() => {
363
+ this._occlusionTimer = null, this.runOcclusionCheckNow();
364
+ }, i));
365
+ }
366
+ _pushOcclusionLog(e) {
367
+ this.occlusionLogEnabled && (this.occlusionCheckLogs.push(e), this.occlusionCheckLogs.length > this.occlusionLogMax && this.occlusionCheckLogs.splice(0, this.occlusionCheckLogs.length - this.occlusionLogMax));
368
+ }
369
+ _computeLabelOccluded(e, t, s, i, o, l) {
370
+ const n = this.viewer?.scene, a = this.viewer?.camera, r = this.Cesium;
371
+ if (!n || !a || !r)
372
+ return this._pushOcclusionLog({
373
+ timestamp: Date.now(),
374
+ id: e,
375
+ lon: i,
376
+ lat: o,
377
+ height: l,
378
+ occluded: !0,
379
+ reason: "runtime-missing"
380
+ }), !0;
381
+ if (!n.pickPositionSupported || !s)
382
+ return this._pushOcclusionLog({
383
+ timestamp: Date.now(),
384
+ id: e,
385
+ lon: i,
386
+ lat: o,
387
+ height: l,
388
+ occluded: !0,
389
+ reason: "pick-unsupported"
390
+ }), !0;
391
+ try {
392
+ const f = n.pickPosition(s);
393
+ if (!f || !a.positionWC)
394
+ return this._pushOcclusionLog({
395
+ timestamp: Date.now(),
396
+ id: e,
397
+ lon: i,
398
+ lat: o,
399
+ height: l,
400
+ occluded: !0,
401
+ reason: "pick-empty"
402
+ }), !0;
403
+ const u = Number(this.occlusionOptions.distanceEpsilon) || 0, c = r.Cartesian3.distance(a.positionWC, t), d = r.Cartesian3.distance(a.positionWC, f), p = d + u < c;
404
+ return this._pushOcclusionLog({
405
+ timestamp: Date.now(),
406
+ id: e,
407
+ lon: i,
408
+ lat: o,
409
+ height: l,
410
+ occluded: p,
411
+ reason: "distance-compare",
412
+ epsilon: u,
413
+ labelDistance: c,
414
+ pickedDistance: d
415
+ }), p;
416
+ } catch {
417
+ return this._pushOcclusionLog({
418
+ timestamp: Date.now(),
419
+ id: e,
420
+ lon: i,
421
+ lat: o,
422
+ height: l,
423
+ occluded: !0,
424
+ reason: "pick-error"
425
+ }), !0;
426
+ }
427
+ }
428
+ runOcclusionCheckNow() {
429
+ if (!this.occlusionOptions.enabled) {
430
+ this.occludedIds.clear();
431
+ return;
432
+ }
433
+ if (this._occlusionChecking) {
434
+ this._occlusionPending = !0;
435
+ return;
436
+ }
437
+ this._occlusionChecking = !0;
438
+ try {
439
+ for (const e of this.activeIds) {
440
+ const t = this.labels.get(e);
441
+ if (!t) {
442
+ this.occludedIds.delete(e), this._pushOcclusionLog({
443
+ timestamp: Date.now(),
444
+ id: e,
445
+ occluded: !1,
446
+ reason: "label-missing"
447
+ });
448
+ continue;
449
+ }
450
+ const s = parseFloat(t.el.dataset.lon), i = parseFloat(t.el.dataset.lat), o = parseFloat(t.el.dataset.height || "0");
451
+ if (!this._isValidCoordinate(s, i)) {
452
+ this.occludedIds.delete(e), this._pushOcclusionLog({
453
+ timestamp: Date.now(),
454
+ id: e,
455
+ lon: s,
456
+ lat: i,
457
+ height: o,
458
+ occluded: !1,
459
+ reason: "invalid-coordinate"
460
+ });
461
+ continue;
462
+ }
463
+ const l = this.Cesium.Cartesian3.fromDegrees(s, i, o), n = this.toWindowCoordinates(l);
464
+ if (!this.Cesium.defined(n)) {
465
+ this.occludedIds.delete(e), this._pushOcclusionLog({
466
+ timestamp: Date.now(),
467
+ id: e,
468
+ lon: s,
469
+ lat: i,
470
+ height: o,
471
+ occluded: !1,
472
+ reason: "screen-position-undefined"
473
+ });
474
+ continue;
475
+ }
476
+ this._computeLabelOccluded(e, l, n, s, i, o) ? this.occludedIds.add(e) : this.occludedIds.delete(e);
477
+ }
478
+ } finally {
479
+ this._lastOcclusionAt = Date.now(), this._occlusionChecking = !1, this._occlusionPending && (this._occlusionPending = !1, this._scheduleOcclusionCheck());
480
+ }
481
+ }
482
+ setOcclusionEnabled(e) {
483
+ this.occlusionOptions.enabled = !!e, this.occlusionOptions.enabled ? this.runOcclusionCheckNow() : (this.occludedIds.clear(), this._occlusionTimer !== null && (clearTimeout(this._occlusionTimer), this._occlusionTimer = null));
484
+ }
485
+ getOcclusionOptions() {
486
+ return {
487
+ enabled: this.occlusionOptions.enabled,
488
+ throttleMs: this.occlusionOptions.throttleMs,
489
+ distanceEpsilon: this.occlusionOptions.distanceEpsilon
490
+ };
491
+ }
492
+ setOcclusionOptions(e) {
493
+ e.throttleMs != null && (this.occlusionOptions.throttleMs = Math.max(0, Number(e.throttleMs) || 0)), e.distanceEpsilon != null && (this.occlusionOptions.distanceEpsilon = Math.max(0, Number(e.distanceEpsilon) || 0)), this.occlusionOptions.enabled && this._scheduleOcclusionCheck();
494
+ }
495
+ setOcclusionLogEnabled(e, t = !1) {
496
+ this.occlusionLogEnabled = !!e, t && (this.occlusionCheckLogs = []);
497
+ }
498
+ /**
499
+ * 销毁标签池,清理监听器和 DOM
500
+ */
501
+ destroy() {
502
+ this.viewer.scene.postRender.removeEventListener(this._updateFn), this.viewer.camera.changed.removeEventListener(this._cameraChangedFn), this._occlusionTimer !== null && (clearTimeout(this._occlusionTimer), this._occlusionTimer = null), this.labels.clear(), this.activeIds.clear(), this.occludedIds.clear();
503
+ }
504
+ }
505
+ export {
506
+ L as H,
507
+ m as M,
508
+ _ as a
509
+ };
510
+ //# sourceMappingURL=HtmlOverlayLabelPool-CbiNlyAM.js.map