@hztxi/cesium-engine 25.0.3 → 25.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-3B2TIEWW.js +73 -0
- package/Build/Workers/chunk-3HOOLJ6E.js +1483 -0
- package/Build/Workers/chunk-3MWOYCFC.js +511 -0
- package/Build/Workers/chunk-3Q52BERF.js +476 -0
- package/Build/Workers/chunk-4MHUA5ZK.js +163 -0
- package/Build/Workers/chunk-5BVKUNRB.js +368 -0
- package/Build/Workers/chunk-642GMGGP.js +162 -0
- package/Build/Workers/chunk-65LZTCWG.js +1344 -0
- package/Build/Workers/chunk-6PYOAYJD.js +1046 -0
- package/Build/Workers/chunk-AH6GJ5MT.js +754 -0
- package/Build/Workers/chunk-AM56LGEB.js +352 -0
- package/Build/Workers/chunk-CADDH6MK.js +140 -0
- package/Build/Workers/chunk-CEIY3YH2.js +57 -0
- package/Build/Workers/chunk-CJT3FTZK.js +58 -0
- package/Build/Workers/chunk-CV7K25H3.js +138 -0
- package/Build/Workers/chunk-DNEERCHO.js +171 -0
- package/Build/Workers/chunk-EHXAKTME.js +147 -0
- package/Build/Workers/chunk-FF6JKPLF.js +454 -0
- package/Build/Workers/chunk-FTRHXHI5.js +3794 -0
- package/Build/Workers/chunk-GH2D6MPO.js +497 -0
- package/Build/Workers/chunk-GHVEEVR7.js +778 -0
- package/Build/Workers/chunk-HUNCRVVV.js +1067 -0
- package/Build/Workers/chunk-IFSGYIDE.js +257 -0
- package/Build/Workers/chunk-ISRYZ3F4.js +414 -0
- package/Build/Workers/chunk-JBJ5PC2D.js +102 -0
- package/Build/Workers/chunk-JFPBQCDB.js +398 -0
- package/Build/Workers/chunk-JKPELBSI.js +682 -0
- package/Build/Workers/chunk-JLLWLD6O.js +973 -0
- package/Build/Workers/chunk-KCUS7QEU.js +387 -0
- package/Build/Workers/chunk-KFRKYG4B.js +288 -0
- package/Build/Workers/chunk-LERIK6IA.js +219 -0
- package/Build/Workers/chunk-LOVXQI64.js +2719 -0
- package/Build/Workers/chunk-MD7CEJO5.js +2342 -0
- package/Build/Workers/chunk-OKPQ3QBG.js +124 -0
- package/Build/Workers/chunk-PC7533X2.js +1800 -0
- package/Build/Workers/chunk-PCXE4XMI.js +82 -0
- package/Build/Workers/chunk-PXPUYOFJ.js +1287 -0
- package/Build/Workers/chunk-QX6AYJX2.js +455 -0
- package/Build/Workers/chunk-RSJUCJPN.js +241 -0
- package/Build/Workers/chunk-SPTT255E.js +301 -0
- package/Build/Workers/chunk-STXWAEVD.js +101 -0
- package/Build/Workers/chunk-SUG6ECWR.js +76 -0
- package/Build/Workers/chunk-TPT5IM72.js +280 -0
- package/Build/Workers/chunk-TTG2JNFN.js +198 -0
- package/Build/Workers/chunk-UDXUBVNR.js +1992 -0
- package/Build/Workers/chunk-UNXJWCXV.js +9230 -0
- package/Build/Workers/chunk-UTKCX3AS.js +352 -0
- package/Build/Workers/chunk-VL2WHGQI.js +305 -0
- package/Build/Workers/chunk-W37YFRTG.js +38 -0
- package/Build/Workers/chunk-W5AGSDWX.js +44 -0
- package/Build/Workers/chunk-WBQDTVCN.js +97 -0
- package/Build/Workers/chunk-WDSHSR57.js +837 -0
- package/Build/Workers/chunk-XPIDT6UT.js +1054 -0
- package/Build/Workers/chunk-XQETP7YD.js +3201 -0
- package/Build/Workers/chunk-Z3KHKVNA.js +56 -0
- package/Build/Workers/chunk-Z7XRKD6H.js +693 -0
- package/Build/Workers/chunk-ZQUSI7YK.js +630 -0
- package/Build/Workers/chunk-ZY4DTNR2.js +56 -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 +23 -23
- 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 +26 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
- package/Build/Workers/createVerticesFromHeightmap.js +23 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
- 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 +23 -23
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Source/Scene/Globe.js +55 -0
- package/Source/Scene/GlobeSurfaceShaderSet.js +132 -1
- package/Source/Scene/GlobeSurfaceTileProvider.js +378 -2
- package/Source/Scene/ImageryLayer.js +244 -10
- package/Source/Scene/QuadtreePrimitive.js +256 -2
- package/Source/Shaders/GlobeFS.glsl +43 -0
- package/Source/Shaders/GlobeFS.js +43 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.js +371 -371
- package/package.json +10 -10
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 1.141.4
|
|
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
|
+
WebGLConstants_default
|
|
28
|
+
} from "./chunk-ZQUSI7YK.js";
|
|
29
|
+
import {
|
|
30
|
+
DeveloperError_default
|
|
31
|
+
} from "./chunk-4MHUA5ZK.js";
|
|
32
|
+
import {
|
|
33
|
+
defined_default
|
|
34
|
+
} from "./chunk-PCXE4XMI.js";
|
|
35
|
+
|
|
36
|
+
// packages/engine/Source/Core/ComponentDatatype.js
|
|
37
|
+
var ComponentDatatype = {
|
|
38
|
+
/**
|
|
39
|
+
* 8-bit signed byte corresponding to <code>gl.BYTE</code> and the type
|
|
40
|
+
* of an element in <code>Int8Array</code>.
|
|
41
|
+
*
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @constant
|
|
44
|
+
*/
|
|
45
|
+
BYTE: WebGLConstants_default.BYTE,
|
|
46
|
+
/**
|
|
47
|
+
* 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
|
|
48
|
+
* of an element in <code>Uint8Array</code>.
|
|
49
|
+
*
|
|
50
|
+
* @type {number}
|
|
51
|
+
* @constant
|
|
52
|
+
*/
|
|
53
|
+
UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
|
|
54
|
+
/**
|
|
55
|
+
* 16-bit signed short corresponding to <code>SHORT</code> and the type
|
|
56
|
+
* of an element in <code>Int16Array</code>.
|
|
57
|
+
*
|
|
58
|
+
* @type {number}
|
|
59
|
+
* @constant
|
|
60
|
+
*/
|
|
61
|
+
SHORT: WebGLConstants_default.SHORT,
|
|
62
|
+
/**
|
|
63
|
+
* 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
|
|
64
|
+
* of an element in <code>Uint16Array</code>.
|
|
65
|
+
*
|
|
66
|
+
* @type {number}
|
|
67
|
+
* @constant
|
|
68
|
+
*/
|
|
69
|
+
UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
|
|
70
|
+
/**
|
|
71
|
+
* 32-bit signed int corresponding to <code>INT</code> and the type
|
|
72
|
+
* of an element in <code>Int32Array</code>.
|
|
73
|
+
*
|
|
74
|
+
* @memberOf ComponentDatatype
|
|
75
|
+
*
|
|
76
|
+
* @type {number}
|
|
77
|
+
* @constant
|
|
78
|
+
*/
|
|
79
|
+
INT: WebGLConstants_default.INT,
|
|
80
|
+
/**
|
|
81
|
+
* 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
|
|
82
|
+
* of an element in <code>Uint32Array</code>.
|
|
83
|
+
*
|
|
84
|
+
* @memberOf ComponentDatatype
|
|
85
|
+
*
|
|
86
|
+
* @type {number}
|
|
87
|
+
* @constant
|
|
88
|
+
*/
|
|
89
|
+
UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT,
|
|
90
|
+
/**
|
|
91
|
+
* 32-bit floating-point corresponding to <code>FLOAT</code> and the type
|
|
92
|
+
* of an element in <code>Float32Array</code>.
|
|
93
|
+
*
|
|
94
|
+
* @type {number}
|
|
95
|
+
* @constant
|
|
96
|
+
*/
|
|
97
|
+
FLOAT: WebGLConstants_default.FLOAT,
|
|
98
|
+
/**
|
|
99
|
+
* 64-bit floating-point corresponding to <code>gl.DOUBLE</code> (in Desktop OpenGL;
|
|
100
|
+
* this is not supported in WebGL, and is emulated in Cesium via {@link GeometryPipeline.encodeAttribute})
|
|
101
|
+
* and the type of an element in <code>Float64Array</code>.
|
|
102
|
+
*
|
|
103
|
+
* @memberOf ComponentDatatype
|
|
104
|
+
*
|
|
105
|
+
* @type {number}
|
|
106
|
+
* @constant
|
|
107
|
+
* @default 0x140A
|
|
108
|
+
*/
|
|
109
|
+
DOUBLE: WebGLConstants_default.DOUBLE
|
|
110
|
+
};
|
|
111
|
+
ComponentDatatype.getSizeInBytes = function(componentDatatype) {
|
|
112
|
+
if (!defined_default(componentDatatype)) {
|
|
113
|
+
throw new DeveloperError_default("value is required.");
|
|
114
|
+
}
|
|
115
|
+
switch (componentDatatype) {
|
|
116
|
+
case ComponentDatatype.BYTE:
|
|
117
|
+
return Int8Array.BYTES_PER_ELEMENT;
|
|
118
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
119
|
+
return Uint8Array.BYTES_PER_ELEMENT;
|
|
120
|
+
case ComponentDatatype.SHORT:
|
|
121
|
+
return Int16Array.BYTES_PER_ELEMENT;
|
|
122
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
123
|
+
return Uint16Array.BYTES_PER_ELEMENT;
|
|
124
|
+
case ComponentDatatype.INT:
|
|
125
|
+
return Int32Array.BYTES_PER_ELEMENT;
|
|
126
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
127
|
+
return Uint32Array.BYTES_PER_ELEMENT;
|
|
128
|
+
case ComponentDatatype.FLOAT:
|
|
129
|
+
return Float32Array.BYTES_PER_ELEMENT;
|
|
130
|
+
case ComponentDatatype.DOUBLE:
|
|
131
|
+
return Float64Array.BYTES_PER_ELEMENT;
|
|
132
|
+
//>>includeStart('debug', pragmas.debug);
|
|
133
|
+
default:
|
|
134
|
+
throw new DeveloperError_default("componentDatatype is not a valid value.");
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
ComponentDatatype.fromTypedArray = function(array) {
|
|
138
|
+
if (array instanceof Int8Array) {
|
|
139
|
+
return ComponentDatatype.BYTE;
|
|
140
|
+
}
|
|
141
|
+
if (array instanceof Uint8Array) {
|
|
142
|
+
return ComponentDatatype.UNSIGNED_BYTE;
|
|
143
|
+
}
|
|
144
|
+
if (array instanceof Int16Array) {
|
|
145
|
+
return ComponentDatatype.SHORT;
|
|
146
|
+
}
|
|
147
|
+
if (array instanceof Uint16Array) {
|
|
148
|
+
return ComponentDatatype.UNSIGNED_SHORT;
|
|
149
|
+
}
|
|
150
|
+
if (array instanceof Int32Array) {
|
|
151
|
+
return ComponentDatatype.INT;
|
|
152
|
+
}
|
|
153
|
+
if (array instanceof Uint32Array) {
|
|
154
|
+
return ComponentDatatype.UNSIGNED_INT;
|
|
155
|
+
}
|
|
156
|
+
if (array instanceof Float32Array) {
|
|
157
|
+
return ComponentDatatype.FLOAT;
|
|
158
|
+
}
|
|
159
|
+
if (array instanceof Float64Array) {
|
|
160
|
+
return ComponentDatatype.DOUBLE;
|
|
161
|
+
}
|
|
162
|
+
throw new DeveloperError_default(
|
|
163
|
+
"array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array."
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
ComponentDatatype.validate = function(componentDatatype) {
|
|
167
|
+
return defined_default(componentDatatype) && (componentDatatype === ComponentDatatype.BYTE || componentDatatype === ComponentDatatype.UNSIGNED_BYTE || componentDatatype === ComponentDatatype.SHORT || componentDatatype === ComponentDatatype.UNSIGNED_SHORT || componentDatatype === ComponentDatatype.INT || componentDatatype === ComponentDatatype.UNSIGNED_INT || componentDatatype === ComponentDatatype.FLOAT || componentDatatype === ComponentDatatype.DOUBLE);
|
|
168
|
+
};
|
|
169
|
+
ComponentDatatype.createTypedArray = function(componentDatatype, valuesOrLength) {
|
|
170
|
+
if (!defined_default(componentDatatype)) {
|
|
171
|
+
throw new DeveloperError_default("componentDatatype is required.");
|
|
172
|
+
}
|
|
173
|
+
if (!defined_default(valuesOrLength)) {
|
|
174
|
+
throw new DeveloperError_default("valuesOrLength is required.");
|
|
175
|
+
}
|
|
176
|
+
switch (componentDatatype) {
|
|
177
|
+
case ComponentDatatype.BYTE:
|
|
178
|
+
return new Int8Array(valuesOrLength);
|
|
179
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
180
|
+
return new Uint8Array(valuesOrLength);
|
|
181
|
+
case ComponentDatatype.SHORT:
|
|
182
|
+
return new Int16Array(valuesOrLength);
|
|
183
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
184
|
+
return new Uint16Array(valuesOrLength);
|
|
185
|
+
case ComponentDatatype.INT:
|
|
186
|
+
return new Int32Array(valuesOrLength);
|
|
187
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
188
|
+
return new Uint32Array(valuesOrLength);
|
|
189
|
+
case ComponentDatatype.FLOAT:
|
|
190
|
+
return new Float32Array(valuesOrLength);
|
|
191
|
+
case ComponentDatatype.DOUBLE:
|
|
192
|
+
return new Float64Array(valuesOrLength);
|
|
193
|
+
//>>includeStart('debug', pragmas.debug);
|
|
194
|
+
default:
|
|
195
|
+
throw new DeveloperError_default("componentDatatype is not a valid value.");
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
ComponentDatatype.createArrayBufferView = function(componentDatatype, buffer, byteOffset, length) {
|
|
199
|
+
if (!defined_default(componentDatatype)) {
|
|
200
|
+
throw new DeveloperError_default("componentDatatype is required.");
|
|
201
|
+
}
|
|
202
|
+
if (!defined_default(buffer)) {
|
|
203
|
+
throw new DeveloperError_default("buffer is required.");
|
|
204
|
+
}
|
|
205
|
+
byteOffset = byteOffset ?? 0;
|
|
206
|
+
length = length ?? (buffer.byteLength - byteOffset) / ComponentDatatype.getSizeInBytes(componentDatatype);
|
|
207
|
+
switch (componentDatatype) {
|
|
208
|
+
case ComponentDatatype.BYTE:
|
|
209
|
+
return new Int8Array(buffer, byteOffset, length);
|
|
210
|
+
case ComponentDatatype.UNSIGNED_BYTE:
|
|
211
|
+
return new Uint8Array(buffer, byteOffset, length);
|
|
212
|
+
case ComponentDatatype.SHORT:
|
|
213
|
+
return new Int16Array(buffer, byteOffset, length);
|
|
214
|
+
case ComponentDatatype.UNSIGNED_SHORT:
|
|
215
|
+
return new Uint16Array(buffer, byteOffset, length);
|
|
216
|
+
case ComponentDatatype.INT:
|
|
217
|
+
return new Int32Array(buffer, byteOffset, length);
|
|
218
|
+
case ComponentDatatype.UNSIGNED_INT:
|
|
219
|
+
return new Uint32Array(buffer, byteOffset, length);
|
|
220
|
+
case ComponentDatatype.FLOAT:
|
|
221
|
+
return new Float32Array(buffer, byteOffset, length);
|
|
222
|
+
case ComponentDatatype.DOUBLE:
|
|
223
|
+
return new Float64Array(buffer, byteOffset, length);
|
|
224
|
+
//>>includeStart('debug', pragmas.debug);
|
|
225
|
+
default:
|
|
226
|
+
throw new DeveloperError_default("componentDatatype is not a valid value.");
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
ComponentDatatype.fromName = function(name) {
|
|
230
|
+
switch (name) {
|
|
231
|
+
case "BYTE":
|
|
232
|
+
return ComponentDatatype.BYTE;
|
|
233
|
+
case "UNSIGNED_BYTE":
|
|
234
|
+
return ComponentDatatype.UNSIGNED_BYTE;
|
|
235
|
+
case "SHORT":
|
|
236
|
+
return ComponentDatatype.SHORT;
|
|
237
|
+
case "UNSIGNED_SHORT":
|
|
238
|
+
return ComponentDatatype.UNSIGNED_SHORT;
|
|
239
|
+
case "INT":
|
|
240
|
+
return ComponentDatatype.INT;
|
|
241
|
+
case "UNSIGNED_INT":
|
|
242
|
+
return ComponentDatatype.UNSIGNED_INT;
|
|
243
|
+
case "FLOAT":
|
|
244
|
+
return ComponentDatatype.FLOAT;
|
|
245
|
+
case "DOUBLE":
|
|
246
|
+
return ComponentDatatype.DOUBLE;
|
|
247
|
+
//>>includeStart('debug', pragmas.debug);
|
|
248
|
+
default:
|
|
249
|
+
throw new DeveloperError_default("name is not a valid value.");
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
Object.freeze(ComponentDatatype);
|
|
253
|
+
var ComponentDatatype_default = ComponentDatatype;
|
|
254
|
+
|
|
255
|
+
export {
|
|
256
|
+
ComponentDatatype_default
|
|
257
|
+
};
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 1.141.4
|
|
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
|
+
EllipsoidGeodesic_default
|
|
28
|
+
} from "./chunk-AM56LGEB.js";
|
|
29
|
+
import {
|
|
30
|
+
EllipsoidRhumbLine_default
|
|
31
|
+
} from "./chunk-QX6AYJX2.js";
|
|
32
|
+
import {
|
|
33
|
+
IntersectionTests_default
|
|
34
|
+
} from "./chunk-65LZTCWG.js";
|
|
35
|
+
import {
|
|
36
|
+
Plane_default
|
|
37
|
+
} from "./chunk-DNEERCHO.js";
|
|
38
|
+
import {
|
|
39
|
+
Matrix4_default
|
|
40
|
+
} from "./chunk-XQETP7YD.js";
|
|
41
|
+
import {
|
|
42
|
+
Cartographic_default,
|
|
43
|
+
Ellipsoid_default
|
|
44
|
+
} from "./chunk-UDXUBVNR.js";
|
|
45
|
+
import {
|
|
46
|
+
Cartesian3_default
|
|
47
|
+
} from "./chunk-MD7CEJO5.js";
|
|
48
|
+
import {
|
|
49
|
+
Math_default
|
|
50
|
+
} from "./chunk-GH2D6MPO.js";
|
|
51
|
+
import {
|
|
52
|
+
DeveloperError_default
|
|
53
|
+
} from "./chunk-4MHUA5ZK.js";
|
|
54
|
+
import {
|
|
55
|
+
defined_default
|
|
56
|
+
} from "./chunk-PCXE4XMI.js";
|
|
57
|
+
|
|
58
|
+
// packages/engine/Source/Core/PolylinePipeline.js
|
|
59
|
+
var PolylinePipeline = {};
|
|
60
|
+
PolylinePipeline.numberOfPoints = function(p0, p1, minDistance) {
|
|
61
|
+
const distance = Cartesian3_default.distance(p0, p1);
|
|
62
|
+
return Math.ceil(distance / minDistance);
|
|
63
|
+
};
|
|
64
|
+
PolylinePipeline.numberOfPointsRhumbLine = function(p0, p1, granularity) {
|
|
65
|
+
const radiansDistanceSquared = Math.pow(p0.longitude - p1.longitude, 2) + Math.pow(p0.latitude - p1.latitude, 2);
|
|
66
|
+
return Math.max(
|
|
67
|
+
1,
|
|
68
|
+
Math.ceil(Math.sqrt(radiansDistanceSquared / (granularity * granularity)))
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
var cartoScratch = new Cartographic_default();
|
|
72
|
+
PolylinePipeline.extractHeights = function(positions, ellipsoid) {
|
|
73
|
+
const length = positions.length;
|
|
74
|
+
const heights = new Array(length);
|
|
75
|
+
for (let i = 0; i < length; i++) {
|
|
76
|
+
const p = positions[i];
|
|
77
|
+
heights[i] = ellipsoid.cartesianToCartographic(p, cartoScratch).height;
|
|
78
|
+
}
|
|
79
|
+
return heights;
|
|
80
|
+
};
|
|
81
|
+
var wrapLongitudeInversMatrix = new Matrix4_default();
|
|
82
|
+
var wrapLongitudeOrigin = new Cartesian3_default();
|
|
83
|
+
var wrapLongitudeXZNormal = new Cartesian3_default();
|
|
84
|
+
var wrapLongitudeXZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
|
|
85
|
+
var wrapLongitudeYZNormal = new Cartesian3_default();
|
|
86
|
+
var wrapLongitudeYZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
|
|
87
|
+
var wrapLongitudeIntersection = new Cartesian3_default();
|
|
88
|
+
var wrapLongitudeOffset = new Cartesian3_default();
|
|
89
|
+
var subdivideHeightsScratchArray = [];
|
|
90
|
+
function subdivideHeights(numPoints, h0, h1) {
|
|
91
|
+
const heights = subdivideHeightsScratchArray;
|
|
92
|
+
heights.length = numPoints;
|
|
93
|
+
let i;
|
|
94
|
+
if (h0 === h1) {
|
|
95
|
+
for (i = 0; i < numPoints; i++) {
|
|
96
|
+
heights[i] = h0;
|
|
97
|
+
}
|
|
98
|
+
return heights;
|
|
99
|
+
}
|
|
100
|
+
const dHeight = h1 - h0;
|
|
101
|
+
const heightPerVertex = dHeight / numPoints;
|
|
102
|
+
for (i = 0; i < numPoints; i++) {
|
|
103
|
+
const h = h0 + i * heightPerVertex;
|
|
104
|
+
heights[i] = h;
|
|
105
|
+
}
|
|
106
|
+
return heights;
|
|
107
|
+
}
|
|
108
|
+
var carto1 = new Cartographic_default();
|
|
109
|
+
var carto2 = new Cartographic_default();
|
|
110
|
+
var cartesian = new Cartesian3_default();
|
|
111
|
+
var scaleFirst = new Cartesian3_default();
|
|
112
|
+
var scaleLast = new Cartesian3_default();
|
|
113
|
+
var ellipsoidGeodesic = new EllipsoidGeodesic_default();
|
|
114
|
+
var ellipsoidRhumb = new EllipsoidRhumbLine_default();
|
|
115
|
+
function generateCartesianArc(p0, p1, minDistance, ellipsoid, h0, h1, array, offset) {
|
|
116
|
+
const first = ellipsoid.scaleToGeodeticSurface(p0, scaleFirst);
|
|
117
|
+
const last = ellipsoid.scaleToGeodeticSurface(p1, scaleLast);
|
|
118
|
+
const numPoints = PolylinePipeline.numberOfPoints(p0, p1, minDistance);
|
|
119
|
+
const start = ellipsoid.cartesianToCartographic(first, carto1);
|
|
120
|
+
const end = ellipsoid.cartesianToCartographic(last, carto2);
|
|
121
|
+
const heights = subdivideHeights(numPoints, h0, h1);
|
|
122
|
+
ellipsoidGeodesic.setEndPoints(start, end);
|
|
123
|
+
const surfaceDistanceBetweenPoints = ellipsoidGeodesic.surfaceDistance / numPoints;
|
|
124
|
+
let index = offset;
|
|
125
|
+
start.height = h0;
|
|
126
|
+
let cart = ellipsoid.cartographicToCartesian(start, cartesian);
|
|
127
|
+
Cartesian3_default.pack(cart, array, index);
|
|
128
|
+
index += 3;
|
|
129
|
+
for (let i = 1; i < numPoints; i++) {
|
|
130
|
+
const carto = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
|
|
131
|
+
i * surfaceDistanceBetweenPoints,
|
|
132
|
+
carto2
|
|
133
|
+
);
|
|
134
|
+
carto.height = heights[i];
|
|
135
|
+
cart = ellipsoid.cartographicToCartesian(carto, cartesian);
|
|
136
|
+
Cartesian3_default.pack(cart, array, index);
|
|
137
|
+
index += 3;
|
|
138
|
+
}
|
|
139
|
+
return index;
|
|
140
|
+
}
|
|
141
|
+
function generateCartesianRhumbArc(p0, p1, granularity, ellipsoid, h0, h1, array, offset) {
|
|
142
|
+
const start = ellipsoid.cartesianToCartographic(p0, carto1);
|
|
143
|
+
const end = ellipsoid.cartesianToCartographic(p1, carto2);
|
|
144
|
+
const numPoints = PolylinePipeline.numberOfPointsRhumbLine(
|
|
145
|
+
start,
|
|
146
|
+
end,
|
|
147
|
+
granularity
|
|
148
|
+
);
|
|
149
|
+
start.height = 0;
|
|
150
|
+
end.height = 0;
|
|
151
|
+
const heights = subdivideHeights(numPoints, h0, h1);
|
|
152
|
+
if (!ellipsoidRhumb.ellipsoid.equals(ellipsoid)) {
|
|
153
|
+
ellipsoidRhumb = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
|
|
154
|
+
}
|
|
155
|
+
ellipsoidRhumb.setEndPoints(start, end);
|
|
156
|
+
const surfaceDistanceBetweenPoints = ellipsoidRhumb.surfaceDistance / numPoints;
|
|
157
|
+
let index = offset;
|
|
158
|
+
start.height = h0;
|
|
159
|
+
let cart = ellipsoid.cartographicToCartesian(start, cartesian);
|
|
160
|
+
Cartesian3_default.pack(cart, array, index);
|
|
161
|
+
index += 3;
|
|
162
|
+
for (let i = 1; i < numPoints; i++) {
|
|
163
|
+
const carto = ellipsoidRhumb.interpolateUsingSurfaceDistance(
|
|
164
|
+
i * surfaceDistanceBetweenPoints,
|
|
165
|
+
carto2
|
|
166
|
+
);
|
|
167
|
+
carto.height = heights[i];
|
|
168
|
+
cart = ellipsoid.cartographicToCartesian(carto, cartesian);
|
|
169
|
+
Cartesian3_default.pack(cart, array, index);
|
|
170
|
+
index += 3;
|
|
171
|
+
}
|
|
172
|
+
return index;
|
|
173
|
+
}
|
|
174
|
+
PolylinePipeline.wrapLongitude = function(positions, modelMatrix) {
|
|
175
|
+
const cartesians = [];
|
|
176
|
+
const segments = [];
|
|
177
|
+
if (defined_default(positions) && positions.length > 0) {
|
|
178
|
+
modelMatrix = modelMatrix ?? Matrix4_default.IDENTITY;
|
|
179
|
+
const inverseModelMatrix = Matrix4_default.inverseTransformation(
|
|
180
|
+
modelMatrix,
|
|
181
|
+
wrapLongitudeInversMatrix
|
|
182
|
+
);
|
|
183
|
+
const origin = Matrix4_default.multiplyByPoint(
|
|
184
|
+
inverseModelMatrix,
|
|
185
|
+
Cartesian3_default.ZERO,
|
|
186
|
+
wrapLongitudeOrigin
|
|
187
|
+
);
|
|
188
|
+
const xzNormal = Cartesian3_default.normalize(
|
|
189
|
+
Matrix4_default.multiplyByPointAsVector(
|
|
190
|
+
inverseModelMatrix,
|
|
191
|
+
Cartesian3_default.UNIT_Y,
|
|
192
|
+
wrapLongitudeXZNormal
|
|
193
|
+
),
|
|
194
|
+
wrapLongitudeXZNormal
|
|
195
|
+
);
|
|
196
|
+
const xzPlane = Plane_default.fromPointNormal(
|
|
197
|
+
origin,
|
|
198
|
+
xzNormal,
|
|
199
|
+
wrapLongitudeXZPlane
|
|
200
|
+
);
|
|
201
|
+
const yzNormal = Cartesian3_default.normalize(
|
|
202
|
+
Matrix4_default.multiplyByPointAsVector(
|
|
203
|
+
inverseModelMatrix,
|
|
204
|
+
Cartesian3_default.UNIT_X,
|
|
205
|
+
wrapLongitudeYZNormal
|
|
206
|
+
),
|
|
207
|
+
wrapLongitudeYZNormal
|
|
208
|
+
);
|
|
209
|
+
const yzPlane = Plane_default.fromPointNormal(
|
|
210
|
+
origin,
|
|
211
|
+
yzNormal,
|
|
212
|
+
wrapLongitudeYZPlane
|
|
213
|
+
);
|
|
214
|
+
let count = 1;
|
|
215
|
+
cartesians.push(Cartesian3_default.clone(positions[0]));
|
|
216
|
+
let prev = cartesians[0];
|
|
217
|
+
const length = positions.length;
|
|
218
|
+
for (let i = 1; i < length; ++i) {
|
|
219
|
+
const cur = positions[i];
|
|
220
|
+
if (Plane_default.getPointDistance(yzPlane, prev) < 0 || Plane_default.getPointDistance(yzPlane, cur) < 0) {
|
|
221
|
+
const intersection = IntersectionTests_default.lineSegmentPlane(
|
|
222
|
+
prev,
|
|
223
|
+
cur,
|
|
224
|
+
xzPlane,
|
|
225
|
+
wrapLongitudeIntersection
|
|
226
|
+
);
|
|
227
|
+
if (defined_default(intersection)) {
|
|
228
|
+
const offset = Cartesian3_default.multiplyByScalar(
|
|
229
|
+
xzNormal,
|
|
230
|
+
5e-9,
|
|
231
|
+
wrapLongitudeOffset
|
|
232
|
+
);
|
|
233
|
+
if (Plane_default.getPointDistance(xzPlane, prev) < 0) {
|
|
234
|
+
Cartesian3_default.negate(offset, offset);
|
|
235
|
+
}
|
|
236
|
+
cartesians.push(
|
|
237
|
+
Cartesian3_default.add(intersection, offset, new Cartesian3_default())
|
|
238
|
+
);
|
|
239
|
+
segments.push(count + 1);
|
|
240
|
+
Cartesian3_default.negate(offset, offset);
|
|
241
|
+
cartesians.push(
|
|
242
|
+
Cartesian3_default.add(intersection, offset, new Cartesian3_default())
|
|
243
|
+
);
|
|
244
|
+
count = 1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
cartesians.push(Cartesian3_default.clone(positions[i]));
|
|
248
|
+
count++;
|
|
249
|
+
prev = cur;
|
|
250
|
+
}
|
|
251
|
+
segments.push(count);
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
positions: cartesians,
|
|
255
|
+
lengths: segments
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
PolylinePipeline.generateArc = function(options) {
|
|
259
|
+
if (!defined_default(options)) {
|
|
260
|
+
options = {};
|
|
261
|
+
}
|
|
262
|
+
const positions = options.positions;
|
|
263
|
+
if (!defined_default(positions)) {
|
|
264
|
+
throw new DeveloperError_default("options.positions is required.");
|
|
265
|
+
}
|
|
266
|
+
const length = positions.length;
|
|
267
|
+
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
|
|
268
|
+
let height = options.height ?? 0;
|
|
269
|
+
const hasHeightArray = Array.isArray(height);
|
|
270
|
+
if (length < 1) {
|
|
271
|
+
return [];
|
|
272
|
+
} else if (length === 1) {
|
|
273
|
+
const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
|
|
274
|
+
height = hasHeightArray ? height[0] : height;
|
|
275
|
+
if (height !== 0) {
|
|
276
|
+
const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
|
|
277
|
+
Cartesian3_default.multiplyByScalar(n, height, n);
|
|
278
|
+
Cartesian3_default.add(p, n, p);
|
|
279
|
+
}
|
|
280
|
+
return [p.x, p.y, p.z];
|
|
281
|
+
}
|
|
282
|
+
let minDistance = options.minDistance;
|
|
283
|
+
if (!defined_default(minDistance)) {
|
|
284
|
+
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
|
|
285
|
+
minDistance = Math_default.chordLength(granularity, ellipsoid.maximumRadius);
|
|
286
|
+
}
|
|
287
|
+
let numPoints = 0;
|
|
288
|
+
let i;
|
|
289
|
+
for (i = 0; i < length - 1; i++) {
|
|
290
|
+
numPoints += PolylinePipeline.numberOfPoints(
|
|
291
|
+
positions[i],
|
|
292
|
+
positions[i + 1],
|
|
293
|
+
minDistance
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
const arrayLength = (numPoints + 1) * 3;
|
|
297
|
+
const newPositions = new Array(arrayLength);
|
|
298
|
+
let offset = 0;
|
|
299
|
+
for (i = 0; i < length - 1; i++) {
|
|
300
|
+
const p0 = positions[i];
|
|
301
|
+
const p1 = positions[i + 1];
|
|
302
|
+
const h0 = hasHeightArray ? height[i] : height;
|
|
303
|
+
const h1 = hasHeightArray ? height[i + 1] : height;
|
|
304
|
+
offset = generateCartesianArc(
|
|
305
|
+
p0,
|
|
306
|
+
p1,
|
|
307
|
+
minDistance,
|
|
308
|
+
ellipsoid,
|
|
309
|
+
h0,
|
|
310
|
+
h1,
|
|
311
|
+
newPositions,
|
|
312
|
+
offset
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
subdivideHeightsScratchArray.length = 0;
|
|
316
|
+
const lastPoint = positions[length - 1];
|
|
317
|
+
const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
|
|
318
|
+
carto.height = hasHeightArray ? height[length - 1] : height;
|
|
319
|
+
const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
|
|
320
|
+
Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
|
|
321
|
+
return newPositions;
|
|
322
|
+
};
|
|
323
|
+
var scratchCartographic0 = new Cartographic_default();
|
|
324
|
+
var scratchCartographic1 = new Cartographic_default();
|
|
325
|
+
PolylinePipeline.generateRhumbArc = function(options) {
|
|
326
|
+
if (!defined_default(options)) {
|
|
327
|
+
options = {};
|
|
328
|
+
}
|
|
329
|
+
const positions = options.positions;
|
|
330
|
+
if (!defined_default(positions)) {
|
|
331
|
+
throw new DeveloperError_default("options.positions is required.");
|
|
332
|
+
}
|
|
333
|
+
const length = positions.length;
|
|
334
|
+
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
|
|
335
|
+
let height = options.height ?? 0;
|
|
336
|
+
const hasHeightArray = Array.isArray(height);
|
|
337
|
+
if (length < 1) {
|
|
338
|
+
return [];
|
|
339
|
+
} else if (length === 1) {
|
|
340
|
+
const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
|
|
341
|
+
height = hasHeightArray ? height[0] : height;
|
|
342
|
+
if (height !== 0) {
|
|
343
|
+
const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
|
|
344
|
+
Cartesian3_default.multiplyByScalar(n, height, n);
|
|
345
|
+
Cartesian3_default.add(p, n, p);
|
|
346
|
+
}
|
|
347
|
+
return [p.x, p.y, p.z];
|
|
348
|
+
}
|
|
349
|
+
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
|
|
350
|
+
let numPoints = 0;
|
|
351
|
+
let i;
|
|
352
|
+
let c0 = ellipsoid.cartesianToCartographic(
|
|
353
|
+
positions[0],
|
|
354
|
+
scratchCartographic0
|
|
355
|
+
);
|
|
356
|
+
let c1;
|
|
357
|
+
for (i = 0; i < length - 1; i++) {
|
|
358
|
+
c1 = ellipsoid.cartesianToCartographic(
|
|
359
|
+
positions[i + 1],
|
|
360
|
+
scratchCartographic1
|
|
361
|
+
);
|
|
362
|
+
numPoints += PolylinePipeline.numberOfPointsRhumbLine(c0, c1, granularity);
|
|
363
|
+
c0 = Cartographic_default.clone(c1, scratchCartographic0);
|
|
364
|
+
}
|
|
365
|
+
const arrayLength = (numPoints + 1) * 3;
|
|
366
|
+
const newPositions = new Array(arrayLength);
|
|
367
|
+
let offset = 0;
|
|
368
|
+
for (i = 0; i < length - 1; i++) {
|
|
369
|
+
const p0 = positions[i];
|
|
370
|
+
const p1 = positions[i + 1];
|
|
371
|
+
const h0 = hasHeightArray ? height[i] : height;
|
|
372
|
+
const h1 = hasHeightArray ? height[i + 1] : height;
|
|
373
|
+
offset = generateCartesianRhumbArc(
|
|
374
|
+
p0,
|
|
375
|
+
p1,
|
|
376
|
+
granularity,
|
|
377
|
+
ellipsoid,
|
|
378
|
+
h0,
|
|
379
|
+
h1,
|
|
380
|
+
newPositions,
|
|
381
|
+
offset
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
subdivideHeightsScratchArray.length = 0;
|
|
385
|
+
const lastPoint = positions[length - 1];
|
|
386
|
+
const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
|
|
387
|
+
carto.height = hasHeightArray ? height[length - 1] : height;
|
|
388
|
+
const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
|
|
389
|
+
Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
|
|
390
|
+
return newPositions;
|
|
391
|
+
};
|
|
392
|
+
PolylinePipeline.generateCartesianArc = function(options) {
|
|
393
|
+
const numberArray = PolylinePipeline.generateArc(options);
|
|
394
|
+
const size = numberArray.length / 3;
|
|
395
|
+
const newPositions = new Array(size);
|
|
396
|
+
for (let i = 0; i < size; i++) {
|
|
397
|
+
newPositions[i] = Cartesian3_default.unpack(numberArray, i * 3);
|
|
398
|
+
}
|
|
399
|
+
return newPositions;
|
|
400
|
+
};
|
|
401
|
+
PolylinePipeline.generateCartesianRhumbArc = function(options) {
|
|
402
|
+
const numberArray = PolylinePipeline.generateRhumbArc(options);
|
|
403
|
+
const size = numberArray.length / 3;
|
|
404
|
+
const newPositions = new Array(size);
|
|
405
|
+
for (let i = 0; i < size; i++) {
|
|
406
|
+
newPositions[i] = Cartesian3_default.unpack(numberArray, i * 3);
|
|
407
|
+
}
|
|
408
|
+
return newPositions;
|
|
409
|
+
};
|
|
410
|
+
var PolylinePipeline_default = PolylinePipeline;
|
|
411
|
+
|
|
412
|
+
export {
|
|
413
|
+
PolylinePipeline_default
|
|
414
|
+
};
|