@cearth/tools 2.6.0 → 2.7.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/tile/3DTileset.d.ts +18 -8
- package/dist/tile/3DTileset.d.ts.map +1 -1
- package/dist/tools.iife.js +15 -15
- package/dist/tools.js +509 -498
- package/dist/tools.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { WebGLConstants as M, Cartesian3 as
|
|
2
|
-
import { MatrixComposeOrder as F, mat4_decompose_quat as
|
|
3
|
-
function
|
|
4
|
-
return q(
|
|
1
|
+
import { WebGLConstants as M, Cartesian3 as u, HeadingPitchRoll as I, Quaternion as w, Matrix3 as g, Matrix4 as s, TranslationRotationScale as R, Plane as an, 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 cn, mat4_compose_quat as ln, getMatrixOfQuantizedMeshTerrainData as un, Geometry as fn, workerApi as mn, GeometricRelation as z, computeSignAreaOfPolygon3 as K, computeRelationAreaOfPolygon2Terrain as pn } from "@web-3d/tools";
|
|
3
|
+
function Yn(n) {
|
|
4
|
+
return q(n) || J(n) || dn(n);
|
|
5
5
|
}
|
|
6
|
-
function q(
|
|
7
|
-
return "modelMatrix" in
|
|
6
|
+
function q(n) {
|
|
7
|
+
return "modelMatrix" in n;
|
|
8
8
|
}
|
|
9
|
-
function J(
|
|
10
|
-
return "position" in
|
|
9
|
+
function J(n) {
|
|
10
|
+
return "position" in n;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return "positions" in
|
|
12
|
+
function dn(n) {
|
|
13
|
+
return "positions" in n;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const yn = {
|
|
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,545 +55,545 @@ const pt = {
|
|
|
55
55
|
*/
|
|
56
56
|
[M.DOUBLE]: Float64Array
|
|
57
57
|
};
|
|
58
|
-
var
|
|
59
|
-
((
|
|
58
|
+
var wn = /* @__PURE__ */ ((n) => (n[n.x = 0] = "x", n[n.y = 1] = "y", n[n.z = 2] = "z", n))(wn || {}), b = /* @__PURE__ */ ((n) => (n.x = "roll", n.y = "pitch", n.z = "heading", n))(b || {});
|
|
59
|
+
((n) => {
|
|
60
60
|
function o(i) {
|
|
61
|
-
for (let [r,
|
|
62
|
-
if (i ===
|
|
61
|
+
for (let [r, a] of Object.entries(n))
|
|
62
|
+
if (i === a)
|
|
63
63
|
return r;
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
function
|
|
67
|
-
return new
|
|
65
|
+
n.toKey = o;
|
|
66
|
+
function t(i) {
|
|
67
|
+
return new u(i.roll, -i.pitch, -i.heading);
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
n.toCartesian3 = t;
|
|
70
70
|
function e(i) {
|
|
71
71
|
return new I(-i[o("heading")], -i[o("pitch")], i[o("roll")]);
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
n.toHeadingPitchRoll = e;
|
|
74
74
|
})(b || (b = {}));
|
|
75
|
-
var
|
|
76
|
-
function $(
|
|
77
|
-
const o =
|
|
78
|
-
return { ...
|
|
75
|
+
var gn = /* @__PURE__ */ ((n) => (n[n.heading = 0] = "heading", n[n.pitch = 1] = "pitch", n[n.roll = 2] = "roll", n))(gn || {});
|
|
76
|
+
function $(n) {
|
|
77
|
+
const o = n?.world, { translation: t, rotation: e, scale: i } = o && typeof o == "object" ? o : { translation: o, rotation: o, scale: o };
|
|
78
|
+
return { ...n, worldTranslation: t, worldRotation: e, worldScale: i };
|
|
79
79
|
}
|
|
80
|
-
function G(
|
|
81
|
-
if (
|
|
82
|
-
const { axis:
|
|
83
|
-
return w.fromAxisAngle(
|
|
80
|
+
function G(n) {
|
|
81
|
+
if (n.axis) {
|
|
82
|
+
const { axis: t, angle: e } = n;
|
|
83
|
+
return w.fromAxisAngle(t, e);
|
|
84
84
|
}
|
|
85
|
-
const o = b.toHeadingPitchRoll(
|
|
85
|
+
const o = b.toHeadingPitchRoll(n);
|
|
86
86
|
return w.fromHeadingPitchRoll(o);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const e = g.fromQuaternion(
|
|
90
|
-
return
|
|
88
|
+
function jn(n, o, t) {
|
|
89
|
+
const e = g.fromQuaternion(n), i = s.fromRotation(e), r = s.inverseTransformation(o, new s()), a = s.multiply(r, i, i);
|
|
90
|
+
return nn(a);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
const
|
|
92
|
+
function nn(n, o) {
|
|
93
|
+
const t = s.getMatrix3(n, new g()), e = w.fromRotationMatrix(t);
|
|
94
94
|
return I.fromQuaternion(e, o);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
const e =
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
function
|
|
102
|
-
let e = w.computeAxis(
|
|
103
|
-
if (e.equals(
|
|
104
|
-
const i = w.computeAngle(
|
|
105
|
-
return e =
|
|
106
|
-
}
|
|
107
|
-
function
|
|
108
|
-
let e = w.computeAxis(
|
|
109
|
-
if (e.equals(
|
|
110
|
-
const i = w.computeAngle(
|
|
111
|
-
return e =
|
|
112
|
-
}
|
|
113
|
-
function L(
|
|
114
|
-
let { translation:
|
|
115
|
-
const { referFrame: r, worldTranslation:
|
|
116
|
-
let
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
function
|
|
120
|
-
let { translation:
|
|
121
|
-
const { referFrame: r, worldTranslation:
|
|
96
|
+
function Wn(n, o, t) {
|
|
97
|
+
t = t ?? new s();
|
|
98
|
+
const e = s.inverse(o, new s());
|
|
99
|
+
return s.multiply(e, n, t);
|
|
100
|
+
}
|
|
101
|
+
function hn(n, o, t) {
|
|
102
|
+
let e = w.computeAxis(n, new u());
|
|
103
|
+
if (e.equals(u.ZERO)) return null;
|
|
104
|
+
const i = w.computeAngle(n);
|
|
105
|
+
return e = s.multiplyByPointAsVector(o, e, e), w.fromAxisAngle(e, i);
|
|
106
|
+
}
|
|
107
|
+
function Xn(n, o, t) {
|
|
108
|
+
let e = w.computeAxis(n, new u());
|
|
109
|
+
if (e.equals(u.ZERO)) return null;
|
|
110
|
+
const i = w.computeAngle(n), r = s.inverse(o, new s());
|
|
111
|
+
return e = s.multiplyByPointAsVector(r, e, e), w.fromAxisAngle(e, i);
|
|
112
|
+
}
|
|
113
|
+
function L(n, o) {
|
|
114
|
+
let { translation: t, rotation: e, scale: i } = n;
|
|
115
|
+
const { referFrame: r, worldTranslation: a, worldRotation: c, worldScale: f } = $(o);
|
|
116
|
+
let l = null;
|
|
117
|
+
return t && (a || (t = s.multiplyByPointAsVector(r, t, new u()))), e && (l = G(e), c || (l = hn(l, r))), i && (f || (i = s.multiplyByPointAsVector(r, i, new u()))), { translation: t, rotation: l, scale: i };
|
|
118
|
+
}
|
|
119
|
+
function xn(n, o) {
|
|
120
|
+
let { translation: t, rotation: e, scale: i } = n;
|
|
121
|
+
const { referFrame: r, worldTranslation: a, worldRotation: c, worldScale: f } = $(o), l = r ? s.inverse(r, new s()) : null;
|
|
122
122
|
let m = null;
|
|
123
|
-
if (
|
|
124
|
-
let p = w.computeAxis(m, new
|
|
125
|
-
if (!p.equals(
|
|
123
|
+
if (t && a && (t = s.multiplyByPointAsVector(l, t, new u())), e && (m = G(e), c)) {
|
|
124
|
+
let p = w.computeAxis(m, new u());
|
|
125
|
+
if (!p.equals(u.ZERO)) {
|
|
126
126
|
const d = w.computeAngle(m);
|
|
127
|
-
p =
|
|
127
|
+
p = s.multiplyByPointAsVector(l, p, p), m = w.fromAxisAngle(p, d);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
return i && f && (i =
|
|
130
|
+
return i && f && (i = s.multiplyByPointAsVector(l, i, new u())), { translation: t, rotation: m, scale: i };
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const
|
|
134
|
-
let { translation: e, rotation: i, scale: r } = L(
|
|
135
|
-
if (
|
|
136
|
-
if (e || (e =
|
|
137
|
-
const c =
|
|
132
|
+
function Tn(n, o) {
|
|
133
|
+
const t = o?.defaultMatrix;
|
|
134
|
+
let { translation: e, rotation: i, scale: r } = L(n, o);
|
|
135
|
+
if (t) {
|
|
136
|
+
if (e || (e = s.getTranslation(t, new u())), !i) {
|
|
137
|
+
const c = s.getMatrix3(t, new g());
|
|
138
138
|
i = w.fromRotationMatrix(c);
|
|
139
139
|
}
|
|
140
|
-
r || (r =
|
|
140
|
+
r || (r = s.getScale(t, new u()));
|
|
141
141
|
}
|
|
142
|
-
const
|
|
143
|
-
return
|
|
142
|
+
const a = new R(e ?? void 0, i ?? void 0, r ?? void 0);
|
|
143
|
+
return s.fromTranslationRotationScale(a);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
const { translation: o, rotation:
|
|
147
|
-
return
|
|
145
|
+
function Zn(n) {
|
|
146
|
+
const { translation: o, rotation: t, scale: e } = n, i = t ? G(t) : void 0, r = new R(o ?? void 0, i, e ?? void 0);
|
|
147
|
+
return s.fromTranslationRotationScale(r);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const e =
|
|
151
|
-
return
|
|
149
|
+
function vn(n, o, t) {
|
|
150
|
+
const e = u.subtract(o, n, new u()), i = u.subtract(t, n, new u()), r = u.cross(e, i, e);
|
|
151
|
+
return u.normalize(r, e);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
const e =
|
|
155
|
-
return
|
|
153
|
+
function Kn(n, o, t) {
|
|
154
|
+
const e = vn(n, o, t);
|
|
155
|
+
return an.fromPointNormal(e, n);
|
|
156
156
|
}
|
|
157
|
-
function*
|
|
158
|
-
const i =
|
|
157
|
+
function* $n(n, o = !0, t, e) {
|
|
158
|
+
const i = n.length, r = o ? i : i - 1, a = t || e ? u.prototype.equalsEpsilon : u.prototype.equals;
|
|
159
159
|
for (let c = 0; c < r; c++) {
|
|
160
|
-
const f =
|
|
161
|
-
let
|
|
162
|
-
for (;
|
|
163
|
-
if (
|
|
160
|
+
const f = n[c];
|
|
161
|
+
let l = (c + 1) % i, m = n[l], p = c;
|
|
162
|
+
for (; a.call(f, m, t, e); ) {
|
|
163
|
+
if (l = (++p + 1) % i, l === c)
|
|
164
164
|
return;
|
|
165
|
-
m =
|
|
165
|
+
m = n[l];
|
|
166
166
|
}
|
|
167
167
|
c = p, yield [f, m];
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
function H(
|
|
171
|
-
|
|
172
|
-
const e =
|
|
173
|
-
return
|
|
170
|
+
function H(n, o, t) {
|
|
171
|
+
t = t ?? new s();
|
|
172
|
+
const e = s.inverse(o, new s()), i = s.multiply(n, e, e);
|
|
173
|
+
return s.multiply(o, i, t);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
e = e ?? new
|
|
177
|
-
const i =
|
|
178
|
-
let r =
|
|
179
|
-
return r =
|
|
175
|
+
function nt(n, o, t, e) {
|
|
176
|
+
e = e ?? new s();
|
|
177
|
+
const i = s.inverse(t, new s());
|
|
178
|
+
let r = s.multiply(i, n, i);
|
|
179
|
+
return r = s.multiply(o, r, r), s.multiply(t, r, e);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
const e =
|
|
183
|
-
return H(e, o,
|
|
181
|
+
function tt(n, o, t) {
|
|
182
|
+
const e = s.fromTranslation(n);
|
|
183
|
+
return H(e, o, t);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
const i = w.fromAxisAngle(
|
|
187
|
-
return H(
|
|
185
|
+
function ot(n, o, t, e) {
|
|
186
|
+
const i = w.fromAxisAngle(n, o), r = g.fromQuaternion(i), a = s.fromRotation(r);
|
|
187
|
+
return H(a, t, e);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
const e =
|
|
191
|
-
return H(e, o,
|
|
189
|
+
function et(n, o, t) {
|
|
190
|
+
const e = s.fromScale(n);
|
|
191
|
+
return H(e, o, t);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function it(n, o, t) {
|
|
194
194
|
const e = g.fromScale(o);
|
|
195
|
-
if (
|
|
196
|
-
for (const i of
|
|
197
|
-
|
|
195
|
+
if (t)
|
|
196
|
+
for (const i of n)
|
|
197
|
+
u.subtract(i, t, i), g.multiplyByVector(e, i, i), u.add(i, t, i);
|
|
198
198
|
else {
|
|
199
199
|
const i = g.fromScale(o);
|
|
200
|
-
for (const r of
|
|
200
|
+
for (const r of n)
|
|
201
201
|
g.multiplyByVector(i, r, r);
|
|
202
202
|
}
|
|
203
|
-
return
|
|
203
|
+
return n;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const { translation:
|
|
205
|
+
function rt(n, o) {
|
|
206
|
+
const { translation: t, rotation: e, scale: i } = n;
|
|
207
207
|
let r;
|
|
208
208
|
if (e) {
|
|
209
209
|
const { axis: c, angle: f } = e;
|
|
210
210
|
r = w.fromAxisAngle(c, f);
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
return
|
|
212
|
+
const a = new R(t ?? void 0, r, i ?? void 0);
|
|
213
|
+
return s.fromTranslationRotationScale(a, o ?? void 0);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
|
|
217
|
-
const e =
|
|
218
|
-
return
|
|
215
|
+
function tn(n, o, t) {
|
|
216
|
+
t ??= new R();
|
|
217
|
+
const e = s.pack(n, []), i = [], r = [], a = [], c = o ? F[o] : F.trs;
|
|
218
|
+
return cn(i, a, r, e, c), u.unpack(i, 0, t.translation), u.unpack(r, 0, t.scale), w.unpack(a, 0, t.rotation), t;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
return
|
|
220
|
+
function st(n, o) {
|
|
221
|
+
return tn(n, null, o);
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
const e =
|
|
225
|
-
return
|
|
223
|
+
function An(n, o, t) {
|
|
224
|
+
const e = u.pack(n.translation, []), i = u.pack(n.scale, []), r = w.pack(n.rotation, []), a = o ? F[o] : F.trs, c = ln([], e, r, i, a);
|
|
225
|
+
return s.unpack(c, 0, t);
|
|
226
226
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
229
|
-
const
|
|
230
|
-
function i(
|
|
231
|
-
return c =
|
|
227
|
+
const at = s.fromTranslationRotationScale;
|
|
228
|
+
function Mn(n, o) {
|
|
229
|
+
const t = s.inverse(n, new s()), e = new s();
|
|
230
|
+
function i(a, c) {
|
|
231
|
+
return c = An(a, o, c), s.multiply(n, c, c);
|
|
232
232
|
}
|
|
233
|
-
function r(
|
|
234
|
-
return
|
|
233
|
+
function r(a, c) {
|
|
234
|
+
return s.multiply(t, a, e), tn(e, o, c);
|
|
235
235
|
}
|
|
236
|
-
return { compose: i, decompose: r, referInverse:
|
|
236
|
+
return { compose: i, decompose: r, referInverse: t };
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
const e = E.eastNorthUpToFixedFrame(
|
|
240
|
-
return { ...
|
|
238
|
+
function on(n, o, t) {
|
|
239
|
+
const e = E.eastNorthUpToFixedFrame(n, t ?? void 0);
|
|
240
|
+
return { ...Mn(e, o), refer: e };
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
let o =
|
|
242
|
+
function ct(n) {
|
|
243
|
+
let o = n.boundingSphere;
|
|
244
244
|
if (o)
|
|
245
245
|
return o;
|
|
246
|
-
let
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
const i =
|
|
246
|
+
let t = n.geometryInstances;
|
|
247
|
+
if (t) {
|
|
248
|
+
t = Array.isArray(t) ? t : [t];
|
|
249
|
+
const i = t.map((r) => r.geometry.boundingSphere);
|
|
250
250
|
return C.fromBoundingSpheres(i);
|
|
251
251
|
}
|
|
252
|
-
const e =
|
|
252
|
+
const e = n.positions;
|
|
253
253
|
return e?.length > 0 ? C.fromPoints(e) : null;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
o = o ?? new
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
return
|
|
260
|
-
const e =
|
|
255
|
+
function lt(n, o) {
|
|
256
|
+
o = o ?? new u();
|
|
257
|
+
const t = n.position;
|
|
258
|
+
if (t)
|
|
259
|
+
return t instanceof u ? t : t.getValue(h.now(), o);
|
|
260
|
+
const e = n.modelMatrix;
|
|
261
261
|
if (e)
|
|
262
|
-
return
|
|
263
|
-
const i =
|
|
262
|
+
return s.getTranslation(e, o);
|
|
263
|
+
const i = n.positions;
|
|
264
264
|
return i?.length > 0 ? C.fromPoints(i).center : null;
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
let { translation: e, rotation: i, scale: r } = L(o,
|
|
268
|
-
const
|
|
269
|
-
return
|
|
266
|
+
function ut(n, o, t) {
|
|
267
|
+
let { translation: e, rotation: i, scale: r } = L(o, t);
|
|
268
|
+
const a = new R(e ?? void 0, i ?? void 0, r ?? void 0), c = s.fromTranslationRotationScale(a);
|
|
269
|
+
return Rn(n, c);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
274
|
-
return
|
|
275
|
-
const e =
|
|
271
|
+
function Rn(n, o) {
|
|
272
|
+
const t = n.modelMatrix;
|
|
273
|
+
if (t)
|
|
274
|
+
return s.multiply(o, t, t), n.modelMatrix = t, !0;
|
|
275
|
+
const e = n.position;
|
|
276
276
|
if (e) {
|
|
277
|
-
if ("scale" in
|
|
278
|
-
const r =
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
|
|
277
|
+
if ("scale" in n) {
|
|
278
|
+
const r = s.getTranslation(o, new u());
|
|
279
|
+
u.add(e, r, e);
|
|
280
|
+
const a = n.scale ?? 1, c = s.getScale(o, new u());
|
|
281
|
+
n.scale = u.maximumComponent(c) * a;
|
|
282
282
|
} else
|
|
283
|
-
|
|
284
|
-
return
|
|
283
|
+
s.multiplyByPoint(o, e, e);
|
|
284
|
+
return n.position = e, !0;
|
|
285
285
|
}
|
|
286
|
-
const i =
|
|
286
|
+
const i = n.positions;
|
|
287
287
|
if (i?.length > 0) {
|
|
288
288
|
for (const r of i)
|
|
289
|
-
|
|
290
|
-
return
|
|
289
|
+
s.multiplyByPoint(o, r, r);
|
|
290
|
+
return n.positions = i, !0;
|
|
291
291
|
}
|
|
292
292
|
return !1;
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
const e =
|
|
296
|
-
return
|
|
297
|
-
}
|
|
298
|
-
function
|
|
299
|
-
if (q(
|
|
300
|
-
return
|
|
301
|
-
const
|
|
302
|
-
if (J(
|
|
303
|
-
if (
|
|
304
|
-
const i =
|
|
305
|
-
|
|
294
|
+
function ft(n, o, t) {
|
|
295
|
+
const e = Sn(n), i = Tn(o, { ...t, defaultMatrix: e });
|
|
296
|
+
return Pn(n, i);
|
|
297
|
+
}
|
|
298
|
+
function Pn(n, o) {
|
|
299
|
+
if (q(n))
|
|
300
|
+
return n.modelMatrix = o, !0;
|
|
301
|
+
const t = s.getTranslation(o, new u());
|
|
302
|
+
if (J(n)) {
|
|
303
|
+
if (n.position = t, "scale" in n) {
|
|
304
|
+
const i = s.getScale(o, new u());
|
|
305
|
+
n.scale = u.maximumComponent(i);
|
|
306
306
|
}
|
|
307
307
|
return !0;
|
|
308
308
|
}
|
|
309
|
-
const e =
|
|
309
|
+
const e = n.positions;
|
|
310
310
|
if (e?.length > 0) {
|
|
311
311
|
const i = C.fromPoints(e);
|
|
312
|
-
|
|
312
|
+
u.subtract(t, i.center, t);
|
|
313
313
|
for (const r of e)
|
|
314
|
-
|
|
315
|
-
return
|
|
314
|
+
u.add(r, t, r);
|
|
315
|
+
return n.positions = e, !0;
|
|
316
316
|
}
|
|
317
317
|
return !1;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
if (q(
|
|
321
|
-
return
|
|
322
|
-
if (J(
|
|
323
|
-
const
|
|
324
|
-
return
|
|
319
|
+
function Sn(n) {
|
|
320
|
+
if (q(n))
|
|
321
|
+
return n.modelMatrix;
|
|
322
|
+
if (J(n)) {
|
|
323
|
+
const t = n.position, e = n.scale ?? 1, i = new R(t, void 0, new u(e, e, e));
|
|
324
|
+
return s.fromTranslationRotationScale(i);
|
|
325
325
|
}
|
|
326
|
-
const o =
|
|
326
|
+
const o = n.positions;
|
|
327
327
|
if (o?.length > 0) {
|
|
328
|
-
const
|
|
329
|
-
return
|
|
328
|
+
const t = C.fromPoints(o);
|
|
329
|
+
return s.fromTranslation(t.center);
|
|
330
330
|
}
|
|
331
331
|
return null;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
let { translation:
|
|
335
|
-
const { reset: r, referFrame:
|
|
333
|
+
function mt(n, o) {
|
|
334
|
+
let { translation: t, rotation: e, scale: i } = L(o, o);
|
|
335
|
+
const { reset: r, referFrame: a } = o, c = h.now(), f = !r;
|
|
336
336
|
if (e) {
|
|
337
337
|
let A = e;
|
|
338
338
|
if (f) {
|
|
339
|
-
const T =
|
|
339
|
+
const T = n.orientation?.getValue(c);
|
|
340
340
|
T && (A = w.multiply(e, T, T));
|
|
341
341
|
}
|
|
342
|
-
|
|
342
|
+
n.orientation = A;
|
|
343
343
|
}
|
|
344
|
-
if (
|
|
345
|
-
let A =
|
|
344
|
+
if (t) {
|
|
345
|
+
let A = t;
|
|
346
346
|
if (f) {
|
|
347
|
-
const T =
|
|
348
|
-
T && (A =
|
|
347
|
+
const T = n.position?.getValue(c);
|
|
348
|
+
T && (A = u.add(T, t, T));
|
|
349
349
|
}
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
if (!
|
|
353
|
-
const { translation:
|
|
354
|
-
let y =
|
|
355
|
-
if (y = H(y,
|
|
356
|
-
const A =
|
|
357
|
-
A &&
|
|
358
|
-
const T =
|
|
359
|
-
T &&
|
|
360
|
-
const Y =
|
|
361
|
-
Y &&
|
|
362
|
-
const j =
|
|
363
|
-
j &&
|
|
364
|
-
const W =
|
|
365
|
-
W &&
|
|
366
|
-
const X =
|
|
367
|
-
X &&
|
|
368
|
-
}
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
const V =
|
|
372
|
-
V &&
|
|
373
|
-
const S =
|
|
374
|
-
S &&
|
|
375
|
-
const B =
|
|
376
|
-
B &&
|
|
377
|
-
const _ =
|
|
378
|
-
_ &&
|
|
379
|
-
}
|
|
380
|
-
function
|
|
381
|
-
const
|
|
382
|
-
e && (
|
|
383
|
-
}
|
|
384
|
-
function
|
|
385
|
-
const
|
|
386
|
-
e != null && (
|
|
387
|
-
const i = Math.max(o.x, o.y), r =
|
|
388
|
-
r != null && (
|
|
389
|
-
const
|
|
390
|
-
c != null && (
|
|
391
|
-
}
|
|
392
|
-
function
|
|
393
|
-
const
|
|
394
|
-
r != null && (
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
const c =
|
|
398
|
-
c != null && (
|
|
399
|
-
const f =
|
|
400
|
-
f != null && (
|
|
401
|
-
}
|
|
402
|
-
function
|
|
403
|
-
const
|
|
404
|
-
e != null && (
|
|
405
|
-
const i =
|
|
406
|
-
i != null && (
|
|
407
|
-
}
|
|
408
|
-
function
|
|
409
|
-
let e =
|
|
410
|
-
if (!
|
|
411
|
-
const i = h.now(), r =
|
|
350
|
+
n.position = A;
|
|
351
|
+
}
|
|
352
|
+
if (!a) return;
|
|
353
|
+
const { translation: l, rotation: m, scale: p } = xn(o, o), d = new R(l ?? void 0, m ?? void 0, p ?? void 0);
|
|
354
|
+
let y = s.fromTranslationRotationScale(d);
|
|
355
|
+
if (y = H(y, a, y), p) {
|
|
356
|
+
const A = n.box;
|
|
357
|
+
A && Dn(A, p);
|
|
358
|
+
const T = n.cylinder;
|
|
359
|
+
T && Vn(T, p);
|
|
360
|
+
const Y = n.ellipse;
|
|
361
|
+
Y && Bn(Y, p);
|
|
362
|
+
const j = n.ellipsoid;
|
|
363
|
+
j && In(j, p);
|
|
364
|
+
const W = n.model;
|
|
365
|
+
W && On(W, p, r);
|
|
366
|
+
const X = n.plane;
|
|
367
|
+
X && Cn(X, p);
|
|
368
|
+
}
|
|
369
|
+
const P = n.corridor;
|
|
370
|
+
P && bn(P, y, p);
|
|
371
|
+
const V = n.polygon;
|
|
372
|
+
V && _n(V, y, p);
|
|
373
|
+
const S = n.polyline;
|
|
374
|
+
S && Nn(S, y, p);
|
|
375
|
+
const B = n.polylineVolume;
|
|
376
|
+
B && Fn(B, y, p);
|
|
377
|
+
const _ = n.wall;
|
|
378
|
+
_ && zn(_, y, p);
|
|
379
|
+
}
|
|
380
|
+
function Dn(n, o) {
|
|
381
|
+
const t = h.now(), e = n.dimensions?.getValue(t);
|
|
382
|
+
e && (n.dimensions = u.multiplyComponents(e, o, e));
|
|
383
|
+
}
|
|
384
|
+
function Vn(n, o) {
|
|
385
|
+
const t = h.now(), e = n.length?.getValue(t);
|
|
386
|
+
e != null && (n.length = e * o.z);
|
|
387
|
+
const i = Math.max(o.x, o.y), r = n.topRadius?.getValue(t);
|
|
388
|
+
r != null && (n.topRadius = r * i);
|
|
389
|
+
const a = o.z, c = n.bottomRadius?.getValue(t);
|
|
390
|
+
c != null && (n.bottomRadius = c * a);
|
|
391
|
+
}
|
|
392
|
+
function Bn(n, o) {
|
|
393
|
+
const t = h.now(), e = Math.max(o.x, o.y), i = o.z, r = n.semiMajorAxis?.getValue(t);
|
|
394
|
+
r != null && (n.semiMajorAxis = r * e);
|
|
395
|
+
const a = n.semiMinorAxis?.getValue(t);
|
|
396
|
+
a != null && (n.semiMinorAxis = a * e);
|
|
397
|
+
const c = n.height?.getValue(t);
|
|
398
|
+
c != null && (n.height = c * i);
|
|
399
|
+
const f = n.extrudedHeight?.getValue(t);
|
|
400
|
+
f != null && (n.extrudedHeight = f * i);
|
|
401
|
+
}
|
|
402
|
+
function In(n, o) {
|
|
403
|
+
const t = h.now(), e = n.radii?.getValue(t);
|
|
404
|
+
e != null && (n.radii = u.multiplyComponents(e, o, e));
|
|
405
|
+
const i = n.innerRadii?.getValue(t);
|
|
406
|
+
i != null && (n.innerRadii = u.multiplyComponents(i, o, i));
|
|
407
|
+
}
|
|
408
|
+
function On(n, o, t) {
|
|
409
|
+
let e = u.maximumComponent(o);
|
|
410
|
+
if (!t) {
|
|
411
|
+
const i = h.now(), r = n.scale?.getValue(i) ?? 1;
|
|
412
412
|
e *= r;
|
|
413
413
|
}
|
|
414
|
-
|
|
414
|
+
n.scale = e;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
417
|
-
const
|
|
418
|
-
i && (
|
|
416
|
+
function Cn(n, o) {
|
|
417
|
+
const t = h.now(), e = x.fromCartesian3(o), i = n.dimensions?.getValue(t);
|
|
418
|
+
i && (n.dimensions = x.multiplyComponents(i, e, i));
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
const e = h.now(), i = new
|
|
420
|
+
function bn(n, o, t) {
|
|
421
|
+
const e = h.now(), i = new u(), r = n.positions?.getValue(e);
|
|
422
422
|
if (r?.length > 0) {
|
|
423
423
|
for (const p of r)
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
function
|
|
433
|
-
const e = h.now(), i = new
|
|
434
|
-
r && (
|
|
435
|
-
const c = (
|
|
436
|
-
f != null && (
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
function
|
|
441
|
-
const { positions:
|
|
442
|
-
for (const i of
|
|
443
|
-
|
|
444
|
-
|
|
424
|
+
s.multiplyByPoint(o, p, p);
|
|
425
|
+
n.dimensions = r;
|
|
426
|
+
}
|
|
427
|
+
const a = t ?? s.getScale(o, i), c = Math.max(a.x, a.y);
|
|
428
|
+
n.width?.getValue(e) != null && (n.width = c * scale);
|
|
429
|
+
const l = n.height?.getValue(e), m = a.z;
|
|
430
|
+
l != null && (n.height = l * m);
|
|
431
|
+
}
|
|
432
|
+
function _n(n, o, t) {
|
|
433
|
+
const e = h.now(), i = new u(), r = n.hierarchy?.getValue(e);
|
|
434
|
+
r && (en(r, o), n.hierarchy = r);
|
|
435
|
+
const c = (t ?? s.getScale(o, i)).z, f = n.height?.getValue(e);
|
|
436
|
+
f != null && (n.height = f * c);
|
|
437
|
+
const l = n.extrudedHeight?.getValue(e);
|
|
438
|
+
l != null && (n.extrudedHeight = l * c);
|
|
439
|
+
}
|
|
440
|
+
function en(n, o) {
|
|
441
|
+
const { positions: t, holes: e } = n;
|
|
442
|
+
for (const i of t)
|
|
443
|
+
s.multiplyByPoint(o, i, i);
|
|
444
|
+
n.positions = t;
|
|
445
445
|
for (const i of e)
|
|
446
|
-
|
|
446
|
+
en(i, o);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
449
|
-
const e = h.now(), i = new
|
|
448
|
+
function Nn(n, o, t) {
|
|
449
|
+
const e = h.now(), i = new u(), r = n.positions?.getValue(e);
|
|
450
450
|
if (r?.length > 0) {
|
|
451
|
-
for (const
|
|
452
|
-
|
|
453
|
-
|
|
451
|
+
for (const l of r)
|
|
452
|
+
s.multiplyByPoint(o, l, l);
|
|
453
|
+
n.positions = r;
|
|
454
454
|
}
|
|
455
|
-
const
|
|
456
|
-
|
|
455
|
+
const a = t ?? s.getScale(o, i), c = Math.max(a.x, a.y);
|
|
456
|
+
n.width?.getValue(e) != null && (n.width = c * scale);
|
|
457
457
|
}
|
|
458
|
-
function
|
|
459
|
-
const e = h.now(), i = new
|
|
458
|
+
function Fn(n, o, t) {
|
|
459
|
+
const e = h.now(), i = new u(), r = n.positions?.getValue(e);
|
|
460
460
|
if (r?.length > 0) {
|
|
461
|
-
for (const
|
|
462
|
-
|
|
463
|
-
|
|
461
|
+
for (const l of r)
|
|
462
|
+
s.multiplyByPoint(o, l, l);
|
|
463
|
+
n.positions = r;
|
|
464
464
|
}
|
|
465
|
-
const
|
|
465
|
+
const a = t ?? s.getScale(o, i), c = x.fromCartesian3(a), f = n.shape?.getValue(e);
|
|
466
466
|
if (f != null) {
|
|
467
|
-
for (const
|
|
468
|
-
x.multiplyComponents(
|
|
469
|
-
|
|
467
|
+
for (const l of f)
|
|
468
|
+
x.multiplyComponents(l, c, l);
|
|
469
|
+
n.shape = f;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
const e = h.now(), i = new
|
|
472
|
+
function zn(n, o, t) {
|
|
473
|
+
const e = h.now(), i = new u(), r = n.positions?.getValue(e);
|
|
474
474
|
if (r?.length > 0) {
|
|
475
475
|
for (const m of r)
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
s.multiplyByPoint(o, m, m);
|
|
477
|
+
n.positions = r;
|
|
478
478
|
}
|
|
479
|
-
const c = (
|
|
479
|
+
const c = (t ?? s.getScale(o, i)).z, f = n.minimumHeights?.getValue(e);
|
|
480
480
|
f != null && (graphicsgraphics.minimumHeights = f.map((m) => m * c));
|
|
481
|
-
const
|
|
482
|
-
|
|
481
|
+
const l = n.maximumHeights?.getValue(e);
|
|
482
|
+
l != null && (graphicsgraphics.maximumHeights = l.map((m) => m * c));
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
const e = h.now(), i =
|
|
484
|
+
function pt(n, o, t) {
|
|
485
|
+
const e = h.now(), i = n.position?.getValue(e);
|
|
486
486
|
if (!i) return null;
|
|
487
|
-
const r =
|
|
487
|
+
const r = n.orientation?.getValue(e), a = n.model?.scale?.getValue(e) ?? 1, c = new u(a, a, a), f = o(i, t), l = s.inverse(f, new s()), m = s.multiplyByPoint(l, i, new u()), p = { translation: m, position: i, scale: c, rotation: new u() };
|
|
488
488
|
let d;
|
|
489
489
|
if (r) {
|
|
490
|
-
const V = g.fromQuaternion(r), S =
|
|
490
|
+
const V = g.fromQuaternion(r), S = s.fromRotation(V), B = s.multiply(l, S, S), _ = nn(B);
|
|
491
491
|
d = b.toCartesian3(_), p.rotation = d;
|
|
492
492
|
}
|
|
493
|
-
const y = new
|
|
494
|
-
let
|
|
495
|
-
return p.matrix =
|
|
493
|
+
const y = new R(m ?? void 0, d ? G(d) : void 0, c ?? void 0);
|
|
494
|
+
let P = s.fromTranslationRotationScale(y);
|
|
495
|
+
return p.matrix = P, p;
|
|
496
496
|
}
|
|
497
|
-
function
|
|
498
|
-
return
|
|
497
|
+
function dt(n) {
|
|
498
|
+
return n.values.length / n.componentsPerAttribute;
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
return Z.getSizeInBytes(
|
|
500
|
+
function yt(n) {
|
|
501
|
+
return Z.getSizeInBytes(n.componentDatatype) * n.componentsPerAttribute;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
const { componentDatatype: o, vertexBuffer:
|
|
503
|
+
function wt(n) {
|
|
504
|
+
const { componentDatatype: o, vertexBuffer: t } = n, e = yn[o];
|
|
505
505
|
if (!e) throw new Error("不支持的数据类型");
|
|
506
|
-
const i =
|
|
507
|
-
let c = new e(
|
|
508
|
-
return
|
|
506
|
+
const i = t.sizeInBytes, r = Z.getSizeInBytes(o), a = i / r;
|
|
507
|
+
let c = new e(a);
|
|
508
|
+
return t.getBufferData(c, 0, 0, i), c;
|
|
509
509
|
}
|
|
510
|
-
new x(), new
|
|
511
|
-
const Q = [new x(), new x(), new x(), new x()], k = [new
|
|
510
|
+
new x(), new u(), new O();
|
|
511
|
+
const Q = [new x(), new x(), new x(), new x()], k = [new u(), new u(), new u(), new u()];
|
|
512
512
|
new O(), new O(), new O(), new O();
|
|
513
|
-
const
|
|
513
|
+
const Gn = [new D(), new D(), new D(), new D()];
|
|
514
514
|
new v(), new v(), new v(), new v();
|
|
515
515
|
new N(), new N(), new N(), new N();
|
|
516
516
|
new g(), new g(), new g(), new g();
|
|
517
|
-
new
|
|
517
|
+
new s(), new s(), new s(), new s();
|
|
518
518
|
new w(), new w(), new w(), new w();
|
|
519
519
|
new I(), new I(), new I(), new I();
|
|
520
|
-
function
|
|
521
|
-
const { stride:
|
|
522
|
-
for (let
|
|
523
|
-
|
|
520
|
+
function gt(n, o = []) {
|
|
521
|
+
const { stride: t, vertexArray: e } = n, i = e.length / t, r = k[0];
|
|
522
|
+
for (let a = 0; a < i; a++)
|
|
523
|
+
n.encoding.decodePosition(e, a, r), u.pack(r, o, o.length);
|
|
524
524
|
return o;
|
|
525
525
|
}
|
|
526
|
-
function
|
|
527
|
-
return
|
|
526
|
+
function ht(n, o, t) {
|
|
527
|
+
return n.encoding.decodePosition(n.vertexArray, o, t);
|
|
528
528
|
}
|
|
529
|
-
function
|
|
530
|
-
const { stride: o, vertices:
|
|
529
|
+
function Hn(n) {
|
|
530
|
+
const { stride: o, vertices: t, indices: e, encoding: i } = n, r = t.length / o, a = k[0], c = new Float32Array(r * 3), f = Q[0], l = new Float32Array(r * 2), m = new Float32Array(r);
|
|
531
531
|
for (let p = 0; p < r; p++) {
|
|
532
|
-
i.decodePosition(
|
|
533
|
-
const d = i.decodeHeight(
|
|
534
|
-
m[p] = d, i.decodeTextureCoordinates(
|
|
532
|
+
i.decodePosition(t, p, a), u.pack(a, c, p * 3);
|
|
533
|
+
const d = i.decodeHeight(t, p);
|
|
534
|
+
m[p] = d, i.decodeTextureCoordinates(t, p, f), x.pack(f, l, p * 2);
|
|
535
535
|
}
|
|
536
536
|
return {
|
|
537
537
|
attributes: {
|
|
538
538
|
position: { array: c, vectorSize: 3 },
|
|
539
|
-
uv: { array:
|
|
539
|
+
uv: { array: l, 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
|
|
547
|
-
const
|
|
548
|
-
for (const r of
|
|
549
|
-
const { rectangle:
|
|
550
|
-
v.intersection(o,
|
|
546
|
+
function rn(n, o) {
|
|
547
|
+
const t = n._surface._tilesToRender, e = [], i = new v();
|
|
548
|
+
for (const r of t) {
|
|
549
|
+
const { rectangle: a } = r;
|
|
550
|
+
v.intersection(o, a, i) && e.push(r);
|
|
551
551
|
}
|
|
552
552
|
return e;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
const o =
|
|
556
|
-
return
|
|
554
|
+
function xt(n) {
|
|
555
|
+
const o = n._surface._tilesToRender;
|
|
556
|
+
return kn(o);
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function kn(n) {
|
|
559
559
|
const o = /* @__PURE__ */ new Set();
|
|
560
|
-
for (const r of
|
|
560
|
+
for (const r of n)
|
|
561
561
|
o.add(r.level);
|
|
562
|
-
const
|
|
562
|
+
const t = [...o], e = Math.min.apply(Math, t), i = Math.max.apply(Math, t);
|
|
563
563
|
return { min: e, max: i };
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
return
|
|
567
|
-
const { mesh:
|
|
568
|
-
return { data: i, encoding:
|
|
565
|
+
function sn(n) {
|
|
566
|
+
return n.map((o) => {
|
|
567
|
+
const { mesh: t, terrainData: e } = o.data, i = Hn(t), { x: r, y: a, level: c } = o, f = [e._minimumHeight, e._maximumHeight];
|
|
568
|
+
return { data: i, encoding: t.encoding, rectangle: o.rectangle, heightRange: f, x: r, y: a, level: c };
|
|
569
569
|
});
|
|
570
570
|
}
|
|
571
|
-
function
|
|
572
|
-
const { x: o, y:
|
|
573
|
-
return
|
|
571
|
+
function Tt(n) {
|
|
572
|
+
const { x: o, y: t, level: e } = n;
|
|
573
|
+
return n.data.terrainData.upsample(n.tilingScheme, o, t, e, o, t, e);
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
const { east: e, north: i, south: r, west:
|
|
577
|
-
c.longitude =
|
|
578
|
-
const f =
|
|
575
|
+
function Qn(n, o, t) {
|
|
576
|
+
const { east: e, north: i, south: r, west: a } = o, c = Gn[0];
|
|
577
|
+
c.longitude = a, c.latitude = r;
|
|
578
|
+
const f = n.positionToTileXY(c, t, Q[0]);
|
|
579
579
|
c.longitude = e, c.latitude = i;
|
|
580
|
-
const
|
|
580
|
+
const l = n.positionToTileXY(c, t, Q[1]), [m, p] = f.x < l.x ? [f.x, l.x] : [l.x, f.x], [d, y] = f.y < l.y ? [f.y, l.y] : [l.y, f.y];
|
|
581
581
|
return { min: [m, d], max: [p, y] };
|
|
582
582
|
}
|
|
583
|
-
const
|
|
584
|
-
function
|
|
585
|
-
return g.getScale(
|
|
583
|
+
const En = 32767;
|
|
584
|
+
function vt(n, o = new u()) {
|
|
585
|
+
return g.getScale(n.halfAxes, o), u.multiplyByScalar(o, 2 * En, o), o;
|
|
586
586
|
}
|
|
587
|
-
function U(
|
|
588
|
-
return
|
|
587
|
+
function U(n, o, t) {
|
|
588
|
+
return t = n.getLocalCurvature(o, t), t.x = 1 / t.x, t.y = 1 / t.y, t;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
591
|
-
|
|
590
|
+
function At(n, o, t) {
|
|
591
|
+
t = U(n, o, t);
|
|
592
592
|
const e = Math.PI / 180;
|
|
593
|
-
return x.multiplyByScalar(
|
|
593
|
+
return x.multiplyByScalar(t, e, t);
|
|
594
594
|
}
|
|
595
|
-
function
|
|
596
|
-
const { _quantizedVertices: o, _indices:
|
|
595
|
+
function qn(n) {
|
|
596
|
+
const { _quantizedVertices: o, _indices: t } = n, e = o.length / 3, i = {
|
|
597
597
|
type: "Float32Array",
|
|
598
598
|
start: 0,
|
|
599
599
|
vectorSize: 1
|
|
@@ -601,57 +601,57 @@ function Et(t) {
|
|
|
601
601
|
type: "Float32Array",
|
|
602
602
|
start: e,
|
|
603
603
|
vectorSize: 1
|
|
604
|
-
},
|
|
604
|
+
}, a = {
|
|
605
605
|
type: "Float32Array",
|
|
606
606
|
start: e * 2,
|
|
607
607
|
vectorSize: 1
|
|
608
608
|
};
|
|
609
609
|
return {
|
|
610
610
|
array: new Float32Array(o),
|
|
611
|
-
attributes: { u: i, v: r, height:
|
|
611
|
+
attributes: { u: i, v: r, height: a },
|
|
612
612
|
count: e,
|
|
613
|
-
indices:
|
|
613
|
+
indices: t
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
|
-
async function
|
|
617
|
-
const i = await
|
|
616
|
+
async function Mt(n, o, t, e) {
|
|
617
|
+
const i = await n.requestTileGeometry(o, t, e);
|
|
618
618
|
if (!i) return null;
|
|
619
|
-
const r =
|
|
620
|
-
return p.mapForAggregate(m, (y,
|
|
619
|
+
const r = qn(i), a = [data._minimumHeight, data._maximumHeight], c = n.tilingScheme.tileXYToRectangle(o, t, e), f = un(c, a), l = s.fromArray(f, void 0), m = ["u", "v", "height"], p = new fn({ ...r, positionNames: m }), d = new u();
|
|
620
|
+
return p.mapForAggregate(m, (y, P) => (u.fromArray(y, 0, d), s.multiplyByPoint(l, d, d), new D(d.x, d.y, d.z)));
|
|
621
621
|
}
|
|
622
|
-
async function
|
|
623
|
-
const { min: e, max: i } =
|
|
622
|
+
async function Rt(n, o, t) {
|
|
623
|
+
const { min: e, max: i } = Qn(n.tilingScheme, o, t), r = [], a = [];
|
|
624
624
|
for (let f = e[0]; f <= i[0]; f++)
|
|
625
|
-
for (let
|
|
626
|
-
const m =
|
|
627
|
-
m && (r.push(m),
|
|
625
|
+
for (let l = e[1]; l <= i[1]; l++) {
|
|
626
|
+
const m = Jn(n, f, l, t);
|
|
627
|
+
m && (r.push(m), a.push({ x: f, y: l }));
|
|
628
628
|
}
|
|
629
|
-
return (await Promise.all(r)).map(function(f,
|
|
630
|
-
const { x: m, y: p } =
|
|
631
|
-
return { x: m, y: p, level:
|
|
629
|
+
return (await Promise.all(r)).map(function(f, l) {
|
|
630
|
+
const { x: m, y: p } = a[l];
|
|
631
|
+
return { x: m, y: p, level: t, data: f };
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
|
-
async function
|
|
635
|
-
return
|
|
634
|
+
async function Jn(n, o, t, e) {
|
|
635
|
+
return n.getTileDataAvailable(o, t, e) ? (await n.loadTileDataAvailability(o, t, e), n.requestTileGeometry(o, t, e)) : Promise.reject("不可用");
|
|
636
636
|
}
|
|
637
|
-
async function
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
const y =
|
|
637
|
+
async function Pt(n, o) {
|
|
638
|
+
const t = v.fromCartesianArray(o), e = D.toCartesian(v.center(t)), i = U(n.ellipsoid, e), r = [i.x, i.y, 1], a = rn(n, t), c = sn(a), f = E.eastNorthUpToFixedFrame(e);
|
|
639
|
+
s.inverseTransformation(f, f);
|
|
640
|
+
const l = o.map((d) => {
|
|
641
|
+
const y = s.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
|
-
const { data: y, ...
|
|
647
|
-
m += await
|
|
646
|
+
const { data: y, ...P } = d, { position: V, uv: S, height: B } = y.attributes;
|
|
647
|
+
m += await mn.computeRelationAreaOfPolygon2Terrain({
|
|
648
648
|
args: [{
|
|
649
649
|
...y,
|
|
650
|
-
...
|
|
650
|
+
...P,
|
|
651
651
|
positionNames: ["position"],
|
|
652
|
-
region:
|
|
652
|
+
region: l,
|
|
653
653
|
// @ts-ignore
|
|
654
|
-
matrix:
|
|
654
|
+
matrix: s.pack(f, []),
|
|
655
655
|
relation: z.Contain | z.Intersect,
|
|
656
656
|
scale: r
|
|
657
657
|
}],
|
|
@@ -660,126 +660,137 @@ async function Rn(t, o) {
|
|
|
660
660
|
});
|
|
661
661
|
if (await Promise.all(p), m === 0 || isNaN(m)) {
|
|
662
662
|
console.warn("贴地面积计算异常,已回退到椭球面投影面积", m);
|
|
663
|
-
const d = o.map((y) =>
|
|
663
|
+
const d = o.map((y) => u.pack(y, []));
|
|
664
664
|
return m = K(d), Math.abs(m);
|
|
665
665
|
}
|
|
666
666
|
return m;
|
|
667
667
|
}
|
|
668
|
-
function
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
const d =
|
|
668
|
+
function St(n, o) {
|
|
669
|
+
const t = v.fromCartesianArray(o), e = D.toCartesian(v.center(t)), i = U(n.ellipsoid, e), r = [i.x, i.y, 1], a = rn(n, t), c = sn(a), f = E.eastNorthUpToFixedFrame(e);
|
|
670
|
+
s.inverseTransformation(f, f);
|
|
671
|
+
const l = o.map((p) => {
|
|
672
|
+
const d = s.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 += pn({
|
|
679
679
|
...d,
|
|
680
680
|
...y,
|
|
681
681
|
positionNames: ["position"],
|
|
682
|
-
region:
|
|
682
|
+
region: l,
|
|
683
683
|
// @ts-ignore
|
|
684
|
-
matrix:
|
|
684
|
+
matrix: s.pack(f, []),
|
|
685
685
|
relation: z.Contain | z.Intersect,
|
|
686
686
|
scale: r
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
689
|
if (m === 0 || isNaN(m)) {
|
|
690
690
|
console.warn("贴地面积计算异常,已回退到椭球面投影面积", m);
|
|
691
|
-
const p = o.map((d) =>
|
|
691
|
+
const p = o.map((d) => u.pack(d, []));
|
|
692
692
|
return m = K(p), Math.abs(m);
|
|
693
693
|
}
|
|
694
694
|
return m;
|
|
695
695
|
}
|
|
696
|
-
function
|
|
697
|
-
const e =
|
|
698
|
-
function
|
|
699
|
-
return
|
|
696
|
+
function Dt(n, o, t) {
|
|
697
|
+
const e = n.transform.clone(), i = s.inverse(e, new s()), r = new s(), { compose: a, decompose: c, ...f } = on(n.boundingSphere.center, o, t);
|
|
698
|
+
function l(p, d) {
|
|
699
|
+
return d = a(p, d), s.multiply(d, i, d);
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
return r(
|
|
701
|
+
function m(p, d) {
|
|
702
|
+
return s.multiply(p, e, r), c(r, d);
|
|
703
703
|
}
|
|
704
|
-
return { ...
|
|
704
|
+
return { ...f, right: i, compose: l, decompose: m };
|
|
705
|
+
}
|
|
706
|
+
function Vt(n, o, t) {
|
|
707
|
+
const e = s.inverse(n.root.transform, new s()), { compose: i, decompose: r, ...a } = on(n.boundingSphere.center, o, t);
|
|
708
|
+
function c(l, m) {
|
|
709
|
+
return m = i(l, m), s.multiply(m, e, m);
|
|
710
|
+
}
|
|
711
|
+
function f(l) {
|
|
712
|
+
return r(n.root.computedTransform, l);
|
|
713
|
+
}
|
|
714
|
+
return { ...a, right: e, compose: c, decompose: f };
|
|
705
715
|
}
|
|
706
716
|
export {
|
|
707
|
-
|
|
708
|
-
|
|
717
|
+
wn as CartesianAxis,
|
|
718
|
+
gn as HeadingPitchRollComponent,
|
|
709
719
|
b as Xyz_Hpr,
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
+
nt as applyMatrixReferFrame,
|
|
721
|
+
Rn as applyTransformInPrimitive,
|
|
722
|
+
ut as applyTransformInfoPrimitive,
|
|
723
|
+
yn as componentDatatypeTypedArrayMap,
|
|
724
|
+
yt as computeAttributeSizeInBytes,
|
|
725
|
+
vn as computeNormalOfCoplanars,
|
|
726
|
+
St as computeTerrainAreaOfPolygon,
|
|
727
|
+
Pt as computeTerrainAreaOfPolygon_worker,
|
|
728
|
+
dt as computeVertexNumOfAttribute,
|
|
729
|
+
Kn as createPlaneOfCoplanars,
|
|
720
730
|
$ as flatTransformInfoOptions,
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
731
|
+
wt as getAttributeData,
|
|
732
|
+
ct as getBoundingSphere,
|
|
733
|
+
gt as getDecodePositionsOfTerrainMesh,
|
|
734
|
+
pt as getEntityInfo,
|
|
735
|
+
qn as getGeometryDataOfQuantizedMeshTerrainData,
|
|
736
|
+
Hn as getGeometryDataOfTerrainMesh,
|
|
737
|
+
kn as getLevelRangeOfQuadtreeTiles,
|
|
728
738
|
U as getLocalCurvatureRadius,
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
739
|
+
At as getLocalSizePerDegrees,
|
|
740
|
+
xn as getLocalTransformInfo,
|
|
741
|
+
rt as getMatrix4OfTransformInfo,
|
|
742
|
+
$n as getNeighborPairs,
|
|
743
|
+
lt as getPosition,
|
|
744
|
+
ht as getPositionOfTerrainMesh,
|
|
745
|
+
rn as getRenderedQuadtreeTilesOfIntersectRectangle,
|
|
746
|
+
xt as getRenderedTileLevelRange,
|
|
747
|
+
vt as getScaleOfTerrainDataByOrientedBoundingBox,
|
|
748
|
+
Jn as getTerrainData,
|
|
749
|
+
Tt as getTerrainDataOfQuadtreeTile,
|
|
750
|
+
Rt as getTerrainDatasOfIntersectRectangle,
|
|
751
|
+
sn as getTerrainDatasOfQuadtreeTiles,
|
|
752
|
+
Qn as getTileRangeOfIntersectRectangle,
|
|
753
|
+
Sn as getTransform,
|
|
754
|
+
Mt as getWorldDataOfQuantizedMeshTerrainData,
|
|
755
|
+
Tn as getWorldMatrix,
|
|
746
756
|
L as getWorldTransformInfo,
|
|
747
757
|
q as isMatrixPrimitive,
|
|
748
|
-
|
|
758
|
+
dn as isPositionListPrimitive,
|
|
749
759
|
J as isPositionPrimitive,
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
760
|
+
Yn as isPrimitiveObject,
|
|
761
|
+
hn as localQuaternionToWorld,
|
|
762
|
+
Mn as localTRS_WorldMatrix4_Convert,
|
|
763
|
+
on as localTRS_WorldMatrix4_ENU_Convert,
|
|
754
764
|
H as makeMatrixReferFrame,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
765
|
+
at as mat4_compose,
|
|
766
|
+
An as mat4_composeByOrder,
|
|
767
|
+
st as mat4_decompose,
|
|
768
|
+
tn as mat4_decomposeByOrder,
|
|
769
|
+
nn as matrix4ToHeadingPitchRoll,
|
|
770
|
+
jn as quaternionToHeadingPitchRoll,
|
|
771
|
+
Pn as resetTransformInPrimitive,
|
|
772
|
+
ft as resetTransformInfoPrimitive,
|
|
773
|
+
ot as rotateMatrixReferFrame,
|
|
764
774
|
G as rotationInfoToQuaternion,
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
775
|
+
Dn as scaleBoxGraphics,
|
|
776
|
+
Vn as scaleCylinderGraphics,
|
|
777
|
+
Bn as scaleEllipseGraphics,
|
|
778
|
+
In as scaleEllipsoidGraphics,
|
|
779
|
+
et as scaleMatrixReferFrame,
|
|
780
|
+
On as scaleModelGraphics,
|
|
781
|
+
Cn as scalePlaneGraphics,
|
|
782
|
+
it as scalePoints,
|
|
783
|
+
Dt as tile_enuTRS_modelMatrix_Convert,
|
|
784
|
+
Vt as tileset_enuTRS_modelMatrix_Convert,
|
|
785
|
+
bn as transformCorridorGraphics,
|
|
786
|
+
mt as transformEntity,
|
|
787
|
+
Zn as transformInfoToMatrix,
|
|
788
|
+
_n as transformPolygonGraphics,
|
|
789
|
+
en as transformPolygonHierarchy,
|
|
790
|
+
Nn as transformPolylineGraphics,
|
|
791
|
+
Fn as transformPolylineVolumeGraphics,
|
|
792
|
+
zn as transformWallGraphics,
|
|
793
|
+
tt as translationMatrixReferFrame,
|
|
794
|
+
Wn as worldMatrixToLocal,
|
|
795
|
+
Xn as worldQuaternionToLocal
|
|
785
796
|
};
|