leiting-bim 2.2.45 → 2.2.48

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.
@@ -0,0 +1,1462 @@
1
+ import { p as ht, c as Me, w as oe } from "./create-DynflqE1.js";
2
+ import { defineComponent as le, computed as m, openBlock as E, createElementBlock as H, normalizeStyle as $, normalizeClass as w, unref as M, toDisplayString as mt, createCommentVNode as Q, createElementVNode as Te, h as P, markRaw as O, render as K, inject as dt, onMounted as we, watch as Y, onUnmounted as yt, renderSlot as pt, ref as G, nextTick as bt, onBeforeUnmount as vt, createBlock as xt, resolveDynamicComponent as Ct } from "vue";
3
+ import { MaterialManager as Le, MarkerEventBus as ee, HtmlOverlayLabelPool as de, BufferedHierarchicalAggregator as Mt, EntityLayerManager as Tt, getPolylineFlowMaterialProperty as wt, getDynamicImgMaterial as Lt, getWallMaterial as Se, MarkerEventKey as J } from "leiting-bim/plugins-methods";
4
+ import { CxCardCarousel as ye } from "./components/card-carousel.js";
5
+ import { CxMarkerBubbleLine as Pe, CxMarkerBubble as Oe } from "./components/marker-bubble.js";
6
+ import { CxMarkerDefault as te } from "./components/marker-default.js";
7
+ import { CxMarkerHtml as St } from "./components/marker-html.js";
8
+ import { CxMarkerText as Ee } from "./components/marker-text.js";
9
+ import { i as se, b as Ie, a as L, S as z, d as pe, c as ce, e as _e, f as Pt, g as Ae, M as Ne, h as re, j as Ot, k as Et, l as It, m as ke, n as He, o as _t, p as At, q as Nt, r as kt, s as Ht, t as De, u as Dt, v as Ft, w as Wt, x as Rt } from "./index-2sxRAf1D.js";
10
+ const Bt = {
11
+ text: { type: String, default: "" },
12
+ svg: { type: Object, default: () => ({}) },
13
+ textStyle: { type: Object, default: () => ({}) },
14
+ textPosition: { type: String, default: "top" },
15
+ textGap: { type: Number, default: 8 }
16
+ }, Gt = /* @__PURE__ */ le({
17
+ name: `${ht}-marker-svg`,
18
+ __name: "MarkerSvg",
19
+ props: Bt,
20
+ setup(t) {
21
+ const e = t, r = Me("marker"), a = (u, y, b, p) => {
22
+ const T = Number(u);
23
+ return Number.isFinite(T) ? Math.min(p, Math.max(b, T)) : y;
24
+ }, n = m(() => a(e.svg.height, 48, 16, 160)), o = m(() => a(e.svg.width, n.value, 1, 320)), i = m(() => a(e.textGap, 8, 0, 80)), s = m(
25
+ () => ["top", "bottom", "left", "right"].includes(e.textPosition) ? e.textPosition : "top"
26
+ ), c = m(() => ({
27
+ width: `${o.value}px`,
28
+ height: `${n.value}px`
29
+ })), f = m(() => ({
30
+ width: `${o.value}px`,
31
+ height: `${n.value}px`,
32
+ backgroundColor: e.svg.fill || "#1890ff",
33
+ opacity: a(e.svg.opacity, 1, 0, 1),
34
+ WebkitMaskImage: e.svg.src ? `url("${e.svg.src}")` : "none",
35
+ maskImage: e.svg.src ? `url("${e.svg.src}")` : "none"
36
+ })), l = m(() => ({
37
+ position: "absolute",
38
+ width: "max-content",
39
+ maxWidth: "none",
40
+ margin: "0",
41
+ padding: "0",
42
+ lineHeight: "1.2",
43
+ whiteSpace: "pre",
44
+ textAlign: "center",
45
+ fontFamily: 'Arial, "Microsoft YaHei", sans-serif',
46
+ ...{
47
+ top: { left: "50%", bottom: `calc(100% + ${i.value}px)`, transform: "translateX(-50%)" },
48
+ bottom: { left: "50%", top: `calc(100% + ${i.value}px)`, transform: "translateX(-50%)" },
49
+ left: { right: `calc(100% + ${i.value}px)`, top: "50%", transform: "translateY(-50%)" },
50
+ right: { left: `calc(100% + ${i.value}px)`, top: "50%", transform: "translateY(-50%)" }
51
+ }[s.value],
52
+ ...e.textStyle
53
+ }));
54
+ return (u, y) => (E(), H("div", {
55
+ class: w(M(r).b("svg")),
56
+ style: $(c.value)
57
+ }, [
58
+ u.text && u.textStyle.display !== "none" ? (E(), H("span", {
59
+ key: 0,
60
+ class: w(M(r).be("svg", "text")),
61
+ style: $(l.value)
62
+ }, mt(u.text), 7)) : Q("", !0),
63
+ Te("span", {
64
+ class: w(M(r).be("svg", "image")),
65
+ style: $(f.value),
66
+ "aria-hidden": "true"
67
+ }, null, 6)
68
+ ], 6));
69
+ }
70
+ }), Fe = oe(Gt), $t = {
71
+ id: { type: String, default: "marker" },
72
+ Cesium: { type: Object },
73
+ viewer: { type: Object },
74
+ aggregatorOptions: { type: Object },
75
+ tagListeningOptions: {
76
+ type: Array
77
+ },
78
+ themeConfig: { type: Object }
79
+ // Optional override
80
+ };
81
+ var X = /* @__PURE__ */ ((t) => (t.左建选中模型 = "MODEL_LEFT_CLICK", t.标记左键点击 = "TAG_LEFT_CLICK", t.标记移入 = "TAG_MOUSEENTER", t.标记移出 = "TAG_MOUSELEAVE", t.模型位置保存 = "SAVE_REGION", t.模型加载完成 = "MODEL_READY", t))(X || {}), Kt = "[object Symbol]";
82
+ function ue(t) {
83
+ return typeof t == "symbol" || se(t) && Ie(t) == Kt;
84
+ }
85
+ function We(t, e) {
86
+ for (var r = -1, a = t == null ? 0 : t.length, n = Array(a); ++r < a; )
87
+ n[r] = e(t[r], r, t);
88
+ return n;
89
+ }
90
+ var be = z ? z.prototype : void 0, ve = be ? be.toString : void 0;
91
+ function Re(t) {
92
+ if (typeof t == "string")
93
+ return t;
94
+ if (L(t))
95
+ return We(t, Re) + "";
96
+ if (ue(t))
97
+ return ve ? ve.call(t) : "";
98
+ var e = t + "";
99
+ return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
100
+ }
101
+ function Be(t) {
102
+ return t;
103
+ }
104
+ function Xt(t, e, r) {
105
+ switch (r.length) {
106
+ case 0:
107
+ return t.call(e);
108
+ case 1:
109
+ return t.call(e, r[0]);
110
+ case 2:
111
+ return t.call(e, r[0], r[1]);
112
+ case 3:
113
+ return t.call(e, r[0], r[1], r[2]);
114
+ }
115
+ return t.apply(e, r);
116
+ }
117
+ var Yt = 800, zt = 16, Vt = Date.now;
118
+ function Ut(t) {
119
+ var e = 0, r = 0;
120
+ return function() {
121
+ var a = Vt(), n = zt - (a - r);
122
+ if (r = a, n > 0) {
123
+ if (++e >= Yt)
124
+ return arguments[0];
125
+ } else
126
+ e = 0;
127
+ return t.apply(void 0, arguments);
128
+ };
129
+ }
130
+ function qt(t) {
131
+ return function() {
132
+ return t;
133
+ };
134
+ }
135
+ var jt = pe ? function(t, e) {
136
+ return pe(t, "toString", {
137
+ configurable: !0,
138
+ enumerable: !1,
139
+ value: qt(e),
140
+ writable: !0
141
+ });
142
+ } : Be, Ge = Ut(jt), xe = Math.max;
143
+ function $e(t, e, r) {
144
+ return e = xe(e === void 0 ? t.length - 1 : e, 0), function() {
145
+ for (var a = arguments, n = -1, o = xe(a.length - e, 0), i = Array(o); ++n < o; )
146
+ i[n] = a[e + n];
147
+ n = -1;
148
+ for (var s = Array(e + 1); ++n < e; )
149
+ s[n] = a[n];
150
+ return s[e] = r(i), Xt(t, this, s);
151
+ };
152
+ }
153
+ function Zt(t, e) {
154
+ return Ge($e(t, e, Be), t + "");
155
+ }
156
+ function Jt(t, e, r) {
157
+ if (!ce(r))
158
+ return !1;
159
+ var a = typeof e;
160
+ return (a == "number" ? _e(r) && Pt(e, r.length) : a == "string" && e in r) ? Ae(r[e], t) : !1;
161
+ }
162
+ function Qt(t) {
163
+ return Zt(function(e, r) {
164
+ var a = -1, n = r.length, o = n > 1 ? r[n - 1] : void 0, i = n > 2 ? r[2] : void 0;
165
+ for (o = t.length > 3 && typeof o == "function" ? (n--, o) : void 0, i && Jt(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), e = Object(e); ++a < n; ) {
166
+ var s = r[a];
167
+ s && t(e, s, a, o);
168
+ }
169
+ return e;
170
+ });
171
+ }
172
+ var er = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, tr = /^\w*$/;
173
+ function rr(t, e) {
174
+ if (L(t))
175
+ return !1;
176
+ var r = typeof t;
177
+ return r == "number" || r == "symbol" || r == "boolean" || t == null || ue(t) ? !0 : tr.test(t) || !er.test(t) || e != null && t in Object(e);
178
+ }
179
+ var ar = "Expected a function";
180
+ function fe(t, e) {
181
+ if (typeof t != "function" || e != null && typeof e != "function")
182
+ throw new TypeError(ar);
183
+ var r = function() {
184
+ var a = arguments, n = e ? e.apply(this, a) : a[0], o = r.cache;
185
+ if (o.has(n))
186
+ return o.get(n);
187
+ var i = t.apply(this, a);
188
+ return r.cache = o.set(n, i) || o, i;
189
+ };
190
+ return r.cache = new (fe.Cache || Ne)(), r;
191
+ }
192
+ fe.Cache = Ne;
193
+ var nr = 500;
194
+ function ir(t) {
195
+ var e = fe(t, function(a) {
196
+ return r.size === nr && r.clear(), a;
197
+ }), r = e.cache;
198
+ return e;
199
+ }
200
+ var or = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, lr = /\\(\\)?/g, sr = ir(function(t) {
201
+ var e = [];
202
+ return t.charCodeAt(0) === 46 && e.push(""), t.replace(or, function(r, a, n, o) {
203
+ e.push(n ? o.replace(lr, "$1") : a || r);
204
+ }), e;
205
+ });
206
+ function cr(t) {
207
+ return t == null ? "" : Re(t);
208
+ }
209
+ function ge(t, e) {
210
+ return L(t) ? t : rr(t, e) ? [t] : sr(cr(t));
211
+ }
212
+ function ae(t) {
213
+ if (typeof t == "string" || ue(t))
214
+ return t;
215
+ var e = t + "";
216
+ return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
217
+ }
218
+ function ur(t, e) {
219
+ e = ge(e, t);
220
+ for (var r = 0, a = e.length; t != null && r < a; )
221
+ t = t[ae(e[r++])];
222
+ return r && r == a ? t : void 0;
223
+ }
224
+ var Ce = z ? z.isConcatSpreadable : void 0;
225
+ function fr(t) {
226
+ return L(t) || re(t) || !!(Ce && t && t[Ce]);
227
+ }
228
+ function gr(t, e, r, a, n) {
229
+ var o = -1, i = t.length;
230
+ for (r || (r = fr), n || (n = []); ++o < i; ) {
231
+ var s = t[o];
232
+ r(s) ? Ot(n, s) : n[n.length] = s;
233
+ }
234
+ return n;
235
+ }
236
+ function hr(t) {
237
+ var e = t == null ? 0 : t.length;
238
+ return e ? gr(t) : [];
239
+ }
240
+ function mr(t) {
241
+ return Ge($e(t, void 0, hr), t + "");
242
+ }
243
+ var dr = "[object Object]", yr = Function.prototype, pr = Object.prototype, Ke = yr.toString, br = pr.hasOwnProperty, vr = Ke.call(Object);
244
+ function Xe(t) {
245
+ if (!se(t) || Ie(t) != dr)
246
+ return !1;
247
+ var e = Et(t);
248
+ if (e === null)
249
+ return !0;
250
+ var r = br.call(e, "constructor") && e.constructor;
251
+ return typeof r == "function" && r instanceof r && Ke.call(r) == vr;
252
+ }
253
+ function xr(t, e, r) {
254
+ var a = -1, n = t.length;
255
+ e < 0 && (e = -e > n ? 0 : n + e), r = r > n ? n : r, r < 0 && (r += n), n = e > r ? 0 : r - e >>> 0, e >>>= 0;
256
+ for (var o = Array(n); ++a < n; )
257
+ o[a] = t[a + e];
258
+ return o;
259
+ }
260
+ function Cr(t) {
261
+ return function(e, r, a) {
262
+ for (var n = -1, o = Object(e), i = a(e), s = i.length; s--; ) {
263
+ var c = i[++n];
264
+ if (r(o[c], c, o) === !1)
265
+ break;
266
+ }
267
+ return e;
268
+ };
269
+ }
270
+ var Mr = Cr();
271
+ function ne(t, e, r) {
272
+ (r !== void 0 && !Ae(t[e], r) || r === void 0 && !(e in t)) && It(t, e, r);
273
+ }
274
+ function Tr(t) {
275
+ return se(t) && _e(t);
276
+ }
277
+ function ie(t, e) {
278
+ if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
279
+ return t[e];
280
+ }
281
+ function wr(t) {
282
+ return ke(t, He(t));
283
+ }
284
+ function Lr(t, e, r, a, n, o, i) {
285
+ var s = ie(t, r), c = ie(e, r), f = i.get(c);
286
+ if (f) {
287
+ ne(t, r, f);
288
+ return;
289
+ }
290
+ var l = o ? o(s, c, r + "", t, e, i) : void 0, u = l === void 0;
291
+ if (u) {
292
+ var y = L(c), b = !y && _t(c), p = !y && !b && At(c);
293
+ l = c, y || b || p ? L(s) ? l = s : Tr(s) ? l = Nt(s) : b ? (u = !1, l = kt(c, !0)) : p ? (u = !1, l = Ht(c, !0)) : l = [] : Xe(c) || re(c) ? (l = s, re(s) ? l = wr(s) : (!ce(s) || De(s)) && (l = Dt(c))) : u = !1;
294
+ }
295
+ u && (i.set(c, l), n(l, c, a, o, i), i.delete(c)), ne(t, r, l);
296
+ }
297
+ function Ye(t, e, r, a, n) {
298
+ t !== e && Mr(e, function(o, i) {
299
+ if (n || (n = new Ft()), ce(o))
300
+ Lr(t, e, i, r, Ye, a, n);
301
+ else {
302
+ var s = a ? a(ie(t, i), o, i + "", t, e, n) : void 0;
303
+ s === void 0 && (s = o), ne(t, i, s);
304
+ }
305
+ }, He);
306
+ }
307
+ function Sr(t) {
308
+ var e = t == null ? 0 : t.length;
309
+ return e ? t[e - 1] : void 0;
310
+ }
311
+ function Pr(t, e) {
312
+ return e.length < 2 ? t : ur(t, xr(e, 0, -1));
313
+ }
314
+ var Or = Qt(function(t, e, r) {
315
+ Ye(t, e, r);
316
+ }), Er = Object.prototype, Ir = Er.hasOwnProperty;
317
+ function _r(t, e) {
318
+ e = ge(e, t);
319
+ var r = -1, a = e.length;
320
+ if (!a)
321
+ return !0;
322
+ for (; ++r < a; ) {
323
+ var n = ae(e[r]);
324
+ if (n === "__proto__" && !Ir.call(t, "__proto__") || (n === "constructor" || n === "prototype") && r < a - 1)
325
+ return !1;
326
+ }
327
+ var o = Pr(t, e);
328
+ return o == null || delete o[ae(Sr(e))];
329
+ }
330
+ function Ar(t) {
331
+ return Xe(t) ? void 0 : t;
332
+ }
333
+ var Nr = 1, kr = 2, Hr = 4, Dr = mr(function(t, e) {
334
+ var r = {};
335
+ if (t == null)
336
+ return r;
337
+ var a = !1;
338
+ e = We(e, function(o) {
339
+ return o = ge(o, t), a || (a = o.length > 1), o;
340
+ }), ke(t, Wt(t), r), a && (r = Rt(r, Nr | kr | Hr, Ar));
341
+ for (var n = e.length; n--; )
342
+ _r(r, e[n]);
343
+ return r;
344
+ });
345
+ class Fr {
346
+ labelId;
347
+ cardId;
348
+ opt;
349
+ entityList = /* @__PURE__ */ new Map();
350
+ MaterialManager;
351
+ instance;
352
+ constructor(e) {
353
+ this.labelId = e.labelId, this.cardId = e.cardId, this.opt = e, this.MaterialManager = e.MaterialManager || new Le(), this.instance = this.initCore(e, e.eventBus, e.cardEventBus);
354
+ }
355
+ //初始化标记管理
356
+ initCore(e, r, a) {
357
+ let { Cesium: n, viewer: o, aggregatorOptions: i } = e;
358
+ r || (r = new ee()), a || (a = new ee());
359
+ const s = new de(n, o, this.labelId, r);
360
+ s.setOcclusionOptions({ distanceEpsilon: 1 }), s.setOcclusionEnabled(!1);
361
+ const c = new de(n, o, this.cardId, a, !1), f = new Mt(n, o, {
362
+ //聚合
363
+ threshold: i?.threshold || 16,
364
+ displayLimit: i?.displayLimit || 300,
365
+ maxLevel: i?.maxLevel || 20,
366
+ debugCurrentGrids: i?.debugCurrentGrids || !1,
367
+ groupByTheme: i?.groupByTheme ?? !0,
368
+ //clusterTheme: aggregatorOptions?.clusterTheme || 'Tag1007', // 这里可以改成你自定义的默认聚合点主题k
369
+ pointTheme: i?.pointTheme || "Tag1001",
370
+ // 普通点的默认主题
371
+ centralPointMode: i?.centralPointMode || "firstPoint",
372
+ // 普通点的默认主题
373
+ ...i,
374
+ labelPool: s
375
+ }), l = this.MaterialManager, u = new Tt(
376
+ //实体图层管理
377
+ n,
378
+ o,
379
+ l,
380
+ f,
381
+ c
382
+ );
383
+ return { materialManager: l, entityLayerManager: u, cardPool: c, labelPool: s, aggregator: f, eventBus: r, cardEventBus: a };
384
+ }
385
+ //添加标记
386
+ set(e) {
387
+ this.entityList.clear(), e.forEach((r) => {
388
+ this.entityList.set(r.id, r);
389
+ }), this.instance.entityLayerManager.removeLayer("Layer_default"), this.instance.entityLayerManager.addLayer("Layer_default"), this.instance.entityLayerManager.addGroupsToLayer(
390
+ "Layer_default",
391
+ Array.from(this.entityList.values())
392
+ );
393
+ }
394
+ //添加
395
+ add(e) {
396
+ let r = [];
397
+ L(e) ? r = e : r.push(e), r.forEach((a) => {
398
+ this.entityList.set(a.id, a);
399
+ }), this.instance.entityLayerManager.getLayer("Layer_default") || this.instance.entityLayerManager.addLayer("Layer_default"), this.instance.entityLayerManager.addGroupsToLayer("Layer_default", r);
400
+ }
401
+ //更新标记
402
+ update(e, r = !0) {
403
+ let a = [];
404
+ L(e) ? a = e : a.push(e);
405
+ const n = a.map((o) => {
406
+ const i = this.entityList.get(o.id);
407
+ if (!i) return;
408
+ let s = Or({}, i, o);
409
+ return this.entityList.set(o.id, s), s;
410
+ }).filter(Boolean);
411
+ r && this.instance.entityLayerManager.updateGroupToLayer("Layer_default", n);
412
+ }
413
+ //获取标记
414
+ getById(e) {
415
+ return this.entityList.get(e);
416
+ }
417
+ getOptions() {
418
+ return new Promise((e) => {
419
+ e({
420
+ entityList: Array.from(this.entityList.values())
421
+ });
422
+ });
423
+ }
424
+ //删除标记
425
+ delete(e) {
426
+ let r = [];
427
+ L(e) ? r = e : r.push(e), r.forEach((a) => {
428
+ this.entityList.delete(a);
429
+ }), this.instance.entityLayerManager.removeGroups("Layer_default", r);
430
+ }
431
+ setMarkerAggregationEnabled(e, r) {
432
+ this.instance.aggregator.setThreshold(e ? r || 2 : 9999999);
433
+ }
434
+ setDebugCurrentGridsEnabled(e) {
435
+ this.instance.aggregator.setDebugCurrentGrids(e || !1);
436
+ }
437
+ setLabelOcclusionEnabled(e) {
438
+ this.instance?.labelPool?.setOcclusionEnabled?.(!!e);
439
+ }
440
+ setLabelOcclusionDistanceEpsilon(e) {
441
+ this.instance?.labelPool?.setOcclusionOptions?.({
442
+ distanceEpsilon: Math.max(0, Number(e) || 0)
443
+ });
444
+ }
445
+ setLabelOcclusionOptions(e = {}) {
446
+ typeof e.enabled == "boolean" && this.setLabelOcclusionEnabled(e.enabled);
447
+ const r = {};
448
+ e.distanceEpsilon != null && (r.distanceEpsilon = Math.max(0, Number(e.distanceEpsilon) || 0)), e.throttleMs != null && (r.throttleMs = Math.max(0, Number(e.throttleMs) || 0)), Object.keys(r).length > 0 && this.instance?.labelPool?.setOcclusionOptions?.(r);
449
+ }
450
+ getLabelOcclusionOptions() {
451
+ return this.instance?.labelPool?.getOcclusionOptions?.() || null;
452
+ }
453
+ }
454
+ const I = {
455
+ wallTileWidth: 2,
456
+ wallTileHeight: 1,
457
+ polygonTileWidth: 2,
458
+ polygonTileHeight: 2
459
+ };
460
+ function d(t, e) {
461
+ const r = Number(t);
462
+ return Number.isFinite(r) ? r : e;
463
+ }
464
+ function C(t) {
465
+ return Number.isFinite(t) ? Math.max(1, t) : 1;
466
+ }
467
+ function Wr(t, e) {
468
+ return Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : e;
469
+ }
470
+ function Rr(t) {
471
+ const e = t?.repeat;
472
+ if (Array.isArray(e) && e.length >= 2)
473
+ return {
474
+ x: C(d(e[0], 1)),
475
+ y: C(d(e[1], 1))
476
+ };
477
+ if (e && typeof e == "object")
478
+ return {
479
+ x: C(d(e.x, 1)),
480
+ y: C(d(e.y, 1))
481
+ };
482
+ const r = Number(t?.repeatX), a = Number(t?.repeatY);
483
+ return Number.isFinite(r) && Number.isFinite(a) ? {
484
+ x: C(r),
485
+ y: C(a)
486
+ } : null;
487
+ }
488
+ function ze(t, e) {
489
+ const r = Array.isArray(e?.positions) ? e.positions : [];
490
+ if (r.length < 2) return 1;
491
+ let a = 0;
492
+ for (let n = 1; n < r.length; n++) {
493
+ const o = r[n - 1], i = r[n];
494
+ if (!Array.isArray(o) || !Array.isArray(i)) continue;
495
+ const s = t.Cartesian3.fromDegrees(
496
+ d(o[0], 0),
497
+ d(o[1], 0),
498
+ d(o[2], 0)
499
+ ), c = t.Cartesian3.fromDegrees(
500
+ d(i[0], 0),
501
+ d(i[1], 0),
502
+ d(i[2], 0)
503
+ );
504
+ a += t.Cartesian3.distance(s, c);
505
+ }
506
+ return a > 0 ? a : 1;
507
+ }
508
+ function Ve(t) {
509
+ const e = t?.maximumHeights, r = t?.minimumHeights;
510
+ if (Array.isArray(e) && Array.isArray(r) && e.length > 0 && e.length === r.length) {
511
+ let o = 0, i = 0;
512
+ for (let s = 0; s < e.length; s++) {
513
+ const c = Number(e[s]) - Number(r[s]);
514
+ Number.isFinite(c) && c > 0 && (o += c, i++);
515
+ }
516
+ if (i > 0) return o / i;
517
+ }
518
+ const a = Math.abs(d(t?.minHeight, 0)), n = Math.abs(d(t?.maxHeight, 0));
519
+ return a > 0 || n > 0 ? a + n : 3;
520
+ }
521
+ function Ue(t, e) {
522
+ const r = e?.hierarchy;
523
+ if (!Array.isArray(r) || r.length < 3)
524
+ return { width: 1, height: 1 };
525
+ const a = Array.isArray(r[0]) ? r.flat() : r;
526
+ if (!Array.isArray(a) || a.length < 3) return { width: 1, height: 1 };
527
+ let n = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY, i = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
528
+ for (let p = 0; p < a.length; p += 3) {
529
+ const T = Number(a[p]), x = Number(a[p + 1]);
530
+ !Number.isFinite(T) || !Number.isFinite(x) || (n = Math.min(n, T), o = Math.max(o, T), i = Math.min(i, x), s = Math.max(s, x));
531
+ }
532
+ if (!Number.isFinite(n) || !Number.isFinite(i))
533
+ return { width: 1, height: 1 };
534
+ const c = (i + s) / 2, f = t.Ellipsoid.WGS84.maximumRadius, l = t.Math.toRadians(Math.abs(o - n)), u = t.Math.toRadians(Math.abs(s - i)), y = l * f * Math.cos(t.Math.toRadians(c)), b = u * f;
535
+ return {
536
+ width: y > 0 ? y : 1,
537
+ height: b > 0 ? b : 1
538
+ };
539
+ }
540
+ function qe({
541
+ Cesium: t,
542
+ themeOptions: e,
543
+ entityOptions: r,
544
+ category: a
545
+ }) {
546
+ const n = Rr(e);
547
+ if (n) return n;
548
+ if (e?.autoRepeat === !1)
549
+ return { x: 1, y: 1 };
550
+ if (a === "wall") {
551
+ const c = ze(t, r), f = Ve(r), l = d(
552
+ e?.tileWidth ?? e?.textureWidth,
553
+ I.wallTileWidth
554
+ ), u = d(
555
+ e?.tileHeight ?? e?.textureHeight,
556
+ I.wallTileHeight
557
+ );
558
+ return {
559
+ x: C(c / Math.max(l, 0.01)),
560
+ y: C(f / Math.max(u, 0.01))
561
+ };
562
+ }
563
+ const o = Ue(t, r), i = d(
564
+ e?.tileWidth ?? e?.textureWidth,
565
+ I.polygonTileWidth
566
+ ), s = d(
567
+ e?.tileHeight ?? e?.textureHeight,
568
+ I.polygonTileHeight
569
+ );
570
+ return {
571
+ x: C(o.width / Math.max(i, 0.01)),
572
+ y: C(o.height / Math.max(s, 0.01))
573
+ };
574
+ }
575
+ function je({
576
+ Cesium: t,
577
+ themeOptions: e,
578
+ entityOptions: r,
579
+ category: a,
580
+ freely: n
581
+ }) {
582
+ const o = Number(e?.count);
583
+ if (Number.isFinite(o) && o > 0) return o;
584
+ if (e?.autoRepeat === !1)
585
+ return 1;
586
+ if (a === "wall") {
587
+ const l = ze(t, r), u = Ve(r), y = d(
588
+ e?.tileWidth ?? e?.textureWidth,
589
+ I.wallTileWidth
590
+ ), b = d(
591
+ e?.tileHeight ?? e?.textureHeight,
592
+ I.wallTileHeight
593
+ ), p = n === "vertical" ? u / Math.max(b, 0.01) : l / Math.max(y, 0.01);
594
+ return C(Number(p.toFixed(2)));
595
+ }
596
+ const i = Ue(t, r), s = d(
597
+ e?.tileWidth ?? e?.textureWidth,
598
+ I.polygonTileWidth
599
+ ), c = d(
600
+ e?.tileHeight ?? e?.textureHeight,
601
+ I.polygonTileHeight
602
+ ), f = n === "vertical" ? i.height / Math.max(c, 0.01) : i.width / Math.max(s, 0.01);
603
+ return C(Number(f.toFixed(2)));
604
+ }
605
+ function V(t) {
606
+ const e = t;
607
+ return e.__materialFactory = !0, e;
608
+ }
609
+ function Ze(t) {
610
+ const e = String(t?.wallVerticalMode ?? t?.verticalMode ?? "stretch");
611
+ return e === "repeat" || e === "bottom" || e === "stretch" ? e : "stretch";
612
+ }
613
+ function Br({
614
+ Cesium: t,
615
+ themeOptions: e,
616
+ entityOptions: r
617
+ }) {
618
+ const a = qe({
619
+ Cesium: t,
620
+ themeOptions: e,
621
+ entityOptions: r,
622
+ category: "wall"
623
+ });
624
+ return Ze(e) === "repeat" ? a : { x: a.x, y: 1 };
625
+ }
626
+ function Gr(t, e) {
627
+ const r = "WallBottomImageMaterial_" + Date.now() + "_" + Math.floor(Math.random() * 1e3);
628
+ function a(n) {
629
+ this._definitionChanged = new t.Event(), this._color = n.color, this.color = n.color;
630
+ }
631
+ return Object.defineProperties(a.prototype, {
632
+ isConstant: {
633
+ get() {
634
+ return !1;
635
+ }
636
+ },
637
+ definitionChanged: {
638
+ get() {
639
+ return this._definitionChanged;
640
+ }
641
+ },
642
+ color: t.createPropertyDescriptor("color")
643
+ }), a.prototype.getType = function() {
644
+ return r;
645
+ }, a.prototype.getValue = function(n, o) {
646
+ return t.defined(o) || (o = {}), o.image = e.image, o.repeatX = e.repeatX, o.bottomHeightRatio = e.bottomHeightRatio, o.color = t.Property.getValueOrClonedDefault(
647
+ this._color,
648
+ n,
649
+ t.Color.WHITE,
650
+ o.color
651
+ ), o;
652
+ }, a.prototype.equals = function(n) {
653
+ return this === n || n instanceof a && t.Property.equals(this._color, n._color);
654
+ }, t.Material._materialCache.addMaterial(r, {
655
+ fabric: {
656
+ type: r,
657
+ uniforms: {
658
+ image: e.image,
659
+ repeatX: e.repeatX,
660
+ bottomHeightRatio: e.bottomHeightRatio,
661
+ color: e.color || t.Color.WHITE
662
+ },
663
+ source: `
664
+ czm_material czm_getMaterial(czm_materialInput materialInput)
665
+ {
666
+ czm_material material = czm_getDefaultMaterial(materialInput);
667
+ vec2 st = materialInput.st;
668
+ float ratio = max(bottomHeightRatio, 0.0001);
669
+ if (st.t > ratio) {
670
+ material.alpha = 0.0;
671
+ return material;
672
+ }
673
+ vec2 uv = vec2(fract(st.s * repeatX), clamp(st.t / ratio, 0.0, 1.0));
674
+ vec4 colorImage = texture(image, uv);
675
+ material.diffuse = colorImage.rgb * color.rgb;
676
+ material.alpha = colorImage.a * color.a;
677
+ return material;
678
+ }`
679
+ },
680
+ translucent: function() {
681
+ return !0;
682
+ }
683
+ }), new a(e);
684
+ }
685
+ function $r({
686
+ Cesium: t,
687
+ options: e,
688
+ MaterialManager: r,
689
+ force: a = !1
690
+ }) {
691
+ if (e.data?.theme) {
692
+ if (e.data?.lineType == "1") {
693
+ let n = wt(t, {
694
+ color: t.Color.fromCssColorString(e?.options?.color || "#ffffff"),
695
+ duration: 100
696
+ });
697
+ r.register({
698
+ themeKey: e.data?.theme,
699
+ material: n,
700
+ force: a,
701
+ category: "polyline"
702
+ });
703
+ } else if (e.data?.lineType == "2") {
704
+ let n = new t.PolylineArrowMaterialProperty(
705
+ t.Color.fromCssColorString(e?.options?.color || "red")
706
+ );
707
+ r.register({
708
+ themeKey: e.data?.theme,
709
+ material: n,
710
+ force: a,
711
+ category: "polyline"
712
+ });
713
+ } else if (e.data?.lineType == "3") {
714
+ let n = new t.PolylineOutlineMaterialProperty({
715
+ color: t.Color.fromCssColorString(e?.options?.color || "red"),
716
+ outlineWidth: 0
717
+ });
718
+ r.register({
719
+ themeKey: e.data?.theme,
720
+ material: n,
721
+ force: a,
722
+ category: "polyline"
723
+ });
724
+ } else if (e.data?.lineType == "4") {
725
+ let n = new t.PolylineDashMaterialProperty({
726
+ color: t.Color.fromCssColorString(e?.options?.color || "red"),
727
+ dashLength: Number(e?.options?.dashLength || 30)
728
+ });
729
+ r.register({
730
+ themeKey: e.data?.theme,
731
+ material: n,
732
+ force: a,
733
+ category: "polyline"
734
+ });
735
+ } else if (e.data?.lineType == "5") {
736
+ let n = Lt(t, {
737
+ image: e.img,
738
+ color: t.Color.fromCssColorString(e?.options?.color || "#ffffff"),
739
+ duration: 5e3,
740
+ direction: "-",
741
+ count: 1,
742
+ isCustomColor: !0
743
+ });
744
+ r.register({
745
+ themeKey: e.data?.theme,
746
+ material: n,
747
+ force: a,
748
+ category: "polyline"
749
+ });
750
+ }
751
+ }
752
+ }
753
+ function Kr({
754
+ Cesium: t,
755
+ options: e,
756
+ MaterialManager: r,
757
+ force: a = !1
758
+ }) {
759
+ if (e.data?.theme) {
760
+ if (e.data?.polygonType == "colorMode") {
761
+ let n = t.Color.fromCssColorString(e?.options?.color || "#ffffff");
762
+ r.register({
763
+ themeKey: e.data?.theme,
764
+ material: n,
765
+ force: a,
766
+ category: "polygon"
767
+ });
768
+ } else if (e.data?.polygonType == "img") {
769
+ const n = e?.options || {};
770
+ r.register({
771
+ themeKey: e.data?.theme,
772
+ category: "polygon",
773
+ force: a,
774
+ material: V((o = {}) => {
775
+ const i = qe({
776
+ Cesium: t,
777
+ themeOptions: n,
778
+ entityOptions: o,
779
+ category: "polygon"
780
+ });
781
+ return new t.ImageMaterialProperty({
782
+ image: e.img,
783
+ repeat: new t.Cartesian2(i.x, i.y)
784
+ });
785
+ })
786
+ });
787
+ } else if (e.data?.polygonType == "DynamicImgMaterial") {
788
+ const n = e?.options || {};
789
+ r.register({
790
+ themeKey: e.data?.theme,
791
+ category: "polygon",
792
+ force: a,
793
+ material: V((o = {}) => {
794
+ const i = e.data?.freely || "vertical", s = je({
795
+ Cesium: t,
796
+ themeOptions: n,
797
+ entityOptions: o,
798
+ category: "polygon",
799
+ freely: i
800
+ });
801
+ return Se(t, {
802
+ image: e.img,
803
+ color: t.Color.fromCssColorString(n?.color || "#ffffff"),
804
+ duration: d(n?.duration, 5e3),
805
+ freely: i,
806
+ direction: n?.direction || "+",
807
+ count: s
808
+ });
809
+ })
810
+ });
811
+ }
812
+ }
813
+ }
814
+ function Xr({
815
+ Cesium: t,
816
+ options: e,
817
+ MaterialManager: r,
818
+ force: a = !1
819
+ }) {
820
+ if (e.data?.theme) {
821
+ if (e.data?.wallType == "img") {
822
+ const n = e?.options || {};
823
+ r.register({
824
+ themeKey: e.data?.theme,
825
+ category: "wall",
826
+ force: a,
827
+ material: V((o = {}) => {
828
+ const i = Ze(n), s = Br({
829
+ Cesium: t,
830
+ themeOptions: n,
831
+ entityOptions: o
832
+ });
833
+ if (i === "bottom") {
834
+ const c = Wr(
835
+ d(n?.bottomHeightRatio, 0.3),
836
+ 0.3
837
+ );
838
+ return Gr(t, {
839
+ image: e.img,
840
+ repeatX: s.x,
841
+ bottomHeightRatio: c,
842
+ color: t.Color.fromCssColorString(n?.color || "#ffffff")
843
+ });
844
+ }
845
+ return new t.ImageMaterialProperty({
846
+ image: e.img,
847
+ repeat: new t.Cartesian2(s.x, s.y),
848
+ transparent: !0
849
+ });
850
+ })
851
+ });
852
+ } else if (e.data?.wallType == "DynamicImgMaterial") {
853
+ const n = e?.options || {};
854
+ r.register({
855
+ themeKey: e.data?.theme,
856
+ category: "wall",
857
+ force: a,
858
+ material: V((o = {}) => {
859
+ const i = e.data?.freely || "vertical", s = je({
860
+ Cesium: t,
861
+ themeOptions: n,
862
+ entityOptions: o,
863
+ category: "wall",
864
+ freely: i
865
+ });
866
+ return Se(t, {
867
+ image: e.img,
868
+ color: t.Color.fromCssColorString(n?.color || "#ffffff"),
869
+ duration: d(n?.duration, 5e3),
870
+ freely: i,
871
+ direction: n?.direction || "+",
872
+ count: s
873
+ });
874
+ })
875
+ });
876
+ }
877
+ }
878
+ }
879
+ class Yr extends Fr {
880
+ getCurrentBillboard(e) {
881
+ return e?.__currentBillboard || e?.billboard?.[0];
882
+ }
883
+ constructor(e) {
884
+ const {
885
+ labelId: r = "report-marker",
886
+ cardId: a = "report-marker",
887
+ tagThemeConfig: n = [],
888
+ lineThemeConfig: o = [],
889
+ cardThemeConfig: i = [],
890
+ runListener: s = () => {
891
+ },
892
+ MaterialManager: c = new Le(),
893
+ aggregatorOptions: f
894
+ } = e, l = [...n], u = [...o], y = [...i], b = {
895
+ clusterTheme: "Tag1007",
896
+ pointTheme: "Tag1001",
897
+ centralPointMode: "firstPoint",
898
+ debugCurrentGrids: !1,
899
+ ...f || {}
900
+ }, p = {
901
+ ...e,
902
+ labelId: r,
903
+ cardId: a,
904
+ MaterialManager: c,
905
+ aggregatorOptions: b,
906
+ eventBus: new ee()
907
+ };
908
+ super(p), this.opt = { ...this.opt, ...p }, this.initTagListener(this.instance.eventBus, this.opt), this.loadTabThemeConfig(l), this.loadLineThemeConfig(u), this.loadCardThemeConfig(y), this.initDefaultLineMaterials(), this.initDefaultTagTheme();
909
+ }
910
+ initDefaultTagTheme() {
911
+ this.setTagTheme({
912
+ comType: 4,
913
+ data: {
914
+ theme: "default",
915
+ options: {
916
+ textStyle: {
917
+ width: "max-content",
918
+ backgroundColor: "rgba(0, 0, 0, 0.7)",
919
+ borderRadius: "5px",
920
+ padding: "4px 8px"
921
+ }
922
+ }
923
+ }
924
+ });
925
+ }
926
+ initDefaultLineMaterials() {
927
+ const e = this.opt.Cesium;
928
+ if (!e) return;
929
+ const r = {
930
+ themeBeUnderConstructionRailway: {
931
+ material: new e.PolylineDashMaterialProperty({
932
+ color: e.Color.fromCssColorString("white"),
933
+ gapColor: e.Color.fromCssColorString("black"),
934
+ dashLength: 50,
935
+ dashPattern: parseInt("1111111111111110", 2)
936
+ })
937
+ },
938
+ themeRailway: {
939
+ material: new e.PolylineDashMaterialProperty({
940
+ color: e.Color.BLACK,
941
+ gapColor: e.Color.WHITE,
942
+ dashLength: 48
943
+ //短划线长度
944
+ })
945
+ },
946
+ themeNewRailway: {
947
+ material: new e.PolylineOutlineMaterialProperty({
948
+ color: e.Color.RED,
949
+ outlineWidth: 0,
950
+ outlineColor: e.Color.BLACK
951
+ })
952
+ },
953
+ themePlanningRailway: {
954
+ material: new e.PolylineOutlineMaterialProperty({
955
+ color: e.Color.fromCssColorString("rgb(162, 83, 188)"),
956
+ outlineWidth: 0,
957
+ outlineColor: e.Color.BLACK
958
+ })
959
+ },
960
+ themePlanLine: {
961
+ material: new e.PolylineOutlineMaterialProperty({
962
+ color: e.Color.fromCssColorString("rgb(5,11,233)"),
963
+ outlineWidth: 0,
964
+ outlineColor: e.Color.BLACK
965
+ })
966
+ },
967
+ themeExpressway: {
968
+ material: new e.PolylineOutlineMaterialProperty({
969
+ color: e.Color.fromCssColorString("rgb(255,255, 0)"),
970
+ outlineWidth: 6,
971
+ outlineColor: e.Color.fromCssColorString("rgb(102, 176 ,8)")
972
+ })
973
+ },
974
+ themeNationalHighway: {
975
+ material: new e.PolylineOutlineMaterialProperty({
976
+ color: e.Color.fromCssColorString("rgb(160 ,119, 0)"),
977
+ outlineWidth: 6,
978
+ outlineColor: e.Color.fromCssColorString("rgb(68 ,33, 24)")
979
+ })
980
+ },
981
+ themeProvincialRoad: {
982
+ material: new e.PolylineOutlineMaterialProperty({
983
+ color: e.Color.fromCssColorString("rgb(160 ,119, 0)"),
984
+ outlineWidth: 6,
985
+ outlineColor: e.Color.fromCssColorString("rgb(68 ,33, 24)")
986
+ })
987
+ },
988
+ themeCityBoundary: {
989
+ material: new e.PolylineDashMaterialProperty({
990
+ color: e.Color.fromCssColorString("rgb(162, 83, 188)"),
991
+ gapColor: e.Color.fromCssColorString("0000"),
992
+ dashLength: 50,
993
+ dashPattern: parseInt("1111111111100100", 2)
994
+ })
995
+ },
996
+ themeProvincialBoundaries: {
997
+ material: new e.PolylineDashMaterialProperty({
998
+ // color: Cesium.Color.fromCssColorString('rgb(162, 83, 188)'),
999
+ color: e.Color.fromCssColorString("rgb(162, 83, 188)"),
1000
+ gapColor: e.Color.fromCssColorString("0000"),
1001
+ dashLength: 50,
1002
+ dashPattern: parseInt("1111111100100100", 2)
1003
+ })
1004
+ }
1005
+ };
1006
+ Object.entries(r).forEach(([a, n]) => {
1007
+ this.MaterialManager.has(a, "polyline") || this.MaterialManager.register({
1008
+ themeKey: a,
1009
+ material: n.material,
1010
+ category: "polyline"
1011
+ });
1012
+ });
1013
+ }
1014
+ // Initialize dynamic themes from data
1015
+ initThemes(e, r = !1) {
1016
+ if (!e) return;
1017
+ e.tag && this.loadTabThemeConfig(e.tag), e.card && this.loadCardThemeConfig(e.card);
1018
+ const a = this.opt.Cesium, n = this.instance.materialManager || this.opt.MaterialManager;
1019
+ if (e.line?.length > 0)
1020
+ for (let o of e.line)
1021
+ $r({
1022
+ options: o,
1023
+ Cesium: a,
1024
+ MaterialManager: n,
1025
+ force: r
1026
+ });
1027
+ if (e.polygon?.length > 0)
1028
+ for (let o of e.polygon)
1029
+ Kr({
1030
+ options: o,
1031
+ Cesium: a,
1032
+ MaterialManager: n,
1033
+ force: r
1034
+ });
1035
+ if (e.wall?.length > 0)
1036
+ for (let o of e.wall)
1037
+ Xr({
1038
+ options: o,
1039
+ Cesium: a,
1040
+ MaterialManager: n,
1041
+ force: r
1042
+ });
1043
+ r && this.entityList.size > 0 && this.set(Array.from(this.entityList.values()));
1044
+ }
1045
+ extractOnEvents(e) {
1046
+ const r = {};
1047
+ for (const a in e)
1048
+ a.startsWith("on") && typeof e[a] == "function" && (r[a] = e[a]);
1049
+ return r;
1050
+ }
1051
+ //注册标记主题
1052
+ loadTabThemeConfig(e) {
1053
+ e.forEach((r) => {
1054
+ this.setTagTheme(r);
1055
+ });
1056
+ }
1057
+ //注册默认的线配置
1058
+ loadLineThemeConfig(e, r = !1) {
1059
+ e.forEach((a) => {
1060
+ !r && this.MaterialManager.has(a.data.theme, "polyline") || a.material && this.MaterialManager.register({
1061
+ themeKey: a.data.theme,
1062
+ material: a.material,
1063
+ force: r,
1064
+ category: "polyline"
1065
+ });
1066
+ });
1067
+ }
1068
+ loadCardThemeConfig(e) {
1069
+ let r = this.instance.cardPool;
1070
+ e.forEach((a) => {
1071
+ r.registerTheme(a.data.theme, {
1072
+ createElement(n, o) {
1073
+ let i = o.data.data, s;
1074
+ return a.comType == 1 ? s = P(O(ye), {
1075
+ data: i || {},
1076
+ imgSrc: a.data.img,
1077
+ styleConfig: {
1078
+ paddingTop: "50px",
1079
+ paddingRight: "18px",
1080
+ paddingBottom: "10px",
1081
+ paddingLeft: "95px",
1082
+ backgroundColor: "rgba(0,0,0,0)",
1083
+ borderRadius: 0,
1084
+ width: "682px",
1085
+ height: "445px"
1086
+ },
1087
+ titleConfig: {
1088
+ show: !0,
1089
+ width: "600px",
1090
+ height: "50px",
1091
+ left: "79px",
1092
+ top: "0px"
1093
+ },
1094
+ bgClass: [a.data.theme]
1095
+ }) : a.comType == 3 && (s = P(O(ye), {
1096
+ data: i || {},
1097
+ imgSrc: a.data.img,
1098
+ styleConfig: {
1099
+ paddingTop: "55px",
1100
+ paddingRight: "12px",
1101
+ paddingBottom: "17px",
1102
+ paddingLeft: "83px",
1103
+ backgroundColor: "rgba(0,0,0,0)",
1104
+ borderRadius: 0,
1105
+ width: "365px",
1106
+ height: "353px"
1107
+ },
1108
+ titleConfig: {
1109
+ show: !0,
1110
+ width: "285px",
1111
+ height: "50px",
1112
+ left: "79px",
1113
+ top: "0px"
1114
+ },
1115
+ bgClass: [a.data.theme]
1116
+ // titleConfig: themeOptions.options.titleConfig,
1117
+ // pageInfoConfig: themeOptions.options.pageInfoConfig,
1118
+ })), K(s, n), () => K(null, n);
1119
+ },
1120
+ options: {
1121
+ offset: a.data.pixelOffset,
1122
+ ...a.data || {}
1123
+ }
1124
+ });
1125
+ });
1126
+ }
1127
+ //注册主题
1128
+ setTagTheme(e) {
1129
+ let { labelPool: r } = this.instance;
1130
+ const a = (n) => this.getCurrentBillboard(n);
1131
+ r.registerTheme(e.data.theme, {
1132
+ createElement(n, o) {
1133
+ let i = a(o.data);
1134
+ const s = Dr(i, ["position", "options"]);
1135
+ let c, f = {
1136
+ ...s,
1137
+ text: i?.options?.text,
1138
+ isFullLink: e?.isFullLink ?? !1,
1139
+ img: e?.data?.options?.img,
1140
+ textStyle: e?.data?.options?.textStyle,
1141
+ imgStyle: e?.data?.options?.imgStyle,
1142
+ svg: e?.data?.options?.svg,
1143
+ textPosition: e?.data?.options?.textPosition || "top",
1144
+ textGap: e?.data?.options?.textGap
1145
+ };
1146
+ if (o.data?.gridKey)
1147
+ c = P(O(te), {
1148
+ text: o.data?.count,
1149
+ isFullLink: e.isFullLink ?? !1,
1150
+ img: e?.data.options.img,
1151
+ imgStyle: e?.data.options?.imgStyle,
1152
+ textStyle: {
1153
+ display: "block !important",
1154
+ "font-size": "12px !important",
1155
+ minWidth: "20px",
1156
+ maxWidth: "max-content",
1157
+ position: "absolute",
1158
+ left: "63%",
1159
+ top: "-8px",
1160
+ background: "#f00",
1161
+ "border-radius": "50%",
1162
+ height: "20px",
1163
+ "line-height": "20px",
1164
+ "text-align": "center",
1165
+ color: "white"
1166
+ }
1167
+ });
1168
+ else if (e.comType == 4)
1169
+ c = P(O(St), f);
1170
+ else if (e.comType == 5 || e.comType == 8) {
1171
+ const l = i?.options || {}, u = e?.data?.options || {}, y = i?.pixelOffset || e?.data?.pixelOffset || { x: 0, y: 0 }, b = l.otherOffset ?? u.otherOffset ?? { x: 0, y: -0 }, p = l.isCanDraggable ?? u.isCanDraggable ?? e?.isCanDraggable ?? !1, T = e.comType == 8 ? Pe : Oe;
1172
+ c = P(O(T), {
1173
+ ...f,
1174
+ pixelOffset: y,
1175
+ textStyle: l.textStyle || u.textStyle,
1176
+ lineStyle: l.lineStyle || u.lineStyle,
1177
+ otherOffset: b,
1178
+ isCanDraggable: p,
1179
+ onCanDraggable: l.onCanDraggable || e?.onCanDraggable,
1180
+ onSetOtherOffset: (x) => {
1181
+ const _ = a(o.data);
1182
+ _?.options && (_.options.otherOffset = x), l.onSetOtherOffset?.(x), e?.onSetOtherOffset?.(o.data, x);
1183
+ },
1184
+ onSetLineStake: (x) => {
1185
+ const _ = a(o.data);
1186
+ _?.options && (_.options.lineStake = x), l.onSetLineStake?.(x), e?.onSetLineStake?.(o.data, x);
1187
+ }
1188
+ });
1189
+ } else e.comType == 6 || e.comType == 7 ? c = P(O(Ee), {
1190
+ text: f.text,
1191
+ textStyle: f.textStyle
1192
+ }) : e.comType == 9 ? c = P(O(Fe), {
1193
+ text: f.text,
1194
+ svg: f.svg,
1195
+ textStyle: f.textStyle,
1196
+ textPosition: f.textPosition || "top",
1197
+ textGap: f.textGap
1198
+ }) : c = P(O(te), f);
1199
+ return K(c, n), () => K(null, n);
1200
+ },
1201
+ options: {
1202
+ offset: e.comType == 5 || e.comType == 8 ? {} : e?.data?.pixelOffset || {}
1203
+ }
1204
+ });
1205
+ }
1206
+ //标记监听事件
1207
+ initTagListener(e, r) {
1208
+ let { viewer: a, tagListeningOptions: n } = r;
1209
+ e.addListener(J.Click, {
1210
+ name: "marker:click",
1211
+ fn: (o) => {
1212
+ r.runListener?.(X.标记左键点击, o.data), De(o.data?.onClick) && o.data?.onClick(o.data), o.data?.cameraPoint && this.getCurrentBillboard(o.data)?.isFlyToCameraPoint && a?.camera?.flyTo({
1213
+ duration: 1,
1214
+ ...o.data?.cameraPoint
1215
+ });
1216
+ }
1217
+ }), e.addListener(J.MouseEnter, {
1218
+ name: "marker:mouseenter",
1219
+ fn: (o) => {
1220
+ let i = this.opt.Cesium, s = { x: 0, y: 0 };
1221
+ try {
1222
+ const c = this.getCurrentBillboard(o.data);
1223
+ if (c?.position?.length > 2) {
1224
+ let f = c.position, l = i.Cartesian3.fromDegrees(f[0], f[1], f[3] || 0), u = this.instance.labelPool.toWindowCoordinates(l);
1225
+ s.x = u.x, s.y = u.y;
1226
+ }
1227
+ } catch (c) {
1228
+ console.log(c);
1229
+ }
1230
+ r.runListener?.(X.标记移入, o.data, s);
1231
+ }
1232
+ }), e.addListener(J.MouseLeave, {
1233
+ name: "marker:mouseleave",
1234
+ fn: (o) => {
1235
+ let i = this.opt.Cesium, s = { x: 0, y: 0 };
1236
+ try {
1237
+ const c = this.getCurrentBillboard(o.data);
1238
+ if (c?.position?.length > 2) {
1239
+ let f = c.position, l = i.Cartesian3.fromDegrees(f[0], f[1], f[3] || 0), u = this.instance.labelPool.toWindowCoordinates(l);
1240
+ s.x = u.x, s.y = u.y;
1241
+ }
1242
+ } catch (c) {
1243
+ console.log(c);
1244
+ }
1245
+ r.runListener?.(X.标记移出, o.data, s);
1246
+ }
1247
+ }), n?.forEach((o) => {
1248
+ e.addListener(o.key, o.ListenerItem, o.overwrite);
1249
+ });
1250
+ }
1251
+ // 兼容旧模式的材质注册
1252
+ setMaterial(e) {
1253
+ const { type: r, material: a, materialKey: n, cover: o } = e, i = r ? r.toLowerCase() : "default";
1254
+ this.MaterialManager.register({
1255
+ themeKey: n,
1256
+ // 兼容传入的是 { material: ... } 结构或者直接是材质对象
1257
+ material: a?.material || a,
1258
+ force: o,
1259
+ category: i
1260
+ });
1261
+ }
1262
+ }
1263
+ const zr = /* @__PURE__ */ le({
1264
+ __name: "MarkerManage",
1265
+ props: $t,
1266
+ emits: ["register", "load", "marker-event"],
1267
+ setup(t, { expose: e, emit: r }) {
1268
+ const a = t, n = r, o = dt("leitingMethods");
1269
+ let i = null;
1270
+ const s = (l = {}) => {
1271
+ if (i) return i;
1272
+ const u = {
1273
+ ...a,
1274
+ ...l,
1275
+ Cesium: l.Cesium || a.Cesium,
1276
+ viewer: l.viewer || a.viewer,
1277
+ runListener: (y, b, ...p) => {
1278
+ n("marker-event", { key: y, data: b, args: p });
1279
+ }
1280
+ };
1281
+ return !u.Cesium || !u.viewer ? null : (i = new Yr(u), l.methods && (l.methods.setTagTheme = i.setTagTheme.bind(i), l.methods.setMaterial = i.setMaterial.bind(i), l.methods.setEntityList = i.set.bind(i), l.methods.addComItem = i.add.bind(i), l.methods.deleteComItem = i.delete.bind(i), l.methods.updateComItem = i.update.bind(i), l.methods.getEntityByID = i.getById.bind(i), l.methods.getOptions = i.getOptions.bind(i)), n("load", i), i);
1282
+ }, c = {
1283
+ init: s,
1284
+ set: (l) => i?.set(l),
1285
+ add: (l) => i?.add(l),
1286
+ update: (l, u) => i?.update(l, u),
1287
+ getById: (l) => i?.getById(l),
1288
+ getOptions: () => i?.getOptions(),
1289
+ delete: (l) => i?.delete(l),
1290
+ setMarkerAggregationEnabled: (l, u) => i?.setMarkerAggregationEnabled(l, u),
1291
+ setDebugCurrentGridsEnabled: (l) => i?.setDebugCurrentGridsEnabled(l),
1292
+ setLabelOcclusionEnabled: (l) => i?.setLabelOcclusionEnabled(l),
1293
+ setLabelOcclusionDistanceEpsilon: (l) => i?.setLabelOcclusionDistanceEpsilon(l),
1294
+ setLabelOcclusionOptions: (l) => i?.setLabelOcclusionOptions(l),
1295
+ getLabelOcclusionOptions: () => i?.getLabelOcclusionOptions(),
1296
+ initThemes: (l) => i?.initThemes(l),
1297
+ setTagTheme: (l) => i?.setTagTheme(l),
1298
+ setMaterial: (l) => i?.setMaterial(l)
1299
+ };
1300
+ e(c), n("register", c);
1301
+ function f() {
1302
+ if (i) return i;
1303
+ const l = M(o), u = l?.getCesium?.(), y = l?.getViewer?.();
1304
+ u && y ? s({ Cesium: u, viewer: y, methods: l }) : a.Cesium && a.viewer && s({ methods: l });
1305
+ }
1306
+ return we(() => {
1307
+ f();
1308
+ }), Y(
1309
+ () => [a.Cesium, a.viewer],
1310
+ ([l, u]) => {
1311
+ l && u && !i && f();
1312
+ }
1313
+ ), Y(
1314
+ () => o?.value,
1315
+ (l, u) => {
1316
+ f();
1317
+ },
1318
+ { deep: !1 }
1319
+ ), yt(() => {
1320
+ }), (l, u) => pt(l.$slots, "default");
1321
+ }
1322
+ }), Vr = /* @__PURE__ */ le({
1323
+ name: "CxMarkerPreview",
1324
+ __name: "MarkerPreview",
1325
+ props: {
1326
+ config: {},
1327
+ text: { default: "示例标注" },
1328
+ img: { default: void 0 },
1329
+ offsetSelectable: { type: Boolean, default: !1 }
1330
+ },
1331
+ emits: ["imageSize", "pixelOffsetSelect"],
1332
+ setup(t, { emit: e }) {
1333
+ const r = t, a = e, n = Me("marker"), o = G(), i = G(), s = m(() => r.config?.data?.options || {}), c = m(() => Number(r.config?.comType ?? 2)), f = m(() => c.value === 5 ? Oe : c.value === 8 ? Pe : [6, 7].includes(c.value) ? Ee : c.value === 9 ? Fe : te), l = m(() => c.value === 2), u = m(() => r.img ?? s.value.img ?? r.config?.img ?? ""), y = m(() => s.value.textStyle || {}), b = m(() => s.value.imgStyle || {}), p = m(() => s.value.lineStyle || {}), T = m(() => s.value.svg || {}), x = m(() => String(s.value.textPosition || "top")), _ = m(() => Number(s.value.textGap ?? 8)), U = m(() => r.config?.data?.pixelOffset || { x: 0, y: 0 }), Je = m(() => s.value.otherOffset || { x: 0, y: 0 }), Qe = m(
1334
+ () => JSON.stringify({
1335
+ comType: c.value,
1336
+ image: u.value,
1337
+ text: r.text,
1338
+ options: s.value
1339
+ })
1340
+ ), R = G(!1), B = G(!1), S = G({ scale: 1, shiftX: 0, shiftY: 0 }), et = m(() => ({
1341
+ transform: `translate(${S.value.shiftX}px, ${S.value.shiftY}px) scale(${S.value.scale})`,
1342
+ visibility: R.value || l.value && (!u.value || !B.value) ? "hidden" : "visible"
1343
+ })), q = m(
1344
+ () => r.offsetSelectable && c.value === 2 && !!u.value && B.value
1345
+ ), tt = m(() => {
1346
+ const h = Number(U.value.x), g = Number(U.value.y);
1347
+ return {
1348
+ left: `${Number.isFinite(h) ? -h : 0}px`,
1349
+ top: `${Number.isFinite(g) ? -g : 0}px`
1350
+ };
1351
+ });
1352
+ function rt() {
1353
+ if (!o.value || !i.value || o.value.clientWidth <= 0 || o.value.clientHeight <= 0) return;
1354
+ const h = Array.from(i.value.querySelectorAll("*")).filter((v) => !v.classList.contains(n.be("preview", "anchor"))).map((v) => v.getBoundingClientRect()).filter((v) => v.width || v.height);
1355
+ if (!h.length) return;
1356
+ const g = o.value.getBoundingClientRect(), N = Math.min(...h.map((v) => v.left)), k = Math.max(...h.map((v) => v.right)), F = Math.min(...h.map((v) => v.top)), W = Math.max(...h.map((v) => v.bottom)), ot = k - N, lt = W - F, me = S.value.scale || 1, st = Math.min(
1357
+ 1,
1358
+ Math.max(1, g.width - 8) / Math.max(ot / me, 1),
1359
+ Math.max(1, g.height - 8) / Math.max(lt / me, 1)
1360
+ ), ct = (N + k) / 2, ut = (F + W) / 2, ft = g.left + g.width / 2, gt = g.top + g.height / 2;
1361
+ S.value = {
1362
+ scale: st,
1363
+ shiftX: S.value.shiftX + ft - ct,
1364
+ shiftY: S.value.shiftY + gt - ut
1365
+ };
1366
+ }
1367
+ function at(h) {
1368
+ const g = h.target;
1369
+ !(g instanceof HTMLImageElement) || !i.value?.contains(g) || (B.value = !0, R.value = !1, a("imageSize", g.naturalHeight > 0 ? g.naturalWidth / g.naturalHeight : void 0), Z());
1370
+ }
1371
+ function nt(h) {
1372
+ !(h.target instanceof HTMLImageElement) || !i.value?.contains(h.target) || (R.value = !0, a("imageSize", void 0));
1373
+ }
1374
+ function it(h) {
1375
+ if (!q.value || !i.value) return;
1376
+ const g = i.value.querySelector(`.${n.b("default")}`);
1377
+ if (!g) return;
1378
+ const N = g.getBoundingClientRect(), k = S.value.scale || 1, F = (h.clientX - N.left) / k, W = (h.clientY - N.top) / k;
1379
+ F < 0 || W < 0 || F > N.width / k || W > N.height / k || a("pixelOffsetSelect", { x: -Math.round(F), y: -Math.round(W) });
1380
+ }
1381
+ Y(
1382
+ u,
1383
+ () => {
1384
+ B.value = !1, R.value = !1, a("imageSize", void 0);
1385
+ },
1386
+ { flush: "sync" }
1387
+ );
1388
+ let D, j = /* @__PURE__ */ new Set(), A;
1389
+ function Z() {
1390
+ A !== void 0 && cancelAnimationFrame(A);
1391
+ let h = 0;
1392
+ const g = () => {
1393
+ A = void 0, rt(), h += 1, h < 3 && (A = requestAnimationFrame(g));
1394
+ };
1395
+ A = requestAnimationFrame(g);
1396
+ }
1397
+ function he() {
1398
+ const h = new Set(Array.from(i.value?.querySelectorAll("*") || []));
1399
+ for (const g of j) h.has(g) || D?.unobserve(g);
1400
+ for (const g of h) j.has(g) || D?.observe(g);
1401
+ j = h, Z();
1402
+ }
1403
+ return Y(Qe, () => bt(he)), we(() => {
1404
+ D = new ResizeObserver(Z), o.value && D.observe(o.value), i.value && D.observe(i.value), he();
1405
+ }), vt(() => {
1406
+ D?.disconnect(), A !== void 0 && cancelAnimationFrame(A);
1407
+ }), (h, g) => (E(), H("div", {
1408
+ ref_key: "host",
1409
+ ref: o,
1410
+ class: w([M(n).b("preview"), q.value ? M(n).bm("preview", "offset-picker") : ""]),
1411
+ "aria-hidden": "true"
1412
+ }, [
1413
+ R.value ? (E(), H("div", {
1414
+ key: 0,
1415
+ class: w(M(n).be("preview", "message"))
1416
+ }, "图片不可用", 2)) : l.value && !u.value ? (E(), H("div", {
1417
+ key: 1,
1418
+ class: w(M(n).be("preview", "message"))
1419
+ }, "请选择图片", 2)) : l.value && !B.value ? (E(), H("div", {
1420
+ key: 2,
1421
+ class: w(M(n).be("preview", "message"))
1422
+ }, "图片加载中…", 2)) : Q("", !0),
1423
+ Te("div", {
1424
+ ref_key: "content",
1425
+ ref: i,
1426
+ class: w(M(n).be("preview", "content")),
1427
+ style: $(et.value),
1428
+ onLoadCapture: at,
1429
+ onErrorCapture: nt,
1430
+ onClick: it
1431
+ }, [
1432
+ (E(), xt(Ct(f.value), {
1433
+ key: u.value,
1434
+ text: t.text,
1435
+ img: u.value,
1436
+ "text-style": y.value,
1437
+ "img-style": b.value,
1438
+ "line-style": p.value,
1439
+ "pixel-offset": U.value,
1440
+ "other-offset": Je.value,
1441
+ svg: T.value,
1442
+ "text-position": x.value,
1443
+ "text-gap": _.value
1444
+ }, null, 8, ["text", "img", "text-style", "img-style", "line-style", "pixel-offset", "other-offset", "svg", "text-position", "text-gap"])),
1445
+ q.value ? (E(), H("span", {
1446
+ key: 0,
1447
+ class: w(M(n).be("preview", "anchor")),
1448
+ style: $(tt.value)
1449
+ }, null, 6)) : Q("", !0)
1450
+ ], 38)
1451
+ ], 2));
1452
+ }
1453
+ }), aa = oe(zr), na = oe(Vr);
1454
+ export {
1455
+ Fe as C,
1456
+ Fr as M,
1457
+ X as R,
1458
+ aa as a,
1459
+ na as b,
1460
+ Yr as c,
1461
+ $t as m
1462
+ };