@skzz/components-gis 0.1.3 → 0.1.5

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 (33) hide show
  1. package/dist/assets/twinPreviewWorker-COILIqOa.js +1 -0
  2. package/dist/color-DVYdxZow.js +359 -0
  3. package/dist/esm-BXiGX6xE.js +86 -0
  4. package/dist/index.css +1 -1
  5. package/dist/index.d.ts +71 -6
  6. package/dist/index.es.js +1138 -9563
  7. package/dist/index.umd.js +5 -5
  8. package/dist/interpolation-Ctw2-y9G.js +211 -0
  9. package/dist/layerStack-CbiVJONn.js +181 -0
  10. package/dist/pako.esm-D6zcBi67.js +1455 -0
  11. package/dist/query-DgSNPfJM.js +239 -0
  12. package/dist/queryPoint-BOi_hkig.js +189 -0
  13. package/dist/zz-3dtiles-BzDYB-tW.js +75 -0
  14. package/dist/zz-gltf-BDHxqQjs.js +70 -0
  15. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsCacheUtils.d.ts +53 -0
  16. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsRenderer.d.ts +96 -12
  17. package/dist/zz-layer/zz-layer-zzts/zztsRasterCacheUtils.d.ts +35 -0
  18. package/dist/zz-layer/zz-layer-zzts/zztsRasterPreviewPolling.d.ts +10 -0
  19. package/dist/zz-layer/zz-layer-zzts3dv2/index.vue.d.ts +1 -0
  20. package/dist/zz-layer/zz-layer-zzts3dv2/twinPreviewWorker.d.ts +1 -0
  21. package/dist/zz-layer-geojson-CtTpn_f9.js +867 -0
  22. package/dist/zz-layer-mvt-R1-GwSIW.js +609 -0
  23. package/dist/zz-layer-shp-zzts-D8BjI5tI.js +1323 -0
  24. package/dist/zz-layer-zzts3d-DqZmLdW3.js +835 -0
  25. package/dist/zz-layer-zzts3d-grid-CTHFZBpo.js +314 -0
  26. package/dist/zz-layer-zzts3d-las-hNa-nqxq.js +560 -0
  27. package/dist/zz-layer-zzts3d-point-DrB5Uuwa.js +750 -0
  28. package/dist/zz-layer-zzts3dtype-BRl3mCk9.js +493 -0
  29. package/dist/zz-layer-zzts3dv2-D5udnVGT.js +913 -0
  30. package/dist/zz-terrain-excavation-A2NXSQ5P.js +502 -0
  31. package/dist/zz-viewer/index.vue.d.ts +2 -2
  32. package/dist/zzts3dLayerSignature-Cnu6KIys.js +42 -0
  33. package/package.json +2 -2
@@ -0,0 +1,560 @@
1
+ import { t as e } from "./pako.esm-D6zcBi67.js";
2
+ import { computed as t, onUnmounted as n, watch as r } from "vue";
3
+ import { httpService as i } from "@skzz/libs-base";
4
+ import a from "axios";
5
+ //#region src/zz-layer/zz-layer-zzts3d-las/lasTileUtils.js
6
+ var o = 30, s = 6378137, c = 1 / 298.257223563, l = 2 * c - c * c;
7
+ function u(e) {
8
+ return e instanceof ArrayBuffer ? e : ArrayBuffer.isView(e) ? e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength) : null;
9
+ }
10
+ function d(e, t, n) {
11
+ let r = Math.atan2(t, e), i = Math.sqrt(e * e + t * t), a = Math.atan2(n, i * (1 - l)), o = 0;
12
+ for (let e = 0; e < 10; e++) {
13
+ let e = Math.sin(a), t = s / Math.sqrt(1 - l * e * e);
14
+ o = i / Math.cos(a) - t;
15
+ let r = a;
16
+ if (a = Math.atan2(n, i * (1 - l * t / (t + o))), Math.abs(a - r) < 1e-12) break;
17
+ }
18
+ return [
19
+ (r * 180 / Math.PI + 540) % 360 - 180,
20
+ a * 180 / Math.PI,
21
+ o
22
+ ];
23
+ }
24
+ function f(t) {
25
+ let n = u(t);
26
+ if (!n || n.byteLength < 4) return null;
27
+ let r = new DataView(n), i = 0, a = r.getInt32(i, !0);
28
+ if (i += 4, a <= 0 || a > 1e4) return console.warn("[zzts3d-las] invalid blob count:", a), null;
29
+ let s = 0, c = [];
30
+ for (let t = 0; t < a; t++) {
31
+ if (i + 4 > n.byteLength) return console.warn("[zzts3d-las] missing blob length at offset", i), null;
32
+ let t = r.getInt32(i, !0);
33
+ if (i += 4, t <= 0 || i + t > n.byteLength) return console.warn("[zzts3d-las] invalid blob length:", t), null;
34
+ let a = r.getUint8(i), l = a === 0 || a === 1, u = l ? a : 0, d = l ? i + 1 : i, f = l ? t - 1 : t;
35
+ i += t;
36
+ let p = new Uint8Array(n, d, f), m;
37
+ if (u === 1) try {
38
+ m = e.ungzip(p);
39
+ } catch (e) {
40
+ return console.warn("[zzts3d-las] gzip inflate failed:", e), null;
41
+ }
42
+ else m = p;
43
+ let h = new DataView(m.buffer, m.byteOffset, 4).getInt32(0, !0);
44
+ h > 0 && h * o + 4 <= m.byteLength && (s += h, c.push({
45
+ raw: m,
46
+ pointCount: h
47
+ }));
48
+ }
49
+ if (s === 0) return null;
50
+ let l = new Float64Array(s * 3), f = new Float32Array(s), p = new Uint8Array(s * 3), m = new Uint16Array(s), h = new Uint8Array(s), g = Infinity, _ = -Infinity, v = Infinity, y = -Infinity, b = Infinity, x = -Infinity, S = !1, C = 0;
51
+ for (let e of c) {
52
+ let t = new DataView(e.raw.buffer, e.raw.byteOffset, e.raw.byteLength), n = 4;
53
+ for (let r = 0; r < e.pointCount; r++) {
54
+ let e = t.getFloat64(n, !0);
55
+ n += 8;
56
+ let r = t.getFloat64(n, !0);
57
+ n += 8;
58
+ let i = t.getFloat64(n, !0);
59
+ n += 8;
60
+ let a = t.getUint8(n);
61
+ n += 1;
62
+ let o = t.getUint8(n);
63
+ n += 1;
64
+ let s = t.getUint8(n);
65
+ n += 1;
66
+ let c = t.getUint16(n, !0);
67
+ n += 2;
68
+ let u = t.getUint8(n);
69
+ n += 1, l[C * 3] = e, l[C * 3 + 1] = r, l[C * 3 + 2] = i, p[C * 3] = a, p[C * 3 + 1] = o, p[C * 3 + 2] = s, m[C] = c, h[C] = u;
70
+ let [w, T, E] = d(e, r, i);
71
+ f[C] = E, g = Math.min(g, w), _ = Math.max(_, w), v = Math.min(v, T), y = Math.max(y, T), b = Math.min(b, E), x = Math.max(x, E), (a !== 128 || o !== 128 || s !== 128) && (S = !0), C++;
72
+ }
73
+ }
74
+ return {
75
+ positions: l,
76
+ heights: f,
77
+ rgb: p,
78
+ intensity: m,
79
+ classification: h,
80
+ pointCount: s,
81
+ hasRgb: S,
82
+ minLon: g,
83
+ maxLon: _,
84
+ minLat: v,
85
+ maxLat: y,
86
+ minH: b,
87
+ maxH: x
88
+ };
89
+ }
90
+ function p() {
91
+ return {
92
+ positions: new Float64Array(),
93
+ heights: new Float32Array(),
94
+ rgb: new Uint8Array(),
95
+ intensity: new Uint16Array(),
96
+ classification: new Uint8Array(),
97
+ pointCount: 0,
98
+ hasRgb: !1,
99
+ minLon: 0,
100
+ maxLon: 0,
101
+ minLat: 0,
102
+ maxLat: 0,
103
+ minH: 0,
104
+ maxH: 0
105
+ };
106
+ }
107
+ function m(e) {
108
+ if (!e || e.length === 0) return p();
109
+ if (e.length === 1) return e[0];
110
+ let t = e.reduce((e, t) => e + t.pointCount, 0), n = new Float64Array(t * 3), r = new Float32Array(t), i = new Uint8Array(t * 3), a = new Uint16Array(t), o = new Uint8Array(t), s = 0;
111
+ for (let t of e) n.set(t.positions, s * 3), r.set(t.heights, s), i.set(t.rgb, s * 3), a.set(t.intensity, s), o.set(t.classification, s), s += t.pointCount;
112
+ return {
113
+ positions: n,
114
+ heights: r,
115
+ rgb: i,
116
+ intensity: a,
117
+ classification: o,
118
+ pointCount: t,
119
+ hasRgb: e.some((e) => e.hasRgb),
120
+ minLon: Math.min(...e.map((e) => e.minLon)),
121
+ maxLon: Math.max(...e.map((e) => e.maxLon)),
122
+ minLat: Math.min(...e.map((e) => e.minLat)),
123
+ maxLat: Math.max(...e.map((e) => e.maxLat)),
124
+ minH: Math.min(...e.map((e) => e.minH)),
125
+ maxH: Math.max(...e.map((e) => e.maxH))
126
+ };
127
+ }
128
+ //#endregion
129
+ //#region src/zz-layer/zz-layer-zzts3d-las/entityGrid.js
130
+ var h = 3e5, g = 4, _ = 3, v = [
131
+ 74,
132
+ 144,
133
+ 217
134
+ ];
135
+ function y(e) {
136
+ switch (e) {
137
+ case 2: return [
138
+ 139,
139
+ 110,
140
+ 70
141
+ ];
142
+ case 3: return [
143
+ 120,
144
+ 190,
145
+ 100
146
+ ];
147
+ case 4: return [
148
+ 90,
149
+ 170,
150
+ 80
151
+ ];
152
+ case 5: return [
153
+ 50,
154
+ 140,
155
+ 60
156
+ ];
157
+ case 6: return [
158
+ 230,
159
+ 90,
160
+ 90
161
+ ];
162
+ case 9: return [
163
+ 70,
164
+ 120,
165
+ 230
166
+ ];
167
+ case 10: return [
168
+ 160,
169
+ 120,
170
+ 200
171
+ ];
172
+ case 11: return [
173
+ 120,
174
+ 120,
175
+ 120
176
+ ];
177
+ case 1: return [
178
+ 80,
179
+ 80,
180
+ 80
181
+ ];
182
+ default: return [
183
+ 150,
184
+ 150,
185
+ 150
186
+ ];
187
+ }
188
+ }
189
+ function b(e) {
190
+ let t = [
191
+ [
192
+ 40,
193
+ 80,
194
+ 220
195
+ ],
196
+ [
197
+ 40,
198
+ 200,
199
+ 220
200
+ ],
201
+ [
202
+ 60,
203
+ 200,
204
+ 90
205
+ ],
206
+ [
207
+ 240,
208
+ 210,
209
+ 60
210
+ ],
211
+ [
212
+ 230,
213
+ 60,
214
+ 50
215
+ ]
216
+ ], n = Math.min(1, Math.max(0, e)) * (t.length - 1), r = Math.min(t.length - 2, Math.floor(n)), i = n - r;
217
+ return [
218
+ Math.round(t[r][0] + (t[r + 1][0] - t[r][0]) * i),
219
+ Math.round(t[r][1] + (t[r + 1][1] - t[r][1]) * i),
220
+ Math.round(t[r][2] + (t[r + 1][2] - t[r][2]) * i)
221
+ ];
222
+ }
223
+ function x(e, t, n) {
224
+ let r = e.pointCount, i = new Uint8Array(r * 4), a = Math.round(Math.min(1, Math.max(0, n)) * 255);
225
+ if (t === "rgb" && e.hasRgb) for (let t = 0; t < r; t++) {
226
+ let n = t * 3, r = t * 4;
227
+ i[r] = e.rgb[n], i[r + 1] = e.rgb[n + 1], i[r + 2] = e.rgb[n + 2], i[r + 3] = a;
228
+ }
229
+ else if (t === "intensity") {
230
+ let t = Infinity, n = -Infinity;
231
+ for (let i = 0; i < r; i++) {
232
+ let r = e.intensity[i];
233
+ r < t && (t = r), r > n && (n = r);
234
+ }
235
+ let o = Math.max(1, n - t);
236
+ for (let n = 0; n < r; n++) {
237
+ let r = b((e.intensity[n] - t) / o), s = n * 4;
238
+ i[s] = r[0], i[s + 1] = r[1], i[s + 2] = r[2], i[s + 3] = a;
239
+ }
240
+ } else if (t === "classification") for (let t = 0; t < r; t++) {
241
+ let n = y(e.classification[t]), r = t * 4;
242
+ i[r] = n[0], i[r + 1] = n[1], i[r + 2] = n[2], i[r + 3] = a;
243
+ }
244
+ else if (t === "height") {
245
+ let t = Math.max(.001, e.maxH - e.minH);
246
+ for (let n = 0; n < r; n++) {
247
+ let r = b((e.heights[n] - e.minH) / t), o = n * 4;
248
+ i[o] = r[0], i[o + 1] = r[1], i[o + 2] = r[2], i[o + 3] = a;
249
+ }
250
+ } else for (let e = 0; e < r; e++) {
251
+ let t = e * 4;
252
+ i[t] = v[0], i[t + 1] = v[1], i[t + 2] = v[2], i[t + 3] = a;
253
+ }
254
+ return i;
255
+ }
256
+ function S(e) {
257
+ return `
258
+ in float batchId;
259
+ in vec3 position3DHigh;
260
+ in vec3 position3DLow;
261
+ in vec4 color;
262
+ out vec4 v_color;
263
+ void main() {
264
+ vec4 positionEC = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow);
265
+ gl_Position = czm_projection * positionEC;
266
+ // pointSize 表示屏幕像素,不再除以相机距离(否则粗层全部退化 1px)
267
+ gl_PointSize = clamp(${Number(e).toFixed(2)}, 1.0, 12.0);
268
+ v_color = color;
269
+ }
270
+ `;
271
+ }
272
+ var C = "\n in vec4 v_color;\n void main() {\n vec2 coord = gl_PointCoord - vec2(0.5);\n if (dot(coord, coord) > 0.25) discard;\n out_FragColor = v_color;\n }\n";
273
+ function w(e) {
274
+ return new Cesium.Appearance({
275
+ translucent: !0,
276
+ vertexShaderSource: S(e),
277
+ fragmentShaderSource: C,
278
+ renderState: {
279
+ depthTest: { enabled: !0 },
280
+ depthMask: !0,
281
+ blending: Cesium.BlendingState.ALPHA_BLEND
282
+ }
283
+ });
284
+ }
285
+ var T = class {
286
+ constructor(e = {}) {
287
+ this.id = e.layerId, this.pointSize = e.pointSize ?? 2, this.opacity = e.opacity ?? 1, this.colorMode = e.colorMode ?? "auto", this.fixedLevel = e.level ?? null, this.currentPrimitives = [], this.visibleTileKeys = /* @__PURE__ */ new Set(), this.loading = !1, this.pendingRefresh = !1, this.renderGeneration = 0, this.destroyed = !1, this.handlers = null, this.initTimer = null, this.parsedData = null, this.activeColorMode = "single", this.cancelSource = null, this.requestVersion = 0;
288
+ }
289
+ async init() {
290
+ this.initTimer = setTimeout(() => {
291
+ this.destroyed || this.initHandler();
292
+ }, 400);
293
+ }
294
+ initHandler() {
295
+ if (this.loadViewportTiles(), this.handlers) try {
296
+ viewer.camera.changed.removeEventListener(this.handlers);
297
+ } catch {}
298
+ let e = null, t = () => {
299
+ clearTimeout(e), e = setTimeout(() => {
300
+ this.loadViewportTiles();
301
+ }, 250);
302
+ };
303
+ viewer.camera.changed.addEventListener(t), this.handlers = t;
304
+ }
305
+ remove() {
306
+ if (this.destroyed = !0, this.requestVersion++, this.initTimer &&= (clearTimeout(this.initTimer), null), this.handlers) {
307
+ try {
308
+ viewer.camera.changed.removeEventListener(this.handlers);
309
+ } catch {}
310
+ this.handlers = null;
311
+ }
312
+ this.cancelInFlight(), this.renderGeneration++, this.removeCurrentPrimitives(), this.visibleTileKeys.clear();
313
+ }
314
+ cancelInFlight() {
315
+ if (this.cancelSource) {
316
+ try {
317
+ this.cancelSource.cancel("layer removed");
318
+ } catch {}
319
+ this.cancelSource = null;
320
+ }
321
+ }
322
+ removeCurrentPrimitives() {
323
+ for (let e of this.currentPrimitives) e.isDestroyed?.() || viewer.scene.primitives.remove(e);
324
+ this.currentPrimitives = [];
325
+ }
326
+ isActiveRequest(e) {
327
+ return !this.destroyed && this.requestVersion === e;
328
+ }
329
+ getCameraRegion() {
330
+ let e = viewer.camera.computeViewRectangle(viewer.scene.globe.ellipsoid);
331
+ if (e) {
332
+ let t = Cesium.Math.toDegrees(e.west), n = Cesium.Math.toDegrees(e.south), r = Cesium.Math.toDegrees(e.east), i = Cesium.Math.toDegrees(e.north);
333
+ if (t < r && n < i) return [
334
+ t,
335
+ n,
336
+ 0,
337
+ r,
338
+ i,
339
+ 0
340
+ ];
341
+ }
342
+ let t = viewer.camera.positionCartographic;
343
+ if (!t) return null;
344
+ let n = Cesium.Math.toDegrees(t.longitude), r = Cesium.Math.toDegrees(t.latitude), i = Math.min(10, Math.max(.01, t.height / 111320 * 1.5));
345
+ return [
346
+ n - i,
347
+ Math.max(-89.99, r - i),
348
+ 0,
349
+ n + i,
350
+ Math.min(89.99, r + i),
351
+ 0
352
+ ];
353
+ }
354
+ async fetchTileWithRetry(e, t, n = _) {
355
+ let r;
356
+ for (let o = 1; o <= n; o++) try {
357
+ return (await i.request({
358
+ method: "GET",
359
+ url: e,
360
+ headers: { Accept: "application/octet-stream" },
361
+ responseType: "arraybuffer",
362
+ timeout: 6e4,
363
+ cancelToken: t.token
364
+ })).data;
365
+ } catch (e) {
366
+ if (a.isCancel(e)) throw e;
367
+ r = e, o < n && await new Promise((e, n) => {
368
+ let r = window.setTimeout(e, 250 * o);
369
+ t.token.promise?.then(() => {
370
+ window.clearTimeout(r), n(new a.Cancel("cancelled"));
371
+ });
372
+ });
373
+ }
374
+ throw r instanceof Error ? r : /* @__PURE__ */ Error("Failed to fetch tile");
375
+ }
376
+ async loadViewportTiles() {
377
+ if (this.destroyed || !viewer) return;
378
+ if (this.loading) {
379
+ this.pendingRefresh = !0, this.cancelInFlight();
380
+ return;
381
+ }
382
+ let e = this.getCameraRegion();
383
+ if (!e) return;
384
+ this.loading = !0, this.cancelInFlight(), this.cancelSource = a.CancelToken.source();
385
+ let t = ++this.requestVersion, n = this.cancelSource;
386
+ try {
387
+ let r = viewer.scene.canvas, o = {
388
+ layerId: this.id,
389
+ region: e.join(","),
390
+ height: String(r.clientHeight),
391
+ width: String(r.clientWidth)
392
+ };
393
+ this.fixedLevel != null && (o.level = String(this.fixedLevel));
394
+ let s = await i.request({
395
+ method: "GET",
396
+ url: "/v1/zzts/layer/3d/las/calTiles",
397
+ params: o,
398
+ timeout: 6e4,
399
+ cancelToken: n.token
400
+ });
401
+ if (!this.isActiveRequest(t)) return;
402
+ let c = Array.isArray(s?.tiles) ? s.tiles : [], l = new Set(c.map((e) => {
403
+ let t = Array.isArray(e.shards) ? e.shards.join(",") : e.hcode || "";
404
+ return `${e.level}/${e.geosot}/${t}`;
405
+ }));
406
+ if (l.size === 0) {
407
+ this.visibleTileKeys.clear();
408
+ return;
409
+ }
410
+ this.visibleTileKeys = l;
411
+ let u = Array(c.length), d = 0;
412
+ if (await Promise.all(Array.from({ length: Math.min(g, c.length) }, async () => {
413
+ for (; d < c.length;) {
414
+ let e = d++, t = c[e], r = {
415
+ layerId: this.id,
416
+ geosot: t.geosot,
417
+ level: String(t.level)
418
+ }, i = Array.isArray(t.shards) ? t.shards.join(",") : t.hcode || "";
419
+ i && (r.shards = i);
420
+ let o = `/v1/zzts/layer/3d/las/getTile?layerId=${encodeURIComponent(r.layerId)}&geosot=${encodeURIComponent(r.geosot)}&level=${r.level}${i ? `&shards=${encodeURIComponent(i)}` : ""}`;
421
+ try {
422
+ u[e] = {
423
+ status: "fulfilled",
424
+ value: await this.fetchTileWithRetry(o, n)
425
+ };
426
+ } catch (n) {
427
+ if (a.isCancel(n)) throw n;
428
+ console.error(`[zzts3d-las] getTile 失败 L${t.level} ${t.geosot}`, n), u[e] = {
429
+ status: "rejected",
430
+ reason: n
431
+ };
432
+ }
433
+ }
434
+ })), !this.isActiveRequest(t)) return;
435
+ let p = u.filter((e) => e?.status === "rejected");
436
+ if (p.length > 0) {
437
+ console.warn(`[zzts3d-las] ${p.length}/${c.length} 个 GeoSOT 请求失败,保留上一视口`);
438
+ return;
439
+ }
440
+ let h = [];
441
+ for (let e of u) {
442
+ if (e.status !== "fulfilled" || !e.value?.byteLength) continue;
443
+ let t = f(e.value);
444
+ t && t.pointCount > 0 && h.push(t);
445
+ }
446
+ if (h.length === 0) {
447
+ console.warn("[zzts3d-las] 当前视口无有效点数据");
448
+ return;
449
+ }
450
+ let _ = m(h);
451
+ this.parsedData = _, this.colorMode === "auto" ? this.activeColorMode = _.hasRgb ? "rgb" : _.intensity.some((e) => e > 0) ? "intensity" : "single" : this.activeColorMode = this.colorMode, this.renderPoints(_, this.activeColorMode);
452
+ } catch (e) {
453
+ !a.isCancel(e) && !this.destroyed && console.error("[zzts3d-las] 视口瓦片加载失败:", e);
454
+ } finally {
455
+ this.loading = !1, this.pendingRefresh && !this.destroyed && (this.pendingRefresh = !1, this.loadViewportTiles());
456
+ }
457
+ }
458
+ renderPoints(e, t) {
459
+ if (!viewer || e.pointCount === 0) return;
460
+ let n = ++this.renderGeneration;
461
+ this.removeCurrentPrimitives();
462
+ let r = x(e, t, this.opacity), i = e.pointCount, a = [];
463
+ for (let t = 0; t < i; t += h) {
464
+ let n = Math.min(i, t + h);
465
+ a.push({
466
+ positions: e.positions.slice(t * 3, n * 3),
467
+ colors: r.slice(t * 4, n * 4)
468
+ });
469
+ }
470
+ let o = 0, s = () => {
471
+ if (n !== this.renderGeneration || !viewer || this.destroyed || o >= a.length) return;
472
+ let e = a[o++], t = {
473
+ position: new Cesium.GeometryAttribute({
474
+ componentDatatype: Cesium.ComponentDatatype.DOUBLE,
475
+ componentsPerAttribute: 3,
476
+ values: e.positions
477
+ }),
478
+ color: new Cesium.GeometryAttribute({
479
+ componentDatatype: Cesium.ComponentDatatype.UNSIGNED_BYTE,
480
+ componentsPerAttribute: 4,
481
+ values: e.colors,
482
+ normalize: !0
483
+ })
484
+ }, r = new Cesium.Geometry({
485
+ attributes: t,
486
+ primitiveType: Cesium.PrimitiveType.POINTS,
487
+ boundingSphere: Cesium.BoundingSphere.fromVertices(e.positions)
488
+ }), i = new Cesium.Primitive({
489
+ geometryInstances: new Cesium.GeometryInstance({ geometry: r }),
490
+ appearance: w(this.pointSize),
491
+ asynchronous: !1,
492
+ allowPicking: !1
493
+ });
494
+ viewer.scene.primitives.add(i), this.currentPrimitives.push(i), requestAnimationFrame(s);
495
+ };
496
+ requestAnimationFrame(s);
497
+ }
498
+ }, E = new class {
499
+ constructor() {
500
+ this.layers = /* @__PURE__ */ new Map();
501
+ }
502
+ async createLayer(e) {
503
+ let t = typeof e == "string" ? e : e?.layerId || e?.id;
504
+ if (!t) return console.error("[zzts3d-las] 创建图层失败:缺少 id 参数"), null;
505
+ if (this.layers.has(t)) {
506
+ let n = this.layers.get(t);
507
+ return n.pointSize = e?.pointSize ?? n.pointSize, n.opacity = e?.opacity ?? n.opacity, n.colorMode = e?.colorMode ?? n.colorMode, n;
508
+ }
509
+ let n = new T(e);
510
+ this.layers.set(t, n);
511
+ try {
512
+ return await n.init(), n.destroyed ? (this.layers.delete(t), null) : n;
513
+ } catch (e) {
514
+ throw this.layers.delete(t), n.remove(), e;
515
+ }
516
+ }
517
+ removeLayer(e) {
518
+ let t = this.layers.get(e);
519
+ t && (t.remove(), this.layers.delete(e));
520
+ }
521
+ getLayer(e) {
522
+ return this.layers.get(e);
523
+ }
524
+ }(), D = (e) => E.createLayer(e), O = (e) => E.removeLayer(e), k = (e) => E.getLayer(e), A = {
525
+ __name: "index",
526
+ props: { config: {
527
+ type: Object,
528
+ default: () => ({})
529
+ } },
530
+ setup(e) {
531
+ let i = e, a = {
532
+ layerId: "",
533
+ colorMode: "auto",
534
+ pointSize: 2,
535
+ opacity: 1,
536
+ level: null
537
+ }, o = t(() => ({
538
+ ...a,
539
+ ...i.config
540
+ })), s = 0, c = async () => {
541
+ ++s;
542
+ let e = o.value;
543
+ if (!e.layerId) return;
544
+ let t = k(e.layerId);
545
+ t ? (t.pointSize = e.pointSize, t.opacity = e.opacity, t.colorMode = e.colorMode) : await D(e);
546
+ }, l = () => {
547
+ O(i.config?.layerId || o.value.layerId);
548
+ };
549
+ return r(o, () => {
550
+ c();
551
+ }, {
552
+ deep: !0,
553
+ immediate: !0
554
+ }), n(() => {
555
+ s++, l();
556
+ }), (e, t) => null;
557
+ }
558
+ };
559
+ //#endregion
560
+ export { A as default };