@cearth/tools 2.5.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/tools.js CHANGED
@@ -1,599 +1,599 @@
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);
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(t) {
7
- return "modelMatrix" in t;
6
+ function q(n) {
7
+ return "modelMatrix" in n;
8
8
  }
9
- function J(t) {
10
- return "position" in t;
9
+ function J(n) {
10
+ return "position" in n;
11
11
  }
12
- function mt(t) {
13
- return "positions" in t;
12
+ function dn(n) {
13
+ return "positions" in n;
14
14
  }
15
- const pt = {
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>.
19
19
  */
20
- [P.BYTE]: Int8Array,
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
- [P.UNSIGNED_BYTE]: Uint8Array,
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
- [P.SHORT]: Int16Array,
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
- [P.UNSIGNED_SHORT]: Uint16Array,
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
- [P.INT]: Int32Array,
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
- [P.UNSIGNED_INT]: Uint32Array,
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
- [P.FLOAT]: Float32Array,
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
- [P.DOUBLE]: Float64Array
56
+ [M.DOUBLE]: Float64Array
57
57
  };
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
- ((t) => {
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, s] of Object.entries(t))
62
- if (i === s)
61
+ for (let [r, a] of Object.entries(n))
62
+ if (i === a)
63
63
  return r;
64
64
  }
65
- t.toKey = o;
66
- function n(i) {
67
- return new l(i.roll, -i.pitch, -i.heading);
65
+ n.toKey = o;
66
+ function t(i) {
67
+ return new u(i.roll, -i.pitch, -i.heading);
68
68
  }
69
- t.toCartesian3 = n;
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
- t.toHeadingPitchRoll = e;
73
+ n.toHeadingPitchRoll = e;
74
74
  })(b || (b = {}));
75
- var yt = /* @__PURE__ */ ((t) => (t[t.heading = 0] = "heading", t[t.pitch = 1] = "pitch", t[t.roll = 2] = "roll", t))(yt || {});
76
- function $(t) {
77
- const o = t?.world, { translation: n, rotation: e, scale: i } = o && typeof o == "object" ? o : { translation: o, rotation: o, scale: o };
78
- return { ...t, worldTranslation: n, worldRotation: e, worldScale: i };
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(t) {
81
- if (t.axis) {
82
- const { axis: n, angle: e } = t;
83
- return w.fromAxisAngle(n, e);
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(t);
85
+ const o = b.toHeadingPitchRoll(n);
86
86
  return w.fromHeadingPitchRoll(o);
87
87
  }
88
- function Ut(t, o, n) {
89
- const e = g.fromQuaternion(t), i = a.fromRotation(e), r = a.inverseTransformation(o, new a()), s = a.multiply(r, i, i);
90
- return tt(s);
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 tt(t, o) {
93
- const n = a.getMatrix3(t, new g()), e = w.fromRotationMatrix(n);
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 Yt(t, o, n) {
97
- n = n ?? new a();
98
- const e = a.inverse(o, new a());
99
- return a.multiply(e, t, n);
100
- }
101
- function wt(t, o, n) {
102
- let e = w.computeAxis(t, new l());
103
- if (e.equals(l.ZERO)) return null;
104
- const i = w.computeAngle(t);
105
- return e = a.multiplyByPointAsVector(o, e, e), w.fromAxisAngle(e, i);
106
- }
107
- function jt(t, o, n) {
108
- let e = w.computeAxis(t, new l());
109
- if (e.equals(l.ZERO)) return null;
110
- const i = w.computeAngle(t), r = a.inverse(o, new a());
111
- return e = a.multiplyByPointAsVector(r, e, e), w.fromAxisAngle(e, i);
112
- }
113
- function L(t, o) {
114
- let { translation: n, rotation: e, scale: i } = t;
115
- const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: u } = $(o);
116
- let f = null;
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
- }
119
- function gt(t, o) {
120
- let { translation: n, rotation: e, scale: i } = t;
121
- const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: u } = $(o), f = r ? a.inverse(r, new a()) : null;
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 (n && s && (n = a.multiplyByPointAsVector(f, n, new l())), e && (m = G(e), c)) {
124
- let p = w.computeAxis(m, new l());
125
- if (!p.equals(l.ZERO)) {
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 = a.multiplyByPointAsVector(f, p, p), m = w.fromAxisAngle(p, d);
127
+ p = s.multiplyByPointAsVector(l, p, p), m = w.fromAxisAngle(p, d);
128
128
  }
129
129
  }
130
- return i && u && (i = a.multiplyByPointAsVector(f, i, new l())), { translation: n, rotation: m, scale: i };
130
+ return i && f && (i = s.multiplyByPointAsVector(l, i, new u())), { translation: t, rotation: m, scale: i };
131
131
  }
132
- function ht(t, o) {
133
- const n = o?.defaultMatrix;
134
- let { translation: e, rotation: i, scale: r } = L(t, o);
135
- if (n) {
136
- if (e || (e = a.getTranslation(n, new l())), !i) {
137
- const c = a.getMatrix3(n, new g());
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 = a.getScale(n, new l()));
140
+ r || (r = s.getScale(t, new u()));
141
141
  }
142
- const s = new M(e ?? void 0, i ?? void 0, r ?? void 0);
143
- return a.fromTranslationRotationScale(s);
142
+ const a = new R(e ?? void 0, i ?? void 0, r ?? void 0);
143
+ return s.fromTranslationRotationScale(a);
144
144
  }
145
- function Wt(t) {
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
- return a.fromTranslationRotationScale(r);
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 xt(t, o, n) {
150
- const e = l.subtract(o, t, new l()), i = l.subtract(n, t, new l()), r = l.cross(e, i, e);
151
- return l.normalize(r, e);
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 Xt(t, o, n) {
154
- const e = xt(t, o, n);
155
- return rt.fromPointNormal(e, t);
153
+ function Kn(n, o, t) {
154
+ const e = vn(n, o, t);
155
+ return an.fromPointNormal(e, n);
156
156
  }
157
- function* Zt(t, o = !0, n, e) {
158
- const i = t.length, r = o ? i : i - 1, s = n || e ? l.prototype.equalsEpsilon : l.prototype.equals;
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 u = t[c];
161
- let f = (c + 1) % i, m = t[f], p = c;
162
- for (; s.call(u, m, n, e); ) {
163
- if (f = (++p + 1) % i, f === c)
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 = t[f];
165
+ m = n[l];
166
166
  }
167
- c = p, yield [u, m];
167
+ c = p, yield [f, m];
168
168
  }
169
169
  }
170
- function H(t, o, n) {
171
- n = n ?? new a();
172
- const e = a.inverse(o, new a()), i = a.multiply(t, e, e);
173
- return a.multiply(o, i, n);
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 Kt(t, o, n, e) {
176
- e = e ?? new a();
177
- const i = a.inverse(n, new a());
178
- let r = a.multiply(i, t, i);
179
- return r = a.multiply(o, r, r), a.multiply(n, r, e);
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 $t(t, o, n) {
182
- const e = a.fromTranslation(t);
183
- return H(e, o, n);
181
+ function tt(n, o, t) {
182
+ const e = s.fromTranslation(n);
183
+ return H(e, o, t);
184
184
  }
185
- function tn(t, o, n, e) {
186
- const i = w.fromAxisAngle(t, o), r = g.fromQuaternion(i), s = a.fromRotation(r);
187
- return H(s, n, e);
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 nn(t, o, n) {
190
- const e = a.fromScale(t);
191
- return H(e, o, n);
189
+ function et(n, o, t) {
190
+ const e = s.fromScale(n);
191
+ return H(e, o, t);
192
192
  }
193
- function on(t, o, n) {
193
+ function it(n, o, t) {
194
194
  const e = g.fromScale(o);
195
- if (n)
196
- for (const i of t)
197
- l.subtract(i, n, i), g.multiplyByVector(e, i, i), l.add(i, n, i);
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 t)
200
+ for (const r of n)
201
201
  g.multiplyByVector(i, r, r);
202
202
  }
203
- return t;
203
+ return n;
204
204
  }
205
- function en(t, o) {
206
- const { translation: n, rotation: e, scale: i } = t;
205
+ function rt(n, o) {
206
+ const { translation: t, rotation: e, scale: i } = n;
207
207
  let r;
208
208
  if (e) {
209
- const { axis: c, angle: u } = e;
210
- r = w.fromAxisAngle(c, u);
209
+ const { axis: c, angle: f } = e;
210
+ r = w.fromAxisAngle(c, f);
211
211
  }
212
- const s = new M(n ?? void 0, r, i ?? void 0);
213
- return a.fromTranslationRotationScale(s, o ?? void 0);
212
+ const a = new R(t ?? void 0, r, i ?? void 0);
213
+ return s.fromTranslationRotationScale(a, o ?? void 0);
214
214
  }
215
- function nt(t, o, n) {
216
- n ??= new M();
217
- const e = a.pack(t, []), i = [], r = [], s = [], c = o ? _[o] : _.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;
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 rn(t, o) {
221
- return nt(t, null, o);
220
+ function st(n, o) {
221
+ return tn(n, null, o);
222
222
  }
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
- return a.unpack(c, 0, n);
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 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);
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(s, c) {
234
- return a.multiply(n, s, e), nt(e, o, c);
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: n };
236
+ return { compose: i, decompose: r, referInverse: t };
237
237
  }
238
- function sn(t, o, n) {
239
- const e = E.eastNorthUpToFixedFrame(t, n ?? void 0);
240
- return { ...vt(e, o), refer: e };
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 cn(t) {
243
- let o = t.boundingSphere;
242
+ function ct(n) {
243
+ let o = n.boundingSphere;
244
244
  if (o)
245
245
  return o;
246
- let n = t.geometryInstances;
247
- if (n) {
248
- n = Array.isArray(n) ? n : [n];
249
- const i = n.map((r) => r.geometry.boundingSphere);
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 = t.positions;
252
+ const e = n.positions;
253
253
  return e?.length > 0 ? C.fromPoints(e) : null;
254
254
  }
255
- function ln(t, o) {
256
- o = o ?? new l();
257
- const n = t.position;
258
- if (n)
259
- return n instanceof l ? n : n.getValue(h.now(), o);
260
- const e = t.modelMatrix;
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 a.getTranslation(e, o);
263
- const i = t.positions;
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 un(t, o, n) {
267
- let { translation: e, rotation: i, scale: r } = L(o, n);
268
- const s = new M(e ?? void 0, i ?? void 0, r ?? void 0), c = a.fromTranslationRotationScale(s);
269
- return At(t, c);
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 At(t, o) {
272
- const n = t.modelMatrix;
273
- if (n)
274
- return a.multiply(o, n, n), t.modelMatrix = n, !0;
275
- const e = t.position;
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 t) {
278
- const r = a.getTranslation(o, new l());
279
- l.add(e, r, e);
280
- const s = t.scale ?? 1, c = a.getScale(o, new l());
281
- t.scale = l.maximumComponent(c) * s;
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
- a.multiplyByPoint(o, e, e);
284
- return t.position = e, !0;
283
+ s.multiplyByPoint(o, e, e);
284
+ return n.position = e, !0;
285
285
  }
286
- const i = t.positions;
286
+ const i = n.positions;
287
287
  if (i?.length > 0) {
288
288
  for (const r of i)
289
- a.multiplyByPoint(o, r, r);
290
- return t.positions = i, !0;
289
+ s.multiplyByPoint(o, r, r);
290
+ return n.positions = i, !0;
291
291
  }
292
292
  return !1;
293
293
  }
294
- function fn(t, o, n) {
295
- const e = Mt(t), i = ht(o, { ...n, defaultMatrix: e });
296
- return Pt(t, i);
297
- }
298
- function Pt(t, o) {
299
- if (q(t))
300
- return t.modelMatrix = o, !0;
301
- const n = a.getTranslation(o, new l());
302
- if (J(t)) {
303
- if (t.position = n, "scale" in t) {
304
- const i = a.getScale(o, new l());
305
- t.scale = l.maximumComponent(i);
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 = t.positions;
309
+ const e = n.positions;
310
310
  if (e?.length > 0) {
311
311
  const i = C.fromPoints(e);
312
- l.subtract(n, i.center, n);
312
+ u.subtract(t, i.center, t);
313
313
  for (const r of e)
314
- l.add(r, n, r);
315
- return t.positions = e, !0;
314
+ u.add(r, t, r);
315
+ return n.positions = e, !0;
316
316
  }
317
317
  return !1;
318
318
  }
319
- function Mt(t) {
320
- if (q(t))
321
- return t.modelMatrix;
322
- if (J(t)) {
323
- const n = t.position, e = t.scale ?? 1, i = new M(n, void 0, new l(e, e, e));
324
- return a.fromTranslationRotationScale(i);
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 = t.positions;
326
+ const o = n.positions;
327
327
  if (o?.length > 0) {
328
- const n = C.fromPoints(o);
329
- return a.fromTranslation(n.center);
328
+ const t = C.fromPoints(o);
329
+ return s.fromTranslation(t.center);
330
330
  }
331
331
  return null;
332
332
  }
333
- function mn(t, o) {
334
- let { translation: n, rotation: e, scale: i } = L(o, o);
335
- const { reset: r, referFrame: s } = o, c = h.now(), u = !r;
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
- if (u) {
339
- const T = t.orientation?.getValue(c);
338
+ if (f) {
339
+ const T = n.orientation?.getValue(c);
340
340
  T && (A = w.multiply(e, T, T));
341
341
  }
342
- t.orientation = A;
342
+ n.orientation = A;
343
343
  }
344
- if (n) {
345
- let A = n;
346
- if (u) {
347
- const T = t.position?.getValue(c);
348
- T && (A = l.add(T, n, T));
344
+ if (t) {
345
+ let A = t;
346
+ if (f) {
347
+ const T = n.position?.getValue(c);
348
+ T && (A = u.add(T, t, T));
349
349
  }
350
- t.position = A;
351
- }
352
- if (!s) return;
353
- const { translation: f, rotation: m, scale: p } = gt(o, o), d = new M(f ?? void 0, m ?? void 0, p ?? void 0);
354
- let y = a.fromTranslationRotationScale(d);
355
- if (y = H(y, s, y), p) {
356
- const A = t.box;
357
- A && Rt(A, p);
358
- const T = t.cylinder;
359
- T && St(T, p);
360
- const Y = t.ellipse;
361
- Y && Dt(Y, p);
362
- const j = t.ellipsoid;
363
- j && Vt(j, p);
364
- const W = t.model;
365
- W && Bt(W, p, r);
366
- const X = t.plane;
367
- X && It(X, p);
368
- }
369
- const R = t.corridor;
370
- R && Ot(R, y, p);
371
- const V = t.polygon;
372
- V && Ct(V, y, p);
373
- const S = t.polyline;
374
- S && bt(S, y, p);
375
- const B = t.polylineVolume;
376
- B && Nt(B, y, p);
377
- const N = t.wall;
378
- N && Ft(N, y, p);
379
- }
380
- function Rt(t, o) {
381
- const n = h.now(), e = t.dimensions?.getValue(n);
382
- e && (t.dimensions = l.multiplyComponents(e, o, e));
383
- }
384
- function St(t, o) {
385
- const n = h.now(), e = t.length?.getValue(n);
386
- e != null && (t.length = e * o.z);
387
- const i = Math.max(o.x, o.y), r = t.topRadius?.getValue(n);
388
- r != null && (t.topRadius = r * i);
389
- const s = o.z, c = t.bottomRadius?.getValue(n);
390
- c != null && (t.bottomRadius = c * s);
391
- }
392
- function Dt(t, o) {
393
- const n = h.now(), e = Math.max(o.x, o.y), i = o.z, r = t.semiMajorAxis?.getValue(n);
394
- r != null && (t.semiMajorAxis = r * e);
395
- const s = t.semiMinorAxis?.getValue(n);
396
- s != null && (t.semiMinorAxis = s * e);
397
- const c = t.height?.getValue(n);
398
- c != null && (t.height = c * i);
399
- const u = t.extrudedHeight?.getValue(n);
400
- u != null && (t.extrudedHeight = u * i);
401
- }
402
- function Vt(t, o) {
403
- const n = h.now(), e = t.radii?.getValue(n);
404
- e != null && (t.radii = l.multiplyComponents(e, o, e));
405
- const i = t.innerRadii?.getValue(n);
406
- i != null && (t.innerRadii = l.multiplyComponents(i, o, i));
407
- }
408
- function Bt(t, o, n) {
409
- let e = l.maximumComponent(o);
410
- if (!n) {
411
- const i = h.now(), r = t.scale?.getValue(i) ?? 1;
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
- t.scale = e;
414
+ n.scale = e;
415
415
  }
416
- function It(t, o) {
417
- const n = h.now(), e = x.fromCartesian3(o), i = t.dimensions?.getValue(n);
418
- i && (t.dimensions = x.multiplyComponents(i, e, 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 Ot(t, o, n) {
421
- const e = h.now(), i = new l(), r = t.positions?.getValue(e);
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
- a.multiplyByPoint(o, p, p);
425
- t.dimensions = r;
426
- }
427
- const s = n ?? a.getScale(o, i), c = Math.max(s.x, s.y);
428
- t.width?.getValue(e) != null && (t.width = c * scale);
429
- const f = t.height?.getValue(e), m = s.z;
430
- f != null && (t.height = f * m);
431
- }
432
- function Ct(t, o, n) {
433
- const e = h.now(), i = new l(), r = t.hierarchy?.getValue(e);
434
- r && (ot(r, o), t.hierarchy = r);
435
- const c = (n ?? a.getScale(o, i)).z, u = t.height?.getValue(e);
436
- u != null && (t.height = u * c);
437
- const f = t.extrudedHeight?.getValue(e);
438
- f != null && (t.extrudedHeight = f * c);
439
- }
440
- function ot(t, o) {
441
- const { positions: n, holes: e } = t;
442
- for (const i of n)
443
- a.multiplyByPoint(o, i, i);
444
- t.positions = n;
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
- ot(i, o);
446
+ en(i, o);
447
447
  }
448
- function bt(t, o, n) {
449
- const e = h.now(), i = new l(), r = t.positions?.getValue(e);
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 f of r)
452
- a.multiplyByPoint(o, f, f);
453
- t.positions = r;
451
+ for (const l of r)
452
+ s.multiplyByPoint(o, l, l);
453
+ n.positions = r;
454
454
  }
455
- const s = n ?? a.getScale(o, i), c = Math.max(s.x, s.y);
456
- t.width?.getValue(e) != null && (t.width = c * scale);
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 Nt(t, o, n) {
459
- const e = h.now(), i = new l(), r = t.positions?.getValue(e);
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 f of r)
462
- a.multiplyByPoint(o, f, f);
463
- t.positions = r;
461
+ for (const l of r)
462
+ s.multiplyByPoint(o, l, l);
463
+ n.positions = r;
464
464
  }
465
- const s = n ?? a.getScale(o, i), c = x.fromCartesian3(s), u = t.shape?.getValue(e);
466
- if (u != null) {
467
- for (const f of u)
468
- x.multiplyComponents(f, c, f);
469
- t.shape = u;
465
+ const a = t ?? s.getScale(o, i), c = x.fromCartesian3(a), f = n.shape?.getValue(e);
466
+ if (f != null) {
467
+ for (const l of f)
468
+ x.multiplyComponents(l, c, l);
469
+ n.shape = f;
470
470
  }
471
471
  }
472
- function Ft(t, o, n) {
473
- const e = h.now(), i = new l(), r = t.positions?.getValue(e);
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
- a.multiplyByPoint(o, m, m);
477
- t.positions = r;
476
+ s.multiplyByPoint(o, m, m);
477
+ n.positions = r;
478
478
  }
479
- const c = (n ?? a.getScale(o, i)).z, u = t.minimumHeights?.getValue(e);
480
- u != null && (graphicsgraphics.minimumHeights = u.map((m) => m * c));
481
- const f = t.maximumHeights?.getValue(e);
482
- f != null && (graphicsgraphics.maximumHeights = f.map((m) => m * c));
479
+ const c = (t ?? s.getScale(o, i)).z, f = n.minimumHeights?.getValue(e);
480
+ f != null && (graphicsgraphics.minimumHeights = f.map((m) => m * c));
481
+ const l = n.maximumHeights?.getValue(e);
482
+ l != null && (graphicsgraphics.maximumHeights = l.map((m) => m * c));
483
483
  }
484
- function pn(t, o, n) {
485
- const e = h.now(), i = t.position?.getValue(e);
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 = t.orientation?.getValue(e), s = t.model?.scale?.getValue(e) ?? 1, c = new l(s, s, s), u = o(i, n), f = a.inverse(u, new a()), m = a.multiplyByPoint(f, i, new l()), p = { translation: m, position: i, scale: c, rotation: new l() };
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 = a.fromRotation(V), B = a.multiply(f, S, S), N = tt(B);
491
- d = b.toCartesian3(N), p.rotation = d;
490
+ const V = g.fromQuaternion(r), S = s.fromRotation(V), B = s.multiply(l, S, S), _ = nn(B);
491
+ d = b.toCartesian3(_), p.rotation = d;
492
492
  }
493
- const y = new M(m ?? void 0, d ? G(d) : void 0, c ?? void 0);
494
- let R = a.fromTranslationRotationScale(y);
495
- return p.matrix = R, p;
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 dn(t) {
498
- return t.values.length / t.componentsPerAttribute;
497
+ function dt(n) {
498
+ return n.values.length / n.componentsPerAttribute;
499
499
  }
500
- function yn(t) {
501
- return Z.getSizeInBytes(t.componentDatatype) * t.componentsPerAttribute;
500
+ function yt(n) {
501
+ return Z.getSizeInBytes(n.componentDatatype) * n.componentsPerAttribute;
502
502
  }
503
- function wn(t) {
504
- const { componentDatatype: o, vertexBuffer: n } = t, e = pt[o];
503
+ function wt(n) {
504
+ const { componentDatatype: o, vertexBuffer: t } = n, e = yn[o];
505
505
  if (!e) throw new Error("不支持的数据类型");
506
- const i = n.sizeInBytes, r = Z.getSizeInBytes(o), s = i / r;
507
- let c = new e(s);
508
- return n.getBufferData(c, 0, 0, i), c;
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 l(), new O();
511
- const Q = [new x(), new x(), new x(), new x()], k = [new l(), new l(), new l(), new l()];
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 _t = [new D(), new D(), new D(), new D()];
513
+ const Gn = [new D(), new D(), new D(), new D()];
514
514
  new v(), new v(), new v(), new v();
515
- new F(), new F(), new F(), new F();
515
+ new N(), new N(), new N(), new N();
516
516
  new g(), new g(), new g(), new g();
517
- new a(), new a(), new a(), new a();
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 gn(t, o = []) {
521
- const { stride: n, vertexArray: e } = t, i = e.length / n, r = k[0];
522
- for (let s = 0; s < i; s++)
523
- t.encoding.decodePosition(e, s, r), l.pack(r, o, o.length);
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 hn(t, o, n) {
527
- return t.encoding.decodePosition(t.vertexArray, o, n);
526
+ function ht(n, o, t) {
527
+ return n.encoding.decodePosition(n.vertexArray, o, t);
528
528
  }
529
- function zt(t) {
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);
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(n, p, s), l.pack(s, c, p * 3);
533
- const d = i.decodeHeight(n, p);
534
- m[p] = d, i.decodeTextureCoordinates(n, p, u), x.pack(u, f, p * 2);
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: f, vectorSize: 2 },
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 et(t, o) {
547
- const n = t._surface._tilesToRender, e = [], i = new v();
548
- for (const r of n) {
549
- const { rectangle: s } = r;
550
- v.intersection(o, s, i) && e.push(r);
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 xn(t) {
555
- const o = t._surface._tilesToRender;
556
- return Gt(o);
554
+ function xt(n) {
555
+ const o = n._surface._tilesToRender;
556
+ return kn(o);
557
557
  }
558
- function Gt(t) {
558
+ function kn(n) {
559
559
  const o = /* @__PURE__ */ new Set();
560
- for (const r of t)
560
+ for (const r of n)
561
561
  o.add(r.level);
562
- const n = [...o], e = Math.min.apply(Math, n), i = Math.max.apply(Math, n);
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 it(t) {
566
- return t.map((o) => {
567
- const { mesh: n, terrainData: e } = o.data, i = zt(n), { x: r, y: s, level: c } = o, u = [e._minimumHeight, e._maximumHeight];
568
- return { data: i, encoding: n.encoding, rectangle: o.rectangle, heightRange: u, x: r, y: s, level: c };
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 Tn(t) {
572
- const { x: o, y: n, level: e } = t;
573
- return t.data.terrainData.upsample(t.tilingScheme, o, n, e, o, n, e);
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 Ht(t, o, n) {
576
- const { east: e, north: i, south: r, west: s } = o, c = _t[0];
577
- c.longitude = s, c.latitude = r;
578
- const u = t.positionToTileXY(c, n, Q[0]);
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 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];
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 kt = 32767;
584
- function vn(t, o = new l()) {
585
- return g.getScale(t.halfAxes, o), l.multiplyByScalar(o, 2 * kt, o), o;
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(t, o, n) {
588
- return n = t.getLocalCurvature(o, n), n.x = 1 / n.x, n.y = 1 / n.y, n;
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 An(t, o, n) {
591
- n = U(t, o, n);
590
+ function At(n, o, t) {
591
+ t = U(n, o, t);
592
592
  const e = Math.PI / 180;
593
- return x.multiplyByScalar(n, e, n);
593
+ return x.multiplyByScalar(t, e, t);
594
594
  }
595
- function Qt(t) {
596
- const { _quantizedVertices: o, _indices: n } = t, e = o.length / 3, i = {
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 Qt(t) {
601
601
  type: "Float32Array",
602
602
  start: e,
603
603
  vectorSize: 1
604
- }, s = {
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: s },
611
+ attributes: { u: i, v: r, height: a },
612
612
  count: e,
613
- indices: n
613
+ indices: t
614
614
  };
615
615
  }
616
- async function Pn(t, o, n, e) {
617
- const i = await t.requestTileGeometry(o, n, e);
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 = 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
- 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
- }
622
- async function Mn(t, o, n) {
623
- const { min: e, max: i } = Ht(t.tilingScheme, o, n), r = [], s = [];
624
- for (let u = e[0]; u <= i[0]; u++)
625
- for (let f = e[1]; f <= i[1]; f++) {
626
- const m = Et(t, u, f, n);
627
- m && (r.push(m), s.push({ x: u, y: f }));
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
+ }
622
+ async function Rt(n, o, t) {
623
+ const { min: e, max: i } = Qn(n.tilingScheme, o, t), r = [], a = [];
624
+ for (let f = e[0]; f <= i[0]; f++)
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(u, f) {
630
- const { x: m, y: p } = s[f];
631
- return { x: m, y: p, level: n, data: u };
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 Et(t, o, n, e) {
635
- return t.getTileDataAvailable(o, n, e) ? (await t.loadTileDataAvailability(o, n, e), t.requestTileGeometry(o, n, e)) : Promise.reject("不可用");
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 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 = et(t, n), c = it(s), u = E.eastNorthUpToFixedFrame(e);
639
- a.inverseTransformation(u, u);
640
- const f = o.map((d) => {
641
- const y = a.multiplyByPoint(u, d, k[2]);
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, ...R } = d, { position: V, uv: S, height: B } = y.attributes;
647
- m += await ut.computeRelationAreaOfPolygon2Terrain({
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
- ...R,
650
+ ...P,
651
651
  positionNames: ["position"],
652
- region: f,
652
+ region: l,
653
653
  // @ts-ignore
654
- matrix: a.pack(u, []),
654
+ matrix: s.pack(f, []),
655
655
  relation: z.Contain | z.Intersect,
656
656
  scale: r
657
657
  }],
@@ -660,115 +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) => l.pack(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 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 = et(t, n), c = it(s), u = E.eastNorthUpToFixedFrame(e);
670
- a.inverseTransformation(u, u);
671
- const f = o.map((p) => {
672
- const d = a.multiplyByPoint(u, p, k[2]);
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 += ft({
678
+ m += pn({
679
679
  ...d,
680
680
  ...y,
681
681
  positionNames: ["position"],
682
- region: f,
682
+ region: l,
683
683
  // @ts-ignore
684
- matrix: a.pack(u, []),
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) => l.pack(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 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
+ }
701
+ function m(p, d) {
702
+ return s.multiply(p, e, r), c(r, d);
703
+ }
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 };
715
+ }
696
716
  export {
697
- dt as CartesianAxis,
698
- yt as HeadingPitchRollComponent,
717
+ wn as CartesianAxis,
718
+ gn as HeadingPitchRollComponent,
699
719
  b as Xyz_Hpr,
700
- Kt as applyMatrixReferFrame,
701
- At as applyTransformInPrimitive,
702
- un as applyTransformInfoPrimitive,
703
- pt as componentDatatypeTypedArrayMap,
704
- yn as computeAttributeSizeInBytes,
705
- xt as computeNormalOfCoplanars,
706
- Sn as computeTerrainAreaOfPolygon,
707
- Rn as computeTerrainAreaOfPolygon_worker,
708
- dn as computeVertexNumOfAttribute,
709
- Xt as createPlaneOfCoplanars,
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,
710
730
  $ as flatTransformInfoOptions,
711
- wn as getAttributeData,
712
- cn as getBoundingSphere,
713
- gn as getDecodePositionsOfTerrainMesh,
714
- pn as getEntityInfo,
715
- Qt as getGeometryDataOfQuantizedMeshTerrainData,
716
- zt as getGeometryDataOfTerrainMesh,
717
- Gt as getLevelRangeOfQuadtreeTiles,
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,
718
738
  U as getLocalCurvatureRadius,
719
- An as getLocalSizePerDegrees,
720
- gt as getLocalTransformInfo,
721
- en as getMatrix4OfTransformInfo,
722
- Zt as getNeighborPairs,
723
- ln as getPosition,
724
- hn as getPositionOfTerrainMesh,
725
- et as getRenderedQuadtreeTilesOfIntersectRectangle,
726
- xn as getRenderedTileLevelRange,
727
- vn as getScaleOfTerrainDataByOrientedBoundingBox,
728
- Et as getTerrainData,
729
- Tn as getTerrainDataOfQuadtreeTile,
730
- Mn as getTerrainDatasOfIntersectRectangle,
731
- it as getTerrainDatasOfQuadtreeTiles,
732
- Ht as getTileRangeOfIntersectRectangle,
733
- Mt as getTransform,
734
- Pn as getWorldDataOfQuantizedMeshTerrainData,
735
- ht as getWorldMatrix,
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,
736
756
  L as getWorldTransformInfo,
737
757
  q as isMatrixPrimitive,
738
- mt as isPositionListPrimitive,
758
+ dn as isPositionListPrimitive,
739
759
  J as isPositionPrimitive,
740
- Lt as isPrimitiveObject,
741
- wt as localQuaternionToWorld,
742
- vt as localTRS_WorldMatrix4_Convert,
743
- sn as localTRS_WorldMatrix4_ENU_Convert,
760
+ Yn as isPrimitiveObject,
761
+ hn as localQuaternionToWorld,
762
+ Mn as localTRS_WorldMatrix4_Convert,
763
+ on as localTRS_WorldMatrix4_ENU_Convert,
744
764
  H as makeMatrixReferFrame,
745
- an as mat4_compose,
746
- Tt as mat4_composeByOrder,
747
- rn as mat4_decompose,
748
- nt as mat4_decomposeByOrder,
749
- tt as matrix4ToHeadingPitchRoll,
750
- Ut as quaternionToHeadingPitchRoll,
751
- Pt as resetTransformInPrimitive,
752
- fn as resetTransformInfoPrimitive,
753
- tn as rotateMatrixReferFrame,
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,
754
774
  G as rotationInfoToQuaternion,
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
- mn as transformEntity,
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
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
774
796
  };