@cearth/tools 2.4.0 → 2.5.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 +5 -3
- package/dist/math/transform.d.ts.map +1 -1
- package/dist/tools.iife.js +21 -21
- package/dist/tools.js +145 -145
- 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 P, Cartesian3 as l, HeadingPitchRoll as I, Quaternion as w, Matrix3 as g, Matrix4 as a, TranslationRotationScale as M, Plane as
|
|
2
|
-
import { MatrixComposeOrder as _, mat4_decompose_quat as
|
|
3
|
-
function
|
|
4
|
-
return q(t) || J(t) ||
|
|
1
|
+
import { WebGLConstants as P, Cartesian3 as l, HeadingPitchRoll as I, Quaternion as w, Matrix3 as g, Matrix4 as a, TranslationRotationScale as M, 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 F } from "cesium";
|
|
2
|
+
import { MatrixComposeOrder as _, 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
|
+
function Lt(t) {
|
|
4
|
+
return q(t) || J(t) || mt(t);
|
|
5
5
|
}
|
|
6
6
|
function q(t) {
|
|
7
7
|
return "modelMatrix" in t;
|
|
@@ -9,10 +9,10 @@ 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>.
|
|
@@ -55,7 +55,7 @@ const mt = {
|
|
|
55
55
|
*/
|
|
56
56
|
[P.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 };
|
|
@@ -85,7 +85,7 @@ function G(t) {
|
|
|
85
85
|
const o = b.toHeadingPitchRoll(t);
|
|
86
86
|
return w.fromHeadingPitchRoll(o);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Ut(t, o, n) {
|
|
89
89
|
const e = g.fromQuaternion(t), i = a.fromRotation(e), r = a.inverseTransformation(o, new a()), s = a.multiply(r, i, i);
|
|
90
90
|
return tt(s);
|
|
91
91
|
}
|
|
@@ -93,18 +93,18 @@ function tt(t, o) {
|
|
|
93
93
|
const n = a.getMatrix3(t, new g()), e = w.fromRotationMatrix(n);
|
|
94
94
|
return I.fromQuaternion(e, o);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Yt(t, o, n) {
|
|
97
97
|
n = n ?? new a();
|
|
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);
|
|
105
105
|
return e = a.multiplyByPointAsVector(o, e, e), w.fromAxisAngle(e, i);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function jt(t, o, n) {
|
|
108
108
|
let e = w.computeAxis(t, new l());
|
|
109
109
|
if (e.equals(l.ZERO)) return null;
|
|
110
110
|
const i = w.computeAngle(t), r = a.inverse(o, new a());
|
|
@@ -114,9 +114,9 @@ function L(t, o) {
|
|
|
114
114
|
let { translation: n, rotation: e, scale: i } = t;
|
|
115
115
|
const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: u } = $(o);
|
|
116
116
|
let f = null;
|
|
117
|
-
return n && (s || (n = a.multiplyByPointAsVector(r, n, new l()))), e && (f = G(e), c || (f =
|
|
117
|
+
return n && (s || (n = a.multiplyByPointAsVector(r, n, new l()))), e && (f = G(e), c || (f = wt(f, r))), i && (u || (i = a.multiplyByPointAsVector(r, i, new l()))), { translation: n, rotation: f, scale: i };
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function gt(t, o) {
|
|
120
120
|
let { translation: n, rotation: e, scale: i } = t;
|
|
121
121
|
const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: u } = $(o), f = r ? a.inverse(r, new a()) : null;
|
|
122
122
|
let m = null;
|
|
@@ -129,7 +129,7 @@ function wt(t, o) {
|
|
|
129
129
|
}
|
|
130
130
|
return i && u && (i = a.multiplyByPointAsVector(f, 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) {
|
|
@@ -142,19 +142,19 @@ function gt(t, o) {
|
|
|
142
142
|
const s = new M(e ?? void 0, i ?? void 0, r ?? void 0);
|
|
143
143
|
return a.fromTranslationRotationScale(s);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Wt(t) {
|
|
146
146
|
const { translation: o, rotation: n, scale: e } = t, i = n ? G(n) : void 0, r = new M(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
|
-
function
|
|
154
|
-
const e =
|
|
155
|
-
return
|
|
153
|
+
function Xt(t, o, n) {
|
|
154
|
+
const e = xt(t, o, n);
|
|
155
|
+
return rt.fromPointNormal(e, t);
|
|
156
156
|
}
|
|
157
|
-
function*
|
|
157
|
+
function* Zt(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
160
|
const u = t[c];
|
|
@@ -172,25 +172,25 @@ function H(t, o, n) {
|
|
|
172
172
|
const e = a.inverse(o, new a()), i = a.multiply(t, e, e);
|
|
173
173
|
return a.multiply(o, i, n);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function Kt(t, o, n, e) {
|
|
176
176
|
e = e ?? new a();
|
|
177
177
|
const i = a.inverse(n, new a());
|
|
178
178
|
let r = a.multiply(i, t, i);
|
|
179
179
|
return r = a.multiply(o, r, r), a.multiply(n, r, e);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function $t(t, o, n) {
|
|
182
182
|
const e = a.fromTranslation(t);
|
|
183
183
|
return H(e, o, n);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function tn(t, o, n, e) {
|
|
186
186
|
const i = w.fromAxisAngle(t, o), r = g.fromQuaternion(i), s = a.fromRotation(r);
|
|
187
187
|
return H(s, n, e);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function nn(t, o, n) {
|
|
190
190
|
const e = a.fromScale(t);
|
|
191
191
|
return H(e, o, n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function on(t, o, n) {
|
|
194
194
|
const e = g.fromScale(o);
|
|
195
195
|
if (n)
|
|
196
196
|
for (const i of t)
|
|
@@ -202,7 +202,7 @@ function en(t, o, n) {
|
|
|
202
202
|
}
|
|
203
203
|
return t;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function en(t, o) {
|
|
206
206
|
const { translation: n, rotation: e, scale: i } = t;
|
|
207
207
|
let r;
|
|
208
208
|
if (e) {
|
|
@@ -212,32 +212,32 @@ function rn(t, o) {
|
|
|
212
212
|
const s = new M(n ?? void 0, r, i ?? void 0);
|
|
213
213
|
return a.fromTranslationRotationScale(s, o ?? void 0);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function nt(t, o, n) {
|
|
216
216
|
n ??= new M();
|
|
217
217
|
const e = a.pack(t, []), i = [], r = [], s = [], c = o ? _[o] : _.trs;
|
|
218
|
-
return
|
|
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 rn(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 ? _[o] : _.trs, c =
|
|
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 ? _[o] : _.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 an = 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 sn(t, o) {
|
|
239
|
-
const
|
|
240
|
-
return { ...
|
|
238
|
+
function sn(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;
|
|
@@ -266,9 +266,9 @@ function ln(t, o) {
|
|
|
266
266
|
function un(t, o, n) {
|
|
267
267
|
let { translation: e, rotation: i, scale: r } = L(o, n);
|
|
268
268
|
const s = new M(e ?? void 0, i ?? void 0, r ?? void 0), c = a.fromTranslationRotationScale(s);
|
|
269
|
-
return
|
|
269
|
+
return At(t, c);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function At(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 =
|
|
296
|
-
return
|
|
295
|
+
const e = Mt(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());
|
|
@@ -316,7 +316,7 @@ function Mt(t, o) {
|
|
|
316
316
|
}
|
|
317
317
|
return !1;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Mt(t) {
|
|
320
320
|
if (q(t))
|
|
321
321
|
return t.modelMatrix;
|
|
322
322
|
if (J(t)) {
|
|
@@ -350,38 +350,38 @@ function mn(t, o) {
|
|
|
350
350
|
t.position = A;
|
|
351
351
|
}
|
|
352
352
|
if (!s) return;
|
|
353
|
-
const { translation: f, rotation: m, scale: p } =
|
|
353
|
+
const { translation: f, rotation: m, scale: p } = gt(o, o), d = new M(f ?? 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;
|
|
357
|
-
A &&
|
|
357
|
+
A && Rt(A, p);
|
|
358
358
|
const T = t.cylinder;
|
|
359
|
-
T &&
|
|
359
|
+
T && St(T, p);
|
|
360
360
|
const Y = t.ellipse;
|
|
361
|
-
Y &&
|
|
361
|
+
Y && Dt(Y, p);
|
|
362
362
|
const j = t.ellipsoid;
|
|
363
|
-
j &&
|
|
363
|
+
j && Vt(j, p);
|
|
364
364
|
const W = t.model;
|
|
365
|
-
W &&
|
|
365
|
+
W && Bt(W, p, r);
|
|
366
366
|
const X = t.plane;
|
|
367
|
-
X &&
|
|
367
|
+
X && It(X, p);
|
|
368
368
|
}
|
|
369
369
|
const R = t.corridor;
|
|
370
|
-
R &&
|
|
370
|
+
R && Ot(R, y, p);
|
|
371
371
|
const V = t.polygon;
|
|
372
|
-
V &&
|
|
372
|
+
V && Ct(V, y, p);
|
|
373
373
|
const S = t.polyline;
|
|
374
|
-
S &&
|
|
374
|
+
S && bt(S, y, p);
|
|
375
375
|
const B = t.polylineVolume;
|
|
376
|
-
B &&
|
|
376
|
+
B && Nt(B, y, p);
|
|
377
377
|
const N = t.wall;
|
|
378
|
-
N &&
|
|
378
|
+
N && Ft(N, y, p);
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function Rt(t, o) {
|
|
381
381
|
const n = h.now(), e = t.dimensions?.getValue(n);
|
|
382
382
|
e && (t.dimensions = l.multiplyComponents(e, o, e));
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function St(t, o) {
|
|
385
385
|
const n = h.now(), e = t.length?.getValue(n);
|
|
386
386
|
e != null && (t.length = e * o.z);
|
|
387
387
|
const i = Math.max(o.x, o.y), r = t.topRadius?.getValue(n);
|
|
@@ -389,7 +389,7 @@ function Dt(t, o) {
|
|
|
389
389
|
const s = o.z, c = t.bottomRadius?.getValue(n);
|
|
390
390
|
c != null && (t.bottomRadius = c * s);
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Dt(t, o) {
|
|
393
393
|
const n = h.now(), e = Math.max(o.x, o.y), i = o.z, r = t.semiMajorAxis?.getValue(n);
|
|
394
394
|
r != null && (t.semiMajorAxis = r * e);
|
|
395
395
|
const s = t.semiMinorAxis?.getValue(n);
|
|
@@ -399,13 +399,13 @@ function Vt(t, o) {
|
|
|
399
399
|
const u = t.extrudedHeight?.getValue(n);
|
|
400
400
|
u != null && (t.extrudedHeight = u * i);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Vt(t, o) {
|
|
403
403
|
const n = h.now(), e = t.radii?.getValue(n);
|
|
404
404
|
e != null && (t.radii = l.multiplyComponents(e, o, e));
|
|
405
405
|
const i = t.innerRadii?.getValue(n);
|
|
406
406
|
i != null && (t.innerRadii = l.multiplyComponents(i, o, i));
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Bt(t, o, n) {
|
|
409
409
|
let e = l.maximumComponent(o);
|
|
410
410
|
if (!n) {
|
|
411
411
|
const i = h.now(), r = t.scale?.getValue(i) ?? 1;
|
|
@@ -413,11 +413,11 @@ function It(t, o, n) {
|
|
|
413
413
|
}
|
|
414
414
|
t.scale = e;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function It(t, o) {
|
|
417
417
|
const n = h.now(), e = x.fromCartesian3(o), i = t.dimensions?.getValue(n);
|
|
418
418
|
i && (t.dimensions = x.multiplyComponents(i, e, i));
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function Ot(t, o, n) {
|
|
421
421
|
const e = h.now(), i = new l(), r = t.positions?.getValue(e);
|
|
422
422
|
if (r?.length > 0) {
|
|
423
423
|
for (const p of r)
|
|
@@ -429,23 +429,23 @@ function Ct(t, o, n) {
|
|
|
429
429
|
const f = t.height?.getValue(e), m = s.z;
|
|
430
430
|
f != null && (t.height = f * m);
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function Ct(t, o, n) {
|
|
433
433
|
const e = h.now(), i = new l(), r = t.hierarchy?.getValue(e);
|
|
434
|
-
r && (
|
|
434
|
+
r && (ot(r, o), t.hierarchy = r);
|
|
435
435
|
const c = (n ?? a.getScale(o, i)).z, u = t.height?.getValue(e);
|
|
436
436
|
u != null && (t.height = u * c);
|
|
437
437
|
const f = t.extrudedHeight?.getValue(e);
|
|
438
438
|
f != null && (t.extrudedHeight = f * 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 bt(t, o, n) {
|
|
449
449
|
const e = h.now(), i = new l(), r = t.positions?.getValue(e);
|
|
450
450
|
if (r?.length > 0) {
|
|
451
451
|
for (const f of r)
|
|
@@ -455,7 +455,7 @@ function Nt(t, o, n) {
|
|
|
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
461
|
for (const f of r)
|
|
@@ -469,7 +469,7 @@ function Ft(t, o, n) {
|
|
|
469
469
|
t.shape = u;
|
|
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)
|
|
@@ -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);
|
|
@@ -510,7 +510,7 @@ function wn(t) {
|
|
|
510
510
|
new x(), new l(), new O();
|
|
511
511
|
const Q = [new x(), new x(), new x(), new x()], k = [new l(), new l(), new l(), new l()];
|
|
512
512
|
new O(), new O(), new O(), new O();
|
|
513
|
-
const
|
|
513
|
+
const _t = [new D(), new D(), new D(), new D()];
|
|
514
514
|
new v(), new v(), new v(), new v();
|
|
515
515
|
new F(), new F(), new F(), new F();
|
|
516
516
|
new g(), new g(), new g(), new g();
|
|
@@ -526,7 +526,7 @@ function gn(t, o = []) {
|
|
|
526
526
|
function hn(t, o, n) {
|
|
527
527
|
return t.encoding.decodePosition(t.vertexArray, o, n);
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function zt(t) {
|
|
530
530
|
const { stride: o, vertices: n, indices: e, encoding: i } = t, r = n.length / o, s = k[0], c = new Float32Array(r * 3), u = Q[0], f = 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);
|
|
@@ -543,7 +543,7 @@ function Gt(t) {
|
|
|
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;
|
|
@@ -553,18 +553,18 @@ function ot(t, o) {
|
|
|
553
553
|
}
|
|
554
554
|
function xn(t) {
|
|
555
555
|
const o = t._surface._tilesToRender;
|
|
556
|
-
return
|
|
556
|
+
return Gt(o);
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function Gt(t) {
|
|
559
559
|
const o = /* @__PURE__ */ new Set();
|
|
560
560
|
for (const r of t)
|
|
561
561
|
o.add(r.level);
|
|
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 =
|
|
567
|
+
const { mesh: n, terrainData: e } = o.data, i = zt(n), { x: r, y: s, level: c } = o, u = [e._minimumHeight, e._maximumHeight];
|
|
568
568
|
return { data: i, encoding: n.encoding, rectangle: o.rectangle, heightRange: u, x: r, y: s, level: c };
|
|
569
569
|
});
|
|
570
570
|
}
|
|
@@ -572,17 +572,17 @@ function Tn(t) {
|
|
|
572
572
|
const { x: o, y: n, level: e } = t;
|
|
573
573
|
return t.data.terrainData.upsample(t.tilingScheme, o, n, e, o, n, e);
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
const { east: e, north: i, south: r, west: s } = o, c =
|
|
575
|
+
function Ht(t, o, n) {
|
|
576
|
+
const { east: e, north: i, south: r, west: s } = o, c = _t[0];
|
|
577
577
|
c.longitude = s, c.latitude = r;
|
|
578
578
|
const u = t.positionToTileXY(c, n, Q[0]);
|
|
579
579
|
c.longitude = e, c.latitude = i;
|
|
580
580
|
const f = t.positionToTileXY(c, n, Q[1]), [m, p] = u.x < f.x ? [u.x, f.x] : [f.x, u.x], [d, y] = u.y < f.y ? [u.y, f.y] : [f.y, u.y];
|
|
581
581
|
return { min: [m, d], max: [p, y] };
|
|
582
582
|
}
|
|
583
|
-
const
|
|
583
|
+
const kt = 32767;
|
|
584
584
|
function vn(t, o = new l()) {
|
|
585
|
-
return g.getScale(t.halfAxes, o), l.multiplyByScalar(o, 2 *
|
|
585
|
+
return g.getScale(t.halfAxes, o), l.multiplyByScalar(o, 2 * kt, o), o;
|
|
586
586
|
}
|
|
587
587
|
function U(t, o, n) {
|
|
588
588
|
return n = t.getLocalCurvature(o, n), n.x = 1 / n.x, n.y = 1 / n.y, n;
|
|
@@ -592,7 +592,7 @@ function An(t, o, n) {
|
|
|
592
592
|
const e = Math.PI / 180;
|
|
593
593
|
return x.multiplyByScalar(n, e, n);
|
|
594
594
|
}
|
|
595
|
-
function
|
|
595
|
+
function Qt(t) {
|
|
596
596
|
const { _quantizedVertices: o, _indices: n } = t, e = o.length / 3, i = {
|
|
597
597
|
type: "Float32Array",
|
|
598
598
|
start: 0,
|
|
@@ -616,14 +616,14 @@ function Et(t) {
|
|
|
616
616
|
async function Pn(t, o, n, e) {
|
|
617
617
|
const i = await t.requestTileGeometry(o, n, e);
|
|
618
618
|
if (!i) return null;
|
|
619
|
-
const r =
|
|
619
|
+
const r = Qt(i), s = [data._minimumHeight, data._maximumHeight], c = t.tilingScheme.tileXYToRectangle(o, n, e), u = ct(c, s), f = a.fromArray(u, void 0), m = ["u", "v", "height"], p = new lt({ ...r, positionNames: m }), d = new l();
|
|
620
620
|
return p.mapForAggregate(m, (y, R) => (l.fromArray(y, 0, d), a.multiplyByPoint(f, d, d), new D(d.x, d.y, d.z)));
|
|
621
621
|
}
|
|
622
622
|
async function Mn(t, o, n) {
|
|
623
|
-
const { min: e, max: i } =
|
|
623
|
+
const { min: e, max: i } = Ht(t.tilingScheme, o, n), r = [], s = [];
|
|
624
624
|
for (let u = e[0]; u <= i[0]; u++)
|
|
625
625
|
for (let f = e[1]; f <= i[1]; f++) {
|
|
626
|
-
const m =
|
|
626
|
+
const m = Et(t, u, f, n);
|
|
627
627
|
m && (r.push(m), s.push({ x: u, y: f }));
|
|
628
628
|
}
|
|
629
629
|
return (await Promise.all(r)).map(function(u, f) {
|
|
@@ -631,11 +631,11 @@ async function Mn(t, o, n) {
|
|
|
631
631
|
return { x: m, y: p, level: n, data: u };
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
|
-
async function
|
|
634
|
+
async function Et(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 =
|
|
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), u = E.eastNorthUpToFixedFrame(e);
|
|
639
639
|
a.inverseTransformation(u, u);
|
|
640
640
|
const f = o.map((d) => {
|
|
641
641
|
const y = a.multiplyByPoint(u, d, k[2]);
|
|
@@ -644,7 +644,7 @@ async function Rn(t, o) {
|
|
|
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,
|
|
@@ -666,7 +666,7 @@ 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 =
|
|
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), u = E.eastNorthUpToFixedFrame(e);
|
|
670
670
|
a.inverseTransformation(u, u);
|
|
671
671
|
const f = o.map((p) => {
|
|
672
672
|
const d = a.multiplyByPoint(u, p, k[2]);
|
|
@@ -675,7 +675,7 @@ function Sn(t, o) {
|
|
|
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"],
|
|
@@ -694,81 +694,81 @@ function Sn(t, o) {
|
|
|
694
694
|
return m;
|
|
695
695
|
}
|
|
696
696
|
export {
|
|
697
|
-
|
|
698
|
-
|
|
697
|
+
dt as CartesianAxis,
|
|
698
|
+
yt as HeadingPitchRollComponent,
|
|
699
699
|
b as Xyz_Hpr,
|
|
700
|
-
|
|
701
|
-
|
|
700
|
+
Kt as applyMatrixReferFrame,
|
|
701
|
+
At as applyTransformInPrimitive,
|
|
702
702
|
un as applyTransformInfoPrimitive,
|
|
703
|
-
|
|
703
|
+
pt as componentDatatypeTypedArrayMap,
|
|
704
704
|
yn as computeAttributeSizeInBytes,
|
|
705
|
-
|
|
705
|
+
xt as computeNormalOfCoplanars,
|
|
706
706
|
Sn as computeTerrainAreaOfPolygon,
|
|
707
707
|
Rn as computeTerrainAreaOfPolygon_worker,
|
|
708
708
|
dn as computeVertexNumOfAttribute,
|
|
709
|
-
|
|
709
|
+
Xt as createPlaneOfCoplanars,
|
|
710
710
|
$ as flatTransformInfoOptions,
|
|
711
711
|
wn as getAttributeData,
|
|
712
712
|
cn as getBoundingSphere,
|
|
713
713
|
gn as getDecodePositionsOfTerrainMesh,
|
|
714
714
|
pn as getEntityInfo,
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
715
|
+
Qt as getGeometryDataOfQuantizedMeshTerrainData,
|
|
716
|
+
zt as getGeometryDataOfTerrainMesh,
|
|
717
|
+
Gt as getLevelRangeOfQuadtreeTiles,
|
|
718
718
|
U as getLocalCurvatureRadius,
|
|
719
719
|
An as getLocalSizePerDegrees,
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
720
|
+
gt as getLocalTransformInfo,
|
|
721
|
+
en as getMatrix4OfTransformInfo,
|
|
722
|
+
Zt as getNeighborPairs,
|
|
723
723
|
ln as getPosition,
|
|
724
724
|
hn as getPositionOfTerrainMesh,
|
|
725
|
-
|
|
725
|
+
et as getRenderedQuadtreeTilesOfIntersectRectangle,
|
|
726
726
|
xn as getRenderedTileLevelRange,
|
|
727
727
|
vn as getScaleOfTerrainDataByOrientedBoundingBox,
|
|
728
|
-
|
|
728
|
+
Et as getTerrainData,
|
|
729
729
|
Tn as getTerrainDataOfQuadtreeTile,
|
|
730
730
|
Mn as getTerrainDatasOfIntersectRectangle,
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
731
|
+
it as getTerrainDatasOfQuadtreeTiles,
|
|
732
|
+
Ht as getTileRangeOfIntersectRectangle,
|
|
733
|
+
Mt as getTransform,
|
|
734
734
|
Pn as getWorldDataOfQuantizedMeshTerrainData,
|
|
735
|
-
|
|
735
|
+
ht as getWorldMatrix,
|
|
736
736
|
L as getWorldTransformInfo,
|
|
737
737
|
q as isMatrixPrimitive,
|
|
738
|
-
|
|
738
|
+
mt as isPositionListPrimitive,
|
|
739
739
|
J as isPositionPrimitive,
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
740
|
+
Lt as isPrimitiveObject,
|
|
741
|
+
wt as localQuaternionToWorld,
|
|
742
|
+
vt as localTRS_WorldMatrix4_Convert,
|
|
743
743
|
sn as localTRS_WorldMatrix4_ENU_Convert,
|
|
744
744
|
H as makeMatrixReferFrame,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
745
|
+
an as mat4_compose,
|
|
746
|
+
Tt as mat4_composeByOrder,
|
|
747
|
+
rn as mat4_decompose,
|
|
748
|
+
nt as mat4_decomposeByOrder,
|
|
749
749
|
tt as matrix4ToHeadingPitchRoll,
|
|
750
|
-
|
|
751
|
-
|
|
750
|
+
Ut as quaternionToHeadingPitchRoll,
|
|
751
|
+
Pt as resetTransformInPrimitive,
|
|
752
752
|
fn as resetTransformInfoPrimitive,
|
|
753
|
-
|
|
753
|
+
tn as rotateMatrixReferFrame,
|
|
754
754
|
G as rotationInfoToQuaternion,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
755
|
+
Rt as scaleBoxGraphics,
|
|
756
|
+
St as scaleCylinderGraphics,
|
|
757
|
+
Dt as scaleEllipseGraphics,
|
|
758
|
+
Vt as scaleEllipsoidGraphics,
|
|
759
|
+
nn as scaleMatrixReferFrame,
|
|
760
|
+
Bt as scaleModelGraphics,
|
|
761
|
+
It as scalePlaneGraphics,
|
|
762
|
+
on as scalePoints,
|
|
763
|
+
Ot as transformCorridorGraphics,
|
|
764
764
|
mn as transformEntity,
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
765
|
+
Wt as transformInfoToMatrix,
|
|
766
|
+
Ct as transformPolygonGraphics,
|
|
767
|
+
ot as transformPolygonHierarchy,
|
|
768
|
+
bt as transformPolylineGraphics,
|
|
769
|
+
Nt as transformPolylineVolumeGraphics,
|
|
770
|
+
Ft as transformWallGraphics,
|
|
771
|
+
$t as translationMatrixReferFrame,
|
|
772
|
+
Yt as worldMatrixToLocal,
|
|
773
|
+
jt as worldQuaternionToLocal
|
|
774
774
|
};
|