@skzz/components-gis 0.1.4 → 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 -9659
  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 +76 -6
  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,493 @@
1
+ import { t as e } from "./pako.esm-D6zcBi67.js";
2
+ import { n as t, t as n } from "./esm-BXiGX6xE.js";
3
+ import { computed as r, inject as i, onMounted as a, onUnmounted as o, ref as s, watch as c } from "vue";
4
+ import { IndexedDBManager as l, httpService as u } from "@skzz/libs-base";
5
+ import d from "axios";
6
+ import { latlng as f } from "@skzz/libs-gis";
7
+ //#region src/zz-layer/zz-layer-zzts3dtype/entityGrid.js
8
+ var p = class {
9
+ constructor(e, t = !1, n = null, r = "255,255,255", i = "", a = 1, o = "") {
10
+ this.id = e, this.dictCode = o == null ? "" : String(o), this.isStatic = t, this.loadedTiles = /* @__PURE__ */ new Map(), this.currentTileIds = /* @__PURE__ */ new Set(), this.currentNewLevel = s(n || 15), this.gridDb = null, this.entityNum = 0, this.handlers = null, this.requestController = null, this.pendingRequests = /* @__PURE__ */ new Map(), this.fadeAnimations = /* @__PURE__ */ new Map(), this.lastTime = 0, this.serviceType = i, this.opacity = a, this.fixedLevel = n, this.levels_add = window.levels_add_plus || 0, this.tileColor = r, this.tileSleepTime = window.tileSleepTime || 400;
11
+ }
12
+ async init() {
13
+ let e = this.isStatic ? "_static" : "";
14
+ console.log("1"), this.gridDb = await new l(`gridDbs_${this.id}${e}_${this.serviceType}_v2`, 2), await this.gridDb.openDatabase("gridEntity", "id"), console.log("2"), this.isStatic || this.initHandler(), this.getViewportInfo();
15
+ }
16
+ getCurrentLevel() {
17
+ return this.currentNewLevel.value;
18
+ }
19
+ remove() {
20
+ this.destroyHandler(), this.clearAllTiles();
21
+ }
22
+ removeTilesOnly() {
23
+ this.clearAllTiles();
24
+ }
25
+ clearAllTiles() {
26
+ this.fadeAnimations.forEach((e) => {
27
+ e.interval && clearInterval(e.interval);
28
+ }), this.fadeAnimations.clear(), this.pendingRequests.forEach((e) => {
29
+ e.cancel && e.cancel();
30
+ }), this.pendingRequests.clear(), this.currentTileIds = /* @__PURE__ */ new Set();
31
+ for (let [e, t] of this.loadedTiles) t.box && viewer.scene.primitives.contains(t.box) && viewer.scene.primitives.remove(t.box), t.line && viewer.scene.primitives.contains(t.line) && viewer.scene.primitives.remove(t.line);
32
+ this.loadedTiles.clear();
33
+ }
34
+ initHandler1() {
35
+ if (this.getViewportInfo(), this.handlers) try {
36
+ viewer.camera.moveEnd.removeEventListener(this.handlers);
37
+ } catch (e) {
38
+ console.warn("移除旧的事件监听器失败:", e);
39
+ }
40
+ this.handlers = () => {
41
+ this.getViewportInfo();
42
+ }, viewer.camera.moveEnd.addEventListener(this.handlers);
43
+ }
44
+ initHandler() {
45
+ if (this.getViewportInfo(), this.handlers) try {
46
+ viewer.camera.changed.removeEventListener(this.handlers);
47
+ } catch (e) {
48
+ console.warn("移除旧的事件监听器失败:", e);
49
+ }
50
+ let e = null, t = () => {
51
+ clearTimeout(e), e = setTimeout(() => {
52
+ this.getViewportInfo();
53
+ }, 250);
54
+ };
55
+ viewer.camera.changed.addEventListener(t), this.handlers = t;
56
+ }
57
+ getViewportInfo() {
58
+ this.requestController && this.requestController.abort(), this.requestController = new AbortController(), this.entityNum = 0;
59
+ let e = f.getFrustumGroundIntersectionPoints(viewer), r = f.getCenter(viewer), i = f.getCameraView(viewer);
60
+ if (i.pitch > -18) return;
61
+ let a;
62
+ if (this.isStatic && this.fixedLevel) a = this.fixedLevel + this.levels_add;
63
+ else {
64
+ let t = Cesium.Cartesian3.distance(Cesium.Cartesian3.fromDegrees(r.x, r.y, 0), Cesium.Cartesian3.fromDegrees(i.x, i.y, i.z));
65
+ console.log(f.entityGridLevels);
66
+ let n = f.entityGridLevels.filter((e) => e.max >= t && e.min <= t);
67
+ if (!n[0] || e.length < 4) return;
68
+ a = n[0].level + this.levels_add;
69
+ }
70
+ if (this.currentNewLevel.value = a, !(e.length < 4)) {
71
+ var o = n(t([
72
+ [e[0].x, e[0].y],
73
+ [e[1].x, e[1].y],
74
+ [e[2].x, e[2].y],
75
+ [e[3].x, e[3].y]
76
+ ]));
77
+ this.getEntityData(o, a, e, this.requestController.signal);
78
+ }
79
+ }
80
+ showDebugPoints(e) {
81
+ viewer.entities.values.filter((e) => e.id && e.id.startsWith(`debug_${this.id}_`)).forEach((e) => viewer.entities.remove(e)), e.forEach((e, t) => {
82
+ this.showPoint(e.x, e.y, 1, t);
83
+ });
84
+ }
85
+ async getEntityData(e, t, n, r) {
86
+ let i = viewer.scene.canvas, a = i.clientWidth, o = i.clientHeight, s = Number(e[2]) - Number(e[0]), c = Number(e[3]) - Number(e[1]);
87
+ if (!(s > 20 || c > 20)) try {
88
+ let n = await u.request({
89
+ method: "GET",
90
+ url: `/v1/zzts/layer/3d/calTiles?region=${e[0]},${e[1]},0,${e[2]},${e[3]},10&width=${a}&height=${o}`,
91
+ timeout: 6e4,
92
+ signal: r
93
+ });
94
+ r.aborted || this.render3DFaces(n.tiles || [], n.lodLevel ?? t);
95
+ } catch (e) {
96
+ e.name === "AbortError" ? console.log(`图层 ${this.id} 请求被取消`) : console.error(`图层 ${this.id} 获取实体数据出错:`, e);
97
+ }
98
+ }
99
+ render3DFaces(e, t) {
100
+ this.lastTime = (/* @__PURE__ */ new Date()).getTime(), e.forEach((e) => {
101
+ e.geoSot = e.geoSot, e.level = t;
102
+ });
103
+ let n = e, r = new Set(n.map((e) => e.geoSot)), i = [], a = [];
104
+ this.currentTileIds.forEach((e) => {
105
+ r.has(e) || a.push(e);
106
+ }), r.forEach((e) => {
107
+ if (!this.currentTileIds.has(e)) {
108
+ let t = n.find((t) => e === t.geoSot);
109
+ t && i.push(t);
110
+ }
111
+ }), i.forEach((e) => {
112
+ this.addTile(e, e.level);
113
+ }), a.forEach((e) => {
114
+ let t = this.loadedTiles.get(e);
115
+ t && this.fadeOut(t, e);
116
+ }), this.currentTileIds = r;
117
+ }
118
+ fadeOut(e, t) {
119
+ if (this.fadeAnimations.has(t)) {
120
+ let e = this.fadeAnimations.get(t);
121
+ e.interval && clearInterval(e.interval);
122
+ }
123
+ let n = 0, r = this.tileSleepTime / 100, i = setInterval(() => {
124
+ n < r ? (e.box && e.box.appearance, n++) : (clearInterval(i), this.fadeAnimations.delete(t), e.box && viewer.scene.primitives.contains(e.box) && viewer.scene.primitives.remove(e.box), e.line && viewer.scene.primitives.contains(e.line) && viewer.scene.primitives.remove(e.line), this.loadedTiles.delete(t), this.currentTileIds.delete(t));
125
+ }, 100);
126
+ this.fadeAnimations.set(t, { interval: i });
127
+ }
128
+ async addTile(e, t) {
129
+ let n = e.geoSot;
130
+ if (this.pendingRequests.has(n)) {
131
+ let e = this.pendingRequests.get(n);
132
+ e.cancel && e.cancel();
133
+ }
134
+ let r = d.CancelToken.source();
135
+ this.pendingRequests.set(n, { cancel: () => r.cancel("请求被取消") });
136
+ let i = e.level || t, a = `${n}__L${i}`;
137
+ try {
138
+ let t = await this.gridDb.getDataById("gridEntity", a);
139
+ if (t) t.data.byteLength > 47 && this.addGridToMap(e, this.parseCompressedMeshData(t.data, i));
140
+ else {
141
+ let t = await u.request({
142
+ method: "GET",
143
+ url: `/v1/zzts/layer/3d/getTilesByType?layerId=${encodeURIComponent(this.dictCode || "")}&level=${i}&geosot=${e.geoSot}&hcode=${e.highCode || 0}&serviceType=7&type=${encodeURIComponent(this.serviceType || "")}`,
144
+ headers: { Accept: "application/octet-stream" },
145
+ responseType: "arraybuffer",
146
+ timeout: 6e4,
147
+ cancelToken: r.token
148
+ });
149
+ !r.token.reason && t.data.byteLength > 47 && (await this.gridDb.addData("gridEntity", {
150
+ id: a,
151
+ data: t.data
152
+ }), this.addGridToMap(e, this.parseCompressedMeshData(t.data, i))), !r.token.reason && t.data.byteLength < 47 && await this.gridDb.addData("gridEntity", {
153
+ id: a,
154
+ data: t.data
155
+ });
156
+ }
157
+ } catch (e) {
158
+ d.isCancel(e) ? console.log(`图层 ${this.id} 瓦片请求被取消:`, n) : console.error(`图层 ${this.id} 获取瓦片数据出错:`, e);
159
+ } finally {
160
+ this.pendingRequests.delete(n);
161
+ }
162
+ }
163
+ createUniqueVertices(e, t) {
164
+ let n = e instanceof Float64Array ? e : new Float64Array(e), r = t.length, i = new Float64Array(r * 3), a = new Uint32Array(r);
165
+ for (let e = 0; e < t.length; e++) {
166
+ let r = t[e] * 3;
167
+ i[e * 3] = n[r], i[e * 3 + 1] = n[r + 1], i[e * 3 + 2] = n[r + 2], a[e] = e;
168
+ }
169
+ return {
170
+ positions: i,
171
+ indices: a
172
+ };
173
+ }
174
+ calculateFlatNormalsForUniqueVertices(e, t) {
175
+ let n = new Float32Array(e.length);
176
+ for (let r = 0; r < t.length; r += 3) {
177
+ let i = t[r] * 3, a = t[r + 1] * 3, o = t[r + 2] * 3, s = [
178
+ e[i],
179
+ e[i + 1],
180
+ e[i + 2]
181
+ ], c = [
182
+ e[a],
183
+ e[a + 1],
184
+ e[a + 2]
185
+ ], l = [
186
+ e[o],
187
+ e[o + 1],
188
+ e[o + 2]
189
+ ], u = [
190
+ c[0] - s[0],
191
+ c[1] - s[1],
192
+ c[2] - s[2]
193
+ ], d = [
194
+ l[0] - s[0],
195
+ l[1] - s[1],
196
+ l[2] - s[2]
197
+ ], f = [
198
+ u[1] * d[2] - u[2] * d[1],
199
+ u[2] * d[0] - u[0] * d[2],
200
+ u[0] * d[1] - u[1] * d[0]
201
+ ], p = Math.sqrt(f[0] * f[0] + f[1] * f[1] + f[2] * f[2]), m;
202
+ m = p > 1e-10 && !isNaN(f[0]) && !isNaN(f[1]) && !isNaN(f[2]) && isFinite(f[0]) && isFinite(f[1]) && isFinite(f[2]) ? [
203
+ f[0] / p,
204
+ f[1] / p,
205
+ f[2] / p
206
+ ] : [
207
+ 0,
208
+ 0,
209
+ 1
210
+ ], n[i] = m[0], n[i + 1] = m[1], n[i + 2] = m[2], n[a] = m[0], n[a + 1] = m[1], n[a + 2] = m[2], n[o] = m[0], n[o + 1] = m[1], n[o + 2] = m[2];
211
+ }
212
+ return n;
213
+ }
214
+ addGridToMap(e, t) {
215
+ if (!t || t.length === 0) return console.warn("没有几何数据可渲染"), null;
216
+ let n = t.map((e) => {
217
+ if (!e.positions || e.positions.length === 0) return console.warn("跳过无效的几何体:缺少顶点数据"), null;
218
+ if (!e.indices || e.indices.length === 0) return console.warn("跳过无效的几何体:缺少索引数据"), null;
219
+ let { positions: t, indices: n } = this.createUniqueVertices(e.positions, e.indices), r = this.calculateFlatNormalsForUniqueVertices(t, n), i = t.length / 3, a = new Float32Array(i * 2);
220
+ for (let e = 0; e < i; e++) a[e * 2] = 0, a[e * 2 + 1] = 0;
221
+ let o = new Cesium.Geometry({
222
+ attributes: {
223
+ position: new Cesium.GeometryAttribute({
224
+ componentDatatype: Cesium.ComponentDatatype.DOUBLE,
225
+ componentsPerAttribute: 3,
226
+ values: t,
227
+ normalize: !1
228
+ }),
229
+ st: new Cesium.GeometryAttribute({
230
+ componentDatatype: Cesium.ComponentDatatype.FLOAT,
231
+ componentsPerAttribute: 2,
232
+ values: a
233
+ }),
234
+ normal: new Cesium.GeometryAttribute({
235
+ componentDatatype: Cesium.ComponentDatatype.FLOAT,
236
+ componentsPerAttribute: 3,
237
+ values: r,
238
+ normalize: !1
239
+ })
240
+ },
241
+ indices: n,
242
+ primitiveType: Cesium.PrimitiveType.TRIANGLES,
243
+ boundingSphere: Cesium.BoundingSphere.fromVertices(t)
244
+ });
245
+ return o.modelId = e.modelId, o.color = e.color, o;
246
+ }).filter((e) => e !== null).map((e, t) => {
247
+ let n = e.color, r = null;
248
+ if (n == "#C2D6E2FF" || n == "#00000000") r = `rgba(${this.tileColor}, ${this.opacity})`;
249
+ else try {
250
+ r = this.hexToRgba(n);
251
+ } catch {
252
+ r = `rgba(${this.tileColor || "255,255,255"}, ${this.opacity})`;
253
+ }
254
+ return r ||= `rgba(${this.tileColor || "255,255,255"}, ${this.opacity})`, new Cesium.GeometryInstance({
255
+ geometry: e,
256
+ id: e.modelId,
257
+ attributes: {
258
+ color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString(`${r}`)),
259
+ show: new Cesium.ShowGeometryInstanceAttribute(!0)
260
+ }
261
+ });
262
+ }), r = new Cesium.Primitive({
263
+ geometryInstances: n,
264
+ asynchronous: !1,
265
+ compressVertices: !1,
266
+ releaseGeometryInstances: !1,
267
+ appearance: new Cesium.PerInstanceColorAppearance({
268
+ vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
269
+ flat: !1,
270
+ translucent: !1,
271
+ renderState: {
272
+ depthTest: { enabled: !0 },
273
+ blending: Cesium.BlendingState.ALPHA_BLEND
274
+ }
275
+ })
276
+ });
277
+ r.layerId = this.id, r.geoSot = e.geoSot, viewer.scene.primitives.add(r);
278
+ let i = 0, a = this.tileSleepTime / 100, o = setInterval(() => {
279
+ i <= a * this.opacity ? (r && r.appearance, i++) : (clearInterval(o), this.fadeAnimations.has(e.geoSot) && this.fadeAnimations.delete(e.geoSot), this.removeOldEntities(e.geoSot));
280
+ }, 100);
281
+ this.fadeAnimations.set(e.geoSot, { interval: o }), this.loadedTiles.set(e.geoSot, { box: r });
282
+ }
283
+ hexToRgba(e) {
284
+ e = e.replace("#", "");
285
+ let t = 1;
286
+ if (e.length === 8) t = parseInt(e.slice(6, 8), 16) / 255;
287
+ else if (e.length !== 6) return console.error("Invalid hex format"), null;
288
+ return `rgba(${parseInt(e.slice(0, 2), 16)}, ${parseInt(e.slice(2, 4), 16)}, ${parseInt(e.slice(4, 6), 16)}, ${t})`;
289
+ }
290
+ removeOldEntities(e) {
291
+ viewer.scene.primitives._primitives.forEach((t) => {
292
+ t.geoSot && t.layerId === this.id && t.geoSot.length !== e.length && viewer.scene.primitives.remove(t);
293
+ });
294
+ }
295
+ destroyHandler() {
296
+ this.handlers &&= (viewer.camera.changed.removeEventListener(this.handlers), null), this.clearAllTiles(), this.requestController &&= (this.requestController.abort(), null);
297
+ }
298
+ decompressMeshChunk(t) {
299
+ try {
300
+ return e.ungzip(t);
301
+ } catch {
302
+ try {
303
+ return e.inflate(t);
304
+ } catch {
305
+ return e.inflate(t, { windowBits: -15 });
306
+ }
307
+ }
308
+ }
309
+ parseCompressedMeshData(e, t) {
310
+ let n = [];
311
+ if (!(e instanceof ArrayBuffer) && !(e?.buffer instanceof ArrayBuffer)) return console.error("parseCompressedMeshData: 输入不是 ArrayBuffer"), n;
312
+ let r = e instanceof ArrayBuffer ? e : e.buffer, i = new DataView(r), a = 0;
313
+ if (r.byteLength < 4) return n;
314
+ let o = i.getInt32(a, !0);
315
+ if (a += 4, o <= 0 || o > 5e5) return console.error(`parseCompressedMeshData: tileCount 异常 ${o}`), n;
316
+ for (let e = 0; e < o; e++) {
317
+ if (a + 4 > r.byteLength) {
318
+ console.error("parseCompressedMeshData: 读取 compressedLength 越界");
319
+ break;
320
+ }
321
+ let o = i.getInt32(a, !0);
322
+ if (a += 4, o <= 0 || a + o > r.byteLength) {
323
+ console.error(`parseCompressedMeshData: compressedLength 异常 ${o}`);
324
+ break;
325
+ }
326
+ let s = new Uint8Array(r, a, o);
327
+ a += o;
328
+ let c;
329
+ try {
330
+ c = this.decompressMeshChunk(s);
331
+ } catch (t) {
332
+ console.error(`parseCompressedMeshData: 解压失败 t=${e}`, t);
333
+ continue;
334
+ }
335
+ let l = new DataView(c.buffer, c.byteOffset, c.byteLength), u = 0;
336
+ if (c.byteLength < 16) {
337
+ console.warn(`parseCompressedMeshData: 解压后过短 t=${e}`);
338
+ continue;
339
+ }
340
+ let d = l.getBigInt64(u, !0);
341
+ u += 8;
342
+ let f = l.getInt32(u, !0);
343
+ u += 4;
344
+ let p = l.getInt32(u, !0);
345
+ u += 4;
346
+ let m = f / 4, h = p / 4;
347
+ if (!Number.isInteger(m) || !Number.isInteger(h) || m < 0 || h < 0 || u + f + p > c.byteLength) {
348
+ console.error(`parseCompressedMeshData: 长度字段异常 t=${e} pos=${f} idx=${p}`);
349
+ continue;
350
+ }
351
+ let g = new Float64Array(m);
352
+ for (let e = 0; e < m; e++) g[e] = l.getInt32(u, !0) / 100, u += 4;
353
+ let _ = new Uint32Array(h);
354
+ for (let e = 0; e < h; e++) _[e] = l.getUint32(u, !0), u += 4;
355
+ n.push({
356
+ positions: g,
357
+ indices: _,
358
+ positionCount: m,
359
+ indexCount: h,
360
+ modelId: d.toString(),
361
+ lodLevel: t,
362
+ color: "#C2D6E2FF"
363
+ });
364
+ }
365
+ return n;
366
+ }
367
+ showPoint(e, t, n, r) {
368
+ viewer.entities.add({
369
+ position: Cesium.Cartesian3.fromDegrees(e, t, n),
370
+ point: {
371
+ pixelSize: 5,
372
+ color: Cesium.Color.RED,
373
+ outlineColor: Cesium.Color.WHITE,
374
+ outlineWidth: 2
375
+ },
376
+ id: `debug_${this.id}_${r}`,
377
+ label: {
378
+ text: r + "",
379
+ font: "14pt monospace",
380
+ outlineWidth: 2,
381
+ horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
382
+ pixelOffset: new Cesium.Cartesian2(10, 0)
383
+ }
384
+ });
385
+ }
386
+ }, m = new class {
387
+ constructor() {
388
+ this.layers = /* @__PURE__ */ new Map();
389
+ }
390
+ async createLayer(e) {
391
+ let t = typeof e == "string" ? e : e?.id || e?.layerKey || e?.serviceType || e?.layerId, n = typeof e == "object" && e?.color != null && String(e.color).trim() ? String(e.color).trim() : void 0, r = e?.level, i = e?.isStatic, a = e?.serviceType, o = e?.opacity, s = typeof e == "object" ? e?.dictCode ?? e?.layerId ?? "" : "";
392
+ if (!t) return console.error("创建图层失败:缺少id参数"), null;
393
+ if (this.layers.has(t)) {
394
+ console.warn(`图层 ${t} 已存在`);
395
+ let e = this.layers.get(t), i = !1;
396
+ if (n != null && n !== "" && e.tileColor !== n && (e.tileColor = n, i = !0), r != null && (e.fixedLevel = r, e.currentNewLevel.value = r), s !== void 0 && (e.dictCode = s == null ? "" : String(s)), a !== void 0 && (e.serviceType = a), o != null) {
397
+ let t = Number(o);
398
+ Number.isFinite(t) && e.opacity !== t && (e.opacity = t, i = !0);
399
+ }
400
+ return i && (typeof e.clearAllTiles == "function" && e.clearAllTiles(), typeof e.getViewportInfo == "function" && e.getViewportInfo()), this.layers.get(t);
401
+ }
402
+ let c = new p(t, i, r, n, a, o, s);
403
+ return await c.init(), this.layers.set(t, c), c;
404
+ }
405
+ removeLayer(e) {
406
+ let t = this.layers.get(e);
407
+ t && (t.remove(), this.layers.delete(e), console.log(`图层 ${e} 已移除`));
408
+ }
409
+ removeAllLayers() {
410
+ this.layers.forEach((e) => e.remove()), this.layers.clear();
411
+ }
412
+ getLayer(e) {
413
+ return this.layers.get(e);
414
+ }
415
+ getLayerIds() {
416
+ return Array.from(this.layers.keys());
417
+ }
418
+ removeTilesByLayerId(e) {
419
+ let t = this.layers.get(e);
420
+ t && t.removeTilesOnly();
421
+ }
422
+ refreshLayer(e) {
423
+ let t = this.layers.get(e);
424
+ t && t.getViewportInfo();
425
+ }
426
+ }(), h = async (e) => m.createLayer(e, !1), g = (e) => {
427
+ m.removeLayer(e);
428
+ };
429
+ r(() => {
430
+ let e = m.getLayerIds();
431
+ if (e.length > 0) {
432
+ let t = m.getLayer(e[0]);
433
+ return t ? t.getCurrentLevel() : 15;
434
+ }
435
+ return 15;
436
+ });
437
+ //#endregion
438
+ //#region src/zz-layer/zz-layer-zzts3dtype/index.vue
439
+ var _ = {
440
+ __name: "index",
441
+ props: { config: {
442
+ type: Object,
443
+ default: () => ({})
444
+ } },
445
+ setup(e) {
446
+ i("cesiumViewer");
447
+ let t = e, n = {
448
+ id: "",
449
+ layerId: "",
450
+ color: "255,255,255",
451
+ isStatic: !1,
452
+ level: null,
453
+ serviceType: "",
454
+ opacity: 1
455
+ }, s = r(() => ({
456
+ ...n,
457
+ ...t.config
458
+ }));
459
+ function l() {
460
+ let { id: e, layerId: t, serviceType: n } = s.value;
461
+ return e || (n ? `${t || "_"}__${n}` : "") || n || t || "";
462
+ }
463
+ let u = async () => {
464
+ s.value.level && (s.value.isStatic = !0);
465
+ let e = l();
466
+ if (!e) {
467
+ console.error("创建图层失败:缺少id参数", s.value);
468
+ return;
469
+ }
470
+ h({
471
+ id: e,
472
+ layerId: s.value.layerId || "",
473
+ dictCode: s.value.layerId || "",
474
+ color: s.value.color,
475
+ isStatic: s.value.isStatic,
476
+ level: s.value.level,
477
+ serviceType: s.value.serviceType,
478
+ opacity: s.value.opacity
479
+ });
480
+ }, d = () => {
481
+ g(l());
482
+ };
483
+ return c(s, () => {
484
+ u();
485
+ }, { deep: !0 }), a(() => {
486
+ console.log("组件挂载,开始初始化..."), u();
487
+ }), o(() => {
488
+ console.log("组件卸载,开始清理资源..."), d();
489
+ }), (e, t) => null;
490
+ }
491
+ };
492
+ //#endregion
493
+ export { _ as default };