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