@skzz/components-gis 0.1.4 → 0.1.6

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 (53) hide show
  1. package/dist/assets/twinPreviewWorker-DvpSZYqE.js +3 -0
  2. package/dist/assets/twinTextureMipWorker-BWoFEUdX.js +3 -0
  3. package/dist/color-DVYdxZow.js +359 -0
  4. package/dist/esm-BXiGX6xE.js +86 -0
  5. package/dist/index.css +1 -1
  6. package/dist/index.d.ts +72 -6
  7. package/dist/index.es.js +1164 -9665
  8. package/dist/index.umd.js +209 -5
  9. package/dist/interpolation-Ctw2-y9G.js +211 -0
  10. package/dist/layerStack-CbiVJONn.js +181 -0
  11. package/dist/pako.esm-D6zcBi67.js +1455 -0
  12. package/dist/query-DgSNPfJM.js +239 -0
  13. package/dist/queryPoint-BOi_hkig.js +189 -0
  14. package/dist/tw2Parser-Dxs5xGvB.js +115 -0
  15. package/dist/zz-3dtiles-BzDYB-tW.js +75 -0
  16. package/dist/zz-gltf-BDHxqQjs.js +70 -0
  17. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsBounds.d.ts +19 -0
  18. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsCacheUtils.d.ts +53 -0
  19. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsGeometry.d.ts +27 -0
  20. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsGeometryWorker.d.ts +1 -0
  21. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsPreviewBudget.d.ts +78 -0
  22. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsRenderer.d.ts +281 -16
  23. package/dist/zz-layer/zz-layer-shp-zzts/shpZztsViewState.d.ts +20 -0
  24. package/dist/zz-layer/zz-layer-zzts/zztsRasterCacheUtils.d.ts +35 -0
  25. package/dist/zz-layer/zz-layer-zzts/zztsRasterPreviewPolling.d.ts +10 -0
  26. package/dist/zz-layer/zz-layer-zzts3dv2/entityGridV2.d.ts +277 -0
  27. package/dist/zz-layer/zz-layer-zzts3dv2/index.vue.d.ts +1 -0
  28. package/dist/zz-layer/zz-layer-zzts3dv2/tw2Parser.d.ts +7 -0
  29. package/dist/zz-layer/zz-layer-zzts3dv2/twinAdaptiveMesh.d.ts +3 -0
  30. package/dist/zz-layer/zz-layer-zzts3dv2/twinCoarseLod.d.ts +4 -0
  31. package/dist/zz-layer/zz-layer-zzts3dv2/twinEnvironmentLighting.d.ts +16 -0
  32. package/dist/zz-layer/zz-layer-zzts3dv2/twinImagePixels.d.ts +6 -0
  33. package/dist/zz-layer/zz-layer-zzts3dv2/twinPagedIndex.d.ts +8 -0
  34. package/dist/zz-layer/zz-layer-zzts3dv2/twinParsePool.d.ts +10 -0
  35. package/dist/zz-layer/zz-layer-zzts3dv2/twinPreviewWorker.d.ts +1 -0
  36. package/dist/zz-layer/zz-layer-zzts3dv2/twinRegionalIndex.d.ts +23 -0
  37. package/dist/zz-layer/zz-layer-zzts3dv2/twinResourceBatch.d.ts +34 -0
  38. package/dist/zz-layer/zz-layer-zzts3dv2/twinTextureAppearance.d.ts +89 -0
  39. package/dist/zz-layer/zz-layer-zzts3dv2/twinTextureMipWorker.d.ts +1 -0
  40. package/dist/zz-layer/zz-layer-zzts3dv2/twinVisualRuntime.d.ts +107 -0
  41. package/dist/zz-layer-geojson-CtTpn_f9.js +867 -0
  42. package/dist/zz-layer-mvt-R1-GwSIW.js +609 -0
  43. package/dist/zz-layer-shp-zzts-Dr3Gxeba.js +1881 -0
  44. package/dist/zz-layer-zzts3d-CsIWse3P.js +835 -0
  45. package/dist/zz-layer-zzts3d-grid-CTHFZBpo.js +314 -0
  46. package/dist/zz-layer-zzts3d-las-D3w01aGe.js +561 -0
  47. package/dist/zz-layer-zzts3d-point-BjaTPTqj.js +752 -0
  48. package/dist/zz-layer-zzts3dtype-BRl3mCk9.js +493 -0
  49. package/dist/zz-layer-zzts3dv2-DFXCOaMe.js +4019 -0
  50. package/dist/zz-terrain-excavation-A2NXSQ5P.js +502 -0
  51. package/dist/zz-viewer/index.vue.d.ts +2 -2
  52. package/dist/zzts3dLayerSignature-DzrPeJTd.js +44 -0
  53. package/package.json +5 -4
@@ -0,0 +1,239 @@
1
+ import { computed as e, inject as t, onUnmounted as n, watch as r } from "vue";
2
+ import { httpService as i } from "@skzz/libs-base";
3
+ //#region src/zz-layer/zz-layer-zzts3d-grid/query.vue
4
+ var a = {
5
+ __name: "query",
6
+ props: {
7
+ config: {
8
+ type: Object,
9
+ default: () => ({})
10
+ },
11
+ style: {
12
+ type: Object,
13
+ default: () => ({})
14
+ }
15
+ },
16
+ emits: ["grid-change"],
17
+ setup(a, { emit: o }) {
18
+ let s = t("cesiumViewer"), c = o, l = a, u = {
19
+ dictCode: "",
20
+ polygon: "",
21
+ height: 0,
22
+ high: 0,
23
+ fill: {
24
+ color: "255,255,255",
25
+ opacity: 1,
26
+ show: !0
27
+ },
28
+ line: {
29
+ color: "0,0,225",
30
+ opacity: 1,
31
+ show: !0,
32
+ width: .5
33
+ }
34
+ }, d = e(() => {
35
+ let e = l.config || {}, t = l.style || {};
36
+ return {
37
+ ...u,
38
+ ...e,
39
+ fill: {
40
+ ...u.fill,
41
+ ...e.fill || {},
42
+ ...t.fill || {}
43
+ },
44
+ line: {
45
+ ...u.line,
46
+ ...e.line || {},
47
+ ...t.line || {}
48
+ }
49
+ };
50
+ }), f = e(() => {
51
+ let e = d.value;
52
+ return JSON.stringify({
53
+ dictCode: e.dictCode,
54
+ polygon: e.polygon,
55
+ height: e.height,
56
+ high: e.high
57
+ });
58
+ }), p = 0, m = "", h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Set(), v = null, y = null, b = null;
59
+ function x(e) {
60
+ if (!e) return {
61
+ r: 255,
62
+ g: 255,
63
+ b: 255
64
+ };
65
+ if (typeof e == "string" && e.startsWith("#") && e.length === 7) return {
66
+ r: Number.parseInt(e.slice(1, 3), 16),
67
+ g: Number.parseInt(e.slice(3, 5), 16),
68
+ b: Number.parseInt(e.slice(5, 7), 16)
69
+ };
70
+ let t = String(e).split(",").map((e) => Number.parseFloat(e.trim()));
71
+ return {
72
+ r: Number.isFinite(t[0]) ? t[0] : 255,
73
+ g: Number.isFinite(t[1]) ? t[1] : 255,
74
+ b: Number.isFinite(t[2]) ? t[2] : 255
75
+ };
76
+ }
77
+ function S(e, t = 1) {
78
+ let { r: n, g: r, b: i } = x(e), a = Number.isFinite(t) ? Math.max(0, Math.min(1, t)) : 1;
79
+ return Cesium.Color.fromBytes(Math.max(0, Math.min(255, Math.round(n))), Math.max(0, Math.min(255, Math.round(r))), Math.max(0, Math.min(255, Math.round(i))), Math.round(a * 255));
80
+ }
81
+ function C(e) {
82
+ let t = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : Array.isArray(e?.records) ? e.records : [], n = [];
83
+ for (let e = 0; e < t.length; e++) {
84
+ let r = t[e];
85
+ if (!Array.isArray(r) || r.length < 1) continue;
86
+ let i = r[0];
87
+ if (!i || typeof i != "object") continue;
88
+ let a = i.xmin, o = i.ymin, s = i.xmax, c = i.ymax, l = i.height, u = i.highLength;
89
+ if (![
90
+ a,
91
+ o,
92
+ s,
93
+ c,
94
+ u,
95
+ l
96
+ ].every(Number.isFinite)) continue;
97
+ let d = i.geoSot || i.highCode || `grid_${e}`;
98
+ n.push([
99
+ a,
100
+ o,
101
+ s,
102
+ c,
103
+ u,
104
+ l,
105
+ d
106
+ ]);
107
+ }
108
+ return n;
109
+ }
110
+ function w(e) {
111
+ let t = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : Array.isArray(e?.records) ? e.records : [], n = [];
112
+ for (let e = 0; e < t.length; e++) {
113
+ let r = t[e];
114
+ if (!Array.isArray(r) || r.length < 1) continue;
115
+ let i = r[0];
116
+ !i || typeof i != "object" || n.push(i);
117
+ }
118
+ return n;
119
+ }
120
+ function T(e = []) {
121
+ c("grid-change", e);
122
+ }
123
+ function E() {
124
+ if (!s.value) return null;
125
+ if (v) return v;
126
+ let e = new Cesium.PrimitiveCollection();
127
+ return s.value.scene.primitives.add(e), v = e, v;
128
+ }
129
+ function D() {
130
+ if (v) {
131
+ try {
132
+ y && v.remove(y), b && v.remove(b);
133
+ } catch {}
134
+ y = null, b = null;
135
+ }
136
+ }
137
+ function O() {
138
+ try {
139
+ D(), s.value && v && s.value.scene.primitives.remove(v);
140
+ } catch {}
141
+ v = null;
142
+ }
143
+ function k(e) {
144
+ m && h.has(m) && A(h.get(m), e);
145
+ }
146
+ function A(e, t) {
147
+ console.log(e);
148
+ let n = E();
149
+ if (!n) return;
150
+ D();
151
+ let r = S(t.fill?.color, t.fill?.opacity), i = S(t.line?.color, t.line?.opacity), a = t.fill?.show !== !1, o = t.line?.show !== !1, s = [], c = [];
152
+ for (let t = 0; t < e.length; t++) {
153
+ let n = e[t], l = n[0], u = n[1], d = n[2], f = n[3], p = n[4], m = n[5], h = n[6], g = Cesium.Rectangle.fromDegrees(l, u, d, f), _ = m + p;
154
+ a && s.push(new Cesium.GeometryInstance({
155
+ id: `grid_fill_${h}`,
156
+ geometry: new Cesium.RectangleGeometry({
157
+ rectangle: g,
158
+ height: m,
159
+ extrudedHeight: _,
160
+ vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
161
+ }),
162
+ attributes: { color: Cesium.ColorGeometryInstanceAttribute.fromColor(r) }
163
+ })), o && c.push(new Cesium.GeometryInstance({
164
+ id: `grid_outline_${h}`,
165
+ geometry: new Cesium.RectangleOutlineGeometry({
166
+ rectangle: g,
167
+ height: m,
168
+ extrudedHeight: _
169
+ }),
170
+ attributes: { color: Cesium.ColorGeometryInstanceAttribute.fromColor(i) }
171
+ }));
172
+ }
173
+ s.length && (y = n.add(new Cesium.Primitive({
174
+ geometryInstances: s,
175
+ appearance: new Cesium.PerInstanceColorAppearance({
176
+ translucent: !0,
177
+ closed: !0
178
+ }),
179
+ asynchronous: !0
180
+ }))), c.length && (b = n.add(new Cesium.Primitive({
181
+ geometryInstances: c,
182
+ appearance: new Cesium.PerInstanceColorAppearance({
183
+ translucent: !0,
184
+ flat: !0
185
+ }),
186
+ asynchronous: !0
187
+ })));
188
+ }
189
+ async function j() {
190
+ if (!s.value) return;
191
+ let e = d.value || {}, t = f.value;
192
+ if (!e.dictCode || !e.polygon) {
193
+ O(), m = "", T([]);
194
+ return;
195
+ }
196
+ let n = ++p;
197
+ E(), D();
198
+ let r = h.get(t), a = g.get(t);
199
+ if (!r) {
200
+ let o = new AbortController();
201
+ _.add(o);
202
+ let s = await i.request({
203
+ method: "POST",
204
+ url: "/v1/zzts/twin/layer/3d/point/getGrid",
205
+ data: {
206
+ dictCode: e.dictCode,
207
+ polygon: e.polygon,
208
+ height: e.height,
209
+ high: e.high
210
+ },
211
+ signal: o.signal
212
+ }).catch((e) => {
213
+ if (o.signal.aborted) return null;
214
+ throw e;
215
+ });
216
+ if (_.delete(o), !s || n !== p) return;
217
+ let c = Array.isArray(s) ? s : s?.data ?? s;
218
+ r = C(c), a = w(c), r.length && h.set(t, r), g.set(t, a);
219
+ }
220
+ if (n === p) {
221
+ if (m = t, T(a || []), !r?.length) {
222
+ D();
223
+ return;
224
+ }
225
+ A(r, e);
226
+ }
227
+ }
228
+ return r(f, () => {
229
+ j();
230
+ }, { immediate: !0 }), r(() => [d.value.fill, d.value.line], () => {
231
+ let e = d.value || {};
232
+ !e.dictCode || !e.polygon || k(e);
233
+ }, { deep: !0 }), n(() => {
234
+ p++, _.forEach((e) => e.abort()), _.clear(), h.clear(), g.clear(), m = "", O();
235
+ }), (e, t) => null;
236
+ }
237
+ };
238
+ //#endregion
239
+ export { a as default };
@@ -0,0 +1,189 @@
1
+ import { computed as e, inject as t, onUnmounted as n, ref as r, watch as i } from "vue";
2
+ import { httpService as a } from "@skzz/libs-base";
3
+ //#region src/zz-layer/zz-layer-zzts3d-point/queryPoint.vue
4
+ var o = {
5
+ __name: "queryPoint",
6
+ props: {
7
+ config: {
8
+ type: Object,
9
+ default: () => ({})
10
+ },
11
+ style: {
12
+ type: Object,
13
+ default: () => ({})
14
+ }
15
+ },
16
+ emits: ["stats-change"],
17
+ setup(o, { emit: s }) {
18
+ let c = t("cesiumViewer"), l = s, u = r([]), d = o, f = {
19
+ dictCode: "",
20
+ polygon: "",
21
+ height: 0,
22
+ high: 0,
23
+ color: "255,0,0",
24
+ opacity: 1,
25
+ pixelSize: 5
26
+ }, p = e(() => {
27
+ let e = d.config || {}, t = d.style || {};
28
+ return {
29
+ ...f,
30
+ ...e,
31
+ color: t.color ?? e.color ?? f.color,
32
+ opacity: Number.isFinite(t.opacity) ? t.opacity : Number.isFinite(e.opacity) ? e.opacity : f.opacity,
33
+ pixelSize: Number.isFinite(t.pixelSize) ? t.pixelSize : Number.isFinite(e.pixelSize) ? e.pixelSize : f.pixelSize
34
+ };
35
+ }), m = e(() => {
36
+ let e = p.value;
37
+ return JSON.stringify({
38
+ dictCode: e.dictCode,
39
+ polygon: e.polygon,
40
+ height: e.height,
41
+ high: e.high
42
+ });
43
+ }), h = 0, g = "", _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), y = null;
44
+ function b(e) {
45
+ try {
46
+ let t = e?.["x-meta-data"] || e?.["X-Meta-Data"];
47
+ if (!t && e && typeof e.get == "function" && (t = e.get("x-meta-data") || e.get("X-Meta-Data")), !t) return [];
48
+ let n = decodeURIComponent(escape(atob(t))), r = JSON.parse(n), i = r?.avgValues, a = r?.properties || {};
49
+ return i ? Object.keys(i).map((e) => ({
50
+ twCode: e,
51
+ avgValue: i[e],
52
+ property: a[e] ?? ""
53
+ })) : [];
54
+ } catch (e) {
55
+ return console.warn("解析 X-Meta-Data 失败:", e), [];
56
+ }
57
+ }
58
+ function x(e) {
59
+ if (!e) return {
60
+ r: 255,
61
+ g: 0,
62
+ b: 0
63
+ };
64
+ if (typeof e == "string" && e.startsWith("#") && e.length === 7) return {
65
+ r: Number.parseInt(e.slice(1, 3), 16),
66
+ g: Number.parseInt(e.slice(3, 5), 16),
67
+ b: Number.parseInt(e.slice(5, 7), 16)
68
+ };
69
+ let t = String(e).split(",").map((e) => Number.parseFloat(e.trim()));
70
+ return {
71
+ r: Number.isFinite(t[0]) ? t[0] : 255,
72
+ g: Number.isFinite(t[1]) ? t[1] : 0,
73
+ b: Number.isFinite(t[2]) ? t[2] : 0
74
+ };
75
+ }
76
+ function S(e, t = 1) {
77
+ let { r: n, g: r, b: i } = x(e), a = Number.isFinite(t) ? Math.max(0, Math.min(1, t)) : 1;
78
+ return Cesium.Color.fromBytes(Math.max(0, Math.min(255, Math.round(n))), Math.max(0, Math.min(255, Math.round(r))), Math.max(0, Math.min(255, Math.round(i))), Math.round(a * 255));
79
+ }
80
+ function C(e = []) {
81
+ u.value = e, l("stats-change", e);
82
+ }
83
+ function w(e) {
84
+ let t = [], n = e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength), r = new DataView(n), i = 0, a = r.getInt32(i, !0);
85
+ i += 4;
86
+ for (let e = 0; e < a; e++) {
87
+ let e = r.getBigInt64(i, !0);
88
+ i += 8;
89
+ let n = r.getInt32(i, !0);
90
+ i += 4;
91
+ let a = n / 8, o = new Float64Array(a);
92
+ for (let e = 0; e < a; e++) o[e] = r.getFloat64(i, !0), i += 8;
93
+ t.push({
94
+ positions: o,
95
+ positionCount: a,
96
+ modelId: e.toString(),
97
+ lodLevel: 0
98
+ });
99
+ }
100
+ return t;
101
+ }
102
+ function T() {
103
+ if (!(!c.value || !y)) {
104
+ try {
105
+ c.value.scene.primitives.remove(y);
106
+ } catch {}
107
+ y = null;
108
+ }
109
+ }
110
+ function E(e, t) {
111
+ if (!e?.length || !c.value) {
112
+ T();
113
+ return;
114
+ }
115
+ T(), y = new Cesium.PointPrimitiveCollection({ blendOption: Cesium.BlendingState.BLEND_ADDITIVE });
116
+ let n = S(t.color, t.opacity), r = t.pixelSize;
117
+ e.forEach((e) => {
118
+ if (!e.positions?.length) return;
119
+ let t = e.positions;
120
+ for (let i = 0; i < t.length; i += 3) {
121
+ let a = t[i], o = t[i + 1], s = t[i + 2], c = y.add({
122
+ position: Cesium.Cartesian3.fromDegrees(a, o, s),
123
+ color: n,
124
+ pixelSize: r
125
+ });
126
+ c.geomModelId = e.modelId;
127
+ }
128
+ }), c.value.scene.primitives.add(y);
129
+ }
130
+ async function D() {
131
+ if (!c.value) return;
132
+ let e = p.value || {}, t = m.value;
133
+ if (!e.dictCode || !e.polygon) {
134
+ T(), C([]), g = "";
135
+ return;
136
+ }
137
+ let n = ++h, r = _.get(t);
138
+ if (r) C(v.get(t) || []);
139
+ else {
140
+ let i = new FormData();
141
+ i.append("modelsJson", JSON.stringify([{
142
+ dictCode: e.dictCode,
143
+ polygon: e.polygon,
144
+ height: e.height,
145
+ high: e.high
146
+ }]));
147
+ let o = await a.request({
148
+ method: "POST",
149
+ url: "/v1/zzts/twin/layer/3d/point/mining",
150
+ timeout: 6e4,
151
+ responseType: "arraybuffer",
152
+ headers: { "Content-Type": "multipart/form-data" },
153
+ data: i
154
+ });
155
+ if (n !== h) return;
156
+ r = w(new Uint8Array(o.data));
157
+ let s = b(o.headers);
158
+ _.set(t, r), v.set(t, s), C(s);
159
+ }
160
+ if (n === h) {
161
+ if (g = t, !r?.length) {
162
+ T();
163
+ return;
164
+ }
165
+ E(r, e);
166
+ }
167
+ }
168
+ function O() {
169
+ !g || !_.has(g) || E(_.get(g), p.value);
170
+ }
171
+ return i(m, () => {
172
+ D();
173
+ }, { immediate: !0 }), i(() => [
174
+ d.style?.color,
175
+ d.style?.opacity,
176
+ d.style?.pixelSize,
177
+ d.config?.color,
178
+ d.config?.opacity,
179
+ d.config?.pixelSize
180
+ ], () => {
181
+ let e = p.value || {};
182
+ !e.dictCode || !e.polygon || O();
183
+ }, { deep: !0 }), n(() => {
184
+ T(), C([]);
185
+ }), (e, t) => null;
186
+ }
187
+ };
188
+ //#endregion
189
+ export { o as default };
@@ -0,0 +1,115 @@
1
+ import { t as e } from "./pako.esm-D6zcBi67.js";
2
+ //#region src/zz-layer/zz-layer-zzts3dv2/tw2Parser.js
3
+ var t = 64 * 1024 * 1024, n = 2e5;
4
+ function r(e, t) {
5
+ if (!e) throw Error(`TW2 ${t}`);
6
+ }
7
+ function i(t, n) {
8
+ if (t[0] !== 31 || t[1] !== 139) return t;
9
+ let i = [], a = 0, o = new e.Inflate({ chunkSize: 65536 });
10
+ o.onData = (e) => {
11
+ a += e.byteLength, r(a <= n, "解压数据超过限制"), i.push(e);
12
+ }, o.push(t, !0), r(!o.err && o.ended, "gzip 数据无效");
13
+ let s = new Uint8Array(a), c = 0;
14
+ for (let e of i) s.set(e, c), c += e.length;
15
+ return s;
16
+ }
17
+ function a(e, a, o = t, s = n) {
18
+ o = Math.min(Number(o) || 67108864, t), s = Math.min(Number(s) || 2e5, n);
19
+ let c = e instanceof Uint8Array ? e : new Uint8Array(e);
20
+ r(c.byteLength <= o, "编码数据超过限制");
21
+ let l = i(c, o);
22
+ r(l.byteLength >= 16 && l.byteLength <= o, "分片数据大小无效");
23
+ let u = new DataView(l.buffer, l.byteOffset, l.byteLength);
24
+ r(u.getUint32(0, !0) === 3299156, "magic 不匹配");
25
+ let d = u.getUint16(4, !0), f = u.getUint8(6), p = u.getUint32(12, !0);
26
+ r([
27
+ 1,
28
+ 2,
29
+ 3
30
+ ].includes(d), "协议版本不受支持"), r(f >= 1 && f <= 5, "LOD 无效"), r(a == null || Number(a) === f, "请求 LOD 与文件不一致"), r(p <= s, "实体数量超过限制"), d === 3 && r(u.getUint16(10, !0) > 0 && u.getUint16(8, !0) < u.getUint16(10, !0), "分片编号无效");
31
+ let m = [], h = 16, g = f <= 3 ? .01 : 1;
32
+ for (let e = 0; e < p; e++) {
33
+ let e = h, t = d === 1 ? 16 : d === 2 ? 48 : 96;
34
+ r(h + t <= l.length, "实体头越界");
35
+ let n = u.getBigUint64(h + (d === 1 ? 0 : 8), !0), i = d === 1 ? u.getUint32(h + 8, !0) / 3 : u.getUint32(h + 16, !0), a = u.getUint32(h + (d === 1 ? 12 : 20), !0), o = d === 1 ? 0 : u.getUint32(h + 24, !0), s = d === 1 ? 0 : u.getUint32(h + 32, !0), c = d === 1 ? 0 : u.getUint32(h + 36, !0), f = d === 3 ? u.getUint32(h + 40, !0) : 0, p = d === 3 ? u.getUint32(h + 44, !0) : 0, _ = d === 3 ? u.getUint32(h + 76, !0) : 0;
36
+ r(Number.isInteger(i) && i >= 0 && a % 3 == 0, "几何数量无效");
37
+ for (let [e, t] of [
38
+ [s, 2],
39
+ [c, 4],
40
+ [f, 3],
41
+ [p, 4],
42
+ [_, 2]
43
+ ]) r(e === 0 || e === i * t, "属性长度无效");
44
+ let v = i * 12 + a * 4 + s * 4 + c + f * 4 + p * 4 + _ * 4 + o * 16, y = d === 1 ? t + v : u.getUint32(h, !0);
45
+ r(y === t + v && e + y <= l.length, "实体记录长度无效");
46
+ let b = d === 1 ? void 0 : l.slice(h + 28, h + 32), x = [
47
+ 0,
48
+ 0,
49
+ 0
50
+ ], S = 0;
51
+ if (d === 3) {
52
+ r(u.getUint32(h + 80, !0) === 96 && u.getUint32(h + 84, !0) === 0 && u.getBigUint64(h + 88, !0) === 0n, "v3 头无效");
53
+ let e = u.getUint32(h + 4, !0), t = [
54
+ s,
55
+ c,
56
+ f,
57
+ p,
58
+ _
59
+ ];
60
+ r((e & -32) == 0 && t.every((t, n) => !!(e & 1 << n) == t > 0), "属性标记不一致"), x = [
61
+ u.getFloat64(h + 48, !0),
62
+ u.getFloat64(h + 56, !0),
63
+ u.getFloat64(h + 64, !0)
64
+ ], S = u.getFloat32(h + 72, !0), r(x.every(Number.isFinite) && Number.isFinite(S) && S >= 0, "局部坐标原点或误差无效");
65
+ }
66
+ h += t;
67
+ let C = new Float64Array(i * 3);
68
+ for (let e = 0; e < C.length; e++) {
69
+ let t = d === 3 ? u.getFloat32(h, !0) : u.getInt32(h, !0) * g;
70
+ r(Number.isFinite(t), "位置非有限数"), C[e] = t + x[e % 3], h += 4;
71
+ }
72
+ let w = new Uint32Array(a);
73
+ for (let e = 0; e < a; e++) w[e] = u.getUint32(h, !0), h += 4, r(w[e] < i, "索引越界");
74
+ let T = (e) => {
75
+ if (!e) return null;
76
+ let t = new Float32Array(e);
77
+ for (let n = 0; n < e; n++) t[n] = u.getFloat32(h, !0), h += 4, r(Number.isFinite(t[n]), "属性非有限数");
78
+ return t;
79
+ }, E = T(s), D = c ? l.slice(h, h + c) : null;
80
+ h += c;
81
+ let O = T(f), k = T(p), A = T(_);
82
+ if (k) for (let e = 3; e < k.length; e += 4) r(Math.abs(Math.abs(k[e]) - 1) < .001, "切线手性无效");
83
+ let j = [];
84
+ for (let e = 0; e < o; e++) {
85
+ let e = u.getUint32(h + 4, !0), t = u.getUint32(h + 8, !0);
86
+ r(e % 3 == 0 && t % 3 == 0 && e + t <= a, "子网格索引范围无效"), j.push({
87
+ materialId: u.getUint32(h, !0),
88
+ firstIndex: e,
89
+ indexCount: t,
90
+ fallback: l.slice(h + 12, h + 16)
91
+ }), h += 16;
92
+ }
93
+ let M = {
94
+ id: n,
95
+ positions: C,
96
+ indices: w
97
+ };
98
+ d >= 2 && Object.assign(M, {
99
+ uv: E,
100
+ color: D,
101
+ subMeshes: j,
102
+ fallback: b
103
+ }), d === 3 && Object.assign(M, {
104
+ normals: O,
105
+ tangents: k,
106
+ uv1: A,
107
+ origin: x,
108
+ geometricErrorMeters: S,
109
+ version: d
110
+ }), m.push(M);
111
+ }
112
+ return r(h === l.length, "分片包含未知内容"), m;
113
+ }
114
+ //#endregion
115
+ export { n, a as r, t };
@@ -0,0 +1,75 @@
1
+ import { a as e, r as t } from "./layerStack-CbiVJONn.js";
2
+ import { computed as n, inject as r, onMounted as i, onUnmounted as a, watch as o } from "vue";
3
+ import * as s from "cesium";
4
+ //#region src/zz-model/zz-3dtiles/index.vue
5
+ var c = {
6
+ __name: "index",
7
+ props: {
8
+ config: {
9
+ type: Object,
10
+ default: () => ({})
11
+ },
12
+ stackIndex: {
13
+ type: Number,
14
+ default: -1
15
+ },
16
+ subStackIndex: {
17
+ type: Number,
18
+ default: 0
19
+ },
20
+ groupKey: {
21
+ type: String,
22
+ default: ""
23
+ }
24
+ },
25
+ emits: ["load-error"],
26
+ setup(c, { emit: l }) {
27
+ let u = r("cesiumViewer"), d = l, f = c, p, m = {
28
+ autoFitToView: !0,
29
+ show: !0
30
+ }, h = n(() => ({
31
+ ...m,
32
+ ...f.config
33
+ })), g = async () => {
34
+ if (u.value) {
35
+ _();
36
+ try {
37
+ if (p = await s.Cesium3DTileset.fromUrl(h.value.url), p.show = h.value.show !== !1, typeof h.value.maximumScreenSpaceError == "number" && (p.maximumScreenSpaceError = h.value.maximumScreenSpaceError), t(u.value, p, f.stackIndex, 0, {
38
+ layerType: "tiles3d",
39
+ groupKey: f.groupKey || h.value.url || String(f.stackIndex),
40
+ subStackIndex: f.subStackIndex
41
+ }), h.value.autoFitToView) {
42
+ let e = h.value.fitDuration;
43
+ typeof e == "number" ? u.value.flyTo(p, { duration: e }) : u.value.zoomTo(p);
44
+ }
45
+ h.value.customShader && (p.customShader = customShader);
46
+ } catch (e) {
47
+ console.error("3D Tiles 图层加载失败:", e), d("load-error");
48
+ }
49
+ }
50
+ }, _ = () => {
51
+ u.value && (p &&= (u.value.scene.primitives.remove(p), null));
52
+ };
53
+ return o(h, (e, t) => {
54
+ e.url === t?.url ? p && e.show !== t?.show && (p.show = e.show !== !1) : g();
55
+ }, { deep: !0 }), o(() => [
56
+ f.stackIndex,
57
+ f.subStackIndex,
58
+ f.groupKey
59
+ ], () => {
60
+ p && u.value && f.stackIndex >= 0 && e(u.value, p, f.stackIndex, {
61
+ layerType: "tiles3d",
62
+ groupKey: f.groupKey || h.value.url || String(f.stackIndex),
63
+ subStackIndex: f.subStackIndex
64
+ });
65
+ }), o(u, (e) => {
66
+ e && g();
67
+ }), i(() => {
68
+ g();
69
+ }), a(() => {
70
+ _();
71
+ }), (e, t) => null;
72
+ }
73
+ };
74
+ //#endregion
75
+ export { c as default };
@@ -0,0 +1,70 @@
1
+ import { computed as e, inject as t, onMounted as n, onUnmounted as r, ref as i, watch as a } from "vue";
2
+ import * as o from "cesium";
3
+ //#region src/zz-model/zz-gltf/index.vue
4
+ var s = {
5
+ __name: "index",
6
+ props: { config: {
7
+ type: Object,
8
+ default: () => ({})
9
+ } },
10
+ emits: ["model-ready", "model-error"],
11
+ setup(s, { emit: c }) {
12
+ let l = t("cesiumViewer"), u = c, d = s, f = i(null), p = {
13
+ url: "",
14
+ position: {
15
+ lng: 0,
16
+ lat: 0,
17
+ height: 0
18
+ },
19
+ scale: 1,
20
+ rotation: {
21
+ heading: 0,
22
+ pitch: 0,
23
+ roll: 0
24
+ },
25
+ show: !0,
26
+ minimumPixelSize: 128,
27
+ maximumScale: 2e4,
28
+ name: "gltf-model",
29
+ credit: ""
30
+ }, m = e(() => ({
31
+ ...p,
32
+ ...d.config
33
+ })), h = () => {
34
+ f.value && l.value && (l.value.entities.remove(f.value), f.value = null);
35
+ }, g = () => {
36
+ if (!(!l.value || !m.value.url)) {
37
+ h();
38
+ try {
39
+ let e = o.Cartesian3.fromDegrees(m.value.position.lng, m.value.position.lat, m.value.position.height), t = o.Transforms.headingPitchRollQuaternion(e, new o.HeadingPitchRoll(m.value.rotation.heading, m.value.rotation.pitch, m.value.rotation.roll));
40
+ f.value = l.value.entities.add({
41
+ name: m.value.name,
42
+ position: e,
43
+ orientation: t,
44
+ show: m.value.show,
45
+ model: {
46
+ uri: m.value.url,
47
+ scale: m.value.scale,
48
+ minimumPixelSize: m.value.minimumPixelSize,
49
+ maximumScale: m.value.maximumScale,
50
+ credit: m.value.credit
51
+ }
52
+ }), l.value.flyTo(f.value), u("model-ready", f.value);
53
+ } catch (e) {
54
+ console.error("GLTF模型加载失败:", e), u("model-error", e);
55
+ }
56
+ }
57
+ };
58
+ return a(m, (e, t) => {
59
+ (e.url !== t.url || JSON.stringify(e.position) !== JSON.stringify(t.position) || e.scale !== t.scale || JSON.stringify(e.rotation) !== JSON.stringify(t.rotation) || e.show !== t.show) && g();
60
+ }, { deep: !0 }), a(l, (e) => {
61
+ e && g();
62
+ }), n(() => {
63
+ g();
64
+ }), r(() => {
65
+ h();
66
+ }), (e, t) => null;
67
+ }
68
+ };
69
+ //#endregion
70
+ export { s as default };
@@ -0,0 +1,19 @@
1
+ /** GeoSOT/Cesium both represent a date-line crossing as west > east. */
2
+ export function normalizePreviewBounds(range: any): {
3
+ west: number;
4
+ south: number;
5
+ east: number;
6
+ north: number;
7
+ } | null;
8
+ /**
9
+ * Intersect wrapped ranges without treating the date line as an empty viewport.
10
+ * Two long arcs can intersect in two disconnected pieces. The existing planner
11
+ * accepts one rectangle, so return their smallest conservative circular envelope;
12
+ * this can include extra coverage, but never drops one of the actual intersections.
13
+ */
14
+ export function intersectPreviewBounds(first: any, second: any): {
15
+ west: number;
16
+ south: number;
17
+ east: number;
18
+ north: number;
19
+ } | null;