@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/math/transform.d.ts +60 -1
- package/dist/math/transform.d.ts.map +1 -1
- package/dist/primitive/VertexArray.d.ts.map +1 -1
- package/dist/tools.iife.js +24 -24
- package/dist/tools.js +548 -537
- package/dist/tools.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/tools.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { WebGLConstants as R, Cartesian3 as
|
|
2
|
-
import { getMatrixOfQuantizedMeshTerrainData as
|
|
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
|
|
4
|
+
return k(t) || J(t) || lt(t);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function k(t) {
|
|
7
7
|
return "modelMatrix" in t;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function J(t) {
|
|
10
10
|
return "position" in t;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function lt(t) {
|
|
13
13
|
return "positions" in t;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
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
|
|
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
|
|
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 =
|
|
66
|
-
function
|
|
67
|
-
return new
|
|
65
|
+
t.toKey = o;
|
|
66
|
+
function n(i) {
|
|
67
|
+
return new l(i.roll, -i.pitch, -i.heading);
|
|
68
68
|
}
|
|
69
|
-
t.toCartesian3 =
|
|
70
|
-
function
|
|
71
|
-
return new
|
|
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 =
|
|
74
|
-
})(
|
|
75
|
-
var
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
return { ...t, worldTranslation:
|
|
79
|
-
}
|
|
80
|
-
function
|
|
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:
|
|
83
|
-
return w.fromAxisAngle(
|
|
82
|
+
const { axis: n, angle: e } = t;
|
|
83
|
+
return w.fromAxisAngle(n, e);
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
return w.fromHeadingPitchRoll(
|
|
85
|
+
const o = O.toHeadingPitchRoll(t);
|
|
86
|
+
return w.fromHeadingPitchRoll(o);
|
|
87
87
|
}
|
|
88
|
-
function qt(t,
|
|
89
|
-
const
|
|
90
|
-
return
|
|
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
|
|
93
|
-
const
|
|
94
|
-
return
|
|
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,
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
return a.multiply(
|
|
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,
|
|
102
|
-
let
|
|
103
|
-
if (
|
|
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
|
|
106
|
-
}
|
|
107
|
-
function
|
|
108
|
-
let
|
|
109
|
-
if (
|
|
110
|
-
const i = w.computeAngle(t), r = a.inverse(
|
|
111
|
-
return
|
|
112
|
-
}
|
|
113
|
-
function
|
|
114
|
-
let { translation:
|
|
115
|
-
const { referFrame: r, worldTranslation: s, worldRotation:
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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 &&
|
|
131
|
-
}
|
|
132
|
-
function
|
|
133
|
-
const
|
|
134
|
-
let { translation:
|
|
135
|
-
if (
|
|
136
|
-
if (
|
|
137
|
-
const
|
|
138
|
-
i = w.fromRotationMatrix(
|
|
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(
|
|
140
|
+
r || (r = a.getScale(n, new l()));
|
|
141
141
|
}
|
|
142
|
-
const s = new
|
|
142
|
+
const s = new P(e ?? void 0, i ?? void 0, r ?? void 0);
|
|
143
143
|
return a.fromTranslationRotationScale(s);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
const { translation:
|
|
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
|
|
150
|
-
const
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
return
|
|
156
|
-
}
|
|
157
|
-
function*
|
|
158
|
-
const i = t.length, r =
|
|
159
|
-
for (let
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
for (; s.call(
|
|
163
|
-
if (
|
|
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
|
-
|
|
165
|
+
m = t[f];
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
c = p, yield [u, m];
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
return a.multiply(
|
|
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
|
|
176
|
-
|
|
177
|
-
const i = a.inverse(
|
|
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(
|
|
179
|
+
return r = a.multiply(o, r, r), a.multiply(n, r, e);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
const
|
|
183
|
-
return
|
|
181
|
+
function Zt(t, o, n) {
|
|
182
|
+
const e = a.fromTranslation(t);
|
|
183
|
+
return H(e, o, n);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
const i = w.fromAxisAngle(t,
|
|
187
|
-
return
|
|
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
|
|
190
|
-
const
|
|
191
|
-
return
|
|
189
|
+
function $t(t, o, n) {
|
|
190
|
+
const e = a.fromScale(t);
|
|
191
|
+
return H(e, o, n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
193
|
+
function tn(t, o, n) {
|
|
194
|
+
const e = g.fromScale(o);
|
|
195
|
+
if (n)
|
|
196
196
|
for (const i of t)
|
|
197
|
-
|
|
197
|
+
l.subtract(i, n, i), g.multiplyByVector(e, i, i), l.add(i, n, i);
|
|
198
198
|
else {
|
|
199
|
-
const i = g.fromScale(
|
|
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
|
|
206
|
-
const { translation:
|
|
205
|
+
function nn(t, o) {
|
|
206
|
+
const { translation: n, rotation: e, scale: i } = t;
|
|
207
207
|
let r;
|
|
208
|
-
if (
|
|
209
|
-
const { axis:
|
|
210
|
-
r = w.fromAxisAngle(
|
|
208
|
+
if (e) {
|
|
209
|
+
const { axis: c, angle: u } = e;
|
|
210
|
+
r = w.fromAxisAngle(c, u);
|
|
211
211
|
}
|
|
212
|
-
const s = new
|
|
213
|
-
return a.fromTranslationRotationScale(s,
|
|
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
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
|
226
|
-
return
|
|
245
|
+
const e = t.positions;
|
|
246
|
+
return e?.length > 0 ? C.fromPoints(e) : null;
|
|
227
247
|
}
|
|
228
|
-
function
|
|
229
|
-
|
|
230
|
-
const
|
|
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
|
|
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
|
|
257
|
+
return i?.length > 0 ? C.fromPoints(i).center : null;
|
|
238
258
|
}
|
|
239
|
-
function
|
|
240
|
-
let { translation:
|
|
241
|
-
const s = new
|
|
242
|
-
return
|
|
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
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
247
|
-
return a.multiply(
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
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(
|
|
252
|
-
|
|
253
|
-
const s = t.scale ?? 1,
|
|
254
|
-
t.scale =
|
|
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(
|
|
257
|
-
return t.position =
|
|
276
|
+
a.multiplyByPoint(o, e, e);
|
|
277
|
+
return t.position = e, !0;
|
|
258
278
|
}
|
|
259
279
|
const i = t.positions;
|
|
260
|
-
if (
|
|
280
|
+
if (i?.length > 0) {
|
|
261
281
|
for (const r of i)
|
|
262
|
-
a.multiplyByPoint(
|
|
282
|
+
a.multiplyByPoint(o, r, r);
|
|
263
283
|
return t.positions = i, !0;
|
|
264
284
|
}
|
|
265
285
|
return !1;
|
|
266
286
|
}
|
|
267
|
-
function
|
|
268
|
-
const
|
|
269
|
-
return
|
|
270
|
-
}
|
|
271
|
-
function
|
|
272
|
-
if (
|
|
273
|
-
return t.modelMatrix =
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
276
|
-
if (t.position =
|
|
277
|
-
const i = a.getScale(
|
|
278
|
-
t.scale =
|
|
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
|
|
283
|
-
if (
|
|
284
|
-
const i =
|
|
285
|
-
|
|
286
|
-
for (const r of
|
|
287
|
-
|
|
288
|
-
return t.positions =
|
|
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
|
|
293
|
-
if (
|
|
312
|
+
function At(t) {
|
|
313
|
+
if (k(t))
|
|
294
314
|
return t.modelMatrix;
|
|
295
|
-
if (
|
|
296
|
-
const
|
|
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
|
|
300
|
-
if (
|
|
301
|
-
const
|
|
302
|
-
return a.fromTranslation(
|
|
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
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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 (
|
|
319
|
-
let A =
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
|
|
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:
|
|
328
|
-
let y = a.fromTranslationRotationScale(
|
|
329
|
-
if (y =
|
|
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 &&
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
|
|
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 &&
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
function
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const
|
|
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 =
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
function
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
const e = h.now(),
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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 =
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
function
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
f
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
const
|
|
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
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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 =
|
|
439
|
-
|
|
440
|
-
}
|
|
441
|
-
function
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
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 =
|
|
450
|
-
if (
|
|
451
|
-
for (const
|
|
452
|
-
|
|
453
|
-
t.shape =
|
|
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
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
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
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
|
|
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
|
|
470
|
-
|
|
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 =
|
|
474
|
-
let
|
|
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
|
|
477
|
-
|
|
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
|
|
480
|
-
let
|
|
481
|
-
return
|
|
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
|
|
490
|
+
function un(t) {
|
|
484
491
|
return t.values.length / t.componentsPerAttribute;
|
|
485
492
|
}
|
|
486
|
-
function
|
|
487
|
-
return
|
|
488
|
-
}
|
|
489
|
-
function
|
|
490
|
-
const { componentDatatype:
|
|
491
|
-
if (!
|
|
492
|
-
const i =
|
|
493
|
-
let
|
|
494
|
-
return
|
|
495
|
-
}
|
|
496
|
-
new
|
|
497
|
-
const
|
|
498
|
-
new
|
|
499
|
-
const
|
|
500
|
-
new
|
|
501
|
-
new
|
|
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
|
|
506
|
-
function
|
|
507
|
-
const { stride:
|
|
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(
|
|
510
|
-
return
|
|
516
|
+
t.encoding.decodePosition(e, s, r), l.pack(r, o, o.length);
|
|
517
|
+
return o;
|
|
511
518
|
}
|
|
512
|
-
function
|
|
513
|
-
return t.encoding.decodePosition(t.vertexArray,
|
|
519
|
+
function dn(t, o, n) {
|
|
520
|
+
return t.encoding.decodePosition(t.vertexArray, o, n);
|
|
514
521
|
}
|
|
515
|
-
function
|
|
516
|
-
const { stride:
|
|
517
|
-
for (let
|
|
518
|
-
i.decodePosition(
|
|
519
|
-
const
|
|
520
|
-
|
|
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:
|
|
525
|
-
uv: { array:
|
|
526
|
-
height: { array:
|
|
531
|
+
position: { array: c, vectorSize: 3 },
|
|
532
|
+
uv: { array: f, vectorSize: 2 },
|
|
533
|
+
height: { array: m, vectorSize: 1 }
|
|
527
534
|
},
|
|
528
|
-
indices:
|
|
535
|
+
indices: e.slice(),
|
|
529
536
|
count: r
|
|
530
537
|
};
|
|
531
538
|
}
|
|
532
|
-
function
|
|
533
|
-
const
|
|
534
|
-
for (const r of
|
|
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
|
-
|
|
543
|
+
v.intersection(o, s, i) && e.push(r);
|
|
537
544
|
}
|
|
538
|
-
return
|
|
545
|
+
return e;
|
|
539
546
|
}
|
|
540
|
-
function
|
|
541
|
-
const
|
|
542
|
-
return
|
|
547
|
+
function yn(t) {
|
|
548
|
+
const o = t._surface._tilesToRender;
|
|
549
|
+
return zt(o);
|
|
543
550
|
}
|
|
544
|
-
function
|
|
545
|
-
const
|
|
551
|
+
function zt(t) {
|
|
552
|
+
const o = /* @__PURE__ */ new Set();
|
|
546
553
|
for (const r of t)
|
|
547
|
-
|
|
548
|
-
const
|
|
549
|
-
return { min:
|
|
550
|
-
}
|
|
551
|
-
function
|
|
552
|
-
return t.map((
|
|
553
|
-
const { mesh:
|
|
554
|
-
return { data: i, encoding:
|
|
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
|
|
558
|
-
const { x:
|
|
559
|
-
return t.data.terrainData.upsample(t.tilingScheme, n, e, o, n, e
|
|
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
|
|
562
|
-
const { east:
|
|
563
|
-
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
const
|
|
567
|
-
return { min: [
|
|
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
|
|
570
|
-
function
|
|
571
|
-
return g.getScale(t.halfAxes,
|
|
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
|
|
574
|
-
return
|
|
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
|
|
577
|
-
|
|
578
|
-
const
|
|
579
|
-
return
|
|
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
|
|
582
|
-
const { _quantizedVertices:
|
|
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:
|
|
595
|
+
start: e,
|
|
589
596
|
vectorSize: 1
|
|
590
597
|
}, s = {
|
|
591
598
|
type: "Float32Array",
|
|
592
|
-
start:
|
|
599
|
+
start: e * 2,
|
|
593
600
|
vectorSize: 1
|
|
594
601
|
};
|
|
595
602
|
return {
|
|
596
|
-
array: new Float32Array(
|
|
603
|
+
array: new Float32Array(o),
|
|
597
604
|
attributes: { u: i, v: r, height: s },
|
|
598
|
-
count:
|
|
599
|
-
indices:
|
|
605
|
+
count: e,
|
|
606
|
+
indices: n
|
|
600
607
|
};
|
|
601
608
|
}
|
|
602
|
-
async function
|
|
603
|
-
const i = await t.requestTileGeometry(n, e
|
|
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 =
|
|
606
|
-
return
|
|
607
|
-
}
|
|
608
|
-
async function
|
|
609
|
-
const { min:
|
|
610
|
-
for (let
|
|
611
|
-
for (let
|
|
612
|
-
const
|
|
613
|
-
|
|
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(
|
|
616
|
-
const { x:
|
|
617
|
-
return { x:
|
|
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
|
|
621
|
-
return t.getTileDataAvailable(n, e
|
|
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
|
|
624
|
-
const
|
|
625
|
-
a.inverseTransformation(
|
|
626
|
-
const
|
|
627
|
-
const y = a.multiplyByPoint(
|
|
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
|
|
631
|
-
const
|
|
632
|
-
const { data: y, ...
|
|
633
|
-
|
|
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
|
-
...
|
|
643
|
+
...M,
|
|
637
644
|
positionNames: ["position"],
|
|
638
|
-
region:
|
|
645
|
+
region: f,
|
|
639
646
|
// @ts-ignore
|
|
640
|
-
matrix: a.pack(
|
|
641
|
-
relation:
|
|
647
|
+
matrix: a.pack(u, []),
|
|
648
|
+
relation: z.Contain | z.Intersect,
|
|
642
649
|
scale: r
|
|
643
650
|
}],
|
|
644
|
-
transfer: [
|
|
651
|
+
transfer: [V.array.buffer, S.array.buffer, I.array.buffer, y.indices.buffer]
|
|
645
652
|
});
|
|
646
653
|
});
|
|
647
|
-
if (await Promise.all(
|
|
648
|
-
console.warn("贴地面积计算异常,已回退到椭球面投影面积",
|
|
649
|
-
const
|
|
650
|
-
return
|
|
651
|
-
}
|
|
652
|
-
return
|
|
653
|
-
}
|
|
654
|
-
function
|
|
655
|
-
const
|
|
656
|
-
a.inverseTransformation(
|
|
657
|
-
const
|
|
658
|
-
const
|
|
659
|
-
return [
|
|
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
|
|
662
|
-
for (const
|
|
663
|
-
const { data:
|
|
664
|
-
|
|
665
|
-
...
|
|
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:
|
|
675
|
+
region: f,
|
|
669
676
|
// @ts-ignore
|
|
670
|
-
matrix: a.pack(
|
|
671
|
-
relation:
|
|
677
|
+
matrix: a.pack(u, []),
|
|
678
|
+
relation: z.Contain | z.Intersect,
|
|
672
679
|
scale: r
|
|
673
680
|
});
|
|
674
681
|
}
|
|
675
|
-
if (
|
|
676
|
-
console.warn("贴地面积计算异常,已回退到椭球面投影面积",
|
|
677
|
-
const
|
|
678
|
-
return
|
|
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
|
|
687
|
+
return m;
|
|
681
688
|
}
|
|
682
689
|
export {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
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
|
-
|
|
729
|
-
|
|
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
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
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
|
-
|
|
764
|
+
Ut as worldQuaternionToLocal
|
|
754
765
|
};
|