leiting-bim 2.2.46 → 2.2.49

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 (52) hide show
  1. package/leiting-bim.es.js +1 -4
  2. package/leitingbim.css +1 -1
  3. package/package.json +1 -1
  4. package/skybox/023/nx.jpg +0 -0
  5. package/skybox/023/ny.jpg +0 -0
  6. package/skybox/023/nz.jpg +0 -0
  7. package/skybox/023/px.jpg +0 -0
  8. package/skybox/023/py.jpg +0 -0
  9. package/skybox/023/pz.jpg +0 -0
  10. package/skybox/035/nx.png +0 -0
  11. package/skybox/035/ny.png +0 -0
  12. package/skybox/035/nz.png +0 -0
  13. package/skybox/035/px.png +0 -0
  14. package/skybox/035/py.png +0 -0
  15. package/skybox/035/pz.png +0 -0
  16. package/skybox/037/nx.png +0 -0
  17. package/skybox/037/ny.png +0 -0
  18. package/skybox/037/nz.png +0 -0
  19. package/skybox/037/px.png +0 -0
  20. package/skybox/037/py.png +0 -0
  21. package/skybox/037/pz.png +0 -0
  22. package/plugins/cesium-core/dist/cesium-core.mjs.map +0 -1
  23. package/plugins/cesium-core/dist/cesium-core.umd.js.map +0 -1
  24. package/plugins/cesium-vue/dist/HtmlOverlayLabelPool-CbiNlyAM.js +0 -510
  25. package/plugins/cesium-vue/dist/HtmlOverlayLabelPool-CbiNlyAM.js.map +0 -1
  26. package/plugins/cesium-vue/dist/HtmlOverlayLabelPool-DgCFnmr3.js +0 -352
  27. package/plugins/cesium-vue/dist/HtmlOverlayLabelPool-DgCFnmr3.js.map +0 -1
  28. package/plugins/cesium-vue/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
  29. package/plugins/cesium-vue/dist/components/basic-audio.js.map +0 -1
  30. package/plugins/cesium-vue/dist/components/basic-video.js.map +0 -1
  31. package/plugins/cesium-vue/dist/components/card-carousel.js.map +0 -1
  32. package/plugins/cesium-vue/dist/components/card-content.js.map +0 -1
  33. package/plugins/cesium-vue/dist/components/card-page.js.map +0 -1
  34. package/plugins/cesium-vue/dist/components/carousel-img.js.map +0 -1
  35. package/plugins/cesium-vue/dist/components/echarts-pro.js.map +0 -1
  36. package/plugins/cesium-vue/dist/components/marker-bubble.js.map +0 -1
  37. package/plugins/cesium-vue/dist/components/marker-default.js.map +0 -1
  38. package/plugins/cesium-vue/dist/components/marker-html.js.map +0 -1
  39. package/plugins/cesium-vue/dist/components/marker-manage.js.map +0 -1
  40. package/plugins/cesium-vue/dist/components/marker-text.js.map +0 -1
  41. package/plugins/cesium-vue/dist/components/measurement.js.map +0 -1
  42. package/plugins/cesium-vue/dist/components/position-picker.js.map +0 -1
  43. package/plugins/cesium-vue/dist/create-DynflqE1.js.map +0 -1
  44. package/plugins/cesium-vue/dist/index-2u2tr1fF.js +0 -1457
  45. package/plugins/cesium-vue/dist/index-CUs_hd1V.js +0 -404
  46. package/plugins/cesium-vue/dist/index-CUs_hd1V.js.map +0 -1
  47. package/plugins/cesium-vue/dist/index-Kdqw0FJN.js +0 -45856
  48. package/plugins/cesium-vue/dist/index-Kdqw0FJN.js.map +0 -1
  49. package/plugins/cesium-vue/dist/index-Kqi_S6KA.js.map +0 -1
  50. package/plugins/cesium-vue/dist/index-McKGafjp.js +0 -45856
  51. package/plugins/cesium-vue/dist/index-McKGafjp.js.map +0 -1
  52. package/plugins/cesium-vue/dist/index.js.map +0 -1
@@ -1,1457 +0,0 @@
1
- import { p as ft, c as we, w as le } from "./create-DynflqE1.js";
2
- import { defineComponent as se, computed as g, openBlock as I, createElementBlock as k, normalizeStyle as $, normalizeClass as L, unref as M, toDisplayString as gt, createCommentVNode as ee, createElementVNode as Le, h as O, markRaw as E, render as K, inject as mt, onMounted as Se, watch as Y, onUnmounted as ht, renderSlot as dt, ref as G, nextTick as yt, onBeforeUnmount as pt, createBlock as bt, resolveDynamicComponent as vt } from "vue";
3
- import { MaterialManager as Pe, MarkerEventBus as te, HtmlOverlayLabelPool as pe, BufferedHierarchicalAggregator as xt, EntityLayerManager as Ct, getPolylineFlowMaterialProperty as Mt, getDynamicImgMaterial as Tt, getWallMaterial as Oe, MarkerEventKey as Q } from "leiting-bim/plugins-methods";
4
- import { CxCardCarousel as be } from "./components/card-carousel.js";
5
- import { CxMarkerBubbleLine as Ee, CxMarkerBubble as Ie } from "./components/marker-bubble.js";
6
- import { CxMarkerDefault as re } from "./components/marker-default.js";
7
- import { CxMarkerHtml as wt } from "./components/marker-html.js";
8
- import { CxMarkerText as _e } from "./components/marker-text.js";
9
- import { i as ce, b as Ae, a as S, S as z, d as ve, c as ue, e as Ne, f as Lt, g as ke, M as De, h as ae, j as St, k as Pt, l as Ot, m as He, n as Fe, o as Et, p as It, q as _t, r as At, s as Nt, t as We, u as kt, v as Dt, w as Ht, x as Ft } from "./index-2sxRAf1D.js";
10
- const Wt = {
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
- }, Rt = /* @__PURE__ */ se({
17
- name: `${ft}-marker-svg`,
18
- __name: "MarkerSvg",
19
- props: Wt,
20
- setup(t) {
21
- const e = t, r = we("marker"), a = (u, d, b, p) => {
22
- const T = Number(u);
23
- return Number.isFinite(T) ? Math.min(p, Math.max(b, T)) : d;
24
- }, n = g(() => a(e.svg.height, 48, 16, 160)), o = g(() => a(e.svg.width, n.value, 1, 320)), i = g(() => a(e.textGap, 8, 0, 80)), s = g(
25
- () => ["top", "bottom", "left", "right"].includes(e.textPosition) ? e.textPosition : "top"
26
- ), c = g(() => ({
27
- width: `${o.value}px`,
28
- height: `${n.value}px`
29
- })), f = g(() => ({
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 = g(() => ({
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, d) => (I(), k("div", {
55
- class: L(M(r).b("svg")),
56
- style: $(c.value)
57
- }, [
58
- u.text && u.textStyle.display !== "none" ? (I(), k("span", {
59
- key: 0,
60
- class: L(M(r).be("svg", "text")),
61
- style: $(l.value)
62
- }, gt(u.text), 7)) : ee("", !0),
63
- Le("span", {
64
- class: L(M(r).be("svg", "image")),
65
- style: $(f.value),
66
- "aria-hidden": "true"
67
- }, null, 6)
68
- ], 6));
69
- }
70
- }), Re = le(Rt), Bt = {
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 || {}), Gt = "[object Symbol]";
82
- function fe(t) {
83
- return typeof t == "symbol" || ce(t) && Ae(t) == Gt;
84
- }
85
- function Be(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 xe = z ? z.prototype : void 0, Ce = xe ? xe.toString : void 0;
91
- function Ge(t) {
92
- if (typeof t == "string")
93
- return t;
94
- if (S(t))
95
- return Be(t, Ge) + "";
96
- if (fe(t))
97
- return Ce ? Ce.call(t) : "";
98
- var e = t + "";
99
- return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
100
- }
101
- function $e(t) {
102
- return t;
103
- }
104
- function $t(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 Kt = 800, Xt = 16, Yt = Date.now;
118
- function zt(t) {
119
- var e = 0, r = 0;
120
- return function() {
121
- var a = Yt(), n = Xt - (a - r);
122
- if (r = a, n > 0) {
123
- if (++e >= Kt)
124
- return arguments[0];
125
- } else
126
- e = 0;
127
- return t.apply(void 0, arguments);
128
- };
129
- }
130
- function Vt(t) {
131
- return function() {
132
- return t;
133
- };
134
- }
135
- var Ut = ve ? function(t, e) {
136
- return ve(t, "toString", {
137
- configurable: !0,
138
- enumerable: !1,
139
- value: Vt(e),
140
- writable: !0
141
- });
142
- } : $e, Ke = zt(Ut), Me = Math.max;
143
- function Xe(t, e, r) {
144
- return e = Me(e === void 0 ? t.length - 1 : e, 0), function() {
145
- for (var a = arguments, n = -1, o = Me(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), $t(t, this, s);
151
- };
152
- }
153
- function qt(t, e) {
154
- return Ke(Xe(t, e, $e), t + "");
155
- }
156
- function jt(t, e, r) {
157
- if (!ue(r))
158
- return !1;
159
- var a = typeof e;
160
- return (a == "number" ? Ne(r) && Lt(e, r.length) : a == "string" && e in r) ? ke(r[e], t) : !1;
161
- }
162
- function Zt(t) {
163
- return qt(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 Jt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Qt = /^\w*$/;
173
- function er(t, e) {
174
- if (S(t))
175
- return !1;
176
- var r = typeof t;
177
- return r == "number" || r == "symbol" || r == "boolean" || t == null || fe(t) ? !0 : Qt.test(t) || !Jt.test(t) || e != null && t in Object(e);
178
- }
179
- var tr = "Expected a function";
180
- function ge(t, e) {
181
- if (typeof t != "function" || e != null && typeof e != "function")
182
- throw new TypeError(tr);
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 (ge.Cache || De)(), r;
191
- }
192
- ge.Cache = De;
193
- var rr = 500;
194
- function ar(t) {
195
- var e = ge(t, function(a) {
196
- return r.size === rr && r.clear(), a;
197
- }), r = e.cache;
198
- return e;
199
- }
200
- var nr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ir = /\\(\\)?/g, or = ar(function(t) {
201
- var e = [];
202
- return t.charCodeAt(0) === 46 && e.push(""), t.replace(nr, function(r, a, n, o) {
203
- e.push(n ? o.replace(ir, "$1") : a || r);
204
- }), e;
205
- });
206
- function lr(t) {
207
- return t == null ? "" : Ge(t);
208
- }
209
- function me(t, e) {
210
- return S(t) ? t : er(t, e) ? [t] : or(lr(t));
211
- }
212
- function ne(t) {
213
- if (typeof t == "string" || fe(t))
214
- return t;
215
- var e = t + "";
216
- return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
217
- }
218
- function sr(t, e) {
219
- e = me(e, t);
220
- for (var r = 0, a = e.length; t != null && r < a; )
221
- t = t[ne(e[r++])];
222
- return r && r == a ? t : void 0;
223
- }
224
- var Te = z ? z.isConcatSpreadable : void 0;
225
- function cr(t) {
226
- return S(t) || ae(t) || !!(Te && t && t[Te]);
227
- }
228
- function ur(t, e, r, a, n) {
229
- var o = -1, i = t.length;
230
- for (r || (r = cr), n || (n = []); ++o < i; ) {
231
- var s = t[o];
232
- r(s) ? St(n, s) : n[n.length] = s;
233
- }
234
- return n;
235
- }
236
- function fr(t) {
237
- var e = t == null ? 0 : t.length;
238
- return e ? ur(t) : [];
239
- }
240
- function gr(t) {
241
- return Ke(Xe(t, void 0, fr), t + "");
242
- }
243
- var mr = "[object Object]", hr = Function.prototype, dr = Object.prototype, Ye = hr.toString, yr = dr.hasOwnProperty, pr = Ye.call(Object);
244
- function ze(t) {
245
- if (!ce(t) || Ae(t) != mr)
246
- return !1;
247
- var e = Pt(t);
248
- if (e === null)
249
- return !0;
250
- var r = yr.call(e, "constructor") && e.constructor;
251
- return typeof r == "function" && r instanceof r && Ye.call(r) == pr;
252
- }
253
- function br(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 vr(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 xr = vr();
271
- function ie(t, e, r) {
272
- (r !== void 0 && !ke(t[e], r) || r === void 0 && !(e in t)) && Ot(t, e, r);
273
- }
274
- function Cr(t) {
275
- return ce(t) && Ne(t);
276
- }
277
- function oe(t, e) {
278
- if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
279
- return t[e];
280
- }
281
- function Mr(t) {
282
- return He(t, Fe(t));
283
- }
284
- function Tr(t, e, r, a, n, o, i) {
285
- var s = oe(t, r), c = oe(e, r), f = i.get(c);
286
- if (f) {
287
- ie(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 d = S(c), b = !d && Et(c), p = !d && !b && It(c);
293
- l = c, d || b || p ? S(s) ? l = s : Cr(s) ? l = _t(s) : b ? (u = !1, l = At(c, !0)) : p ? (u = !1, l = Nt(c, !0)) : l = [] : ze(c) || ae(c) ? (l = s, ae(s) ? l = Mr(s) : (!ue(s) || We(s)) && (l = kt(c))) : u = !1;
294
- }
295
- u && (i.set(c, l), n(l, c, a, o, i), i.delete(c)), ie(t, r, l);
296
- }
297
- function Ve(t, e, r, a, n) {
298
- t !== e && xr(e, function(o, i) {
299
- if (n || (n = new Dt()), ue(o))
300
- Tr(t, e, i, r, Ve, a, n);
301
- else {
302
- var s = a ? a(oe(t, i), o, i + "", t, e, n) : void 0;
303
- s === void 0 && (s = o), ie(t, i, s);
304
- }
305
- }, Fe);
306
- }
307
- function wr(t) {
308
- var e = t == null ? 0 : t.length;
309
- return e ? t[e - 1] : void 0;
310
- }
311
- function Lr(t, e) {
312
- return e.length < 2 ? t : sr(t, br(e, 0, -1));
313
- }
314
- var Sr = Zt(function(t, e, r) {
315
- Ve(t, e, r);
316
- }), Pr = Object.prototype, Or = Pr.hasOwnProperty;
317
- function Er(t, e) {
318
- e = me(e, t);
319
- var r = -1, a = e.length;
320
- if (!a)
321
- return !0;
322
- for (; ++r < a; ) {
323
- var n = ne(e[r]);
324
- if (n === "__proto__" && !Or.call(t, "__proto__") || (n === "constructor" || n === "prototype") && r < a - 1)
325
- return !1;
326
- }
327
- var o = Lr(t, e);
328
- return o == null || delete o[ne(wr(e))];
329
- }
330
- function Ir(t) {
331
- return ze(t) ? void 0 : t;
332
- }
333
- var _r = 1, Ar = 2, Nr = 4, kr = gr(function(t, e) {
334
- var r = {};
335
- if (t == null)
336
- return r;
337
- var a = !1;
338
- e = Be(e, function(o) {
339
- return o = me(o, t), a || (a = o.length > 1), o;
340
- }), He(t, Ht(t), r), a && (r = Ft(r, _r | Ar | Nr, Ir));
341
- for (var n = e.length; n--; )
342
- Er(r, e[n]);
343
- return r;
344
- });
345
- class Dr {
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 Pe(), 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 te()), a || (a = new te());
359
- const s = new pe(n, o, this.labelId, r);
360
- s.setOcclusionOptions({ distanceEpsilon: 1 }), s.setOcclusionEnabled(!1);
361
- const c = new pe(n, o, this.cardId, a, !1), f = new xt(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 Ct(
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
- S(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
- S(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 = Sr({}, 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
- S(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 _ = {
455
- wallTileWidth: 2,
456
- wallTileHeight: 1,
457
- polygonTileWidth: 2,
458
- polygonTileHeight: 2
459
- };
460
- function h(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 Hr(t, e) {
468
- return Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : e;
469
- }
470
- function Fr(t) {
471
- const e = t?.repeat;
472
- if (Array.isArray(e) && e.length >= 2)
473
- return {
474
- x: C(h(e[0], 1)),
475
- y: C(h(e[1], 1))
476
- };
477
- if (e && typeof e == "object")
478
- return {
479
- x: C(h(e.x, 1)),
480
- y: C(h(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 Ue(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
- h(o[0], 0),
497
- h(o[1], 0),
498
- h(o[2], 0)
499
- ), c = t.Cartesian3.fromDegrees(
500
- h(i[0], 0),
501
- h(i[1], 0),
502
- h(i[2], 0)
503
- );
504
- a += t.Cartesian3.distance(s, c);
505
- }
506
- return a > 0 ? a : 1;
507
- }
508
- function qe(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(h(t?.minHeight, 0)), n = Math.abs(h(t?.maxHeight, 0));
519
- return a > 0 || n > 0 ? a + n : 3;
520
- }
521
- function je(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)), d = l * f * Math.cos(t.Math.toRadians(c)), b = u * f;
535
- return {
536
- width: d > 0 ? d : 1,
537
- height: b > 0 ? b : 1
538
- };
539
- }
540
- function Ze({
541
- Cesium: t,
542
- themeOptions: e,
543
- entityOptions: r,
544
- category: a
545
- }) {
546
- const n = Fr(e);
547
- if (n) return n;
548
- if (e?.autoRepeat === !1)
549
- return { x: 1, y: 1 };
550
- if (a === "wall") {
551
- const c = Ue(t, r), f = qe(r), l = h(
552
- e?.tileWidth ?? e?.textureWidth,
553
- _.wallTileWidth
554
- ), u = h(
555
- e?.tileHeight ?? e?.textureHeight,
556
- _.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 = je(t, r), i = h(
564
- e?.tileWidth ?? e?.textureWidth,
565
- _.polygonTileWidth
566
- ), s = h(
567
- e?.tileHeight ?? e?.textureHeight,
568
- _.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 = Ue(t, r), u = qe(r), d = h(
588
- e?.tileWidth ?? e?.textureWidth,
589
- _.wallTileWidth
590
- ), b = h(
591
- e?.tileHeight ?? e?.textureHeight,
592
- _.wallTileHeight
593
- ), p = n === "vertical" ? u / Math.max(b, 0.01) : l / Math.max(d, 0.01);
594
- return C(Number(p.toFixed(2)));
595
- }
596
- const i = je(t, r), s = h(
597
- e?.tileWidth ?? e?.textureWidth,
598
- _.polygonTileWidth
599
- ), c = h(
600
- e?.tileHeight ?? e?.textureHeight,
601
- _.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 Qe(t) {
610
- const e = String(t?.wallVerticalMode ?? t?.verticalMode ?? "stretch");
611
- return e === "repeat" || e === "bottom" || e === "stretch" ? e : "stretch";
612
- }
613
- function Wr({
614
- Cesium: t,
615
- themeOptions: e,
616
- entityOptions: r
617
- }) {
618
- const a = Ze({
619
- Cesium: t,
620
- themeOptions: e,
621
- entityOptions: r,
622
- category: "wall"
623
- });
624
- return Qe(e) === "repeat" ? a : { x: a.x, y: 1 };
625
- }
626
- function Rr(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 Br({
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 = Mt(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 = Tt(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 Gr({
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 = Ze({
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 Oe(t, {
802
- image: e.img,
803
- color: t.Color.fromCssColorString(n?.color || "#ffffff"),
804
- duration: h(n?.duration, 5e3),
805
- freely: i,
806
- direction: n?.direction || "+",
807
- count: s
808
- });
809
- })
810
- });
811
- }
812
- }
813
- }
814
- function $r({
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 = Qe(n), s = Wr({
829
- Cesium: t,
830
- themeOptions: n,
831
- entityOptions: o
832
- });
833
- if (i === "bottom") {
834
- const c = Hr(
835
- h(n?.bottomHeightRatio, 0.3),
836
- 0.3
837
- );
838
- return Rr(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 Oe(t, {
867
- image: e.img,
868
- color: t.Color.fromCssColorString(n?.color || "#ffffff"),
869
- duration: h(n?.duration, 5e3),
870
- freely: i,
871
- direction: n?.direction || "+",
872
- count: s
873
- });
874
- })
875
- });
876
- }
877
- }
878
- }
879
- class Kr extends Dr {
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 Pe(),
893
- aggregatorOptions: f
894
- } = e, l = [...n], u = [...o], d = [...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 te()
907
- };
908
- super(p), this.opt = { ...this.opt, ...p }, this.initTagListener(this.instance.eventBus, this.opt), this.loadTabThemeConfig(l), this.loadLineThemeConfig(u), this.loadCardThemeConfig(d), 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
- Br({
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
- Gr({
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
- $r({
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 = O(E(be), {
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 = O(E(be), {
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 = kr(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 = O(E(re), {
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 = O(E(wt), f);
1170
- else if (e.comType == 5 || e.comType == 8) {
1171
- const l = i?.options || {}, u = e?.data?.options || {}, d = 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 ? Ee : Ie;
1172
- c = O(E(T), {
1173
- ...f,
1174
- pixelOffset: d,
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 = a(o.data);
1182
- A?.options && (A.options.otherOffset = x), l.onSetOtherOffset?.(x), e?.onSetOtherOffset?.(o.data, x);
1183
- },
1184
- onSetLineStake: (x) => {
1185
- const A = a(o.data);
1186
- A?.options && (A.options.lineStake = x), l.onSetLineStake?.(x), e?.onSetLineStake?.(o.data, x);
1187
- }
1188
- });
1189
- } else e.comType == 6 || e.comType == 7 ? c = O(E(_e), {
1190
- text: f.text,
1191
- textStyle: f.textStyle
1192
- }) : e.comType == 9 ? c = O(E(Re), {
1193
- text: f.text,
1194
- svg: f.svg,
1195
- textStyle: f.textStyle,
1196
- textPosition: f.textPosition || "top",
1197
- textGap: f.textGap
1198
- }) : c = O(E(re), 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(Q.Click, {
1210
- name: "marker:click",
1211
- fn: (o) => {
1212
- r.runListener?.(X.标记左键点击, o.data), We(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(Q.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(Q.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 Xr = /* @__PURE__ */ se({
1264
- __name: "MarkerManage",
1265
- props: Bt,
1266
- emits: ["register", "load", "marker-event"],
1267
- setup(t, { expose: e, emit: r }) {
1268
- const a = t, n = r, o = mt("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: (d, b, ...p) => {
1278
- n("marker-event", { key: d, data: b, args: p });
1279
- }
1280
- };
1281
- return !u.Cesium || !u.viewer ? null : (i = new Kr(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?.(), d = l?.getViewer?.();
1304
- u && d ? s({ Cesium: u, viewer: d, methods: l }) : a.Cesium && a.viewer && s({ methods: l });
1305
- }
1306
- return Se(() => {
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
- ), ht(() => {
1320
- }), (l, u) => dt(l.$slots, "default");
1321
- }
1322
- }), Yr = /* @__PURE__ */ se({
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 = we("marker"), o = G(), i = G(), s = g(() => r.config?.data?.options || {}), c = g(() => Number(r.config?.comType ?? 2)), f = g(() => c.value === 5 ? Ie : c.value === 8 ? Ee : [6, 7].includes(c.value) ? _e : c.value === 9 ? Re : re), l = g(() => c.value === 2), u = g(() => r.img ?? s.value.img ?? r.config?.img ?? ""), d = g(() => s.value.textStyle || {}), b = g(() => s.value.imgStyle || {}), p = g(() => s.value.lineStyle || {}), T = g(() => s.value.svg || {}), x = g(() => String(s.value.textPosition || "top")), A = g(() => Number(s.value.textGap ?? 8)), U = g(() => r.config?.data?.pixelOffset || { x: 0, y: 0 }), et = g(() => s.value.otherOffset || { x: 0, y: 0 }), tt = g(
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), D = G({ scale: 1, shiftX: 0, shiftY: 0 }), rt = g(() => ({
1341
- transform: `translate(${D.value.shiftX}px, ${D.value.shiftY}px) scale(${D.value.scale})`,
1342
- visibility: R.value || l.value && (!u.value || !B.value) ? "hidden" : "visible"
1343
- })), q = g(
1344
- () => r.offsetSelectable && c.value === 2 && !!u.value && B.value
1345
- ), at = g(() => {
1346
- const y = Number(U.value.x), m = Number(U.value.y);
1347
- return {
1348
- left: `${Number.isFinite(y) ? -y : 0}px`,
1349
- top: `${Number.isFinite(m) ? -m : 0}px`
1350
- };
1351
- });
1352
- function he() {
1353
- if (!o.value || !i.value || o.value.clientWidth <= 0 || o.value.clientHeight <= 0) return;
1354
- const y = 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 (!y.length) return;
1356
- const m = D.value.scale, w = i.value.getBoundingClientRect(), N = Math.min(...y.map((v) => v.left)), F = Math.max(...y.map((v) => v.right)), W = Math.min(...y.map((v) => v.top)), ye = Math.max(...y.map((v) => v.bottom)), lt = (F - N) / m, st = (ye - W) / m, J = Math.min(
1357
- 1,
1358
- Math.max(1, o.value.clientWidth - 8) / Math.max(lt, 1),
1359
- Math.max(1, o.value.clientHeight - 8) / Math.max(st, 1)
1360
- ), ct = (N + F - w.left - w.right) / 2 / m, ut = (W + ye - w.top - w.bottom) / 2 / m;
1361
- D.value = { scale: J, shiftX: -ct * J, shiftY: -ut * J };
1362
- }
1363
- function nt(y) {
1364
- const m = y.target;
1365
- !(m instanceof HTMLImageElement) || !i.value?.contains(m) || (B.value = !0, R.value = !1, a("imageSize", m.naturalHeight > 0 ? m.naturalWidth / m.naturalHeight : void 0), Z());
1366
- }
1367
- function it(y) {
1368
- !(y.target instanceof HTMLImageElement) || !i.value?.contains(y.target) || (R.value = !0, a("imageSize", void 0));
1369
- }
1370
- function ot(y) {
1371
- if (!q.value || !i.value) return;
1372
- const m = i.value.querySelector(`.${n.b("default")}`);
1373
- if (!m) return;
1374
- const w = m.getBoundingClientRect(), N = D.value.scale || 1, F = (y.clientX - w.left) / N, W = (y.clientY - w.top) / N;
1375
- F < 0 || W < 0 || F > w.width / N || W > w.height / N || a("pixelOffsetSelect", { x: -Math.round(F), y: -Math.round(W) });
1376
- }
1377
- Y(
1378
- u,
1379
- () => {
1380
- B.value = !1, R.value = !1, a("imageSize", void 0);
1381
- },
1382
- { flush: "sync" }
1383
- );
1384
- let H, j = /* @__PURE__ */ new Set(), P;
1385
- function Z() {
1386
- P !== void 0 && cancelAnimationFrame(P), P = requestAnimationFrame(() => {
1387
- P = void 0, he(), P = requestAnimationFrame(() => {
1388
- P = void 0, he();
1389
- });
1390
- });
1391
- }
1392
- function de() {
1393
- const y = new Set(Array.from(i.value?.querySelectorAll("*") || []));
1394
- for (const m of j) y.has(m) || H?.unobserve(m);
1395
- for (const m of y) j.has(m) || H?.observe(m);
1396
- j = y, Z();
1397
- }
1398
- return Y(tt, () => yt(de)), Se(() => {
1399
- H = new ResizeObserver(Z), o.value && H.observe(o.value), i.value && H.observe(i.value), de();
1400
- }), pt(() => {
1401
- H?.disconnect(), P !== void 0 && cancelAnimationFrame(P);
1402
- }), (y, m) => (I(), k("div", {
1403
- ref_key: "host",
1404
- ref: o,
1405
- class: L([M(n).b("preview"), q.value ? M(n).bm("preview", "offset-picker") : ""]),
1406
- "aria-hidden": "true"
1407
- }, [
1408
- R.value ? (I(), k("div", {
1409
- key: 0,
1410
- class: L(M(n).be("preview", "message"))
1411
- }, "图片不可用", 2)) : l.value && !u.value ? (I(), k("div", {
1412
- key: 1,
1413
- class: L(M(n).be("preview", "message"))
1414
- }, "请选择图片", 2)) : l.value && !B.value ? (I(), k("div", {
1415
- key: 2,
1416
- class: L(M(n).be("preview", "message"))
1417
- }, "图片加载中…", 2)) : ee("", !0),
1418
- Le("div", {
1419
- ref_key: "content",
1420
- ref: i,
1421
- class: L(M(n).be("preview", "content")),
1422
- style: $(rt.value),
1423
- onLoadCapture: nt,
1424
- onErrorCapture: it,
1425
- onClick: ot
1426
- }, [
1427
- (I(), bt(vt(f.value), {
1428
- key: u.value,
1429
- text: t.text,
1430
- img: u.value,
1431
- "text-style": d.value,
1432
- "img-style": b.value,
1433
- "line-style": p.value,
1434
- "pixel-offset": U.value,
1435
- "other-offset": et.value,
1436
- svg: T.value,
1437
- "text-position": x.value,
1438
- "text-gap": A.value
1439
- }, null, 8, ["text", "img", "text-style", "img-style", "line-style", "pixel-offset", "other-offset", "svg", "text-position", "text-gap"])),
1440
- q.value ? (I(), k("span", {
1441
- key: 0,
1442
- class: L(M(n).be("preview", "anchor")),
1443
- style: $(at.value)
1444
- }, null, 6)) : ee("", !0)
1445
- ], 38)
1446
- ], 2));
1447
- }
1448
- }), ta = le(Xr), ra = le(Yr);
1449
- export {
1450
- Re as C,
1451
- Dr as M,
1452
- X as R,
1453
- ta as a,
1454
- ra as b,
1455
- Kr as c,
1456
- Bt as m
1457
- };