@cearth/tools 2.4.0 → 2.6.0
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/math/transform.d.ts +8 -6
- package/dist/math/transform.d.ts.map +1 -1
- package/dist/tile/3DTileset.d.ts +28 -0
- package/dist/tile/3DTileset.d.ts.map +1 -0
- package/dist/tile/index.d.ts +1 -0
- package/dist/tile/index.d.ts.map +1 -1
- package/dist/tools.iife.js +15 -15
- package/dist/tools.js +175 -164
- package/dist/tools.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WebGLConstants as
|
|
2
|
-
import { MatrixComposeOrder as
|
|
1
|
+
import { WebGLConstants as M, Cartesian3 as l, HeadingPitchRoll as I, Quaternion as w, Matrix3 as g, Matrix4 as a, TranslationRotationScale as P, Plane as rt, Transforms as E, BoundingSphere as C, JulianDate as h, Cartesian2 as x, ComponentDatatype as Z, Cartographic as D, Cartesian4 as O, Rectangle as v, Matrix2 as N } from "cesium";
|
|
2
|
+
import { MatrixComposeOrder as F, mat4_decompose_quat as at, mat4_compose_quat as st, getMatrixOfQuantizedMeshTerrainData as ct, Geometry as lt, workerApi as ut, GeometricRelation as z, computeSignAreaOfPolygon3 as K, computeRelationAreaOfPolygon2Terrain as ft } from "@web-3d/tools";
|
|
3
3
|
function Ut(t) {
|
|
4
|
-
return q(t) || J(t) ||
|
|
4
|
+
return q(t) || J(t) || mt(t);
|
|
5
5
|
}
|
|
6
6
|
function q(t) {
|
|
7
7
|
return "modelMatrix" in t;
|
|
@@ -9,53 +9,53 @@ function q(t) {
|
|
|
9
9
|
function J(t) {
|
|
10
10
|
return "position" in t;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function mt(t) {
|
|
13
13
|
return "positions" in t;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const pt = {
|
|
16
16
|
/**
|
|
17
17
|
* 8-bit signed byte corresponding to <code>gl.BYTE</code> and the type
|
|
18
18
|
* of an element in <code>Int8Array</code>.
|
|
19
19
|
*/
|
|
20
|
-
[
|
|
20
|
+
[M.BYTE]: Int8Array,
|
|
21
21
|
/**
|
|
22
22
|
* 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
|
|
23
23
|
* of an element in <code>Uint8Array</code>.
|
|
24
24
|
*/
|
|
25
|
-
[
|
|
25
|
+
[M.UNSIGNED_BYTE]: Uint8Array,
|
|
26
26
|
/**
|
|
27
27
|
* 16-bit signed short corresponding to <code>SHORT</code> and the type
|
|
28
28
|
* of an element in <code>Int16Array</code>.
|
|
29
29
|
*/
|
|
30
|
-
[
|
|
30
|
+
[M.SHORT]: Int16Array,
|
|
31
31
|
/**
|
|
32
32
|
* 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
|
|
33
33
|
* of an element in <code>Uint16Array</code>.
|
|
34
34
|
*/
|
|
35
|
-
[
|
|
35
|
+
[M.UNSIGNED_SHORT]: Uint16Array,
|
|
36
36
|
/**
|
|
37
37
|
* 32-bit signed int corresponding to <code>INT</code> and the type
|
|
38
38
|
* of an element in <code>Int32Array</code>.
|
|
39
39
|
*/
|
|
40
|
-
[
|
|
40
|
+
[M.INT]: Int32Array,
|
|
41
41
|
/**
|
|
42
42
|
* 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
|
|
43
43
|
* of an element in <code>Uint32Array</code>.
|
|
44
44
|
*/
|
|
45
|
-
[
|
|
45
|
+
[M.UNSIGNED_INT]: Uint32Array,
|
|
46
46
|
/**
|
|
47
47
|
* 32-bit floating-point corresponding to <code>FLOAT</code> and the type
|
|
48
48
|
* of an element in <code>Float32Array</code>.
|
|
49
49
|
*/
|
|
50
|
-
[
|
|
50
|
+
[M.FLOAT]: Float32Array,
|
|
51
51
|
/**
|
|
52
52
|
* 64-bit floating-point corresponding to <code>gl.DOUBLE</code> (in Desktop OpenGL;
|
|
53
53
|
* this is not supported in WebGL, and is emulated in Cesium via {@link GeometryPipeline.encodeAttribute})
|
|
54
54
|
* and the type of an element in <code>Float64Array</code>.
|
|
55
55
|
*/
|
|
56
|
-
[
|
|
56
|
+
[M.DOUBLE]: Float64Array
|
|
57
57
|
};
|
|
58
|
-
var
|
|
58
|
+
var dt = /* @__PURE__ */ ((t) => (t[t.x = 0] = "x", t[t.y = 1] = "y", t[t.z = 2] = "z", t))(dt || {}), b = /* @__PURE__ */ ((t) => (t.x = "roll", t.y = "pitch", t.z = "heading", t))(b || {});
|
|
59
59
|
((t) => {
|
|
60
60
|
function o(i) {
|
|
61
61
|
for (let [r, s] of Object.entries(t))
|
|
@@ -72,7 +72,7 @@ var pt = /* @__PURE__ */ ((t) => (t[t.x = 0] = "x", t[t.y = 1] = "y", t[t.z = 2]
|
|
|
72
72
|
}
|
|
73
73
|
t.toHeadingPitchRoll = e;
|
|
74
74
|
})(b || (b = {}));
|
|
75
|
-
var
|
|
75
|
+
var yt = /* @__PURE__ */ ((t) => (t[t.heading = 0] = "heading", t[t.pitch = 1] = "pitch", t[t.roll = 2] = "roll", t))(yt || {});
|
|
76
76
|
function $(t) {
|
|
77
77
|
const o = t?.world, { translation: n, rotation: e, scale: i } = o && typeof o == "object" ? o : { translation: o, rotation: o, scale: o };
|
|
78
78
|
return { ...t, worldTranslation: n, worldRotation: e, worldScale: i };
|
|
@@ -98,7 +98,7 @@ function jt(t, o, n) {
|
|
|
98
98
|
const e = a.inverse(o, new a());
|
|
99
99
|
return a.multiply(e, t, n);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function wt(t, o, n) {
|
|
102
102
|
let e = w.computeAxis(t, new l());
|
|
103
103
|
if (e.equals(l.ZERO)) return null;
|
|
104
104
|
const i = w.computeAngle(t);
|
|
@@ -112,24 +112,24 @@ function Wt(t, o, n) {
|
|
|
112
112
|
}
|
|
113
113
|
function L(t, o) {
|
|
114
114
|
let { translation: n, rotation: e, scale: i } = t;
|
|
115
|
-
const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale:
|
|
116
|
-
let
|
|
117
|
-
return n && (s || (n = a.multiplyByPointAsVector(r, n, new l()))), e && (
|
|
115
|
+
const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: f } = $(o);
|
|
116
|
+
let u = null;
|
|
117
|
+
return n && (s || (n = a.multiplyByPointAsVector(r, n, new l()))), e && (u = G(e), c || (u = wt(u, r))), i && (f || (i = a.multiplyByPointAsVector(r, i, new l()))), { translation: n, rotation: u, scale: i };
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function gt(t, o) {
|
|
120
120
|
let { translation: n, rotation: e, scale: i } = t;
|
|
121
|
-
const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale:
|
|
121
|
+
const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: f } = $(o), u = r ? a.inverse(r, new a()) : null;
|
|
122
122
|
let m = null;
|
|
123
|
-
if (n && s && (n = a.multiplyByPointAsVector(
|
|
123
|
+
if (n && s && (n = a.multiplyByPointAsVector(u, n, new l())), e && (m = G(e), c)) {
|
|
124
124
|
let p = w.computeAxis(m, new l());
|
|
125
125
|
if (!p.equals(l.ZERO)) {
|
|
126
126
|
const d = w.computeAngle(m);
|
|
127
|
-
p = a.multiplyByPointAsVector(
|
|
127
|
+
p = a.multiplyByPointAsVector(u, p, p), m = w.fromAxisAngle(p, d);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
return i &&
|
|
130
|
+
return i && f && (i = a.multiplyByPointAsVector(u, i, new l())), { translation: n, rotation: m, scale: i };
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function ht(t, o) {
|
|
133
133
|
const n = o?.defaultMatrix;
|
|
134
134
|
let { translation: e, rotation: i, scale: r } = L(t, o);
|
|
135
135
|
if (n) {
|
|
@@ -139,32 +139,32 @@ function gt(t, o) {
|
|
|
139
139
|
}
|
|
140
140
|
r || (r = a.getScale(n, new l()));
|
|
141
141
|
}
|
|
142
|
-
const s = new
|
|
142
|
+
const s = new P(e ?? void 0, i ?? void 0, r ?? void 0);
|
|
143
143
|
return a.fromTranslationRotationScale(s);
|
|
144
144
|
}
|
|
145
145
|
function Xt(t) {
|
|
146
|
-
const { translation: o, rotation: n, scale: e } = t, i = n ? G(n) : void 0, r = new
|
|
146
|
+
const { translation: o, rotation: n, scale: e } = t, i = n ? G(n) : void 0, r = new P(o ?? void 0, i, e ?? void 0);
|
|
147
147
|
return a.fromTranslationRotationScale(r);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function xt(t, o, n) {
|
|
150
150
|
const e = l.subtract(o, t, new l()), i = l.subtract(n, t, new l()), r = l.cross(e, i, e);
|
|
151
151
|
return l.normalize(r, e);
|
|
152
152
|
}
|
|
153
153
|
function Zt(t, o, n) {
|
|
154
|
-
const e =
|
|
155
|
-
return
|
|
154
|
+
const e = xt(t, o, n);
|
|
155
|
+
return rt.fromPointNormal(e, t);
|
|
156
156
|
}
|
|
157
157
|
function* Kt(t, o = !0, n, e) {
|
|
158
158
|
const i = t.length, r = o ? i : i - 1, s = n || e ? l.prototype.equalsEpsilon : l.prototype.equals;
|
|
159
159
|
for (let c = 0; c < r; c++) {
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
for (; s.call(
|
|
163
|
-
if (
|
|
160
|
+
const f = t[c];
|
|
161
|
+
let u = (c + 1) % i, m = t[u], p = c;
|
|
162
|
+
for (; s.call(f, m, n, e); ) {
|
|
163
|
+
if (u = (++p + 1) % i, u === c)
|
|
164
164
|
return;
|
|
165
|
-
m = t[
|
|
165
|
+
m = t[u];
|
|
166
166
|
}
|
|
167
|
-
c = p, yield [
|
|
167
|
+
c = p, yield [f, m];
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
function H(t, o, n) {
|
|
@@ -206,38 +206,38 @@ function rn(t, o) {
|
|
|
206
206
|
const { translation: n, rotation: e, scale: i } = t;
|
|
207
207
|
let r;
|
|
208
208
|
if (e) {
|
|
209
|
-
const { axis: c, angle:
|
|
210
|
-
r = w.fromAxisAngle(c,
|
|
209
|
+
const { axis: c, angle: f } = e;
|
|
210
|
+
r = w.fromAxisAngle(c, f);
|
|
211
211
|
}
|
|
212
|
-
const s = new
|
|
212
|
+
const s = new P(n ?? void 0, r, i ?? void 0);
|
|
213
213
|
return a.fromTranslationRotationScale(s, o ?? void 0);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
n ??= new
|
|
217
|
-
const e = a.pack(t, []), i = [], r = [], s = [], c = o ?
|
|
218
|
-
return
|
|
215
|
+
function nt(t, o, n) {
|
|
216
|
+
n ??= new P();
|
|
217
|
+
const e = a.pack(t, []), i = [], r = [], s = [], c = o ? F[o] : F.trs;
|
|
218
|
+
return at(i, s, r, e, c), l.unpack(i, 0, n.translation), l.unpack(r, 0, n.scale), w.unpack(s, 0, n.rotation), n;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
return
|
|
220
|
+
function an(t, o) {
|
|
221
|
+
return nt(t, null, o);
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
const e = l.pack(t.translation, []), i = l.pack(t.scale, []), r = w.pack(t.rotation, []), s = o ?
|
|
223
|
+
function Tt(t, o, n) {
|
|
224
|
+
const e = l.pack(t.translation, []), i = l.pack(t.scale, []), r = w.pack(t.rotation, []), s = o ? F[o] : F.trs, c = st([], e, r, i, s);
|
|
225
225
|
return a.unpack(c, 0, n);
|
|
226
226
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
229
|
-
const
|
|
230
|
-
function
|
|
231
|
-
return
|
|
227
|
+
const sn = a.fromTranslationRotationScale;
|
|
228
|
+
function vt(t, o) {
|
|
229
|
+
const n = a.inverse(t, new a()), e = new a();
|
|
230
|
+
function i(s, c) {
|
|
231
|
+
return c = Tt(s, o, c), a.multiply(t, c, c);
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return a.multiply(
|
|
233
|
+
function r(s, c) {
|
|
234
|
+
return a.multiply(n, s, e), nt(e, o, c);
|
|
235
235
|
}
|
|
236
|
-
return { compose:
|
|
236
|
+
return { compose: i, decompose: r, referInverse: n };
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
const
|
|
240
|
-
return { ...
|
|
238
|
+
function At(t, o, n) {
|
|
239
|
+
const e = E.eastNorthUpToFixedFrame(t, n ?? void 0);
|
|
240
|
+
return { ...vt(e, o), refer: e };
|
|
241
241
|
}
|
|
242
242
|
function cn(t) {
|
|
243
243
|
let o = t.boundingSphere;
|
|
@@ -265,10 +265,10 @@ function ln(t, o) {
|
|
|
265
265
|
}
|
|
266
266
|
function un(t, o, n) {
|
|
267
267
|
let { translation: e, rotation: i, scale: r } = L(o, n);
|
|
268
|
-
const s = new
|
|
269
|
-
return
|
|
268
|
+
const s = new P(e ?? void 0, i ?? void 0, r ?? void 0), c = a.fromTranslationRotationScale(s);
|
|
269
|
+
return Mt(t, c);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Mt(t, o) {
|
|
272
272
|
const n = t.modelMatrix;
|
|
273
273
|
if (n)
|
|
274
274
|
return a.multiply(o, n, n), t.modelMatrix = n, !0;
|
|
@@ -292,10 +292,10 @@ function Pt(t, o) {
|
|
|
292
292
|
return !1;
|
|
293
293
|
}
|
|
294
294
|
function fn(t, o, n) {
|
|
295
|
-
const e = Rt(t), i =
|
|
296
|
-
return
|
|
295
|
+
const e = Rt(t), i = ht(o, { ...n, defaultMatrix: e });
|
|
296
|
+
return Pt(t, i);
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function Pt(t, o) {
|
|
299
299
|
if (q(t))
|
|
300
300
|
return t.modelMatrix = o, !0;
|
|
301
301
|
const n = a.getTranslation(o, new l());
|
|
@@ -320,7 +320,7 @@ function Rt(t) {
|
|
|
320
320
|
if (q(t))
|
|
321
321
|
return t.modelMatrix;
|
|
322
322
|
if (J(t)) {
|
|
323
|
-
const n = t.position, e = t.scale ?? 1, i = new
|
|
323
|
+
const n = t.position, e = t.scale ?? 1, i = new P(n, void 0, new l(e, e, e));
|
|
324
324
|
return a.fromTranslationRotationScale(i);
|
|
325
325
|
}
|
|
326
326
|
const o = t.positions;
|
|
@@ -332,10 +332,10 @@ function Rt(t) {
|
|
|
332
332
|
}
|
|
333
333
|
function mn(t, o) {
|
|
334
334
|
let { translation: n, rotation: e, scale: i } = L(o, o);
|
|
335
|
-
const { reset: r, referFrame: s } = o, c = h.now(),
|
|
335
|
+
const { reset: r, referFrame: s } = o, c = h.now(), f = !r;
|
|
336
336
|
if (e) {
|
|
337
337
|
let A = e;
|
|
338
|
-
if (
|
|
338
|
+
if (f) {
|
|
339
339
|
const T = t.orientation?.getValue(c);
|
|
340
340
|
T && (A = w.multiply(e, T, T));
|
|
341
341
|
}
|
|
@@ -343,14 +343,14 @@ function mn(t, o) {
|
|
|
343
343
|
}
|
|
344
344
|
if (n) {
|
|
345
345
|
let A = n;
|
|
346
|
-
if (
|
|
346
|
+
if (f) {
|
|
347
347
|
const T = t.position?.getValue(c);
|
|
348
348
|
T && (A = l.add(T, n, T));
|
|
349
349
|
}
|
|
350
350
|
t.position = A;
|
|
351
351
|
}
|
|
352
352
|
if (!s) return;
|
|
353
|
-
const { translation:
|
|
353
|
+
const { translation: u, rotation: m, scale: p } = gt(o, o), d = new P(u ?? void 0, m ?? void 0, p ?? void 0);
|
|
354
354
|
let y = a.fromTranslationRotationScale(d);
|
|
355
355
|
if (y = H(y, s, y), p) {
|
|
356
356
|
const A = t.box;
|
|
@@ -371,11 +371,11 @@ function mn(t, o) {
|
|
|
371
371
|
const V = t.polygon;
|
|
372
372
|
V && bt(V, y, p);
|
|
373
373
|
const S = t.polyline;
|
|
374
|
-
S &&
|
|
374
|
+
S && _t(S, y, p);
|
|
375
375
|
const B = t.polylineVolume;
|
|
376
|
-
B &&
|
|
377
|
-
const
|
|
378
|
-
|
|
376
|
+
B && Nt(B, y, p);
|
|
377
|
+
const _ = t.wall;
|
|
378
|
+
_ && Ft(_, y, p);
|
|
379
379
|
}
|
|
380
380
|
function St(t, o) {
|
|
381
381
|
const n = h.now(), e = t.dimensions?.getValue(n);
|
|
@@ -396,8 +396,8 @@ function Vt(t, o) {
|
|
|
396
396
|
s != null && (t.semiMinorAxis = s * e);
|
|
397
397
|
const c = t.height?.getValue(n);
|
|
398
398
|
c != null && (t.height = c * i);
|
|
399
|
-
const
|
|
400
|
-
|
|
399
|
+
const f = t.extrudedHeight?.getValue(n);
|
|
400
|
+
f != null && (t.extrudedHeight = f * i);
|
|
401
401
|
}
|
|
402
402
|
function Bt(t, o) {
|
|
403
403
|
const n = h.now(), e = t.radii?.getValue(n);
|
|
@@ -426,71 +426,71 @@ function Ct(t, o, n) {
|
|
|
426
426
|
}
|
|
427
427
|
const s = n ?? a.getScale(o, i), c = Math.max(s.x, s.y);
|
|
428
428
|
t.width?.getValue(e) != null && (t.width = c * scale);
|
|
429
|
-
const
|
|
430
|
-
|
|
429
|
+
const u = t.height?.getValue(e), m = s.z;
|
|
430
|
+
u != null && (t.height = u * m);
|
|
431
431
|
}
|
|
432
432
|
function bt(t, o, n) {
|
|
433
433
|
const e = h.now(), i = new l(), r = t.hierarchy?.getValue(e);
|
|
434
|
-
r && (
|
|
435
|
-
const c = (n ?? a.getScale(o, i)).z,
|
|
436
|
-
|
|
437
|
-
const
|
|
438
|
-
|
|
434
|
+
r && (ot(r, o), t.hierarchy = r);
|
|
435
|
+
const c = (n ?? a.getScale(o, i)).z, f = t.height?.getValue(e);
|
|
436
|
+
f != null && (t.height = f * c);
|
|
437
|
+
const u = t.extrudedHeight?.getValue(e);
|
|
438
|
+
u != null && (t.extrudedHeight = u * c);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function ot(t, o) {
|
|
441
441
|
const { positions: n, holes: e } = t;
|
|
442
442
|
for (const i of n)
|
|
443
443
|
a.multiplyByPoint(o, i, i);
|
|
444
444
|
t.positions = n;
|
|
445
445
|
for (const i of e)
|
|
446
|
-
|
|
446
|
+
ot(i, o);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function _t(t, o, n) {
|
|
449
449
|
const e = h.now(), i = new l(), r = t.positions?.getValue(e);
|
|
450
450
|
if (r?.length > 0) {
|
|
451
|
-
for (const
|
|
452
|
-
a.multiplyByPoint(o,
|
|
451
|
+
for (const u of r)
|
|
452
|
+
a.multiplyByPoint(o, u, u);
|
|
453
453
|
t.positions = r;
|
|
454
454
|
}
|
|
455
455
|
const s = n ?? a.getScale(o, i), c = Math.max(s.x, s.y);
|
|
456
456
|
t.width?.getValue(e) != null && (t.width = c * scale);
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Nt(t, o, n) {
|
|
459
459
|
const e = h.now(), i = new l(), r = t.positions?.getValue(e);
|
|
460
460
|
if (r?.length > 0) {
|
|
461
|
-
for (const
|
|
462
|
-
a.multiplyByPoint(o,
|
|
461
|
+
for (const u of r)
|
|
462
|
+
a.multiplyByPoint(o, u, u);
|
|
463
463
|
t.positions = r;
|
|
464
464
|
}
|
|
465
|
-
const s = n ?? a.getScale(o, i), c = x.fromCartesian3(s),
|
|
466
|
-
if (
|
|
467
|
-
for (const
|
|
468
|
-
x.multiplyComponents(
|
|
469
|
-
t.shape =
|
|
465
|
+
const s = n ?? a.getScale(o, i), c = x.fromCartesian3(s), f = t.shape?.getValue(e);
|
|
466
|
+
if (f != null) {
|
|
467
|
+
for (const u of f)
|
|
468
|
+
x.multiplyComponents(u, c, u);
|
|
469
|
+
t.shape = f;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Ft(t, o, n) {
|
|
473
473
|
const e = h.now(), i = new l(), r = t.positions?.getValue(e);
|
|
474
474
|
if (r?.length > 0) {
|
|
475
475
|
for (const m of r)
|
|
476
476
|
a.multiplyByPoint(o, m, m);
|
|
477
477
|
t.positions = r;
|
|
478
478
|
}
|
|
479
|
-
const c = (n ?? a.getScale(o, i)).z,
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
|
|
479
|
+
const c = (n ?? a.getScale(o, i)).z, f = t.minimumHeights?.getValue(e);
|
|
480
|
+
f != null && (graphicsgraphics.minimumHeights = f.map((m) => m * c));
|
|
481
|
+
const u = t.maximumHeights?.getValue(e);
|
|
482
|
+
u != null && (graphicsgraphics.maximumHeights = u.map((m) => m * c));
|
|
483
483
|
}
|
|
484
484
|
function pn(t, o, n) {
|
|
485
485
|
const e = h.now(), i = t.position?.getValue(e);
|
|
486
486
|
if (!i) return null;
|
|
487
|
-
const r = t.orientation?.getValue(e), s = t.model?.scale?.getValue(e) ?? 1, c = new l(s, s, s),
|
|
487
|
+
const r = t.orientation?.getValue(e), s = t.model?.scale?.getValue(e) ?? 1, c = new l(s, s, s), f = o(i, n), u = a.inverse(f, new a()), m = a.multiplyByPoint(u, i, new l()), p = { translation: m, position: i, scale: c, rotation: new l() };
|
|
488
488
|
let d;
|
|
489
489
|
if (r) {
|
|
490
|
-
const V = g.fromQuaternion(r), S = a.fromRotation(V), B = a.multiply(
|
|
491
|
-
d = b.toCartesian3(
|
|
490
|
+
const V = g.fromQuaternion(r), S = a.fromRotation(V), B = a.multiply(u, S, S), _ = tt(B);
|
|
491
|
+
d = b.toCartesian3(_), p.rotation = d;
|
|
492
492
|
}
|
|
493
|
-
const y = new
|
|
493
|
+
const y = new P(m ?? void 0, d ? G(d) : void 0, c ?? void 0);
|
|
494
494
|
let R = a.fromTranslationRotationScale(y);
|
|
495
495
|
return p.matrix = R, p;
|
|
496
496
|
}
|
|
@@ -501,7 +501,7 @@ function yn(t) {
|
|
|
501
501
|
return Z.getSizeInBytes(t.componentDatatype) * t.componentsPerAttribute;
|
|
502
502
|
}
|
|
503
503
|
function wn(t) {
|
|
504
|
-
const { componentDatatype: o, vertexBuffer: n } = t, e =
|
|
504
|
+
const { componentDatatype: o, vertexBuffer: n } = t, e = pt[o];
|
|
505
505
|
if (!e) throw new Error("不支持的数据类型");
|
|
506
506
|
const i = n.sizeInBytes, r = Z.getSizeInBytes(o), s = i / r;
|
|
507
507
|
let c = new e(s);
|
|
@@ -512,7 +512,7 @@ const Q = [new x(), new x(), new x(), new x()], k = [new l(), new l(), new l(),
|
|
|
512
512
|
new O(), new O(), new O(), new O();
|
|
513
513
|
const zt = [new D(), new D(), new D(), new D()];
|
|
514
514
|
new v(), new v(), new v(), new v();
|
|
515
|
-
new
|
|
515
|
+
new N(), new N(), new N(), new N();
|
|
516
516
|
new g(), new g(), new g(), new g();
|
|
517
517
|
new a(), new a(), new a(), new a();
|
|
518
518
|
new w(), new w(), new w(), new w();
|
|
@@ -527,23 +527,23 @@ function hn(t, o, n) {
|
|
|
527
527
|
return t.encoding.decodePosition(t.vertexArray, o, n);
|
|
528
528
|
}
|
|
529
529
|
function Gt(t) {
|
|
530
|
-
const { stride: o, vertices: n, indices: e, encoding: i } = t, r = n.length / o, s = k[0], c = new Float32Array(r * 3),
|
|
530
|
+
const { stride: o, vertices: n, indices: e, encoding: i } = t, r = n.length / o, s = k[0], c = new Float32Array(r * 3), f = Q[0], u = new Float32Array(r * 2), m = new Float32Array(r);
|
|
531
531
|
for (let p = 0; p < r; p++) {
|
|
532
532
|
i.decodePosition(n, p, s), l.pack(s, c, p * 3);
|
|
533
533
|
const d = i.decodeHeight(n, p);
|
|
534
|
-
m[p] = d, i.decodeTextureCoordinates(n, p,
|
|
534
|
+
m[p] = d, i.decodeTextureCoordinates(n, p, f), x.pack(f, u, p * 2);
|
|
535
535
|
}
|
|
536
536
|
return {
|
|
537
537
|
attributes: {
|
|
538
538
|
position: { array: c, vectorSize: 3 },
|
|
539
|
-
uv: { array:
|
|
539
|
+
uv: { array: u, vectorSize: 2 },
|
|
540
540
|
height: { array: m, vectorSize: 1 }
|
|
541
541
|
},
|
|
542
542
|
indices: e.slice(),
|
|
543
543
|
count: r
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function et(t, o) {
|
|
547
547
|
const n = t._surface._tilesToRender, e = [], i = new v();
|
|
548
548
|
for (const r of n) {
|
|
549
549
|
const { rectangle: s } = r;
|
|
@@ -562,10 +562,10 @@ function Ht(t) {
|
|
|
562
562
|
const n = [...o], e = Math.min.apply(Math, n), i = Math.max.apply(Math, n);
|
|
563
563
|
return { min: e, max: i };
|
|
564
564
|
}
|
|
565
|
-
function
|
|
565
|
+
function it(t) {
|
|
566
566
|
return t.map((o) => {
|
|
567
|
-
const { mesh: n, terrainData: e } = o.data, i = Gt(n), { x: r, y: s, level: c } = o,
|
|
568
|
-
return { data: i, encoding: n.encoding, rectangle: o.rectangle, heightRange:
|
|
567
|
+
const { mesh: n, terrainData: e } = o.data, i = Gt(n), { x: r, y: s, level: c } = o, f = [e._minimumHeight, e._maximumHeight];
|
|
568
|
+
return { data: i, encoding: n.encoding, rectangle: o.rectangle, heightRange: f, x: r, y: s, level: c };
|
|
569
569
|
});
|
|
570
570
|
}
|
|
571
571
|
function Tn(t) {
|
|
@@ -575,9 +575,9 @@ function Tn(t) {
|
|
|
575
575
|
function kt(t, o, n) {
|
|
576
576
|
const { east: e, north: i, south: r, west: s } = o, c = zt[0];
|
|
577
577
|
c.longitude = s, c.latitude = r;
|
|
578
|
-
const
|
|
578
|
+
const f = t.positionToTileXY(c, n, Q[0]);
|
|
579
579
|
c.longitude = e, c.latitude = i;
|
|
580
|
-
const
|
|
580
|
+
const u = t.positionToTileXY(c, n, Q[1]), [m, p] = f.x < u.x ? [f.x, u.x] : [u.x, f.x], [d, y] = f.y < u.y ? [f.y, u.y] : [u.y, f.y];
|
|
581
581
|
return { min: [m, d], max: [p, y] };
|
|
582
582
|
}
|
|
583
583
|
const Qt = 32767;
|
|
@@ -613,45 +613,45 @@ function Et(t) {
|
|
|
613
613
|
indices: n
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
|
-
async function
|
|
616
|
+
async function Mn(t, o, n, e) {
|
|
617
617
|
const i = await t.requestTileGeometry(o, n, e);
|
|
618
618
|
if (!i) return null;
|
|
619
|
-
const r = Et(i), s = [data._minimumHeight, data._maximumHeight], c = t.tilingScheme.tileXYToRectangle(o, n, e),
|
|
620
|
-
return p.mapForAggregate(m, (y, R) => (l.fromArray(y, 0, d), a.multiplyByPoint(
|
|
619
|
+
const r = Et(i), s = [data._minimumHeight, data._maximumHeight], c = t.tilingScheme.tileXYToRectangle(o, n, e), f = ct(c, s), u = a.fromArray(f, void 0), m = ["u", "v", "height"], p = new lt({ ...r, positionNames: m }), d = new l();
|
|
620
|
+
return p.mapForAggregate(m, (y, R) => (l.fromArray(y, 0, d), a.multiplyByPoint(u, d, d), new D(d.x, d.y, d.z)));
|
|
621
621
|
}
|
|
622
|
-
async function
|
|
622
|
+
async function Pn(t, o, n) {
|
|
623
623
|
const { min: e, max: i } = kt(t.tilingScheme, o, n), r = [], s = [];
|
|
624
|
-
for (let
|
|
625
|
-
for (let
|
|
626
|
-
const m = qt(t,
|
|
627
|
-
m && (r.push(m), s.push({ x:
|
|
624
|
+
for (let f = e[0]; f <= i[0]; f++)
|
|
625
|
+
for (let u = e[1]; u <= i[1]; u++) {
|
|
626
|
+
const m = qt(t, f, u, n);
|
|
627
|
+
m && (r.push(m), s.push({ x: f, y: u }));
|
|
628
628
|
}
|
|
629
|
-
return (await Promise.all(r)).map(function(
|
|
630
|
-
const { x: m, y: p } = s[
|
|
631
|
-
return { x: m, y: p, level: n, data:
|
|
629
|
+
return (await Promise.all(r)).map(function(f, u) {
|
|
630
|
+
const { x: m, y: p } = s[u];
|
|
631
|
+
return { x: m, y: p, level: n, data: f };
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
634
|
async function qt(t, o, n, e) {
|
|
635
635
|
return t.getTileDataAvailable(o, n, e) ? (await t.loadTileDataAvailability(o, n, e), t.requestTileGeometry(o, n, e)) : Promise.reject("不可用");
|
|
636
636
|
}
|
|
637
637
|
async function Rn(t, o) {
|
|
638
|
-
const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s =
|
|
639
|
-
a.inverseTransformation(
|
|
640
|
-
const
|
|
641
|
-
const y = a.multiplyByPoint(
|
|
638
|
+
const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s = et(t, n), c = it(s), f = E.eastNorthUpToFixedFrame(e);
|
|
639
|
+
a.inverseTransformation(f, f);
|
|
640
|
+
const u = o.map((d) => {
|
|
641
|
+
const y = a.multiplyByPoint(f, d, k[2]);
|
|
642
642
|
return [y.x, y.y];
|
|
643
643
|
});
|
|
644
644
|
let m = 0;
|
|
645
645
|
const p = c.map(async (d) => {
|
|
646
646
|
const { data: y, ...R } = d, { position: V, uv: S, height: B } = y.attributes;
|
|
647
|
-
m += await
|
|
647
|
+
m += await ut.computeRelationAreaOfPolygon2Terrain({
|
|
648
648
|
args: [{
|
|
649
649
|
...y,
|
|
650
650
|
...R,
|
|
651
651
|
positionNames: ["position"],
|
|
652
|
-
region:
|
|
652
|
+
region: u,
|
|
653
653
|
// @ts-ignore
|
|
654
|
-
matrix: a.pack(
|
|
654
|
+
matrix: a.pack(f, []),
|
|
655
655
|
relation: z.Contain | z.Intersect,
|
|
656
656
|
scale: r
|
|
657
657
|
}],
|
|
@@ -666,22 +666,22 @@ async function Rn(t, o) {
|
|
|
666
666
|
return m;
|
|
667
667
|
}
|
|
668
668
|
function Sn(t, o) {
|
|
669
|
-
const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s =
|
|
670
|
-
a.inverseTransformation(
|
|
671
|
-
const
|
|
672
|
-
const d = a.multiplyByPoint(
|
|
669
|
+
const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s = et(t, n), c = it(s), f = E.eastNorthUpToFixedFrame(e);
|
|
670
|
+
a.inverseTransformation(f, f);
|
|
671
|
+
const u = o.map((p) => {
|
|
672
|
+
const d = a.multiplyByPoint(f, p, k[2]);
|
|
673
673
|
return [d.x, d.y];
|
|
674
674
|
});
|
|
675
675
|
let m = 0;
|
|
676
676
|
for (const p of c) {
|
|
677
677
|
const { data: d, ...y } = p;
|
|
678
|
-
m +=
|
|
678
|
+
m += ft({
|
|
679
679
|
...d,
|
|
680
680
|
...y,
|
|
681
681
|
positionNames: ["position"],
|
|
682
|
-
region:
|
|
682
|
+
region: u,
|
|
683
683
|
// @ts-ignore
|
|
684
|
-
matrix: a.pack(
|
|
684
|
+
matrix: a.pack(f, []),
|
|
685
685
|
relation: z.Contain | z.Intersect,
|
|
686
686
|
scale: r
|
|
687
687
|
});
|
|
@@ -693,16 +693,26 @@ function Sn(t, o) {
|
|
|
693
693
|
}
|
|
694
694
|
return m;
|
|
695
695
|
}
|
|
696
|
+
function Dn(t, o, n) {
|
|
697
|
+
const e = a.inverse(t.root.transform, new a()), { compose: i, decompose: r, ...s } = At(t.boundingSphere.center, o, n);
|
|
698
|
+
function c(u, m) {
|
|
699
|
+
return m = i(u, m), a.multiply(m, e, m);
|
|
700
|
+
}
|
|
701
|
+
function f(u) {
|
|
702
|
+
return r(t.root.computedTransform, u);
|
|
703
|
+
}
|
|
704
|
+
return { ...s, right: e, compose: c, decompose: f };
|
|
705
|
+
}
|
|
696
706
|
export {
|
|
697
|
-
|
|
698
|
-
|
|
707
|
+
dt as CartesianAxis,
|
|
708
|
+
yt as HeadingPitchRollComponent,
|
|
699
709
|
b as Xyz_Hpr,
|
|
700
710
|
$t as applyMatrixReferFrame,
|
|
701
|
-
|
|
711
|
+
Mt as applyTransformInPrimitive,
|
|
702
712
|
un as applyTransformInfoPrimitive,
|
|
703
|
-
|
|
713
|
+
pt as componentDatatypeTypedArrayMap,
|
|
704
714
|
yn as computeAttributeSizeInBytes,
|
|
705
|
-
|
|
715
|
+
xt as computeNormalOfCoplanars,
|
|
706
716
|
Sn as computeTerrainAreaOfPolygon,
|
|
707
717
|
Rn as computeTerrainAreaOfPolygon_worker,
|
|
708
718
|
dn as computeVertexNumOfAttribute,
|
|
@@ -717,38 +727,38 @@ export {
|
|
|
717
727
|
Ht as getLevelRangeOfQuadtreeTiles,
|
|
718
728
|
U as getLocalCurvatureRadius,
|
|
719
729
|
An as getLocalSizePerDegrees,
|
|
720
|
-
|
|
730
|
+
gt as getLocalTransformInfo,
|
|
721
731
|
rn as getMatrix4OfTransformInfo,
|
|
722
732
|
Kt as getNeighborPairs,
|
|
723
733
|
ln as getPosition,
|
|
724
734
|
hn as getPositionOfTerrainMesh,
|
|
725
|
-
|
|
735
|
+
et as getRenderedQuadtreeTilesOfIntersectRectangle,
|
|
726
736
|
xn as getRenderedTileLevelRange,
|
|
727
737
|
vn as getScaleOfTerrainDataByOrientedBoundingBox,
|
|
728
738
|
qt as getTerrainData,
|
|
729
739
|
Tn as getTerrainDataOfQuadtreeTile,
|
|
730
|
-
|
|
731
|
-
|
|
740
|
+
Pn as getTerrainDatasOfIntersectRectangle,
|
|
741
|
+
it as getTerrainDatasOfQuadtreeTiles,
|
|
732
742
|
kt as getTileRangeOfIntersectRectangle,
|
|
733
743
|
Rt as getTransform,
|
|
734
|
-
|
|
735
|
-
|
|
744
|
+
Mn as getWorldDataOfQuantizedMeshTerrainData,
|
|
745
|
+
ht as getWorldMatrix,
|
|
736
746
|
L as getWorldTransformInfo,
|
|
737
747
|
q as isMatrixPrimitive,
|
|
738
|
-
|
|
748
|
+
mt as isPositionListPrimitive,
|
|
739
749
|
J as isPositionPrimitive,
|
|
740
750
|
Ut as isPrimitiveObject,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
751
|
+
wt as localQuaternionToWorld,
|
|
752
|
+
vt as localTRS_WorldMatrix4_Convert,
|
|
753
|
+
At as localTRS_WorldMatrix4_ENU_Convert,
|
|
744
754
|
H as makeMatrixReferFrame,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
755
|
+
sn as mat4_compose,
|
|
756
|
+
Tt as mat4_composeByOrder,
|
|
757
|
+
an as mat4_decompose,
|
|
758
|
+
nt as mat4_decomposeByOrder,
|
|
749
759
|
tt as matrix4ToHeadingPitchRoll,
|
|
750
760
|
Yt as quaternionToHeadingPitchRoll,
|
|
751
|
-
|
|
761
|
+
Pt as resetTransformInPrimitive,
|
|
752
762
|
fn as resetTransformInfoPrimitive,
|
|
753
763
|
nn as rotateMatrixReferFrame,
|
|
754
764
|
G as rotationInfoToQuaternion,
|
|
@@ -760,14 +770,15 @@ export {
|
|
|
760
770
|
It as scaleModelGraphics,
|
|
761
771
|
Ot as scalePlaneGraphics,
|
|
762
772
|
en as scalePoints,
|
|
773
|
+
Dn as tileset_enuTRS_modelMatrix_Convert,
|
|
763
774
|
Ct as transformCorridorGraphics,
|
|
764
775
|
mn as transformEntity,
|
|
765
776
|
Xt as transformInfoToMatrix,
|
|
766
777
|
bt as transformPolygonGraphics,
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
778
|
+
ot as transformPolygonHierarchy,
|
|
779
|
+
_t as transformPolylineGraphics,
|
|
780
|
+
Nt as transformPolylineVolumeGraphics,
|
|
781
|
+
Ft as transformWallGraphics,
|
|
771
782
|
tn as translationMatrixReferFrame,
|
|
772
783
|
jt as worldMatrixToLocal,
|
|
773
784
|
Wt as worldQuaternionToLocal
|