deeptwins-cesium-engine 0.0.3 → 0.0.4
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/Build/Workers/chunk-25U3LB43.js +139 -0
- package/Build/Workers/chunk-2GSMCVKA.js +837 -0
- package/Build/Workers/chunk-3G3JCTFQ.js +101 -0
- package/Build/Workers/chunk-3GRIO7U2.js +162 -0
- package/Build/Workers/chunk-3ZQ33WD3.js +455 -0
- package/Build/Workers/chunk-4U7LLSJ4.js +288 -0
- package/Build/Workers/chunk-4ZMC542T.js +55 -0
- package/Build/Workers/chunk-57TENMAK.js +37 -0
- package/Build/Workers/chunk-5JCUBAVN.js +387 -0
- package/Build/Workers/chunk-5MAQRQUK.js +102 -0
- package/Build/Workers/chunk-5XRGC6C7.js +299 -0
- package/Build/Workers/chunk-63UAUZT6.js +414 -0
- package/Build/Workers/chunk-6BUOGRYV.js +2058 -0
- package/Build/Workers/chunk-7D5ZXLGY.js +163 -0
- package/Build/Workers/chunk-7N66TCUJ.js +1800 -0
- package/Build/Workers/chunk-AG6ARNCB.js +682 -0
- package/Build/Workers/chunk-ARXSS5JC.js +788 -0
- package/Build/Workers/chunk-BDVACEHF.js +778 -0
- package/Build/Workers/chunk-BU67FVEG.js +97 -0
- package/Build/Workers/chunk-BYC4YR4M.js +352 -0
- package/Build/Workers/chunk-CH66JW7J.js +629 -0
- package/Build/Workers/chunk-CV2CR5WA.js +114 -0
- package/Build/Workers/chunk-DGMXFRAL.js +1443 -0
- package/Build/Workers/chunk-EDP33VH5.js +1054 -0
- package/Build/Workers/chunk-F7AOI3UD.js +73 -0
- package/Build/Workers/chunk-FKKSB7ZT.js +8366 -0
- package/Build/Workers/chunk-FTK6K2HA.js +1483 -0
- package/Build/Workers/chunk-IUPJ4QGV.js +476 -0
- package/Build/Workers/chunk-K7Z6W3PJ.js +368 -0
- package/Build/Workers/chunk-KBCQ5JGP.js +57 -0
- package/Build/Workers/chunk-KKTCNH5B.js +398 -0
- package/Build/Workers/chunk-LCSOUDEK.js +58 -0
- package/Build/Workers/chunk-LE5B7M4M.js +642 -0
- package/Build/Workers/chunk-LPPTJ7CE.js +511 -0
- package/Build/Workers/chunk-M3CFFEB7.js +280 -0
- package/Build/Workers/chunk-NN52QO5J.js +497 -0
- package/Build/Workers/chunk-NO3BDHBF.js +241 -0
- package/Build/Workers/chunk-O2H3UW6F.js +256 -0
- package/Build/Workers/chunk-OLJ7MBC7.js +439 -0
- package/Build/Workers/chunk-OZMVAGFQ.js +2719 -0
- package/Build/Workers/chunk-P3S5BWX6.js +219 -0
- package/Build/Workers/chunk-PLQPDE4E.js +171 -0
- package/Build/Workers/chunk-PYMMZCF6.js +3514 -0
- package/Build/Workers/chunk-QIK67M72.js +692 -0
- package/Build/Workers/chunk-RDQU66WA.js +124 -0
- package/Build/Workers/chunk-S6YC56IM.js +940 -0
- package/Build/Workers/chunk-S7CL5IXE.js +138 -0
- package/Build/Workers/chunk-SCVFHATG.js +1317 -0
- package/Build/Workers/chunk-V3IFABPY.js +44 -0
- package/Build/Workers/chunk-VKRSYA3C.js +1067 -0
- package/Build/Workers/chunk-VXIA6U3E.js +75 -0
- package/Build/Workers/chunk-WKTTAMO3.js +305 -0
- package/Build/Workers/chunk-WMMHNRGJ.js +198 -0
- package/Build/Workers/chunk-WY6ZUQRU.js +55 -0
- package/Build/Workers/chunk-X33W4QLH.js +958 -0
- package/Build/Workers/chunk-ZB5XJVWP.js +1460 -0
- package/Build/Workers/chunk-ZNQU6MNK.js +352 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/README.md +1 -1
- package/Source/Scene/DerivedCommand.js +1 -1
- package/Source/Scene/VoxelContent.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +9 -9
- package/package.json +7 -11
|
@@ -0,0 +1,1460 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.29
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2011-2022 Cesium Contributors
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*
|
|
20
|
+
* Columbus View (Pat. Pend.)
|
|
21
|
+
*
|
|
22
|
+
* Portions licensed separately.
|
|
23
|
+
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
Cartesian3_default
|
|
28
|
+
} from "./chunk-DGMXFRAL.js";
|
|
29
|
+
import {
|
|
30
|
+
Math_default
|
|
31
|
+
} from "./chunk-NN52QO5J.js";
|
|
32
|
+
import {
|
|
33
|
+
Check_default,
|
|
34
|
+
DeveloperError_default
|
|
35
|
+
} from "./chunk-7D5ZXLGY.js";
|
|
36
|
+
import {
|
|
37
|
+
defined_default
|
|
38
|
+
} from "./chunk-VXIA6U3E.js";
|
|
39
|
+
|
|
40
|
+
// packages/engine/Source/Core/scaleToGeodeticSurface.js
|
|
41
|
+
var scaleToGeodeticSurfaceIntersection = new Cartesian3_default();
|
|
42
|
+
var scaleToGeodeticSurfaceGradient = new Cartesian3_default();
|
|
43
|
+
function scaleToGeodeticSurface(cartesian, oneOverRadii, oneOverRadiiSquared, centerToleranceSquared, result) {
|
|
44
|
+
if (!defined_default(cartesian)) {
|
|
45
|
+
throw new DeveloperError_default("cartesian is required.");
|
|
46
|
+
}
|
|
47
|
+
if (!defined_default(oneOverRadii)) {
|
|
48
|
+
throw new DeveloperError_default("oneOverRadii is required.");
|
|
49
|
+
}
|
|
50
|
+
if (!defined_default(oneOverRadiiSquared)) {
|
|
51
|
+
throw new DeveloperError_default("oneOverRadiiSquared is required.");
|
|
52
|
+
}
|
|
53
|
+
if (!defined_default(centerToleranceSquared)) {
|
|
54
|
+
throw new DeveloperError_default("centerToleranceSquared is required.");
|
|
55
|
+
}
|
|
56
|
+
const positionX = cartesian.x;
|
|
57
|
+
const positionY = cartesian.y;
|
|
58
|
+
const positionZ = cartesian.z;
|
|
59
|
+
const oneOverRadiiX = oneOverRadii.x;
|
|
60
|
+
const oneOverRadiiY = oneOverRadii.y;
|
|
61
|
+
const oneOverRadiiZ = oneOverRadii.z;
|
|
62
|
+
const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
|
|
63
|
+
const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
|
|
64
|
+
const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
|
|
65
|
+
const squaredNorm = x2 + y2 + z2;
|
|
66
|
+
const ratio = Math.sqrt(1 / squaredNorm);
|
|
67
|
+
const intersection = Cartesian3_default.multiplyByScalar(
|
|
68
|
+
cartesian,
|
|
69
|
+
ratio,
|
|
70
|
+
scaleToGeodeticSurfaceIntersection
|
|
71
|
+
);
|
|
72
|
+
if (squaredNorm < centerToleranceSquared) {
|
|
73
|
+
return !isFinite(ratio) ? void 0 : Cartesian3_default.clone(intersection, result);
|
|
74
|
+
}
|
|
75
|
+
const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
|
|
76
|
+
const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
|
|
77
|
+
const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
|
|
78
|
+
const gradient = scaleToGeodeticSurfaceGradient;
|
|
79
|
+
gradient.x = intersection.x * oneOverRadiiSquaredX * 2;
|
|
80
|
+
gradient.y = intersection.y * oneOverRadiiSquaredY * 2;
|
|
81
|
+
gradient.z = intersection.z * oneOverRadiiSquaredZ * 2;
|
|
82
|
+
let lambda = (1 - ratio) * Cartesian3_default.magnitude(cartesian) / (0.5 * Cartesian3_default.magnitude(gradient));
|
|
83
|
+
let correction = 0;
|
|
84
|
+
let func;
|
|
85
|
+
let denominator;
|
|
86
|
+
let xMultiplier;
|
|
87
|
+
let yMultiplier;
|
|
88
|
+
let zMultiplier;
|
|
89
|
+
let xMultiplier2;
|
|
90
|
+
let yMultiplier2;
|
|
91
|
+
let zMultiplier2;
|
|
92
|
+
let xMultiplier3;
|
|
93
|
+
let yMultiplier3;
|
|
94
|
+
let zMultiplier3;
|
|
95
|
+
do {
|
|
96
|
+
lambda -= correction;
|
|
97
|
+
xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
|
|
98
|
+
yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
|
|
99
|
+
zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
|
|
100
|
+
xMultiplier2 = xMultiplier * xMultiplier;
|
|
101
|
+
yMultiplier2 = yMultiplier * yMultiplier;
|
|
102
|
+
zMultiplier2 = zMultiplier * zMultiplier;
|
|
103
|
+
xMultiplier3 = xMultiplier2 * xMultiplier;
|
|
104
|
+
yMultiplier3 = yMultiplier2 * yMultiplier;
|
|
105
|
+
zMultiplier3 = zMultiplier2 * zMultiplier;
|
|
106
|
+
func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
|
|
107
|
+
denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
|
|
108
|
+
const derivative = -2 * denominator;
|
|
109
|
+
correction = func / derivative;
|
|
110
|
+
} while (Math.abs(func) > Math_default.EPSILON12);
|
|
111
|
+
if (!defined_default(result)) {
|
|
112
|
+
return new Cartesian3_default(
|
|
113
|
+
positionX * xMultiplier,
|
|
114
|
+
positionY * yMultiplier,
|
|
115
|
+
positionZ * zMultiplier
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
result.x = positionX * xMultiplier;
|
|
119
|
+
result.y = positionY * yMultiplier;
|
|
120
|
+
result.z = positionZ * zMultiplier;
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
var scaleToGeodeticSurface_default = scaleToGeodeticSurface;
|
|
124
|
+
|
|
125
|
+
// packages/engine/Source/Core/Cartographic.js
|
|
126
|
+
function Cartographic(longitude, latitude, height) {
|
|
127
|
+
this.longitude = longitude ?? 0;
|
|
128
|
+
this.latitude = latitude ?? 0;
|
|
129
|
+
this.height = height ?? 0;
|
|
130
|
+
}
|
|
131
|
+
Cartographic.fromRadians = function(longitude, latitude, height, result) {
|
|
132
|
+
Check_default.typeOf.number("longitude", longitude);
|
|
133
|
+
Check_default.typeOf.number("latitude", latitude);
|
|
134
|
+
height = height ?? 0;
|
|
135
|
+
if (!defined_default(result)) {
|
|
136
|
+
return new Cartographic(longitude, latitude, height);
|
|
137
|
+
}
|
|
138
|
+
result.longitude = longitude;
|
|
139
|
+
result.latitude = latitude;
|
|
140
|
+
result.height = height;
|
|
141
|
+
return result;
|
|
142
|
+
};
|
|
143
|
+
Cartographic.fromDegrees = function(longitude, latitude, height, result) {
|
|
144
|
+
Check_default.typeOf.number("longitude", longitude);
|
|
145
|
+
Check_default.typeOf.number("latitude", latitude);
|
|
146
|
+
longitude = Math_default.toRadians(longitude);
|
|
147
|
+
latitude = Math_default.toRadians(latitude);
|
|
148
|
+
return Cartographic.fromRadians(longitude, latitude, height, result);
|
|
149
|
+
};
|
|
150
|
+
var cartesianToCartographicN = new Cartesian3_default();
|
|
151
|
+
var cartesianToCartographicP = new Cartesian3_default();
|
|
152
|
+
var cartesianToCartographicH = new Cartesian3_default();
|
|
153
|
+
Cartographic._ellipsoidOneOverRadii = new Cartesian3_default(
|
|
154
|
+
1 / 6378137,
|
|
155
|
+
1 / 6378137,
|
|
156
|
+
1 / 6356752314245179e-9
|
|
157
|
+
);
|
|
158
|
+
Cartographic._ellipsoidOneOverRadiiSquared = new Cartesian3_default(
|
|
159
|
+
1 / (6378137 * 6378137),
|
|
160
|
+
1 / (6378137 * 6378137),
|
|
161
|
+
1 / (6356752314245179e-9 * 6356752314245179e-9)
|
|
162
|
+
);
|
|
163
|
+
Cartographic._ellipsoidCenterToleranceSquared = Math_default.EPSILON1;
|
|
164
|
+
Cartographic.fromCartesian = function(cartesian, ellipsoid, result) {
|
|
165
|
+
const oneOverRadii = defined_default(ellipsoid) ? ellipsoid.oneOverRadii : Cartographic._ellipsoidOneOverRadii;
|
|
166
|
+
const oneOverRadiiSquared = defined_default(ellipsoid) ? ellipsoid.oneOverRadiiSquared : Cartographic._ellipsoidOneOverRadiiSquared;
|
|
167
|
+
const centerToleranceSquared = defined_default(ellipsoid) ? ellipsoid._centerToleranceSquared : Cartographic._ellipsoidCenterToleranceSquared;
|
|
168
|
+
const p = scaleToGeodeticSurface_default(
|
|
169
|
+
cartesian,
|
|
170
|
+
oneOverRadii,
|
|
171
|
+
oneOverRadiiSquared,
|
|
172
|
+
centerToleranceSquared,
|
|
173
|
+
cartesianToCartographicP
|
|
174
|
+
);
|
|
175
|
+
if (!defined_default(p)) {
|
|
176
|
+
return void 0;
|
|
177
|
+
}
|
|
178
|
+
let n = Cartesian3_default.multiplyComponents(
|
|
179
|
+
p,
|
|
180
|
+
oneOverRadiiSquared,
|
|
181
|
+
cartesianToCartographicN
|
|
182
|
+
);
|
|
183
|
+
n = Cartesian3_default.normalize(n, n);
|
|
184
|
+
const h = Cartesian3_default.subtract(cartesian, p, cartesianToCartographicH);
|
|
185
|
+
const longitude = Math.atan2(n.y, n.x);
|
|
186
|
+
const latitude = Math.asin(n.z);
|
|
187
|
+
const height = Math_default.sign(Cartesian3_default.dot(h, cartesian)) * Cartesian3_default.magnitude(h);
|
|
188
|
+
if (!defined_default(result)) {
|
|
189
|
+
return new Cartographic(longitude, latitude, height);
|
|
190
|
+
}
|
|
191
|
+
result.longitude = longitude;
|
|
192
|
+
result.latitude = latitude;
|
|
193
|
+
result.height = height;
|
|
194
|
+
return result;
|
|
195
|
+
};
|
|
196
|
+
Cartographic.toCartesian = function(cartographic, ellipsoid, result) {
|
|
197
|
+
Check_default.defined("cartographic", cartographic);
|
|
198
|
+
return Cartesian3_default.fromRadians(
|
|
199
|
+
cartographic.longitude,
|
|
200
|
+
cartographic.latitude,
|
|
201
|
+
cartographic.height,
|
|
202
|
+
ellipsoid,
|
|
203
|
+
result
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
Cartographic.clone = function(cartographic, result) {
|
|
207
|
+
if (!defined_default(cartographic)) {
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
210
|
+
if (!defined_default(result)) {
|
|
211
|
+
return new Cartographic(
|
|
212
|
+
cartographic.longitude,
|
|
213
|
+
cartographic.latitude,
|
|
214
|
+
cartographic.height
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
result.longitude = cartographic.longitude;
|
|
218
|
+
result.latitude = cartographic.latitude;
|
|
219
|
+
result.height = cartographic.height;
|
|
220
|
+
return result;
|
|
221
|
+
};
|
|
222
|
+
Cartographic.equals = function(left, right) {
|
|
223
|
+
return left === right || defined_default(left) && defined_default(right) && left.longitude === right.longitude && left.latitude === right.latitude && left.height === right.height;
|
|
224
|
+
};
|
|
225
|
+
Cartographic.equalsEpsilon = function(left, right, epsilon) {
|
|
226
|
+
epsilon = epsilon ?? 0;
|
|
227
|
+
return left === right || defined_default(left) && defined_default(right) && Math.abs(left.longitude - right.longitude) <= epsilon && Math.abs(left.latitude - right.latitude) <= epsilon && Math.abs(left.height - right.height) <= epsilon;
|
|
228
|
+
};
|
|
229
|
+
Cartographic.ZERO = Object.freeze(new Cartographic(0, 0, 0));
|
|
230
|
+
Cartographic.prototype.clone = function(result) {
|
|
231
|
+
return Cartographic.clone(this, result);
|
|
232
|
+
};
|
|
233
|
+
Cartographic.prototype.equals = function(right) {
|
|
234
|
+
return Cartographic.equals(this, right);
|
|
235
|
+
};
|
|
236
|
+
Cartographic.prototype.equalsEpsilon = function(right, epsilon) {
|
|
237
|
+
return Cartographic.equalsEpsilon(this, right, epsilon);
|
|
238
|
+
};
|
|
239
|
+
Cartographic.prototype.toString = function() {
|
|
240
|
+
return `(${this.longitude}, ${this.latitude}, ${this.height})`;
|
|
241
|
+
};
|
|
242
|
+
var Cartographic_default = Cartographic;
|
|
243
|
+
|
|
244
|
+
// packages/engine/Source/Core/Cartesian2.js
|
|
245
|
+
function Cartesian2(x, y) {
|
|
246
|
+
this.x = x ?? 0;
|
|
247
|
+
this.y = y ?? 0;
|
|
248
|
+
}
|
|
249
|
+
Cartesian2.fromElements = function(x, y, result) {
|
|
250
|
+
if (!defined_default(result)) {
|
|
251
|
+
return new Cartesian2(x, y);
|
|
252
|
+
}
|
|
253
|
+
result.x = x;
|
|
254
|
+
result.y = y;
|
|
255
|
+
return result;
|
|
256
|
+
};
|
|
257
|
+
Cartesian2.clone = function(cartesian, result) {
|
|
258
|
+
if (!defined_default(cartesian)) {
|
|
259
|
+
return void 0;
|
|
260
|
+
}
|
|
261
|
+
if (!defined_default(result)) {
|
|
262
|
+
return new Cartesian2(cartesian.x, cartesian.y);
|
|
263
|
+
}
|
|
264
|
+
result.x = cartesian.x;
|
|
265
|
+
result.y = cartesian.y;
|
|
266
|
+
return result;
|
|
267
|
+
};
|
|
268
|
+
Cartesian2.fromCartesian3 = Cartesian2.clone;
|
|
269
|
+
Cartesian2.fromCartesian4 = Cartesian2.clone;
|
|
270
|
+
Cartesian2.packedLength = 2;
|
|
271
|
+
Cartesian2.pack = function(value, array, startingIndex) {
|
|
272
|
+
Check_default.typeOf.object("value", value);
|
|
273
|
+
Check_default.defined("array", array);
|
|
274
|
+
startingIndex = startingIndex ?? 0;
|
|
275
|
+
array[startingIndex++] = value.x;
|
|
276
|
+
array[startingIndex] = value.y;
|
|
277
|
+
return array;
|
|
278
|
+
};
|
|
279
|
+
Cartesian2.unpack = function(array, startingIndex, result) {
|
|
280
|
+
Check_default.defined("array", array);
|
|
281
|
+
startingIndex = startingIndex ?? 0;
|
|
282
|
+
if (!defined_default(result)) {
|
|
283
|
+
result = new Cartesian2();
|
|
284
|
+
}
|
|
285
|
+
result.x = array[startingIndex++];
|
|
286
|
+
result.y = array[startingIndex];
|
|
287
|
+
return result;
|
|
288
|
+
};
|
|
289
|
+
Cartesian2.packArray = function(array, result) {
|
|
290
|
+
Check_default.defined("array", array);
|
|
291
|
+
const length = array.length;
|
|
292
|
+
const resultLength = length * 2;
|
|
293
|
+
if (!defined_default(result)) {
|
|
294
|
+
result = new Array(resultLength);
|
|
295
|
+
} else if (!Array.isArray(result) && result.length !== resultLength) {
|
|
296
|
+
throw new DeveloperError_default(
|
|
297
|
+
"If result is a typed array, it must have exactly array.length * 2 elements"
|
|
298
|
+
);
|
|
299
|
+
} else if (result.length !== resultLength) {
|
|
300
|
+
result.length = resultLength;
|
|
301
|
+
}
|
|
302
|
+
for (let i = 0; i < length; ++i) {
|
|
303
|
+
Cartesian2.pack(array[i], result, i * 2);
|
|
304
|
+
}
|
|
305
|
+
return result;
|
|
306
|
+
};
|
|
307
|
+
Cartesian2.unpackArray = function(array, result) {
|
|
308
|
+
Check_default.defined("array", array);
|
|
309
|
+
Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 2);
|
|
310
|
+
if (array.length % 2 !== 0) {
|
|
311
|
+
throw new DeveloperError_default("array length must be a multiple of 2.");
|
|
312
|
+
}
|
|
313
|
+
const length = array.length;
|
|
314
|
+
if (!defined_default(result)) {
|
|
315
|
+
result = new Array(length / 2);
|
|
316
|
+
} else {
|
|
317
|
+
result.length = length / 2;
|
|
318
|
+
}
|
|
319
|
+
for (let i = 0; i < length; i += 2) {
|
|
320
|
+
const index = i / 2;
|
|
321
|
+
result[index] = Cartesian2.unpack(array, i, result[index]);
|
|
322
|
+
}
|
|
323
|
+
return result;
|
|
324
|
+
};
|
|
325
|
+
Cartesian2.fromArray = Cartesian2.unpack;
|
|
326
|
+
Cartesian2.maximumComponent = function(cartesian) {
|
|
327
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
328
|
+
return Math.max(cartesian.x, cartesian.y);
|
|
329
|
+
};
|
|
330
|
+
Cartesian2.minimumComponent = function(cartesian) {
|
|
331
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
332
|
+
return Math.min(cartesian.x, cartesian.y);
|
|
333
|
+
};
|
|
334
|
+
Cartesian2.minimumByComponent = function(first, second, result) {
|
|
335
|
+
Check_default.typeOf.object("first", first);
|
|
336
|
+
Check_default.typeOf.object("second", second);
|
|
337
|
+
Check_default.typeOf.object("result", result);
|
|
338
|
+
result.x = Math.min(first.x, second.x);
|
|
339
|
+
result.y = Math.min(first.y, second.y);
|
|
340
|
+
return result;
|
|
341
|
+
};
|
|
342
|
+
Cartesian2.maximumByComponent = function(first, second, result) {
|
|
343
|
+
Check_default.typeOf.object("first", first);
|
|
344
|
+
Check_default.typeOf.object("second", second);
|
|
345
|
+
Check_default.typeOf.object("result", result);
|
|
346
|
+
result.x = Math.max(first.x, second.x);
|
|
347
|
+
result.y = Math.max(first.y, second.y);
|
|
348
|
+
return result;
|
|
349
|
+
};
|
|
350
|
+
Cartesian2.clamp = function(value, min, max, result) {
|
|
351
|
+
Check_default.typeOf.object("value", value);
|
|
352
|
+
Check_default.typeOf.object("min", min);
|
|
353
|
+
Check_default.typeOf.object("max", max);
|
|
354
|
+
Check_default.typeOf.object("result", result);
|
|
355
|
+
const x = Math_default.clamp(value.x, min.x, max.x);
|
|
356
|
+
const y = Math_default.clamp(value.y, min.y, max.y);
|
|
357
|
+
result.x = x;
|
|
358
|
+
result.y = y;
|
|
359
|
+
return result;
|
|
360
|
+
};
|
|
361
|
+
Cartesian2.magnitudeSquared = function(cartesian) {
|
|
362
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
363
|
+
return cartesian.x * cartesian.x + cartesian.y * cartesian.y;
|
|
364
|
+
};
|
|
365
|
+
Cartesian2.magnitude = function(cartesian) {
|
|
366
|
+
return Math.sqrt(Cartesian2.magnitudeSquared(cartesian));
|
|
367
|
+
};
|
|
368
|
+
var distanceScratch = new Cartesian2();
|
|
369
|
+
Cartesian2.distance = function(left, right) {
|
|
370
|
+
Check_default.typeOf.object("left", left);
|
|
371
|
+
Check_default.typeOf.object("right", right);
|
|
372
|
+
Cartesian2.subtract(left, right, distanceScratch);
|
|
373
|
+
return Cartesian2.magnitude(distanceScratch);
|
|
374
|
+
};
|
|
375
|
+
Cartesian2.distanceSquared = function(left, right) {
|
|
376
|
+
Check_default.typeOf.object("left", left);
|
|
377
|
+
Check_default.typeOf.object("right", right);
|
|
378
|
+
Cartesian2.subtract(left, right, distanceScratch);
|
|
379
|
+
return Cartesian2.magnitudeSquared(distanceScratch);
|
|
380
|
+
};
|
|
381
|
+
Cartesian2.normalize = function(cartesian, result) {
|
|
382
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
383
|
+
Check_default.typeOf.object("result", result);
|
|
384
|
+
const magnitude = Cartesian2.magnitude(cartesian);
|
|
385
|
+
result.x = cartesian.x / magnitude;
|
|
386
|
+
result.y = cartesian.y / magnitude;
|
|
387
|
+
if (isNaN(result.x) || isNaN(result.y)) {
|
|
388
|
+
throw new DeveloperError_default("normalized result is not a number");
|
|
389
|
+
}
|
|
390
|
+
return result;
|
|
391
|
+
};
|
|
392
|
+
Cartesian2.dot = function(left, right) {
|
|
393
|
+
Check_default.typeOf.object("left", left);
|
|
394
|
+
Check_default.typeOf.object("right", right);
|
|
395
|
+
return left.x * right.x + left.y * right.y;
|
|
396
|
+
};
|
|
397
|
+
Cartesian2.cross = function(left, right) {
|
|
398
|
+
Check_default.typeOf.object("left", left);
|
|
399
|
+
Check_default.typeOf.object("right", right);
|
|
400
|
+
return left.x * right.y - left.y * right.x;
|
|
401
|
+
};
|
|
402
|
+
Cartesian2.multiplyComponents = function(left, right, result) {
|
|
403
|
+
Check_default.typeOf.object("left", left);
|
|
404
|
+
Check_default.typeOf.object("right", right);
|
|
405
|
+
Check_default.typeOf.object("result", result);
|
|
406
|
+
result.x = left.x * right.x;
|
|
407
|
+
result.y = left.y * right.y;
|
|
408
|
+
return result;
|
|
409
|
+
};
|
|
410
|
+
Cartesian2.divideComponents = function(left, right, result) {
|
|
411
|
+
Check_default.typeOf.object("left", left);
|
|
412
|
+
Check_default.typeOf.object("right", right);
|
|
413
|
+
Check_default.typeOf.object("result", result);
|
|
414
|
+
result.x = left.x / right.x;
|
|
415
|
+
result.y = left.y / right.y;
|
|
416
|
+
return result;
|
|
417
|
+
};
|
|
418
|
+
Cartesian2.add = function(left, right, result) {
|
|
419
|
+
Check_default.typeOf.object("left", left);
|
|
420
|
+
Check_default.typeOf.object("right", right);
|
|
421
|
+
Check_default.typeOf.object("result", result);
|
|
422
|
+
result.x = left.x + right.x;
|
|
423
|
+
result.y = left.y + right.y;
|
|
424
|
+
return result;
|
|
425
|
+
};
|
|
426
|
+
Cartesian2.subtract = function(left, right, result) {
|
|
427
|
+
Check_default.typeOf.object("left", left);
|
|
428
|
+
Check_default.typeOf.object("right", right);
|
|
429
|
+
Check_default.typeOf.object("result", result);
|
|
430
|
+
result.x = left.x - right.x;
|
|
431
|
+
result.y = left.y - right.y;
|
|
432
|
+
return result;
|
|
433
|
+
};
|
|
434
|
+
Cartesian2.multiplyByScalar = function(cartesian, scalar, result) {
|
|
435
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
436
|
+
Check_default.typeOf.number("scalar", scalar);
|
|
437
|
+
Check_default.typeOf.object("result", result);
|
|
438
|
+
result.x = cartesian.x * scalar;
|
|
439
|
+
result.y = cartesian.y * scalar;
|
|
440
|
+
return result;
|
|
441
|
+
};
|
|
442
|
+
Cartesian2.divideByScalar = function(cartesian, scalar, result) {
|
|
443
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
444
|
+
Check_default.typeOf.number("scalar", scalar);
|
|
445
|
+
Check_default.typeOf.object("result", result);
|
|
446
|
+
result.x = cartesian.x / scalar;
|
|
447
|
+
result.y = cartesian.y / scalar;
|
|
448
|
+
return result;
|
|
449
|
+
};
|
|
450
|
+
Cartesian2.negate = function(cartesian, result) {
|
|
451
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
452
|
+
Check_default.typeOf.object("result", result);
|
|
453
|
+
result.x = -cartesian.x;
|
|
454
|
+
result.y = -cartesian.y;
|
|
455
|
+
return result;
|
|
456
|
+
};
|
|
457
|
+
Cartesian2.abs = function(cartesian, result) {
|
|
458
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
459
|
+
Check_default.typeOf.object("result", result);
|
|
460
|
+
result.x = Math.abs(cartesian.x);
|
|
461
|
+
result.y = Math.abs(cartesian.y);
|
|
462
|
+
return result;
|
|
463
|
+
};
|
|
464
|
+
var lerpScratch = new Cartesian2();
|
|
465
|
+
Cartesian2.lerp = function(start, end, t, result) {
|
|
466
|
+
Check_default.typeOf.object("start", start);
|
|
467
|
+
Check_default.typeOf.object("end", end);
|
|
468
|
+
Check_default.typeOf.number("t", t);
|
|
469
|
+
Check_default.typeOf.object("result", result);
|
|
470
|
+
Cartesian2.multiplyByScalar(end, t, lerpScratch);
|
|
471
|
+
result = Cartesian2.multiplyByScalar(start, 1 - t, result);
|
|
472
|
+
return Cartesian2.add(lerpScratch, result, result);
|
|
473
|
+
};
|
|
474
|
+
var angleBetweenScratch = new Cartesian2();
|
|
475
|
+
var angleBetweenScratch2 = new Cartesian2();
|
|
476
|
+
Cartesian2.angleBetween = function(left, right) {
|
|
477
|
+
Check_default.typeOf.object("left", left);
|
|
478
|
+
Check_default.typeOf.object("right", right);
|
|
479
|
+
Cartesian2.normalize(left, angleBetweenScratch);
|
|
480
|
+
Cartesian2.normalize(right, angleBetweenScratch2);
|
|
481
|
+
return Math_default.acosClamped(
|
|
482
|
+
Cartesian2.dot(angleBetweenScratch, angleBetweenScratch2)
|
|
483
|
+
);
|
|
484
|
+
};
|
|
485
|
+
var mostOrthogonalAxisScratch = new Cartesian2();
|
|
486
|
+
Cartesian2.mostOrthogonalAxis = function(cartesian, result) {
|
|
487
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
488
|
+
Check_default.typeOf.object("result", result);
|
|
489
|
+
const f = Cartesian2.normalize(cartesian, mostOrthogonalAxisScratch);
|
|
490
|
+
Cartesian2.abs(f, f);
|
|
491
|
+
if (f.x <= f.y) {
|
|
492
|
+
result = Cartesian2.clone(Cartesian2.UNIT_X, result);
|
|
493
|
+
} else {
|
|
494
|
+
result = Cartesian2.clone(Cartesian2.UNIT_Y, result);
|
|
495
|
+
}
|
|
496
|
+
return result;
|
|
497
|
+
};
|
|
498
|
+
Cartesian2.equals = function(left, right) {
|
|
499
|
+
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y;
|
|
500
|
+
};
|
|
501
|
+
Cartesian2.equalsArray = function(cartesian, array, offset) {
|
|
502
|
+
return cartesian.x === array[offset] && cartesian.y === array[offset + 1];
|
|
503
|
+
};
|
|
504
|
+
Cartesian2.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
|
|
505
|
+
return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
|
|
506
|
+
left.x,
|
|
507
|
+
right.x,
|
|
508
|
+
relativeEpsilon,
|
|
509
|
+
absoluteEpsilon
|
|
510
|
+
) && Math_default.equalsEpsilon(
|
|
511
|
+
left.y,
|
|
512
|
+
right.y,
|
|
513
|
+
relativeEpsilon,
|
|
514
|
+
absoluteEpsilon
|
|
515
|
+
);
|
|
516
|
+
};
|
|
517
|
+
Cartesian2.ZERO = Object.freeze(new Cartesian2(0, 0));
|
|
518
|
+
Cartesian2.ONE = Object.freeze(new Cartesian2(1, 1));
|
|
519
|
+
Cartesian2.UNIT_X = Object.freeze(new Cartesian2(1, 0));
|
|
520
|
+
Cartesian2.UNIT_Y = Object.freeze(new Cartesian2(0, 1));
|
|
521
|
+
Cartesian2.prototype.clone = function(result) {
|
|
522
|
+
return Cartesian2.clone(this, result);
|
|
523
|
+
};
|
|
524
|
+
Cartesian2.prototype.equals = function(right) {
|
|
525
|
+
return Cartesian2.equals(this, right);
|
|
526
|
+
};
|
|
527
|
+
Cartesian2.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
|
|
528
|
+
return Cartesian2.equalsEpsilon(
|
|
529
|
+
this,
|
|
530
|
+
right,
|
|
531
|
+
relativeEpsilon,
|
|
532
|
+
absoluteEpsilon
|
|
533
|
+
);
|
|
534
|
+
};
|
|
535
|
+
Cartesian2.prototype.toString = function() {
|
|
536
|
+
return `(${this.x}, ${this.y})`;
|
|
537
|
+
};
|
|
538
|
+
var Cartesian2_default = Cartesian2;
|
|
539
|
+
|
|
540
|
+
// packages/engine/Source/Core/Ellipsoid.js
|
|
541
|
+
function initialize(ellipsoid, x, y, z) {
|
|
542
|
+
x = x ?? 0;
|
|
543
|
+
y = y ?? 0;
|
|
544
|
+
z = z ?? 0;
|
|
545
|
+
Check_default.typeOf.number.greaterThanOrEquals("x", x, 0);
|
|
546
|
+
Check_default.typeOf.number.greaterThanOrEquals("y", y, 0);
|
|
547
|
+
Check_default.typeOf.number.greaterThanOrEquals("z", z, 0);
|
|
548
|
+
ellipsoid._radii = new Cartesian3_default(x, y, z);
|
|
549
|
+
ellipsoid._radiiSquared = new Cartesian3_default(x * x, y * y, z * z);
|
|
550
|
+
ellipsoid._radiiToTheFourth = new Cartesian3_default(
|
|
551
|
+
x * x * x * x,
|
|
552
|
+
y * y * y * y,
|
|
553
|
+
z * z * z * z
|
|
554
|
+
);
|
|
555
|
+
ellipsoid._oneOverRadii = new Cartesian3_default(
|
|
556
|
+
x === 0 ? 0 : 1 / x,
|
|
557
|
+
y === 0 ? 0 : 1 / y,
|
|
558
|
+
z === 0 ? 0 : 1 / z
|
|
559
|
+
);
|
|
560
|
+
ellipsoid._oneOverRadiiSquared = new Cartesian3_default(
|
|
561
|
+
x === 0 ? 0 : 1 / (x * x),
|
|
562
|
+
y === 0 ? 0 : 1 / (y * y),
|
|
563
|
+
z === 0 ? 0 : 1 / (z * z)
|
|
564
|
+
);
|
|
565
|
+
ellipsoid._minimumRadius = Math.min(x, y, z);
|
|
566
|
+
ellipsoid._maximumRadius = Math.max(x, y, z);
|
|
567
|
+
ellipsoid._centerToleranceSquared = Math_default.EPSILON1;
|
|
568
|
+
if (ellipsoid._radiiSquared.z !== 0) {
|
|
569
|
+
ellipsoid._squaredXOverSquaredZ = ellipsoid._radiiSquared.x / ellipsoid._radiiSquared.z;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
function Ellipsoid(x, y, z) {
|
|
573
|
+
this._radii = void 0;
|
|
574
|
+
this._radiiSquared = void 0;
|
|
575
|
+
this._radiiToTheFourth = void 0;
|
|
576
|
+
this._oneOverRadii = void 0;
|
|
577
|
+
this._oneOverRadiiSquared = void 0;
|
|
578
|
+
this._minimumRadius = void 0;
|
|
579
|
+
this._maximumRadius = void 0;
|
|
580
|
+
this._centerToleranceSquared = void 0;
|
|
581
|
+
this._squaredXOverSquaredZ = void 0;
|
|
582
|
+
initialize(this, x, y, z);
|
|
583
|
+
}
|
|
584
|
+
Object.defineProperties(Ellipsoid.prototype, {
|
|
585
|
+
/**
|
|
586
|
+
* Gets the radii of the ellipsoid.
|
|
587
|
+
* @memberof Ellipsoid.prototype
|
|
588
|
+
* @type {Cartesian3}
|
|
589
|
+
* @readonly
|
|
590
|
+
*/
|
|
591
|
+
radii: {
|
|
592
|
+
get: function() {
|
|
593
|
+
return this._radii;
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
/**
|
|
597
|
+
* Gets the squared radii of the ellipsoid.
|
|
598
|
+
* @memberof Ellipsoid.prototype
|
|
599
|
+
* @type {Cartesian3}
|
|
600
|
+
* @readonly
|
|
601
|
+
*/
|
|
602
|
+
radiiSquared: {
|
|
603
|
+
get: function() {
|
|
604
|
+
return this._radiiSquared;
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
/**
|
|
608
|
+
* Gets the radii of the ellipsoid raise to the fourth power.
|
|
609
|
+
* @memberof Ellipsoid.prototype
|
|
610
|
+
* @type {Cartesian3}
|
|
611
|
+
* @readonly
|
|
612
|
+
*/
|
|
613
|
+
radiiToTheFourth: {
|
|
614
|
+
get: function() {
|
|
615
|
+
return this._radiiToTheFourth;
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
/**
|
|
619
|
+
* Gets one over the radii of the ellipsoid.
|
|
620
|
+
* @memberof Ellipsoid.prototype
|
|
621
|
+
* @type {Cartesian3}
|
|
622
|
+
* @readonly
|
|
623
|
+
*/
|
|
624
|
+
oneOverRadii: {
|
|
625
|
+
get: function() {
|
|
626
|
+
return this._oneOverRadii;
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
/**
|
|
630
|
+
* Gets one over the squared radii of the ellipsoid.
|
|
631
|
+
* @memberof Ellipsoid.prototype
|
|
632
|
+
* @type {Cartesian3}
|
|
633
|
+
* @readonly
|
|
634
|
+
*/
|
|
635
|
+
oneOverRadiiSquared: {
|
|
636
|
+
get: function() {
|
|
637
|
+
return this._oneOverRadiiSquared;
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
/**
|
|
641
|
+
* Gets the minimum radius of the ellipsoid.
|
|
642
|
+
* @memberof Ellipsoid.prototype
|
|
643
|
+
* @type {number}
|
|
644
|
+
* @readonly
|
|
645
|
+
*/
|
|
646
|
+
minimumRadius: {
|
|
647
|
+
get: function() {
|
|
648
|
+
return this._minimumRadius;
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
/**
|
|
652
|
+
* Gets the maximum radius of the ellipsoid.
|
|
653
|
+
* @memberof Ellipsoid.prototype
|
|
654
|
+
* @type {number}
|
|
655
|
+
* @readonly
|
|
656
|
+
*/
|
|
657
|
+
maximumRadius: {
|
|
658
|
+
get: function() {
|
|
659
|
+
return this._maximumRadius;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
Ellipsoid.clone = function(ellipsoid, result) {
|
|
664
|
+
if (!defined_default(ellipsoid)) {
|
|
665
|
+
return void 0;
|
|
666
|
+
}
|
|
667
|
+
const radii = ellipsoid._radii;
|
|
668
|
+
if (!defined_default(result)) {
|
|
669
|
+
return new Ellipsoid(radii.x, radii.y, radii.z);
|
|
670
|
+
}
|
|
671
|
+
Cartesian3_default.clone(radii, result._radii);
|
|
672
|
+
Cartesian3_default.clone(ellipsoid._radiiSquared, result._radiiSquared);
|
|
673
|
+
Cartesian3_default.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth);
|
|
674
|
+
Cartesian3_default.clone(ellipsoid._oneOverRadii, result._oneOverRadii);
|
|
675
|
+
Cartesian3_default.clone(ellipsoid._oneOverRadiiSquared, result._oneOverRadiiSquared);
|
|
676
|
+
result._minimumRadius = ellipsoid._minimumRadius;
|
|
677
|
+
result._maximumRadius = ellipsoid._maximumRadius;
|
|
678
|
+
result._centerToleranceSquared = ellipsoid._centerToleranceSquared;
|
|
679
|
+
return result;
|
|
680
|
+
};
|
|
681
|
+
Ellipsoid.fromCartesian3 = function(cartesian, result) {
|
|
682
|
+
if (!defined_default(result)) {
|
|
683
|
+
result = new Ellipsoid();
|
|
684
|
+
}
|
|
685
|
+
if (!defined_default(cartesian)) {
|
|
686
|
+
return result;
|
|
687
|
+
}
|
|
688
|
+
initialize(result, cartesian.x, cartesian.y, cartesian.z);
|
|
689
|
+
return result;
|
|
690
|
+
};
|
|
691
|
+
Ellipsoid.WGS84 = Object.freeze(
|
|
692
|
+
new Ellipsoid(6378137, 6378137, 6356752314245179e-9)
|
|
693
|
+
);
|
|
694
|
+
Ellipsoid.UNIT_SPHERE = Object.freeze(new Ellipsoid(1, 1, 1));
|
|
695
|
+
Ellipsoid.MOON = Object.freeze(
|
|
696
|
+
new Ellipsoid(
|
|
697
|
+
Math_default.LUNAR_RADIUS,
|
|
698
|
+
Math_default.LUNAR_RADIUS,
|
|
699
|
+
Math_default.LUNAR_RADIUS
|
|
700
|
+
)
|
|
701
|
+
);
|
|
702
|
+
Ellipsoid.MARS = Object.freeze(new Ellipsoid(3396190, 3396190, 3376200));
|
|
703
|
+
Ellipsoid._default = Ellipsoid.WGS84;
|
|
704
|
+
Object.defineProperties(Ellipsoid, {
|
|
705
|
+
/**
|
|
706
|
+
* The default ellipsoid used when not otherwise specified.
|
|
707
|
+
* @memberof Ellipsoid
|
|
708
|
+
* @type {Ellipsoid}
|
|
709
|
+
* @example
|
|
710
|
+
* Cesium.Ellipsoid.default = Cesium.Ellipsoid.MOON;
|
|
711
|
+
*
|
|
712
|
+
* // Apollo 11 landing site
|
|
713
|
+
* const position = Cesium.Cartesian3.fromRadians(
|
|
714
|
+
* 0.67416,
|
|
715
|
+
* 23.47315,
|
|
716
|
+
* );
|
|
717
|
+
*/
|
|
718
|
+
default: {
|
|
719
|
+
get: function() {
|
|
720
|
+
return Ellipsoid._default;
|
|
721
|
+
},
|
|
722
|
+
set: function(value) {
|
|
723
|
+
Check_default.typeOf.object("value", value);
|
|
724
|
+
Ellipsoid._default = value;
|
|
725
|
+
Cartesian3_default._ellipsoidRadiiSquared = value.radiiSquared;
|
|
726
|
+
Cartographic_default._ellipsoidOneOverRadii = value.oneOverRadii;
|
|
727
|
+
Cartographic_default._ellipsoidOneOverRadiiSquared = value.oneOverRadiiSquared;
|
|
728
|
+
Cartographic_default._ellipsoidCenterToleranceSquared = value._centerToleranceSquared;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
Ellipsoid.prototype.clone = function(result) {
|
|
733
|
+
return Ellipsoid.clone(this, result);
|
|
734
|
+
};
|
|
735
|
+
Ellipsoid.packedLength = Cartesian3_default.packedLength;
|
|
736
|
+
Ellipsoid.pack = function(value, array, startingIndex) {
|
|
737
|
+
Check_default.typeOf.object("value", value);
|
|
738
|
+
Check_default.defined("array", array);
|
|
739
|
+
startingIndex = startingIndex ?? 0;
|
|
740
|
+
Cartesian3_default.pack(value._radii, array, startingIndex);
|
|
741
|
+
return array;
|
|
742
|
+
};
|
|
743
|
+
Ellipsoid.unpack = function(array, startingIndex, result) {
|
|
744
|
+
Check_default.defined("array", array);
|
|
745
|
+
startingIndex = startingIndex ?? 0;
|
|
746
|
+
const radii = Cartesian3_default.unpack(array, startingIndex);
|
|
747
|
+
return Ellipsoid.fromCartesian3(radii, result);
|
|
748
|
+
};
|
|
749
|
+
Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3_default.normalize;
|
|
750
|
+
Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function(cartographic, result) {
|
|
751
|
+
Check_default.typeOf.object("cartographic", cartographic);
|
|
752
|
+
const longitude = cartographic.longitude;
|
|
753
|
+
const latitude = cartographic.latitude;
|
|
754
|
+
const cosLatitude = Math.cos(latitude);
|
|
755
|
+
const x = cosLatitude * Math.cos(longitude);
|
|
756
|
+
const y = cosLatitude * Math.sin(longitude);
|
|
757
|
+
const z = Math.sin(latitude);
|
|
758
|
+
if (!defined_default(result)) {
|
|
759
|
+
result = new Cartesian3_default();
|
|
760
|
+
}
|
|
761
|
+
result.x = x;
|
|
762
|
+
result.y = y;
|
|
763
|
+
result.z = z;
|
|
764
|
+
return Cartesian3_default.normalize(result, result);
|
|
765
|
+
};
|
|
766
|
+
Ellipsoid.prototype.geodeticSurfaceNormal = function(cartesian, result) {
|
|
767
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
768
|
+
if (isNaN(cartesian.x) || isNaN(cartesian.y) || isNaN(cartesian.z)) {
|
|
769
|
+
throw new DeveloperError_default("cartesian has a NaN component");
|
|
770
|
+
}
|
|
771
|
+
if (Cartesian3_default.equalsEpsilon(cartesian, Cartesian3_default.ZERO, Math_default.EPSILON14)) {
|
|
772
|
+
return void 0;
|
|
773
|
+
}
|
|
774
|
+
if (!defined_default(result)) {
|
|
775
|
+
result = new Cartesian3_default();
|
|
776
|
+
}
|
|
777
|
+
result = Cartesian3_default.multiplyComponents(
|
|
778
|
+
cartesian,
|
|
779
|
+
this._oneOverRadiiSquared,
|
|
780
|
+
result
|
|
781
|
+
);
|
|
782
|
+
return Cartesian3_default.normalize(result, result);
|
|
783
|
+
};
|
|
784
|
+
var cartographicToCartesianNormal = new Cartesian3_default();
|
|
785
|
+
var cartographicToCartesianK = new Cartesian3_default();
|
|
786
|
+
Ellipsoid.prototype.cartographicToCartesian = function(cartographic, result) {
|
|
787
|
+
const n = cartographicToCartesianNormal;
|
|
788
|
+
const k = cartographicToCartesianK;
|
|
789
|
+
this.geodeticSurfaceNormalCartographic(cartographic, n);
|
|
790
|
+
Cartesian3_default.multiplyComponents(this._radiiSquared, n, k);
|
|
791
|
+
const gamma = Math.sqrt(Cartesian3_default.dot(n, k));
|
|
792
|
+
Cartesian3_default.divideByScalar(k, gamma, k);
|
|
793
|
+
Cartesian3_default.multiplyByScalar(n, cartographic.height, n);
|
|
794
|
+
if (!defined_default(result)) {
|
|
795
|
+
result = new Cartesian3_default();
|
|
796
|
+
}
|
|
797
|
+
return Cartesian3_default.add(k, n, result);
|
|
798
|
+
};
|
|
799
|
+
Ellipsoid.prototype.cartographicArrayToCartesianArray = function(cartographics, result) {
|
|
800
|
+
Check_default.defined("cartographics", cartographics);
|
|
801
|
+
const length = cartographics.length;
|
|
802
|
+
if (!defined_default(result)) {
|
|
803
|
+
result = new Array(length);
|
|
804
|
+
} else {
|
|
805
|
+
result.length = length;
|
|
806
|
+
}
|
|
807
|
+
for (let i = 0; i < length; i++) {
|
|
808
|
+
result[i] = this.cartographicToCartesian(cartographics[i], result[i]);
|
|
809
|
+
}
|
|
810
|
+
return result;
|
|
811
|
+
};
|
|
812
|
+
var cartesianToCartographicN2 = new Cartesian3_default();
|
|
813
|
+
var cartesianToCartographicP2 = new Cartesian3_default();
|
|
814
|
+
var cartesianToCartographicH2 = new Cartesian3_default();
|
|
815
|
+
Ellipsoid.prototype.cartesianToCartographic = function(cartesian, result) {
|
|
816
|
+
const p = this.scaleToGeodeticSurface(cartesian, cartesianToCartographicP2);
|
|
817
|
+
if (!defined_default(p)) {
|
|
818
|
+
return void 0;
|
|
819
|
+
}
|
|
820
|
+
const n = this.geodeticSurfaceNormal(p, cartesianToCartographicN2);
|
|
821
|
+
const h = Cartesian3_default.subtract(cartesian, p, cartesianToCartographicH2);
|
|
822
|
+
const longitude = Math.atan2(n.y, n.x);
|
|
823
|
+
const latitude = Math.asin(n.z);
|
|
824
|
+
const height = Math_default.sign(Cartesian3_default.dot(h, cartesian)) * Cartesian3_default.magnitude(h);
|
|
825
|
+
if (!defined_default(result)) {
|
|
826
|
+
return new Cartographic_default(longitude, latitude, height);
|
|
827
|
+
}
|
|
828
|
+
result.longitude = longitude;
|
|
829
|
+
result.latitude = latitude;
|
|
830
|
+
result.height = height;
|
|
831
|
+
return result;
|
|
832
|
+
};
|
|
833
|
+
Ellipsoid.prototype.cartesianArrayToCartographicArray = function(cartesians, result) {
|
|
834
|
+
Check_default.defined("cartesians", cartesians);
|
|
835
|
+
const length = cartesians.length;
|
|
836
|
+
if (!defined_default(result)) {
|
|
837
|
+
result = new Array(length);
|
|
838
|
+
} else {
|
|
839
|
+
result.length = length;
|
|
840
|
+
}
|
|
841
|
+
for (let i = 0; i < length; ++i) {
|
|
842
|
+
result[i] = this.cartesianToCartographic(cartesians[i], result[i]);
|
|
843
|
+
}
|
|
844
|
+
return result;
|
|
845
|
+
};
|
|
846
|
+
Ellipsoid.prototype.scaleToGeodeticSurface = function(cartesian, result) {
|
|
847
|
+
return scaleToGeodeticSurface_default(
|
|
848
|
+
cartesian,
|
|
849
|
+
this._oneOverRadii,
|
|
850
|
+
this._oneOverRadiiSquared,
|
|
851
|
+
this._centerToleranceSquared,
|
|
852
|
+
result
|
|
853
|
+
);
|
|
854
|
+
};
|
|
855
|
+
Ellipsoid.prototype.scaleToGeocentricSurface = function(cartesian, result) {
|
|
856
|
+
Check_default.typeOf.object("cartesian", cartesian);
|
|
857
|
+
if (!defined_default(result)) {
|
|
858
|
+
result = new Cartesian3_default();
|
|
859
|
+
}
|
|
860
|
+
const positionX = cartesian.x;
|
|
861
|
+
const positionY = cartesian.y;
|
|
862
|
+
const positionZ = cartesian.z;
|
|
863
|
+
const oneOverRadiiSquared = this._oneOverRadiiSquared;
|
|
864
|
+
const beta = 1 / Math.sqrt(
|
|
865
|
+
positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z
|
|
866
|
+
);
|
|
867
|
+
return Cartesian3_default.multiplyByScalar(cartesian, beta, result);
|
|
868
|
+
};
|
|
869
|
+
Ellipsoid.prototype.transformPositionToScaledSpace = function(position, result) {
|
|
870
|
+
if (!defined_default(result)) {
|
|
871
|
+
result = new Cartesian3_default();
|
|
872
|
+
}
|
|
873
|
+
return Cartesian3_default.multiplyComponents(position, this._oneOverRadii, result);
|
|
874
|
+
};
|
|
875
|
+
Ellipsoid.prototype.transformPositionFromScaledSpace = function(position, result) {
|
|
876
|
+
if (!defined_default(result)) {
|
|
877
|
+
result = new Cartesian3_default();
|
|
878
|
+
}
|
|
879
|
+
return Cartesian3_default.multiplyComponents(position, this._radii, result);
|
|
880
|
+
};
|
|
881
|
+
Ellipsoid.prototype.equals = function(right) {
|
|
882
|
+
return this === right || defined_default(right) && Cartesian3_default.equals(this._radii, right._radii);
|
|
883
|
+
};
|
|
884
|
+
Ellipsoid.prototype.toString = function() {
|
|
885
|
+
return this._radii.toString();
|
|
886
|
+
};
|
|
887
|
+
Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function(position, buffer, result) {
|
|
888
|
+
Check_default.typeOf.object("position", position);
|
|
889
|
+
if (!Math_default.equalsEpsilon(
|
|
890
|
+
this._radii.x,
|
|
891
|
+
this._radii.y,
|
|
892
|
+
Math_default.EPSILON15
|
|
893
|
+
)) {
|
|
894
|
+
throw new DeveloperError_default(
|
|
895
|
+
"Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)"
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
Check_default.typeOf.number.greaterThan("Ellipsoid.radii.z", this._radii.z, 0);
|
|
899
|
+
buffer = buffer ?? 0;
|
|
900
|
+
const squaredXOverSquaredZ = this._squaredXOverSquaredZ;
|
|
901
|
+
if (!defined_default(result)) {
|
|
902
|
+
result = new Cartesian3_default();
|
|
903
|
+
}
|
|
904
|
+
result.x = 0;
|
|
905
|
+
result.y = 0;
|
|
906
|
+
result.z = position.z * (1 - squaredXOverSquaredZ);
|
|
907
|
+
if (Math.abs(result.z) >= this._radii.z - buffer) {
|
|
908
|
+
return void 0;
|
|
909
|
+
}
|
|
910
|
+
return result;
|
|
911
|
+
};
|
|
912
|
+
var scratchEndpoint = new Cartesian3_default();
|
|
913
|
+
Ellipsoid.prototype.getLocalCurvature = function(surfacePosition, result) {
|
|
914
|
+
Check_default.typeOf.object("surfacePosition", surfacePosition);
|
|
915
|
+
if (!defined_default(result)) {
|
|
916
|
+
result = new Cartesian2_default();
|
|
917
|
+
}
|
|
918
|
+
const primeVerticalEndpoint = this.getSurfaceNormalIntersectionWithZAxis(
|
|
919
|
+
surfacePosition,
|
|
920
|
+
0,
|
|
921
|
+
scratchEndpoint
|
|
922
|
+
);
|
|
923
|
+
const primeVerticalRadius = Cartesian3_default.distance(
|
|
924
|
+
surfacePosition,
|
|
925
|
+
primeVerticalEndpoint
|
|
926
|
+
);
|
|
927
|
+
const radiusRatio = this.minimumRadius * primeVerticalRadius / this.maximumRadius ** 2;
|
|
928
|
+
const meridionalRadius = primeVerticalRadius * radiusRatio ** 2;
|
|
929
|
+
return Cartesian2_default.fromElements(
|
|
930
|
+
1 / primeVerticalRadius,
|
|
931
|
+
1 / meridionalRadius,
|
|
932
|
+
result
|
|
933
|
+
);
|
|
934
|
+
};
|
|
935
|
+
var abscissas = [
|
|
936
|
+
0.14887433898163,
|
|
937
|
+
0.43339539412925,
|
|
938
|
+
0.67940956829902,
|
|
939
|
+
0.86506336668898,
|
|
940
|
+
0.97390652851717,
|
|
941
|
+
0
|
|
942
|
+
];
|
|
943
|
+
var weights = [
|
|
944
|
+
0.29552422471475,
|
|
945
|
+
0.26926671930999,
|
|
946
|
+
0.21908636251598,
|
|
947
|
+
0.14945134915058,
|
|
948
|
+
0.066671344308684,
|
|
949
|
+
0
|
|
950
|
+
];
|
|
951
|
+
function gaussLegendreQuadrature(a, b, func) {
|
|
952
|
+
Check_default.typeOf.number("a", a);
|
|
953
|
+
Check_default.typeOf.number("b", b);
|
|
954
|
+
Check_default.typeOf.func("func", func);
|
|
955
|
+
const xMean = 0.5 * (b + a);
|
|
956
|
+
const xRange = 0.5 * (b - a);
|
|
957
|
+
let sum = 0;
|
|
958
|
+
for (let i = 0; i < 5; i++) {
|
|
959
|
+
const dx = xRange * abscissas[i];
|
|
960
|
+
sum += weights[i] * (func(xMean + dx) + func(xMean - dx));
|
|
961
|
+
}
|
|
962
|
+
sum *= xRange;
|
|
963
|
+
return sum;
|
|
964
|
+
}
|
|
965
|
+
Ellipsoid.prototype.surfaceArea = function(rectangle) {
|
|
966
|
+
Check_default.typeOf.object("rectangle", rectangle);
|
|
967
|
+
const minLongitude = rectangle.west;
|
|
968
|
+
let maxLongitude = rectangle.east;
|
|
969
|
+
const minLatitude = rectangle.south;
|
|
970
|
+
const maxLatitude = rectangle.north;
|
|
971
|
+
while (maxLongitude < minLongitude) {
|
|
972
|
+
maxLongitude += Math_default.TWO_PI;
|
|
973
|
+
}
|
|
974
|
+
const radiiSquared = this._radiiSquared;
|
|
975
|
+
const a2 = radiiSquared.x;
|
|
976
|
+
const b2 = radiiSquared.y;
|
|
977
|
+
const c2 = radiiSquared.z;
|
|
978
|
+
const a2b2 = a2 * b2;
|
|
979
|
+
return gaussLegendreQuadrature(minLatitude, maxLatitude, function(lat) {
|
|
980
|
+
const sinPhi = Math.cos(lat);
|
|
981
|
+
const cosPhi = Math.sin(lat);
|
|
982
|
+
return Math.cos(lat) * gaussLegendreQuadrature(minLongitude, maxLongitude, function(lon) {
|
|
983
|
+
const cosTheta = Math.cos(lon);
|
|
984
|
+
const sinTheta = Math.sin(lon);
|
|
985
|
+
return Math.sqrt(
|
|
986
|
+
a2b2 * cosPhi * cosPhi + c2 * (b2 * cosTheta * cosTheta + a2 * sinTheta * sinTheta) * sinPhi * sinPhi
|
|
987
|
+
);
|
|
988
|
+
});
|
|
989
|
+
});
|
|
990
|
+
};
|
|
991
|
+
var Ellipsoid_default = Ellipsoid;
|
|
992
|
+
|
|
993
|
+
// packages/engine/Source/Core/Fullscreen.js
|
|
994
|
+
var _supportsFullscreen;
|
|
995
|
+
var _names = {
|
|
996
|
+
requestFullscreen: void 0,
|
|
997
|
+
exitFullscreen: void 0,
|
|
998
|
+
fullscreenEnabled: void 0,
|
|
999
|
+
fullscreenElement: void 0,
|
|
1000
|
+
fullscreenchange: void 0,
|
|
1001
|
+
fullscreenerror: void 0
|
|
1002
|
+
};
|
|
1003
|
+
var Fullscreen = {};
|
|
1004
|
+
Object.defineProperties(Fullscreen, {
|
|
1005
|
+
/**
|
|
1006
|
+
* The element that is currently fullscreen, if any. To simply check if the
|
|
1007
|
+
* browser is in fullscreen mode or not, use {@link Fullscreen#fullscreen}.
|
|
1008
|
+
* @memberof Fullscreen
|
|
1009
|
+
* @type {object}
|
|
1010
|
+
* @readonly
|
|
1011
|
+
*/
|
|
1012
|
+
element: {
|
|
1013
|
+
get: function() {
|
|
1014
|
+
if (!Fullscreen.supportsFullscreen()) {
|
|
1015
|
+
return void 0;
|
|
1016
|
+
}
|
|
1017
|
+
return document[_names.fullscreenElement];
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
1020
|
+
/**
|
|
1021
|
+
* The name of the event on the document that is fired when fullscreen is
|
|
1022
|
+
* entered or exited. This event name is intended for use with addEventListener.
|
|
1023
|
+
* In your event handler, to determine if the browser is in fullscreen mode or not,
|
|
1024
|
+
* use {@link Fullscreen#fullscreen}.
|
|
1025
|
+
* @memberof Fullscreen
|
|
1026
|
+
* @type {string}
|
|
1027
|
+
* @readonly
|
|
1028
|
+
*/
|
|
1029
|
+
changeEventName: {
|
|
1030
|
+
get: function() {
|
|
1031
|
+
if (!Fullscreen.supportsFullscreen()) {
|
|
1032
|
+
return void 0;
|
|
1033
|
+
}
|
|
1034
|
+
return _names.fullscreenchange;
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
/**
|
|
1038
|
+
* The name of the event that is fired when a fullscreen error
|
|
1039
|
+
* occurs. This event name is intended for use with addEventListener.
|
|
1040
|
+
* @memberof Fullscreen
|
|
1041
|
+
* @type {string}
|
|
1042
|
+
* @readonly
|
|
1043
|
+
*/
|
|
1044
|
+
errorEventName: {
|
|
1045
|
+
get: function() {
|
|
1046
|
+
if (!Fullscreen.supportsFullscreen()) {
|
|
1047
|
+
return void 0;
|
|
1048
|
+
}
|
|
1049
|
+
return _names.fullscreenerror;
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
/**
|
|
1053
|
+
* Determine whether the browser will allow an element to be made fullscreen, or not.
|
|
1054
|
+
* For example, by default, iframes cannot go fullscreen unless the containing page
|
|
1055
|
+
* adds an "allowfullscreen" attribute (or prefixed equivalent).
|
|
1056
|
+
* @memberof Fullscreen
|
|
1057
|
+
* @type {boolean}
|
|
1058
|
+
* @readonly
|
|
1059
|
+
*/
|
|
1060
|
+
enabled: {
|
|
1061
|
+
get: function() {
|
|
1062
|
+
if (!Fullscreen.supportsFullscreen()) {
|
|
1063
|
+
return void 0;
|
|
1064
|
+
}
|
|
1065
|
+
return document[_names.fullscreenEnabled];
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
/**
|
|
1069
|
+
* Determines if the browser is currently in fullscreen mode.
|
|
1070
|
+
* @memberof Fullscreen
|
|
1071
|
+
* @type {boolean}
|
|
1072
|
+
* @readonly
|
|
1073
|
+
*/
|
|
1074
|
+
fullscreen: {
|
|
1075
|
+
get: function() {
|
|
1076
|
+
if (!Fullscreen.supportsFullscreen()) {
|
|
1077
|
+
return void 0;
|
|
1078
|
+
}
|
|
1079
|
+
return Fullscreen.element !== null;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
Fullscreen.supportsFullscreen = function() {
|
|
1084
|
+
if (defined_default(_supportsFullscreen)) {
|
|
1085
|
+
return _supportsFullscreen;
|
|
1086
|
+
}
|
|
1087
|
+
_supportsFullscreen = false;
|
|
1088
|
+
const body = document.body;
|
|
1089
|
+
if (typeof body.requestFullscreen === "function") {
|
|
1090
|
+
_names.requestFullscreen = "requestFullscreen";
|
|
1091
|
+
_names.exitFullscreen = "exitFullscreen";
|
|
1092
|
+
_names.fullscreenEnabled = "fullscreenEnabled";
|
|
1093
|
+
_names.fullscreenElement = "fullscreenElement";
|
|
1094
|
+
_names.fullscreenchange = "fullscreenchange";
|
|
1095
|
+
_names.fullscreenerror = "fullscreenerror";
|
|
1096
|
+
_supportsFullscreen = true;
|
|
1097
|
+
return _supportsFullscreen;
|
|
1098
|
+
}
|
|
1099
|
+
const prefixes = ["webkit", "moz", "o", "ms", "khtml"];
|
|
1100
|
+
let name;
|
|
1101
|
+
for (let i = 0, len = prefixes.length; i < len; ++i) {
|
|
1102
|
+
const prefix = prefixes[i];
|
|
1103
|
+
name = `${prefix}RequestFullscreen`;
|
|
1104
|
+
if (typeof body[name] === "function") {
|
|
1105
|
+
_names.requestFullscreen = name;
|
|
1106
|
+
_supportsFullscreen = true;
|
|
1107
|
+
} else {
|
|
1108
|
+
name = `${prefix}RequestFullScreen`;
|
|
1109
|
+
if (typeof body[name] === "function") {
|
|
1110
|
+
_names.requestFullscreen = name;
|
|
1111
|
+
_supportsFullscreen = true;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
name = `${prefix}ExitFullscreen`;
|
|
1115
|
+
if (typeof document[name] === "function") {
|
|
1116
|
+
_names.exitFullscreen = name;
|
|
1117
|
+
} else {
|
|
1118
|
+
name = `${prefix}CancelFullScreen`;
|
|
1119
|
+
if (typeof document[name] === "function") {
|
|
1120
|
+
_names.exitFullscreen = name;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
name = `${prefix}FullscreenEnabled`;
|
|
1124
|
+
if (document[name] !== void 0) {
|
|
1125
|
+
_names.fullscreenEnabled = name;
|
|
1126
|
+
} else {
|
|
1127
|
+
name = `${prefix}FullScreenEnabled`;
|
|
1128
|
+
if (document[name] !== void 0) {
|
|
1129
|
+
_names.fullscreenEnabled = name;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
name = `${prefix}FullscreenElement`;
|
|
1133
|
+
if (document[name] !== void 0) {
|
|
1134
|
+
_names.fullscreenElement = name;
|
|
1135
|
+
} else {
|
|
1136
|
+
name = `${prefix}FullScreenElement`;
|
|
1137
|
+
if (document[name] !== void 0) {
|
|
1138
|
+
_names.fullscreenElement = name;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
name = `${prefix}fullscreenchange`;
|
|
1142
|
+
if (document[`on${name}`] !== void 0) {
|
|
1143
|
+
if (prefix === "ms") {
|
|
1144
|
+
name = "MSFullscreenChange";
|
|
1145
|
+
}
|
|
1146
|
+
_names.fullscreenchange = name;
|
|
1147
|
+
}
|
|
1148
|
+
name = `${prefix}fullscreenerror`;
|
|
1149
|
+
if (document[`on${name}`] !== void 0) {
|
|
1150
|
+
if (prefix === "ms") {
|
|
1151
|
+
name = "MSFullscreenError";
|
|
1152
|
+
}
|
|
1153
|
+
_names.fullscreenerror = name;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
return _supportsFullscreen;
|
|
1157
|
+
};
|
|
1158
|
+
Fullscreen.requestFullscreen = function(element, vrDevice) {
|
|
1159
|
+
if (!Fullscreen.supportsFullscreen()) {
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
element[_names.requestFullscreen]({ vrDisplay: vrDevice });
|
|
1163
|
+
};
|
|
1164
|
+
Fullscreen.exitFullscreen = function() {
|
|
1165
|
+
if (!Fullscreen.supportsFullscreen()) {
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
document[_names.exitFullscreen]();
|
|
1169
|
+
};
|
|
1170
|
+
Fullscreen._names = _names;
|
|
1171
|
+
var Fullscreen_default = Fullscreen;
|
|
1172
|
+
|
|
1173
|
+
// packages/engine/Source/Core/FeatureDetection.js
|
|
1174
|
+
var theNavigator;
|
|
1175
|
+
if (typeof navigator !== "undefined") {
|
|
1176
|
+
theNavigator = navigator;
|
|
1177
|
+
} else {
|
|
1178
|
+
theNavigator = {};
|
|
1179
|
+
}
|
|
1180
|
+
function extractVersion(versionString) {
|
|
1181
|
+
const parts = versionString.split(".");
|
|
1182
|
+
for (let i = 0, len = parts.length; i < len; ++i) {
|
|
1183
|
+
parts[i] = parseInt(parts[i], 10);
|
|
1184
|
+
}
|
|
1185
|
+
return parts;
|
|
1186
|
+
}
|
|
1187
|
+
var isChromeResult;
|
|
1188
|
+
var chromeVersionResult;
|
|
1189
|
+
function isChrome() {
|
|
1190
|
+
if (!defined_default(isChromeResult)) {
|
|
1191
|
+
isChromeResult = false;
|
|
1192
|
+
if (!isEdge()) {
|
|
1193
|
+
const fields = / Chrome\/([\.0-9]+)/.exec(theNavigator.userAgent);
|
|
1194
|
+
if (fields !== null) {
|
|
1195
|
+
isChromeResult = true;
|
|
1196
|
+
chromeVersionResult = extractVersion(fields[1]);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
return isChromeResult;
|
|
1201
|
+
}
|
|
1202
|
+
function chromeVersion() {
|
|
1203
|
+
return isChrome() && chromeVersionResult;
|
|
1204
|
+
}
|
|
1205
|
+
var isSafariResult;
|
|
1206
|
+
var safariVersionResult;
|
|
1207
|
+
function isSafari() {
|
|
1208
|
+
if (!defined_default(isSafariResult)) {
|
|
1209
|
+
isSafariResult = false;
|
|
1210
|
+
if (!isChrome() && !isEdge() && / Safari\/[\.0-9]+/.test(theNavigator.userAgent)) {
|
|
1211
|
+
const fields = / Version\/([\.0-9]+)/.exec(theNavigator.userAgent);
|
|
1212
|
+
if (fields !== null) {
|
|
1213
|
+
isSafariResult = true;
|
|
1214
|
+
safariVersionResult = extractVersion(fields[1]);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return isSafariResult;
|
|
1219
|
+
}
|
|
1220
|
+
function safariVersion() {
|
|
1221
|
+
return isSafari() && safariVersionResult;
|
|
1222
|
+
}
|
|
1223
|
+
var isWebkitResult;
|
|
1224
|
+
var webkitVersionResult;
|
|
1225
|
+
function isWebkit() {
|
|
1226
|
+
if (!defined_default(isWebkitResult)) {
|
|
1227
|
+
isWebkitResult = false;
|
|
1228
|
+
const fields = / AppleWebKit\/([\.0-9]+)(\+?)/.exec(theNavigator.userAgent);
|
|
1229
|
+
if (fields !== null) {
|
|
1230
|
+
isWebkitResult = true;
|
|
1231
|
+
webkitVersionResult = extractVersion(fields[1]);
|
|
1232
|
+
webkitVersionResult.isNightly = !!fields[2];
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
return isWebkitResult;
|
|
1236
|
+
}
|
|
1237
|
+
function webkitVersion() {
|
|
1238
|
+
return isWebkit() && webkitVersionResult;
|
|
1239
|
+
}
|
|
1240
|
+
var isInternetExplorerResult;
|
|
1241
|
+
var internetExplorerVersionResult;
|
|
1242
|
+
function isInternetExplorer() {
|
|
1243
|
+
if (!defined_default(isInternetExplorerResult)) {
|
|
1244
|
+
isInternetExplorerResult = false;
|
|
1245
|
+
let fields;
|
|
1246
|
+
if (theNavigator.appName === "Microsoft Internet Explorer") {
|
|
1247
|
+
fields = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent);
|
|
1248
|
+
if (fields !== null) {
|
|
1249
|
+
isInternetExplorerResult = true;
|
|
1250
|
+
internetExplorerVersionResult = extractVersion(fields[1]);
|
|
1251
|
+
}
|
|
1252
|
+
} else if (theNavigator.appName === "Netscape") {
|
|
1253
|
+
fields = /Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(
|
|
1254
|
+
theNavigator.userAgent
|
|
1255
|
+
);
|
|
1256
|
+
if (fields !== null) {
|
|
1257
|
+
isInternetExplorerResult = true;
|
|
1258
|
+
internetExplorerVersionResult = extractVersion(fields[1]);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
return isInternetExplorerResult;
|
|
1263
|
+
}
|
|
1264
|
+
function internetExplorerVersion() {
|
|
1265
|
+
return isInternetExplorer() && internetExplorerVersionResult;
|
|
1266
|
+
}
|
|
1267
|
+
var isEdgeResult;
|
|
1268
|
+
var edgeVersionResult;
|
|
1269
|
+
function isEdge() {
|
|
1270
|
+
if (!defined_default(isEdgeResult)) {
|
|
1271
|
+
isEdgeResult = false;
|
|
1272
|
+
const fields = / Edg\/([\.0-9]+)/.exec(theNavigator.userAgent);
|
|
1273
|
+
if (fields !== null) {
|
|
1274
|
+
isEdgeResult = true;
|
|
1275
|
+
edgeVersionResult = extractVersion(fields[1]);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
return isEdgeResult;
|
|
1279
|
+
}
|
|
1280
|
+
function edgeVersion() {
|
|
1281
|
+
return isEdge() && edgeVersionResult;
|
|
1282
|
+
}
|
|
1283
|
+
var isFirefoxResult;
|
|
1284
|
+
var firefoxVersionResult;
|
|
1285
|
+
function isFirefox() {
|
|
1286
|
+
if (!defined_default(isFirefoxResult)) {
|
|
1287
|
+
isFirefoxResult = false;
|
|
1288
|
+
const fields = /Firefox\/([\.0-9]+)/.exec(theNavigator.userAgent);
|
|
1289
|
+
if (fields !== null) {
|
|
1290
|
+
isFirefoxResult = true;
|
|
1291
|
+
firefoxVersionResult = extractVersion(fields[1]);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
return isFirefoxResult;
|
|
1295
|
+
}
|
|
1296
|
+
var isWindowsResult;
|
|
1297
|
+
function isWindows() {
|
|
1298
|
+
if (!defined_default(isWindowsResult)) {
|
|
1299
|
+
isWindowsResult = /Windows/i.test(theNavigator.appVersion);
|
|
1300
|
+
}
|
|
1301
|
+
return isWindowsResult;
|
|
1302
|
+
}
|
|
1303
|
+
var isIPadOrIOSResult;
|
|
1304
|
+
function isIPadOrIOS() {
|
|
1305
|
+
if (!defined_default(isIPadOrIOSResult)) {
|
|
1306
|
+
isIPadOrIOSResult = navigator.platform === "iPhone" || navigator.platform === "iPod" || navigator.platform === "iPad";
|
|
1307
|
+
}
|
|
1308
|
+
return isIPadOrIOSResult;
|
|
1309
|
+
}
|
|
1310
|
+
function firefoxVersion() {
|
|
1311
|
+
return isFirefox() && firefoxVersionResult;
|
|
1312
|
+
}
|
|
1313
|
+
var hasPointerEvents;
|
|
1314
|
+
function supportsPointerEvents() {
|
|
1315
|
+
if (!defined_default(hasPointerEvents)) {
|
|
1316
|
+
hasPointerEvents = !isFirefox() && typeof PointerEvent !== "undefined" && (!defined_default(theNavigator.pointerEnabled) || theNavigator.pointerEnabled);
|
|
1317
|
+
}
|
|
1318
|
+
return hasPointerEvents;
|
|
1319
|
+
}
|
|
1320
|
+
var imageRenderingValueResult;
|
|
1321
|
+
var supportsImageRenderingPixelatedResult;
|
|
1322
|
+
function supportsImageRenderingPixelated() {
|
|
1323
|
+
if (!defined_default(supportsImageRenderingPixelatedResult)) {
|
|
1324
|
+
const canvas = document.createElement("canvas");
|
|
1325
|
+
canvas.setAttribute(
|
|
1326
|
+
"style",
|
|
1327
|
+
"image-rendering: -moz-crisp-edges;image-rendering: pixelated;"
|
|
1328
|
+
);
|
|
1329
|
+
const tmp = canvas.style.imageRendering;
|
|
1330
|
+
supportsImageRenderingPixelatedResult = defined_default(tmp) && tmp !== "";
|
|
1331
|
+
if (supportsImageRenderingPixelatedResult) {
|
|
1332
|
+
imageRenderingValueResult = tmp;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
return supportsImageRenderingPixelatedResult;
|
|
1336
|
+
}
|
|
1337
|
+
function imageRenderingValue() {
|
|
1338
|
+
return supportsImageRenderingPixelated() ? imageRenderingValueResult : void 0;
|
|
1339
|
+
}
|
|
1340
|
+
function supportsWebP() {
|
|
1341
|
+
if (!supportsWebP.initialized) {
|
|
1342
|
+
throw new DeveloperError_default(
|
|
1343
|
+
"You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP"
|
|
1344
|
+
);
|
|
1345
|
+
}
|
|
1346
|
+
return supportsWebP._result;
|
|
1347
|
+
}
|
|
1348
|
+
supportsWebP._promise = void 0;
|
|
1349
|
+
supportsWebP._result = void 0;
|
|
1350
|
+
supportsWebP.initialize = function() {
|
|
1351
|
+
if (defined_default(supportsWebP._promise)) {
|
|
1352
|
+
return supportsWebP._promise;
|
|
1353
|
+
}
|
|
1354
|
+
supportsWebP._promise = new Promise((resolve) => {
|
|
1355
|
+
const image = new Image();
|
|
1356
|
+
image.onload = function() {
|
|
1357
|
+
supportsWebP._result = image.width > 0 && image.height > 0;
|
|
1358
|
+
resolve(supportsWebP._result);
|
|
1359
|
+
};
|
|
1360
|
+
image.onerror = function() {
|
|
1361
|
+
supportsWebP._result = false;
|
|
1362
|
+
resolve(supportsWebP._result);
|
|
1363
|
+
};
|
|
1364
|
+
image.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
|
|
1365
|
+
});
|
|
1366
|
+
return supportsWebP._promise;
|
|
1367
|
+
};
|
|
1368
|
+
Object.defineProperties(supportsWebP, {
|
|
1369
|
+
initialized: {
|
|
1370
|
+
get: function() {
|
|
1371
|
+
return defined_default(supportsWebP._result);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
var typedArrayTypes = [];
|
|
1376
|
+
if (typeof ArrayBuffer !== "undefined") {
|
|
1377
|
+
typedArrayTypes.push(
|
|
1378
|
+
Int8Array,
|
|
1379
|
+
Uint8Array,
|
|
1380
|
+
Int16Array,
|
|
1381
|
+
Uint16Array,
|
|
1382
|
+
Int32Array,
|
|
1383
|
+
Uint32Array,
|
|
1384
|
+
Float32Array,
|
|
1385
|
+
Float64Array
|
|
1386
|
+
);
|
|
1387
|
+
if (typeof Uint8ClampedArray !== "undefined") {
|
|
1388
|
+
typedArrayTypes.push(Uint8ClampedArray);
|
|
1389
|
+
}
|
|
1390
|
+
if (typeof Uint8ClampedArray !== "undefined") {
|
|
1391
|
+
typedArrayTypes.push(Uint8ClampedArray);
|
|
1392
|
+
}
|
|
1393
|
+
if (typeof BigInt64Array !== "undefined") {
|
|
1394
|
+
typedArrayTypes.push(BigInt64Array);
|
|
1395
|
+
}
|
|
1396
|
+
if (typeof BigUint64Array !== "undefined") {
|
|
1397
|
+
typedArrayTypes.push(BigUint64Array);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
var FeatureDetection = {
|
|
1401
|
+
isChrome,
|
|
1402
|
+
chromeVersion,
|
|
1403
|
+
isSafari,
|
|
1404
|
+
safariVersion,
|
|
1405
|
+
isWebkit,
|
|
1406
|
+
webkitVersion,
|
|
1407
|
+
isInternetExplorer,
|
|
1408
|
+
internetExplorerVersion,
|
|
1409
|
+
isEdge,
|
|
1410
|
+
edgeVersion,
|
|
1411
|
+
isFirefox,
|
|
1412
|
+
firefoxVersion,
|
|
1413
|
+
isWindows,
|
|
1414
|
+
isIPadOrIOS,
|
|
1415
|
+
hardwareConcurrency: theNavigator.hardwareConcurrency ?? 3,
|
|
1416
|
+
supportsPointerEvents,
|
|
1417
|
+
supportsImageRenderingPixelated,
|
|
1418
|
+
supportsWebP,
|
|
1419
|
+
imageRenderingValue,
|
|
1420
|
+
typedArrayTypes
|
|
1421
|
+
};
|
|
1422
|
+
FeatureDetection.supportsBasis = function(scene) {
|
|
1423
|
+
return FeatureDetection.supportsWebAssembly() && scene.context.supportsBasis;
|
|
1424
|
+
};
|
|
1425
|
+
FeatureDetection.supportsFullscreen = function() {
|
|
1426
|
+
return Fullscreen_default.supportsFullscreen();
|
|
1427
|
+
};
|
|
1428
|
+
FeatureDetection.supportsTypedArrays = function() {
|
|
1429
|
+
return typeof ArrayBuffer !== "undefined";
|
|
1430
|
+
};
|
|
1431
|
+
FeatureDetection.supportsBigInt64Array = function() {
|
|
1432
|
+
return typeof BigInt64Array !== "undefined";
|
|
1433
|
+
};
|
|
1434
|
+
FeatureDetection.supportsBigUint64Array = function() {
|
|
1435
|
+
return typeof BigUint64Array !== "undefined";
|
|
1436
|
+
};
|
|
1437
|
+
FeatureDetection.supportsBigInt = function() {
|
|
1438
|
+
return typeof BigInt !== "undefined";
|
|
1439
|
+
};
|
|
1440
|
+
FeatureDetection.supportsWebWorkers = function() {
|
|
1441
|
+
return typeof Worker !== "undefined";
|
|
1442
|
+
};
|
|
1443
|
+
FeatureDetection.supportsWebAssembly = function() {
|
|
1444
|
+
return typeof WebAssembly !== "undefined";
|
|
1445
|
+
};
|
|
1446
|
+
FeatureDetection.supportsWebgl2 = function(scene) {
|
|
1447
|
+
Check_default.defined("scene", scene);
|
|
1448
|
+
return scene.context.webgl2;
|
|
1449
|
+
};
|
|
1450
|
+
FeatureDetection.supportsEsmWebWorkers = function() {
|
|
1451
|
+
return !isFirefox() || parseInt(firefoxVersionResult) >= 114;
|
|
1452
|
+
};
|
|
1453
|
+
var FeatureDetection_default = FeatureDetection;
|
|
1454
|
+
|
|
1455
|
+
export {
|
|
1456
|
+
Cartographic_default,
|
|
1457
|
+
Cartesian2_default,
|
|
1458
|
+
Ellipsoid_default,
|
|
1459
|
+
FeatureDetection_default
|
|
1460
|
+
};
|