@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.
- package/dist/assets/twinPreviewWorker-COILIqOa.js +1 -0
- package/dist/color-DVYdxZow.js +359 -0
- package/dist/esm-BXiGX6xE.js +86 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +71 -6
- package/dist/index.es.js +1138 -9659
- package/dist/index.umd.js +5 -5
- package/dist/interpolation-Ctw2-y9G.js +211 -0
- package/dist/layerStack-CbiVJONn.js +181 -0
- package/dist/pako.esm-D6zcBi67.js +1455 -0
- package/dist/query-DgSNPfJM.js +239 -0
- package/dist/queryPoint-BOi_hkig.js +189 -0
- package/dist/zz-3dtiles-BzDYB-tW.js +75 -0
- package/dist/zz-gltf-BDHxqQjs.js +70 -0
- package/dist/zz-layer/zz-layer-shp-zzts/shpZztsCacheUtils.d.ts +53 -0
- package/dist/zz-layer/zz-layer-shp-zzts/shpZztsRenderer.d.ts +76 -6
- package/dist/zz-layer/zz-layer-zzts/zztsRasterCacheUtils.d.ts +35 -0
- package/dist/zz-layer/zz-layer-zzts/zztsRasterPreviewPolling.d.ts +10 -0
- package/dist/zz-layer/zz-layer-zzts3dv2/index.vue.d.ts +1 -0
- package/dist/zz-layer/zz-layer-zzts3dv2/twinPreviewWorker.d.ts +1 -0
- package/dist/zz-layer-geojson-CtTpn_f9.js +867 -0
- package/dist/zz-layer-mvt-R1-GwSIW.js +609 -0
- package/dist/zz-layer-shp-zzts-D8BjI5tI.js +1323 -0
- package/dist/zz-layer-zzts3d-DqZmLdW3.js +835 -0
- package/dist/zz-layer-zzts3d-grid-CTHFZBpo.js +314 -0
- package/dist/zz-layer-zzts3d-las-hNa-nqxq.js +560 -0
- package/dist/zz-layer-zzts3d-point-DrB5Uuwa.js +750 -0
- package/dist/zz-layer-zzts3dtype-BRl3mCk9.js +493 -0
- package/dist/zz-layer-zzts3dv2-D5udnVGT.js +913 -0
- package/dist/zz-terrain-excavation-A2NXSQ5P.js +502 -0
- package/dist/zz-viewer/index.vue.d.ts +2 -2
- package/dist/zzts3dLayerSignature-Cnu6KIys.js +42 -0
- package/package.json +2 -2
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { computed as e, inject as t, onMounted as n, onUnmounted as r, ref as i, watch as a } from "vue";
|
|
2
|
+
import { httpService as o } from "@skzz/libs-base";
|
|
3
|
+
//#region src/zz-layer/zz-layer-zzts3d-grid/index.vue
|
|
4
|
+
var s = "__zzts3dGridPickable", c = {
|
|
5
|
+
__name: "index",
|
|
6
|
+
props: { config: {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: () => ({})
|
|
9
|
+
} },
|
|
10
|
+
emits: ["point-click"],
|
|
11
|
+
setup(c, { emit: l }) {
|
|
12
|
+
let u = t("cesiumViewer"), d = c, f = l, p = i(null), m = {
|
|
13
|
+
modelId: "",
|
|
14
|
+
highlightEnabled: !1,
|
|
15
|
+
highlightColor: "255,255,0",
|
|
16
|
+
highlightOpacity: 1,
|
|
17
|
+
highlightToggle: !1,
|
|
18
|
+
fill: {
|
|
19
|
+
color: "255,255,255",
|
|
20
|
+
opacity: 1,
|
|
21
|
+
show: !0
|
|
22
|
+
},
|
|
23
|
+
line: {
|
|
24
|
+
color: "0,0,225",
|
|
25
|
+
opacity: 1,
|
|
26
|
+
show: !0,
|
|
27
|
+
width: .5
|
|
28
|
+
}
|
|
29
|
+
}, h = e(() => {
|
|
30
|
+
let e = d.config || {};
|
|
31
|
+
return {
|
|
32
|
+
...m,
|
|
33
|
+
...e,
|
|
34
|
+
fill: {
|
|
35
|
+
...m.fill,
|
|
36
|
+
...e.fill || {}
|
|
37
|
+
},
|
|
38
|
+
line: {
|
|
39
|
+
...m.line,
|
|
40
|
+
...e.line || {}
|
|
41
|
+
},
|
|
42
|
+
highlightEnabled: e.highlightEnabled === void 0 ? m.highlightEnabled : e.highlightEnabled,
|
|
43
|
+
highlightColor: e.highlightColor ?? m.highlightColor,
|
|
44
|
+
highlightOpacity: e.highlightOpacity === void 0 ? m.highlightOpacity : e.highlightOpacity,
|
|
45
|
+
highlightToggle: e.highlightToggle === void 0 ? m.highlightToggle : e.highlightToggle
|
|
46
|
+
};
|
|
47
|
+
}), g = i(null), _ = 0, v = 0, y = "", b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(), S = null, C = null, w = null;
|
|
48
|
+
function T(e) {
|
|
49
|
+
if (!e) return {
|
|
50
|
+
r: 255,
|
|
51
|
+
g: 255,
|
|
52
|
+
b: 255
|
|
53
|
+
};
|
|
54
|
+
if (typeof e == "string" && e.startsWith("#") && e.length === 7) return {
|
|
55
|
+
r: Number.parseInt(e.slice(1, 3), 16),
|
|
56
|
+
g: Number.parseInt(e.slice(3, 5), 16),
|
|
57
|
+
b: Number.parseInt(e.slice(5, 7), 16)
|
|
58
|
+
};
|
|
59
|
+
let t = String(e).split(",").map((e) => Number.parseFloat(e.trim()));
|
|
60
|
+
return {
|
|
61
|
+
r: Number.isFinite(t[0]) ? t[0] : 255,
|
|
62
|
+
g: Number.isFinite(t[1]) ? t[1] : 255,
|
|
63
|
+
b: Number.isFinite(t[2]) ? t[2] : 255
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function E(e, t = 1) {
|
|
67
|
+
let { r: n, g: r, b: i } = T(e), a = Number.isFinite(t) ? Math.max(0, Math.min(1, t)) : 1;
|
|
68
|
+
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));
|
|
69
|
+
}
|
|
70
|
+
function D(e) {
|
|
71
|
+
let t = new DataView(e), n = 0, r = t.getInt32(n, !1);
|
|
72
|
+
n += 4;
|
|
73
|
+
let i = [];
|
|
74
|
+
for (let a = 0; a < r; a++) {
|
|
75
|
+
let r = t.getInt32(n, !1);
|
|
76
|
+
n += 4;
|
|
77
|
+
let a = new Uint8Array(e, n, r), o = new TextDecoder("utf-8").decode(a);
|
|
78
|
+
n += r;
|
|
79
|
+
let s = t.getFloat64(n, !1), c = t.getFloat64(n + 8, !1), l = t.getFloat64(n + 16, !1), u = t.getFloat64(n + 24, !1), d = t.getFloat64(n + 32, !1), f = t.getFloat64(n + 40, !1);
|
|
80
|
+
n += 48, i.push([
|
|
81
|
+
s,
|
|
82
|
+
c,
|
|
83
|
+
l,
|
|
84
|
+
u,
|
|
85
|
+
d,
|
|
86
|
+
f,
|
|
87
|
+
o
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
return i;
|
|
91
|
+
}
|
|
92
|
+
function O() {
|
|
93
|
+
if (!u.value) return null;
|
|
94
|
+
if (S) return S;
|
|
95
|
+
let e = new Cesium.PrimitiveCollection();
|
|
96
|
+
return u.value.scene.primitives.add(e), S = e, S;
|
|
97
|
+
}
|
|
98
|
+
function k() {
|
|
99
|
+
if (S) {
|
|
100
|
+
try {
|
|
101
|
+
C && S.remove(C), w && S.remove(w);
|
|
102
|
+
} catch {}
|
|
103
|
+
try {
|
|
104
|
+
C && delete C[s], w && delete w[s];
|
|
105
|
+
} catch {}
|
|
106
|
+
C = null, w = null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function A() {
|
|
110
|
+
if (p.value) {
|
|
111
|
+
try {
|
|
112
|
+
p.value.destroy();
|
|
113
|
+
} catch {}
|
|
114
|
+
p.value = null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function j(e) {
|
|
118
|
+
if (e == null) return "";
|
|
119
|
+
let t = String(e);
|
|
120
|
+
return t.startsWith("grid_outline_") ? t.slice(13) : t;
|
|
121
|
+
}
|
|
122
|
+
function M() {
|
|
123
|
+
C && (C[s] = !0), w && (w[s] = !0);
|
|
124
|
+
}
|
|
125
|
+
function N(e, t) {
|
|
126
|
+
return Cesium.ColorGeometryInstanceAttribute.toValue(E(e, t));
|
|
127
|
+
}
|
|
128
|
+
function P(e) {
|
|
129
|
+
if (!e) return;
|
|
130
|
+
let t = h.value, n = String(e), r = `grid_outline_${e}`;
|
|
131
|
+
try {
|
|
132
|
+
if (C?.ready) {
|
|
133
|
+
let e = C.getGeometryInstanceAttributes(n);
|
|
134
|
+
e?.color && t.fill?.show !== !1 && (e.color = N(t.fill?.color, t.fill?.opacity));
|
|
135
|
+
}
|
|
136
|
+
if (w?.ready) {
|
|
137
|
+
let e = w.getGeometryInstanceAttributes(r);
|
|
138
|
+
e?.color && t.line?.show !== !1 && (e.color = N(t.line?.color, t.line?.opacity));
|
|
139
|
+
}
|
|
140
|
+
} catch {}
|
|
141
|
+
}
|
|
142
|
+
function F(e) {
|
|
143
|
+
if (!e) return;
|
|
144
|
+
let t = h.value, n = N(t.highlightColor, t.highlightOpacity ?? 1), r = String(e), i = `grid_outline_${e}`;
|
|
145
|
+
try {
|
|
146
|
+
if (C?.ready) {
|
|
147
|
+
let e = C.getGeometryInstanceAttributes(r);
|
|
148
|
+
e?.color && t.fill?.show !== !1 && (e.color = n);
|
|
149
|
+
}
|
|
150
|
+
if (w?.ready) {
|
|
151
|
+
let e = w.getGeometryInstanceAttributes(i);
|
|
152
|
+
e?.color && t.line?.show !== !1 && (e.color = n);
|
|
153
|
+
}
|
|
154
|
+
} catch {}
|
|
155
|
+
}
|
|
156
|
+
function I() {
|
|
157
|
+
let e = g.value;
|
|
158
|
+
e && (P(e), g.value = null);
|
|
159
|
+
}
|
|
160
|
+
function L(e) {
|
|
161
|
+
if (!u.value?.scene?.drillPick) return null;
|
|
162
|
+
let t = u.value.scene.drillPick(e.position, 32);
|
|
163
|
+
if (!t?.length) return null;
|
|
164
|
+
for (let e = 0; e < t.length; e++) {
|
|
165
|
+
let n = t[e], r = n?.primitive;
|
|
166
|
+
if (r && (r[s] === !0 || r === C || r === w)) return n;
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
function R() {
|
|
171
|
+
if (A(), u.value) {
|
|
172
|
+
if (!h.value.highlightEnabled) {
|
|
173
|
+
I();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
!C && !w || (M(), p.value = new Cesium.ScreenSpaceEventHandler(u.value.scene.canvas), p.value.setInputAction((e) => {
|
|
177
|
+
(async () => {
|
|
178
|
+
try {
|
|
179
|
+
let t = h.value, n = L(e);
|
|
180
|
+
if (!n) {
|
|
181
|
+
I(), f("point-click", {});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
let r = j(n.id);
|
|
185
|
+
if (!r) {
|
|
186
|
+
I(), f("point-click", {});
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
g.value === r && t.highlightToggle ? I() : (I(), g.value = r, F(r));
|
|
190
|
+
let i = null;
|
|
191
|
+
i = await o.request({
|
|
192
|
+
method: "post",
|
|
193
|
+
url: "/v1/zzts/twin/layer/3d/point/queryGridByCode",
|
|
194
|
+
data: { code: r },
|
|
195
|
+
headers: { repeatSubmit: !1 }
|
|
196
|
+
}), f("point-click", {
|
|
197
|
+
code: r,
|
|
198
|
+
gridData: i
|
|
199
|
+
});
|
|
200
|
+
} catch (e) {
|
|
201
|
+
console.error("[zzLayerZzts3dGrid] point-click", e);
|
|
202
|
+
}
|
|
203
|
+
})();
|
|
204
|
+
}, Cesium.ScreenSpaceEventType.LEFT_CLICK));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function z() {
|
|
208
|
+
A(), g.value = null;
|
|
209
|
+
try {
|
|
210
|
+
k(), u.value && S && u.value.scene.primitives.remove(S);
|
|
211
|
+
} catch {}
|
|
212
|
+
S = null;
|
|
213
|
+
}
|
|
214
|
+
function B(e) {
|
|
215
|
+
y && b.has(y) && V(b.get(y), e);
|
|
216
|
+
}
|
|
217
|
+
function V(e, t) {
|
|
218
|
+
let n = ++v, r = O();
|
|
219
|
+
if (!r) return;
|
|
220
|
+
k();
|
|
221
|
+
let i = E(t.fill?.color, t.fill?.opacity), a = E(t.line?.color, t.line?.opacity), o = t.fill?.show !== !1, s = t.line?.show !== !1, c = [], l = [];
|
|
222
|
+
for (let t = 0; t < e.length; t++) {
|
|
223
|
+
let n = e[t], r = n[0], u = n[1], d = n[2], f = n[3], p = n[4], m = n[5], h = n[6], g = Cesium.Rectangle.fromDegrees(r, u, d, f), _ = m + p;
|
|
224
|
+
o && c.push(new Cesium.GeometryInstance({
|
|
225
|
+
id: `${h}`,
|
|
226
|
+
geometry: new Cesium.RectangleGeometry({
|
|
227
|
+
rectangle: g,
|
|
228
|
+
height: m,
|
|
229
|
+
extrudedHeight: _,
|
|
230
|
+
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
|
|
231
|
+
}),
|
|
232
|
+
attributes: { color: Cesium.ColorGeometryInstanceAttribute.fromColor(i) }
|
|
233
|
+
})), s && l.push(new Cesium.GeometryInstance({
|
|
234
|
+
id: `grid_outline_${h}`,
|
|
235
|
+
geometry: new Cesium.RectangleOutlineGeometry({
|
|
236
|
+
rectangle: g,
|
|
237
|
+
height: m,
|
|
238
|
+
extrudedHeight: _
|
|
239
|
+
}),
|
|
240
|
+
attributes: { color: Cesium.ColorGeometryInstanceAttribute.fromColor(a) }
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
c.length && (C = r.add(new Cesium.Primitive({
|
|
244
|
+
geometryInstances: c,
|
|
245
|
+
appearance: new Cesium.PerInstanceColorAppearance({
|
|
246
|
+
translucent: !0,
|
|
247
|
+
closed: !0
|
|
248
|
+
}),
|
|
249
|
+
asynchronous: !0,
|
|
250
|
+
allowPicking: !0
|
|
251
|
+
}))), l.length && (w = r.add(new Cesium.Primitive({
|
|
252
|
+
geometryInstances: l,
|
|
253
|
+
appearance: new Cesium.PerInstanceColorAppearance({
|
|
254
|
+
translucent: !0,
|
|
255
|
+
flat: !0
|
|
256
|
+
}),
|
|
257
|
+
asynchronous: !0,
|
|
258
|
+
allowPicking: !0
|
|
259
|
+
})));
|
|
260
|
+
let d = () => {
|
|
261
|
+
if (n !== v || !u.value || u.value.isDestroyed()) return;
|
|
262
|
+
R();
|
|
263
|
+
let e = g.value;
|
|
264
|
+
e && F(e);
|
|
265
|
+
}, f = [];
|
|
266
|
+
C?.readyPromise && f.push(C.readyPromise), w?.readyPromise && f.push(w.readyPromise), f.length ? Promise.all(f).then(d, d) : d();
|
|
267
|
+
}
|
|
268
|
+
async function H() {
|
|
269
|
+
if (!u.value) return;
|
|
270
|
+
let e = h.value || {}, t = e.modelId;
|
|
271
|
+
if (!t) {
|
|
272
|
+
z();
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
let n = ++_;
|
|
276
|
+
O(), k();
|
|
277
|
+
let r = b.get(t);
|
|
278
|
+
if (!r) {
|
|
279
|
+
let e = new AbortController();
|
|
280
|
+
x.add(e);
|
|
281
|
+
let i = await o.request({
|
|
282
|
+
method: "GET",
|
|
283
|
+
url: "/v1/zzts/layer/3d/getGridsNewByModelId",
|
|
284
|
+
headers: { Accept: "application/octet-stream" },
|
|
285
|
+
responseType: "arraybuffer",
|
|
286
|
+
params: { modelId: t },
|
|
287
|
+
signal: e.signal
|
|
288
|
+
}).catch((t) => {
|
|
289
|
+
if (e.signal.aborted) return null;
|
|
290
|
+
throw t;
|
|
291
|
+
});
|
|
292
|
+
if (x.delete(e), !i || n !== _) return;
|
|
293
|
+
let a = i?.data;
|
|
294
|
+
if (!a || !a.byteLength) return;
|
|
295
|
+
r = D(a), b.set(t, r);
|
|
296
|
+
}
|
|
297
|
+
n === _ && (y = t, V(r, e));
|
|
298
|
+
}
|
|
299
|
+
return a(() => h.value.modelId, () => {
|
|
300
|
+
H();
|
|
301
|
+
}, { immediate: !0 }), a(() => [h.value.fill, h.value.line], () => {
|
|
302
|
+
let e = h.value || {};
|
|
303
|
+
e?.modelId && B(e);
|
|
304
|
+
}, { deep: !0 }), a(() => h.value.highlightEnabled, () => {
|
|
305
|
+
R();
|
|
306
|
+
}), a(() => [h.value.highlightColor, h.value.highlightOpacity], () => {
|
|
307
|
+
g.value && F(g.value);
|
|
308
|
+
}), n(() => {}), r(() => {
|
|
309
|
+
_++, v++, x.forEach((e) => e.abort()), x.clear(), b.clear(), y = "", z();
|
|
310
|
+
}), (e, t) => null;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
//#endregion
|
|
314
|
+
export { c as default };
|