@pggis/pg-sdk 3.3.10 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/index.js +1966 -4
- package/dist/pggis.min.css +1 -1
- package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
- package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
- package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
- package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
- package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
- package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
- package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
- package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
- package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
- package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
- package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
- package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
- package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
- package/dist/resources/Workers/{chunk-F3YA3Y2Z.js → chunk-A56XVLQR.js} +2 -13
- package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
- package/dist/resources/Workers/{chunk-EHWHNOEX.js → chunk-ARG42DC4.js} +2 -31
- package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
- package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
- package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
- package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
- package/dist/resources/Workers/{chunk-4H7PY4U5.js → chunk-D6AA5QVT.js} +2 -20
- package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
- package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
- package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
- package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
- package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
- package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
- package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
- package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
- package/dist/resources/Workers/{chunk-BBWDMCVU.js → chunk-GBYLG25F.js} +2 -15
- package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
- package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
- package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
- package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
- package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
- package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
- package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
- package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
- package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
- package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
- package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
- package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
- package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
- package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
- package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
- package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
- package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
- package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
- package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
- package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
- package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
- package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
- package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
- package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
- package/dist/resources/Workers/chunk-WZDE3RYP.js +28 -0
- package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
- package/dist/resources/Workers/combineGeometry.js +2 -44
- package/dist/resources/Workers/createBoxGeometry.js +2 -34
- package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -211
- package/dist/resources/Workers/createCircleGeometry.js +2 -173
- package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -123
- package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -482
- package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -201
- package/dist/resources/Workers/createCorridorGeometry.js +2 -1239
- package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -544
- package/dist/resources/Workers/createCylinderGeometry.js +2 -36
- package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -207
- package/dist/resources/Workers/createEllipseGeometry.js +2 -47
- package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -40
- package/dist/resources/Workers/createEllipsoidGeometry.js +2 -35
- package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -37
- package/dist/resources/Workers/createFrustumGeometry.js +2 -34
- package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -211
- package/dist/resources/Workers/createGeometry.js +2 -147
- package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1584
- package/dist/resources/Workers/createPlaneGeometry.js +2 -200
- package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -100
- package/dist/resources/Workers/createPolygonGeometry.js +2 -1387
- package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -519
- package/dist/resources/Workers/createPolylineGeometry.js +2 -472
- package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -355
- package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -253
- package/dist/resources/Workers/createRectangleGeometry.js +2 -1250
- package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -455
- package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -376
- package/dist/resources/Workers/createSphereGeometry.js +2 -94
- package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -94
- package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
- package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -468
- package/dist/resources/Workers/createVectorTileGeometries.js +2 -363
- package/dist/resources/Workers/createVectorTilePoints.js +2 -88
- package/dist/resources/Workers/createVectorTilePolygons.js +2 -361
- package/dist/resources/Workers/createVectorTilePolylines.js +2 -238
- package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -545
- package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2254
- package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -722
- package/dist/resources/Workers/createWallGeometry.js +2 -466
- package/dist/resources/Workers/createWallOutlineGeometry.js +2 -314
- package/dist/resources/Workers/decodeDraco.js +2 -345
- package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2626
- package/dist/resources/Workers/decodeI3S.js +2 -1320
- package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
- package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
- package/dist/resources/Workers/transcodeKTX2.js +29 -3398
- package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
- package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -795
- package/package.json +9 -8
- package/dist/pggis.min.js +0 -14796
- package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
- package/dist/resources/Workers/chunk-23UFSGND.js +0 -236
- package/dist/resources/Workers/chunk-2A75IWRS.js +0 -218
- package/dist/resources/Workers/chunk-2FRVPMCS.js +0 -1258
- package/dist/resources/Workers/chunk-2FWRMUTY.js +0 -138
- package/dist/resources/Workers/chunk-2UPKWTMJ.js +0 -117
- package/dist/resources/Workers/chunk-34FXV7D7.js +0 -73
- package/dist/resources/Workers/chunk-3VAZEH7M.js +0 -101
- package/dist/resources/Workers/chunk-4DO5W5XZ.js +0 -196
- package/dist/resources/Workers/chunk-5QULIR53.js +0 -501
- package/dist/resources/Workers/chunk-7TC63SJW.js +0 -302
- package/dist/resources/Workers/chunk-7ZFGPDJA.js +0 -122
- package/dist/resources/Workers/chunk-A5DWLWCY.js +0 -834
- package/dist/resources/Workers/chunk-BG4UCVXN.js +0 -73
- package/dist/resources/Workers/chunk-BIKA3NRA.js +0 -59
- package/dist/resources/Workers/chunk-BROJAZRZ.js +0 -390
- package/dist/resources/Workers/chunk-DDUQAJ4P.js +0 -476
- package/dist/resources/Workers/chunk-EERJKOAF.js +0 -305
- package/dist/resources/Workers/chunk-EG6PTBY2.js +0 -2716
- package/dist/resources/Workers/chunk-F4HFJMGM.js +0 -353
- package/dist/resources/Workers/chunk-FJKNFAKQ.js +0 -8219
- package/dist/resources/Workers/chunk-FNIRWHJB.js +0 -289
- package/dist/resources/Workers/chunk-FZRIVR7Y.js +0 -100
- package/dist/resources/Workers/chunk-G43QFN4Q.js +0 -157
- package/dist/resources/Workers/chunk-GATZHF3K.js +0 -1860
- package/dist/resources/Workers/chunk-GRC2ZTAF.js +0 -398
- package/dist/resources/Workers/chunk-HU6N6EXB.js +0 -767
- package/dist/resources/Workers/chunk-I46ZRR5W.js +0 -1052
- package/dist/resources/Workers/chunk-JURN7NPV.js +0 -1075
- package/dist/resources/Workers/chunk-KKCR2YOP.js +0 -421
- package/dist/resources/Workers/chunk-LPR3YNP2.js +0 -138
- package/dist/resources/Workers/chunk-M7ERACJJ.js +0 -511
- package/dist/resources/Workers/chunk-MDWEGWPA.js +0 -1007
- package/dist/resources/Workers/chunk-OGXZVPPM.js +0 -2365
- package/dist/resources/Workers/chunk-PGSJK77E.js +0 -634
- package/dist/resources/Workers/chunk-PPH7OFP3.js +0 -258
- package/dist/resources/Workers/chunk-SH5USDPI.js +0 -456
- package/dist/resources/Workers/chunk-SOWMRMWA.js +0 -629
- package/dist/resources/Workers/chunk-STW2DGFI.js +0 -58
- package/dist/resources/Workers/chunk-T3XIFPYR.js +0 -1477
- package/dist/resources/Workers/chunk-TTUZP4BO.js +0 -501
- package/dist/resources/Workers/chunk-UEXTBDBE.js +0 -693
- package/dist/resources/Workers/chunk-VOXYEYJT.js +0 -684
- package/dist/resources/Workers/chunk-X4356LRH.js +0 -368
- package/dist/resources/Workers/chunk-XGI5BXZY.js +0 -163
- package/dist/resources/Workers/chunk-Y2ME2IJV.js +0 -781
- package/dist/resources/Workers/chunk-Y5UQJLYE.js +0 -171
- package/dist/resources/Workers/chunk-YJEBABKH.js +0 -2977
- package/dist/resources/Workers/chunk-YWTJ2B4B.js +0 -77
- package/dist/resources/Workers/chunk-Z3TIFFGF.js +0 -430
- package/dist/resources/Workers/chunk-ZT7KWISZ.js +0 -102
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.
|
|
4
|
+
* Version 1.132
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
|
7
7
|
*
|
|
@@ -23,1389 +23,4 @@
|
|
|
23
23
|
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import {
|
|
27
|
-
BoundingRectangle_default
|
|
28
|
-
} from "./chunk-2A75IWRS.js";
|
|
29
|
-
import {
|
|
30
|
-
PolygonGeometryLibrary_default
|
|
31
|
-
} from "./chunk-I46ZRR5W.js";
|
|
32
|
-
import {
|
|
33
|
-
ArcType_default
|
|
34
|
-
} from "./chunk-EHWHNOEX.js";
|
|
35
|
-
import {
|
|
36
|
-
GeometryInstance_default
|
|
37
|
-
} from "./chunk-BIKA3NRA.js";
|
|
38
|
-
import {
|
|
39
|
-
GeometryPipeline_default
|
|
40
|
-
} from "./chunk-EG6PTBY2.js";
|
|
41
|
-
import "./chunk-Z3TIFFGF.js";
|
|
42
|
-
import "./chunk-ZT7KWISZ.js";
|
|
43
|
-
import {
|
|
44
|
-
GeometryOffsetAttribute_default
|
|
45
|
-
} from "./chunk-F3YA3Y2Z.js";
|
|
46
|
-
import {
|
|
47
|
-
VertexFormat_default
|
|
48
|
-
} from "./chunk-2FWRMUTY.js";
|
|
49
|
-
import {
|
|
50
|
-
EllipsoidTangentPlane_default
|
|
51
|
-
} from "./chunk-FNIRWHJB.js";
|
|
52
|
-
import "./chunk-G43QFN4Q.js";
|
|
53
|
-
import {
|
|
54
|
-
PolygonPipeline_default,
|
|
55
|
-
WindingOrder_default
|
|
56
|
-
} from "./chunk-MDWEGWPA.js";
|
|
57
|
-
import "./chunk-FZRIVR7Y.js";
|
|
58
|
-
import "./chunk-SH5USDPI.js";
|
|
59
|
-
import {
|
|
60
|
-
IntersectionTests_default,
|
|
61
|
-
Ray_default
|
|
62
|
-
} from "./chunk-2FRVPMCS.js";
|
|
63
|
-
import "./chunk-Y5UQJLYE.js";
|
|
64
|
-
import {
|
|
65
|
-
IndexDatatype_default
|
|
66
|
-
} from "./chunk-LPR3YNP2.js";
|
|
67
|
-
import "./chunk-4H7PY4U5.js";
|
|
68
|
-
import {
|
|
69
|
-
GeometryAttribute_default,
|
|
70
|
-
Geometry_default
|
|
71
|
-
} from "./chunk-7TC63SJW.js";
|
|
72
|
-
import {
|
|
73
|
-
BoundingSphere_default,
|
|
74
|
-
Quaternion_default
|
|
75
|
-
} from "./chunk-FJKNFAKQ.js";
|
|
76
|
-
import "./chunk-TTUZP4BO.js";
|
|
77
|
-
import "./chunk-BG4UCVXN.js";
|
|
78
|
-
import {
|
|
79
|
-
Rectangle_default
|
|
80
|
-
} from "./chunk-YJEBABKH.js";
|
|
81
|
-
import {
|
|
82
|
-
ComponentDatatype_default
|
|
83
|
-
} from "./chunk-PPH7OFP3.js";
|
|
84
|
-
import {
|
|
85
|
-
Cartesian2_default,
|
|
86
|
-
Cartesian3_default,
|
|
87
|
-
Cartographic_default,
|
|
88
|
-
Ellipsoid_default,
|
|
89
|
-
Matrix3_default
|
|
90
|
-
} from "./chunk-OGXZVPPM.js";
|
|
91
|
-
import {
|
|
92
|
-
Math_default
|
|
93
|
-
} from "./chunk-5QULIR53.js";
|
|
94
|
-
import "./chunk-SOWMRMWA.js";
|
|
95
|
-
import "./chunk-STW2DGFI.js";
|
|
96
|
-
import {
|
|
97
|
-
defaultValue_default
|
|
98
|
-
} from "./chunk-BBWDMCVU.js";
|
|
99
|
-
import {
|
|
100
|
-
Check_default,
|
|
101
|
-
DeveloperError_default
|
|
102
|
-
} from "./chunk-XGI5BXZY.js";
|
|
103
|
-
import {
|
|
104
|
-
defined_default
|
|
105
|
-
} from "./chunk-YWTJ2B4B.js";
|
|
106
|
-
|
|
107
|
-
// packages/engine/Source/Core/Stereographic.js
|
|
108
|
-
function Stereographic(position, tangentPlane) {
|
|
109
|
-
this.position = position;
|
|
110
|
-
if (!defined_default(this.position)) {
|
|
111
|
-
this.position = new Cartesian2_default();
|
|
112
|
-
}
|
|
113
|
-
this.tangentPlane = tangentPlane;
|
|
114
|
-
if (!defined_default(this.tangentPlane)) {
|
|
115
|
-
this.tangentPlane = Stereographic.NORTH_POLE_TANGENT_PLANE;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
Object.defineProperties(Stereographic.prototype, {
|
|
119
|
-
/**
|
|
120
|
-
* Gets the ellipsoid.
|
|
121
|
-
* @memberof Stereographic.prototype
|
|
122
|
-
* @type {Ellipsoid}
|
|
123
|
-
*/
|
|
124
|
-
ellipsoid: {
|
|
125
|
-
get: function() {
|
|
126
|
-
return this.tangentPlane.ellipsoid;
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
/**
|
|
130
|
-
* Gets the x coordinate
|
|
131
|
-
* @memberof Stereographic.prototype
|
|
132
|
-
* @type {number}
|
|
133
|
-
*/
|
|
134
|
-
x: {
|
|
135
|
-
get: function() {
|
|
136
|
-
return this.position.x;
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
/**
|
|
140
|
-
* Gets the y coordinate
|
|
141
|
-
* @memberof Stereographic.prototype
|
|
142
|
-
* @type {number}
|
|
143
|
-
*/
|
|
144
|
-
y: {
|
|
145
|
-
get: function() {
|
|
146
|
-
return this.position.y;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
/**
|
|
150
|
-
* Computes the conformal latitude, or the ellipsoidal latitude projected onto an arbitrary sphere.
|
|
151
|
-
* @memberof Stereographic.prototype
|
|
152
|
-
* @type {number}
|
|
153
|
-
*/
|
|
154
|
-
conformalLatitude: {
|
|
155
|
-
get: function() {
|
|
156
|
-
const r = Cartesian2_default.magnitude(this.position);
|
|
157
|
-
const d = 2 * this.ellipsoid.maximumRadius;
|
|
158
|
-
const sign = this.tangentPlane.plane.normal.z;
|
|
159
|
-
return sign * (Math_default.PI_OVER_TWO - 2 * Math.atan2(r, d));
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
/**
|
|
163
|
-
* Computes the longitude
|
|
164
|
-
* @memberof Stereographic.prototype
|
|
165
|
-
* @type {number}
|
|
166
|
-
*/
|
|
167
|
-
longitude: {
|
|
168
|
-
get: function() {
|
|
169
|
-
let longitude = Math_default.PI_OVER_TWO + Math.atan2(this.y, this.x);
|
|
170
|
-
if (longitude > Math.PI) {
|
|
171
|
-
longitude -= Math_default.TWO_PI;
|
|
172
|
-
}
|
|
173
|
-
return longitude;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
var scratchCartographic = new Cartographic_default();
|
|
178
|
-
var scratchCartesian = new Cartesian3_default();
|
|
179
|
-
Stereographic.prototype.getLatitude = function(ellipsoid) {
|
|
180
|
-
if (!defined_default(ellipsoid)) {
|
|
181
|
-
ellipsoid = Ellipsoid_default.WGS84;
|
|
182
|
-
}
|
|
183
|
-
scratchCartographic.latitude = this.conformalLatitude;
|
|
184
|
-
scratchCartographic.longitude = this.longitude;
|
|
185
|
-
scratchCartographic.height = 0;
|
|
186
|
-
const cartesian = this.ellipsoid.cartographicToCartesian(
|
|
187
|
-
scratchCartographic,
|
|
188
|
-
scratchCartesian
|
|
189
|
-
);
|
|
190
|
-
ellipsoid.cartesianToCartographic(cartesian, scratchCartographic);
|
|
191
|
-
return scratchCartographic.latitude;
|
|
192
|
-
};
|
|
193
|
-
var scratchProjectPointOntoPlaneRay = new Ray_default();
|
|
194
|
-
var scratchProjectPointOntoPlaneRayDirection = new Cartesian3_default();
|
|
195
|
-
var scratchProjectPointOntoPlaneCartesian3 = new Cartesian3_default();
|
|
196
|
-
Stereographic.fromCartesian = function(cartesian, result) {
|
|
197
|
-
Check_default.defined("cartesian", cartesian);
|
|
198
|
-
const sign = Math_default.signNotZero(cartesian.z);
|
|
199
|
-
let tangentPlane = Stereographic.NORTH_POLE_TANGENT_PLANE;
|
|
200
|
-
let origin = Stereographic.SOUTH_POLE;
|
|
201
|
-
if (sign < 0) {
|
|
202
|
-
tangentPlane = Stereographic.SOUTH_POLE_TANGENT_PLANE;
|
|
203
|
-
origin = Stereographic.NORTH_POLE;
|
|
204
|
-
}
|
|
205
|
-
const ray = scratchProjectPointOntoPlaneRay;
|
|
206
|
-
ray.origin = tangentPlane.ellipsoid.scaleToGeocentricSurface(
|
|
207
|
-
cartesian,
|
|
208
|
-
ray.origin
|
|
209
|
-
);
|
|
210
|
-
ray.direction = Cartesian3_default.subtract(
|
|
211
|
-
ray.origin,
|
|
212
|
-
origin,
|
|
213
|
-
scratchProjectPointOntoPlaneRayDirection
|
|
214
|
-
);
|
|
215
|
-
Cartesian3_default.normalize(ray.direction, ray.direction);
|
|
216
|
-
const intersectionPoint = IntersectionTests_default.rayPlane(
|
|
217
|
-
ray,
|
|
218
|
-
tangentPlane.plane,
|
|
219
|
-
scratchProjectPointOntoPlaneCartesian3
|
|
220
|
-
);
|
|
221
|
-
const v = Cartesian3_default.subtract(intersectionPoint, origin, intersectionPoint);
|
|
222
|
-
const x = Cartesian3_default.dot(tangentPlane.xAxis, v);
|
|
223
|
-
const y = sign * Cartesian3_default.dot(tangentPlane.yAxis, v);
|
|
224
|
-
if (!defined_default(result)) {
|
|
225
|
-
return new Stereographic(new Cartesian2_default(x, y), tangentPlane);
|
|
226
|
-
}
|
|
227
|
-
result.position = new Cartesian2_default(x, y);
|
|
228
|
-
result.tangentPlane = tangentPlane;
|
|
229
|
-
return result;
|
|
230
|
-
};
|
|
231
|
-
Stereographic.fromCartesianArray = function(cartesians, result) {
|
|
232
|
-
Check_default.defined("cartesians", cartesians);
|
|
233
|
-
const length = cartesians.length;
|
|
234
|
-
if (!defined_default(result)) {
|
|
235
|
-
result = new Array(length);
|
|
236
|
-
} else {
|
|
237
|
-
result.length = length;
|
|
238
|
-
}
|
|
239
|
-
for (let i = 0; i < length; i++) {
|
|
240
|
-
result[i] = Stereographic.fromCartesian(cartesians[i], result[i]);
|
|
241
|
-
}
|
|
242
|
-
return result;
|
|
243
|
-
};
|
|
244
|
-
Stereographic.clone = function(stereographic, result) {
|
|
245
|
-
if (!defined_default(stereographic)) {
|
|
246
|
-
return void 0;
|
|
247
|
-
}
|
|
248
|
-
if (!defined_default(result)) {
|
|
249
|
-
return new Stereographic(
|
|
250
|
-
stereographic.position,
|
|
251
|
-
stereographic.tangentPlane
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
result.position = stereographic.position;
|
|
255
|
-
result.tangentPlane = stereographic.tangentPlane;
|
|
256
|
-
return result;
|
|
257
|
-
};
|
|
258
|
-
Stereographic.HALF_UNIT_SPHERE = Object.freeze(new Ellipsoid_default(0.5, 0.5, 0.5));
|
|
259
|
-
Stereographic.NORTH_POLE = Object.freeze(new Cartesian3_default(0, 0, 0.5));
|
|
260
|
-
Stereographic.SOUTH_POLE = Object.freeze(new Cartesian3_default(0, 0, -0.5));
|
|
261
|
-
Stereographic.NORTH_POLE_TANGENT_PLANE = Object.freeze(
|
|
262
|
-
new EllipsoidTangentPlane_default(
|
|
263
|
-
Stereographic.NORTH_POLE,
|
|
264
|
-
Stereographic.HALF_UNIT_SPHERE
|
|
265
|
-
)
|
|
266
|
-
);
|
|
267
|
-
Stereographic.SOUTH_POLE_TANGENT_PLANE = Object.freeze(
|
|
268
|
-
new EllipsoidTangentPlane_default(
|
|
269
|
-
Stereographic.SOUTH_POLE,
|
|
270
|
-
Stereographic.HALF_UNIT_SPHERE
|
|
271
|
-
)
|
|
272
|
-
);
|
|
273
|
-
var Stereographic_default = Stereographic;
|
|
274
|
-
|
|
275
|
-
// packages/engine/Source/Core/PolygonGeometry.js
|
|
276
|
-
var scratchCarto1 = new Cartographic_default();
|
|
277
|
-
var scratchCarto2 = new Cartographic_default();
|
|
278
|
-
function adjustPosHeightsForNormal(position, p1, p2, ellipsoid) {
|
|
279
|
-
const carto1 = ellipsoid.cartesianToCartographic(position, scratchCarto1);
|
|
280
|
-
const height = carto1.height;
|
|
281
|
-
const p1Carto = ellipsoid.cartesianToCartographic(p1, scratchCarto2);
|
|
282
|
-
p1Carto.height = height;
|
|
283
|
-
ellipsoid.cartographicToCartesian(p1Carto, p1);
|
|
284
|
-
const p2Carto = ellipsoid.cartesianToCartographic(p2, scratchCarto2);
|
|
285
|
-
p2Carto.height = height - 100;
|
|
286
|
-
ellipsoid.cartographicToCartesian(p2Carto, p2);
|
|
287
|
-
}
|
|
288
|
-
var scratchBoundingRectangle = new BoundingRectangle_default();
|
|
289
|
-
var scratchPosition = new Cartesian3_default();
|
|
290
|
-
var scratchNormal = new Cartesian3_default();
|
|
291
|
-
var scratchTangent = new Cartesian3_default();
|
|
292
|
-
var scratchBitangent = new Cartesian3_default();
|
|
293
|
-
var p1Scratch = new Cartesian3_default();
|
|
294
|
-
var p2Scratch = new Cartesian3_default();
|
|
295
|
-
var scratchPerPosNormal = new Cartesian3_default();
|
|
296
|
-
var scratchPerPosTangent = new Cartesian3_default();
|
|
297
|
-
var scratchPerPosBitangent = new Cartesian3_default();
|
|
298
|
-
var appendTextureCoordinatesOrigin = new Cartesian2_default();
|
|
299
|
-
var appendTextureCoordinatesCartesian2 = new Cartesian2_default();
|
|
300
|
-
var appendTextureCoordinatesCartesian3 = new Cartesian3_default();
|
|
301
|
-
var appendTextureCoordinatesQuaternion = new Quaternion_default();
|
|
302
|
-
var appendTextureCoordinatesMatrix3 = new Matrix3_default();
|
|
303
|
-
var tangentMatrixScratch = new Matrix3_default();
|
|
304
|
-
function computeAttributes(options) {
|
|
305
|
-
const vertexFormat = options.vertexFormat;
|
|
306
|
-
const geometry = options.geometry;
|
|
307
|
-
const shadowVolume = options.shadowVolume;
|
|
308
|
-
const flatPositions = geometry.attributes.position.values;
|
|
309
|
-
const flatTexcoords = defined_default(geometry.attributes.st) ? geometry.attributes.st.values : void 0;
|
|
310
|
-
let length = flatPositions.length;
|
|
311
|
-
const wall = options.wall;
|
|
312
|
-
const top = options.top || wall;
|
|
313
|
-
const bottom = options.bottom || wall;
|
|
314
|
-
if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
|
|
315
|
-
const boundingRectangle = options.boundingRectangle;
|
|
316
|
-
const rotationAxis = options.rotationAxis;
|
|
317
|
-
const projectTo2d = options.projectTo2d;
|
|
318
|
-
const ellipsoid = options.ellipsoid;
|
|
319
|
-
const stRotation = options.stRotation;
|
|
320
|
-
const perPositionHeight = options.perPositionHeight;
|
|
321
|
-
const origin = appendTextureCoordinatesOrigin;
|
|
322
|
-
origin.x = boundingRectangle.x;
|
|
323
|
-
origin.y = boundingRectangle.y;
|
|
324
|
-
const textureCoordinates = vertexFormat.st ? new Float32Array(2 * (length / 3)) : void 0;
|
|
325
|
-
let normals;
|
|
326
|
-
if (vertexFormat.normal) {
|
|
327
|
-
if (perPositionHeight && top && !wall) {
|
|
328
|
-
normals = geometry.attributes.normal.values;
|
|
329
|
-
} else {
|
|
330
|
-
normals = new Float32Array(length);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const tangents = vertexFormat.tangent ? new Float32Array(length) : void 0;
|
|
334
|
-
const bitangents = vertexFormat.bitangent ? new Float32Array(length) : void 0;
|
|
335
|
-
const extrudeNormals = shadowVolume ? new Float32Array(length) : void 0;
|
|
336
|
-
let textureCoordIndex = 0;
|
|
337
|
-
let attrIndex = 0;
|
|
338
|
-
let normal = scratchNormal;
|
|
339
|
-
let tangent = scratchTangent;
|
|
340
|
-
let bitangent = scratchBitangent;
|
|
341
|
-
let recomputeNormal = true;
|
|
342
|
-
let textureMatrix = appendTextureCoordinatesMatrix3;
|
|
343
|
-
let tangentRotationMatrix = tangentMatrixScratch;
|
|
344
|
-
if (stRotation !== 0) {
|
|
345
|
-
let rotation = Quaternion_default.fromAxisAngle(
|
|
346
|
-
rotationAxis,
|
|
347
|
-
stRotation,
|
|
348
|
-
appendTextureCoordinatesQuaternion
|
|
349
|
-
);
|
|
350
|
-
textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
|
|
351
|
-
rotation = Quaternion_default.fromAxisAngle(
|
|
352
|
-
rotationAxis,
|
|
353
|
-
-stRotation,
|
|
354
|
-
appendTextureCoordinatesQuaternion
|
|
355
|
-
);
|
|
356
|
-
tangentRotationMatrix = Matrix3_default.fromQuaternion(
|
|
357
|
-
rotation,
|
|
358
|
-
tangentRotationMatrix
|
|
359
|
-
);
|
|
360
|
-
} else {
|
|
361
|
-
textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
|
|
362
|
-
tangentRotationMatrix = Matrix3_default.clone(
|
|
363
|
-
Matrix3_default.IDENTITY,
|
|
364
|
-
tangentRotationMatrix
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
let bottomOffset = 0;
|
|
368
|
-
let bottomOffset2 = 0;
|
|
369
|
-
if (top && bottom) {
|
|
370
|
-
bottomOffset = length / 2;
|
|
371
|
-
bottomOffset2 = length / 3;
|
|
372
|
-
length /= 2;
|
|
373
|
-
}
|
|
374
|
-
for (let i = 0; i < length; i += 3) {
|
|
375
|
-
const position = Cartesian3_default.fromArray(
|
|
376
|
-
flatPositions,
|
|
377
|
-
i,
|
|
378
|
-
appendTextureCoordinatesCartesian3
|
|
379
|
-
);
|
|
380
|
-
if (vertexFormat.st) {
|
|
381
|
-
if (!defined_default(flatTexcoords)) {
|
|
382
|
-
let p = Matrix3_default.multiplyByVector(
|
|
383
|
-
textureMatrix,
|
|
384
|
-
position,
|
|
385
|
-
scratchPosition
|
|
386
|
-
);
|
|
387
|
-
p = ellipsoid.scaleToGeodeticSurface(p, p);
|
|
388
|
-
const st = projectTo2d(p, appendTextureCoordinatesCartesian2);
|
|
389
|
-
Cartesian2_default.subtract(st, origin, st);
|
|
390
|
-
const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
|
|
391
|
-
const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
|
|
392
|
-
if (bottom) {
|
|
393
|
-
textureCoordinates[textureCoordIndex + bottomOffset2] = stx;
|
|
394
|
-
textureCoordinates[textureCoordIndex + 1 + bottomOffset2] = sty;
|
|
395
|
-
}
|
|
396
|
-
if (top) {
|
|
397
|
-
textureCoordinates[textureCoordIndex] = stx;
|
|
398
|
-
textureCoordinates[textureCoordIndex + 1] = sty;
|
|
399
|
-
}
|
|
400
|
-
textureCoordIndex += 2;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
|
|
404
|
-
const attrIndex1 = attrIndex + 1;
|
|
405
|
-
const attrIndex2 = attrIndex + 2;
|
|
406
|
-
if (wall) {
|
|
407
|
-
if (i + 3 < length) {
|
|
408
|
-
const p1 = Cartesian3_default.fromArray(flatPositions, i + 3, p1Scratch);
|
|
409
|
-
if (recomputeNormal) {
|
|
410
|
-
const p2 = Cartesian3_default.fromArray(
|
|
411
|
-
flatPositions,
|
|
412
|
-
i + length,
|
|
413
|
-
p2Scratch
|
|
414
|
-
);
|
|
415
|
-
if (perPositionHeight) {
|
|
416
|
-
adjustPosHeightsForNormal(position, p1, p2, ellipsoid);
|
|
417
|
-
}
|
|
418
|
-
Cartesian3_default.subtract(p1, position, p1);
|
|
419
|
-
Cartesian3_default.subtract(p2, position, p2);
|
|
420
|
-
normal = Cartesian3_default.normalize(
|
|
421
|
-
Cartesian3_default.cross(p2, p1, normal),
|
|
422
|
-
normal
|
|
423
|
-
);
|
|
424
|
-
recomputeNormal = false;
|
|
425
|
-
}
|
|
426
|
-
if (Cartesian3_default.equalsEpsilon(p1, position, Math_default.EPSILON10)) {
|
|
427
|
-
recomputeNormal = true;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
if (vertexFormat.tangent || vertexFormat.bitangent) {
|
|
431
|
-
bitangent = ellipsoid.geodeticSurfaceNormal(position, bitangent);
|
|
432
|
-
if (vertexFormat.tangent) {
|
|
433
|
-
tangent = Cartesian3_default.normalize(
|
|
434
|
-
Cartesian3_default.cross(bitangent, normal, tangent),
|
|
435
|
-
tangent
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
} else {
|
|
440
|
-
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
|
|
441
|
-
if (vertexFormat.tangent || vertexFormat.bitangent) {
|
|
442
|
-
if (perPositionHeight) {
|
|
443
|
-
scratchPerPosNormal = Cartesian3_default.fromArray(
|
|
444
|
-
normals,
|
|
445
|
-
attrIndex,
|
|
446
|
-
scratchPerPosNormal
|
|
447
|
-
);
|
|
448
|
-
scratchPerPosTangent = Cartesian3_default.cross(
|
|
449
|
-
Cartesian3_default.UNIT_Z,
|
|
450
|
-
scratchPerPosNormal,
|
|
451
|
-
scratchPerPosTangent
|
|
452
|
-
);
|
|
453
|
-
scratchPerPosTangent = Cartesian3_default.normalize(
|
|
454
|
-
Matrix3_default.multiplyByVector(
|
|
455
|
-
tangentRotationMatrix,
|
|
456
|
-
scratchPerPosTangent,
|
|
457
|
-
scratchPerPosTangent
|
|
458
|
-
),
|
|
459
|
-
scratchPerPosTangent
|
|
460
|
-
);
|
|
461
|
-
if (vertexFormat.bitangent) {
|
|
462
|
-
scratchPerPosBitangent = Cartesian3_default.normalize(
|
|
463
|
-
Cartesian3_default.cross(
|
|
464
|
-
scratchPerPosNormal,
|
|
465
|
-
scratchPerPosTangent,
|
|
466
|
-
scratchPerPosBitangent
|
|
467
|
-
),
|
|
468
|
-
scratchPerPosBitangent
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
tangent = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal, tangent);
|
|
473
|
-
tangent = Cartesian3_default.normalize(
|
|
474
|
-
Matrix3_default.multiplyByVector(tangentRotationMatrix, tangent, tangent),
|
|
475
|
-
tangent
|
|
476
|
-
);
|
|
477
|
-
if (vertexFormat.bitangent) {
|
|
478
|
-
bitangent = Cartesian3_default.normalize(
|
|
479
|
-
Cartesian3_default.cross(normal, tangent, bitangent),
|
|
480
|
-
bitangent
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
if (vertexFormat.normal) {
|
|
486
|
-
if (options.wall) {
|
|
487
|
-
normals[attrIndex + bottomOffset] = normal.x;
|
|
488
|
-
normals[attrIndex1 + bottomOffset] = normal.y;
|
|
489
|
-
normals[attrIndex2 + bottomOffset] = normal.z;
|
|
490
|
-
} else if (bottom) {
|
|
491
|
-
normals[attrIndex + bottomOffset] = -normal.x;
|
|
492
|
-
normals[attrIndex1 + bottomOffset] = -normal.y;
|
|
493
|
-
normals[attrIndex2 + bottomOffset] = -normal.z;
|
|
494
|
-
}
|
|
495
|
-
if (top && !perPositionHeight || wall) {
|
|
496
|
-
normals[attrIndex] = normal.x;
|
|
497
|
-
normals[attrIndex1] = normal.y;
|
|
498
|
-
normals[attrIndex2] = normal.z;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
if (shadowVolume) {
|
|
502
|
-
if (wall) {
|
|
503
|
-
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
|
|
504
|
-
}
|
|
505
|
-
extrudeNormals[attrIndex + bottomOffset] = -normal.x;
|
|
506
|
-
extrudeNormals[attrIndex1 + bottomOffset] = -normal.y;
|
|
507
|
-
extrudeNormals[attrIndex2 + bottomOffset] = -normal.z;
|
|
508
|
-
}
|
|
509
|
-
if (vertexFormat.tangent) {
|
|
510
|
-
if (options.wall) {
|
|
511
|
-
tangents[attrIndex + bottomOffset] = tangent.x;
|
|
512
|
-
tangents[attrIndex1 + bottomOffset] = tangent.y;
|
|
513
|
-
tangents[attrIndex2 + bottomOffset] = tangent.z;
|
|
514
|
-
} else if (bottom) {
|
|
515
|
-
tangents[attrIndex + bottomOffset] = -tangent.x;
|
|
516
|
-
tangents[attrIndex1 + bottomOffset] = -tangent.y;
|
|
517
|
-
tangents[attrIndex2 + bottomOffset] = -tangent.z;
|
|
518
|
-
}
|
|
519
|
-
if (top) {
|
|
520
|
-
if (perPositionHeight) {
|
|
521
|
-
tangents[attrIndex] = scratchPerPosTangent.x;
|
|
522
|
-
tangents[attrIndex1] = scratchPerPosTangent.y;
|
|
523
|
-
tangents[attrIndex2] = scratchPerPosTangent.z;
|
|
524
|
-
} else {
|
|
525
|
-
tangents[attrIndex] = tangent.x;
|
|
526
|
-
tangents[attrIndex1] = tangent.y;
|
|
527
|
-
tangents[attrIndex2] = tangent.z;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
if (vertexFormat.bitangent) {
|
|
532
|
-
if (bottom) {
|
|
533
|
-
bitangents[attrIndex + bottomOffset] = bitangent.x;
|
|
534
|
-
bitangents[attrIndex1 + bottomOffset] = bitangent.y;
|
|
535
|
-
bitangents[attrIndex2 + bottomOffset] = bitangent.z;
|
|
536
|
-
}
|
|
537
|
-
if (top) {
|
|
538
|
-
if (perPositionHeight) {
|
|
539
|
-
bitangents[attrIndex] = scratchPerPosBitangent.x;
|
|
540
|
-
bitangents[attrIndex1] = scratchPerPosBitangent.y;
|
|
541
|
-
bitangents[attrIndex2] = scratchPerPosBitangent.z;
|
|
542
|
-
} else {
|
|
543
|
-
bitangents[attrIndex] = bitangent.x;
|
|
544
|
-
bitangents[attrIndex1] = bitangent.y;
|
|
545
|
-
bitangents[attrIndex2] = bitangent.z;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
attrIndex += 3;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
if (vertexFormat.st && !defined_default(flatTexcoords)) {
|
|
553
|
-
geometry.attributes.st = new GeometryAttribute_default({
|
|
554
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
555
|
-
componentsPerAttribute: 2,
|
|
556
|
-
values: textureCoordinates
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
if (vertexFormat.normal) {
|
|
560
|
-
geometry.attributes.normal = new GeometryAttribute_default({
|
|
561
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
562
|
-
componentsPerAttribute: 3,
|
|
563
|
-
values: normals
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
if (vertexFormat.tangent) {
|
|
567
|
-
geometry.attributes.tangent = new GeometryAttribute_default({
|
|
568
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
569
|
-
componentsPerAttribute: 3,
|
|
570
|
-
values: tangents
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
if (vertexFormat.bitangent) {
|
|
574
|
-
geometry.attributes.bitangent = new GeometryAttribute_default({
|
|
575
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
576
|
-
componentsPerAttribute: 3,
|
|
577
|
-
values: bitangents
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
if (shadowVolume) {
|
|
581
|
-
geometry.attributes.extrudeDirection = new GeometryAttribute_default({
|
|
582
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
583
|
-
componentsPerAttribute: 3,
|
|
584
|
-
values: extrudeNormals
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
if (options.extrude && defined_default(options.offsetAttribute)) {
|
|
589
|
-
const size = flatPositions.length / 3;
|
|
590
|
-
let offsetAttribute = new Uint8Array(size);
|
|
591
|
-
if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
|
|
592
|
-
if (top && bottom || wall) {
|
|
593
|
-
offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
|
|
594
|
-
} else if (top) {
|
|
595
|
-
offsetAttribute = offsetAttribute.fill(1);
|
|
596
|
-
}
|
|
597
|
-
} else {
|
|
598
|
-
const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
599
|
-
offsetAttribute = offsetAttribute.fill(offsetValue);
|
|
600
|
-
}
|
|
601
|
-
geometry.attributes.applyOffset = new GeometryAttribute_default({
|
|
602
|
-
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
603
|
-
componentsPerAttribute: 1,
|
|
604
|
-
values: offsetAttribute
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
return geometry;
|
|
608
|
-
}
|
|
609
|
-
var createGeometryFromPositionsExtrudedPositions = [];
|
|
610
|
-
function createGeometryFromPositionsExtruded(ellipsoid, polygon2, textureCoordinates, granularity, hierarchy, perPositionHeight, closeTop, closeBottom, vertexFormat, arcType) {
|
|
611
|
-
const geos = {
|
|
612
|
-
walls: []
|
|
613
|
-
};
|
|
614
|
-
let i;
|
|
615
|
-
if (closeTop || closeBottom) {
|
|
616
|
-
const topGeo = PolygonGeometryLibrary_default.createGeometryFromPositions(
|
|
617
|
-
ellipsoid,
|
|
618
|
-
polygon2,
|
|
619
|
-
textureCoordinates,
|
|
620
|
-
granularity,
|
|
621
|
-
perPositionHeight,
|
|
622
|
-
vertexFormat,
|
|
623
|
-
arcType
|
|
624
|
-
);
|
|
625
|
-
const edgePoints = topGeo.attributes.position.values;
|
|
626
|
-
const indices = topGeo.indices;
|
|
627
|
-
let numPositions;
|
|
628
|
-
let newIndices;
|
|
629
|
-
if (closeTop && closeBottom) {
|
|
630
|
-
const topBottomPositions = edgePoints.concat(edgePoints);
|
|
631
|
-
numPositions = topBottomPositions.length / 3;
|
|
632
|
-
newIndices = IndexDatatype_default.createTypedArray(
|
|
633
|
-
numPositions,
|
|
634
|
-
indices.length * 2
|
|
635
|
-
);
|
|
636
|
-
newIndices.set(indices);
|
|
637
|
-
const ilength = indices.length;
|
|
638
|
-
const length = numPositions / 2;
|
|
639
|
-
for (i = 0; i < ilength; i += 3) {
|
|
640
|
-
const i0 = newIndices[i] + length;
|
|
641
|
-
const i1 = newIndices[i + 1] + length;
|
|
642
|
-
const i2 = newIndices[i + 2] + length;
|
|
643
|
-
newIndices[i + ilength] = i2;
|
|
644
|
-
newIndices[i + 1 + ilength] = i1;
|
|
645
|
-
newIndices[i + 2 + ilength] = i0;
|
|
646
|
-
}
|
|
647
|
-
topGeo.attributes.position.values = topBottomPositions;
|
|
648
|
-
if (perPositionHeight && vertexFormat.normal) {
|
|
649
|
-
const normals = topGeo.attributes.normal.values;
|
|
650
|
-
topGeo.attributes.normal.values = new Float32Array(
|
|
651
|
-
topBottomPositions.length
|
|
652
|
-
);
|
|
653
|
-
topGeo.attributes.normal.values.set(normals);
|
|
654
|
-
}
|
|
655
|
-
if (vertexFormat.st && defined_default(textureCoordinates)) {
|
|
656
|
-
const texcoords = topGeo.attributes.st.values;
|
|
657
|
-
topGeo.attributes.st.values = new Float32Array(numPositions * 2);
|
|
658
|
-
topGeo.attributes.st.values = texcoords.concat(texcoords);
|
|
659
|
-
}
|
|
660
|
-
topGeo.indices = newIndices;
|
|
661
|
-
} else if (closeBottom) {
|
|
662
|
-
numPositions = edgePoints.length / 3;
|
|
663
|
-
newIndices = IndexDatatype_default.createTypedArray(numPositions, indices.length);
|
|
664
|
-
for (i = 0; i < indices.length; i += 3) {
|
|
665
|
-
newIndices[i] = indices[i + 2];
|
|
666
|
-
newIndices[i + 1] = indices[i + 1];
|
|
667
|
-
newIndices[i + 2] = indices[i];
|
|
668
|
-
}
|
|
669
|
-
topGeo.indices = newIndices;
|
|
670
|
-
}
|
|
671
|
-
geos.topAndBottom = new GeometryInstance_default({
|
|
672
|
-
geometry: topGeo
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
let outerRing = hierarchy.outerRing;
|
|
676
|
-
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(outerRing, ellipsoid);
|
|
677
|
-
let positions2D = tangentPlane.projectPointsOntoPlane(
|
|
678
|
-
outerRing,
|
|
679
|
-
createGeometryFromPositionsExtrudedPositions
|
|
680
|
-
);
|
|
681
|
-
let windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
|
|
682
|
-
if (windingOrder === WindingOrder_default.CLOCKWISE) {
|
|
683
|
-
outerRing = outerRing.slice().reverse();
|
|
684
|
-
}
|
|
685
|
-
let wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
|
|
686
|
-
outerRing,
|
|
687
|
-
textureCoordinates,
|
|
688
|
-
ellipsoid,
|
|
689
|
-
granularity,
|
|
690
|
-
perPositionHeight,
|
|
691
|
-
arcType
|
|
692
|
-
);
|
|
693
|
-
geos.walls.push(
|
|
694
|
-
new GeometryInstance_default({
|
|
695
|
-
geometry: wallGeo
|
|
696
|
-
})
|
|
697
|
-
);
|
|
698
|
-
const holes = hierarchy.holes;
|
|
699
|
-
for (i = 0; i < holes.length; i++) {
|
|
700
|
-
let hole = holes[i];
|
|
701
|
-
positions2D = tangentPlane.projectPointsOntoPlane(
|
|
702
|
-
hole,
|
|
703
|
-
createGeometryFromPositionsExtrudedPositions
|
|
704
|
-
);
|
|
705
|
-
windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
|
|
706
|
-
if (windingOrder === WindingOrder_default.COUNTER_CLOCKWISE) {
|
|
707
|
-
hole = hole.slice().reverse();
|
|
708
|
-
}
|
|
709
|
-
wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
|
|
710
|
-
hole,
|
|
711
|
-
textureCoordinates,
|
|
712
|
-
ellipsoid,
|
|
713
|
-
granularity,
|
|
714
|
-
perPositionHeight,
|
|
715
|
-
arcType
|
|
716
|
-
);
|
|
717
|
-
geos.walls.push(
|
|
718
|
-
new GeometryInstance_default({
|
|
719
|
-
geometry: wallGeo
|
|
720
|
-
})
|
|
721
|
-
);
|
|
722
|
-
}
|
|
723
|
-
return geos;
|
|
724
|
-
}
|
|
725
|
-
function PolygonGeometry(options) {
|
|
726
|
-
Check_default.typeOf.object("options", options);
|
|
727
|
-
Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
|
|
728
|
-
if (defined_default(options.perPositionHeight) && options.perPositionHeight && defined_default(options.height)) {
|
|
729
|
-
throw new DeveloperError_default(
|
|
730
|
-
"Cannot use both options.perPositionHeight and options.height"
|
|
731
|
-
);
|
|
732
|
-
}
|
|
733
|
-
if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
|
|
734
|
-
throw new DeveloperError_default(
|
|
735
|
-
"Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
|
|
736
|
-
);
|
|
737
|
-
}
|
|
738
|
-
const polygonHierarchy = options.polygonHierarchy;
|
|
739
|
-
const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
|
|
740
|
-
const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
|
|
741
|
-
const granularity = defaultValue_default(
|
|
742
|
-
options.granularity,
|
|
743
|
-
Math_default.RADIANS_PER_DEGREE
|
|
744
|
-
);
|
|
745
|
-
const stRotation = defaultValue_default(options.stRotation, 0);
|
|
746
|
-
const textureCoordinates = options.textureCoordinates;
|
|
747
|
-
const perPositionHeight = defaultValue_default(options.perPositionHeight, false);
|
|
748
|
-
const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
|
|
749
|
-
let height = defaultValue_default(options.height, 0);
|
|
750
|
-
let extrudedHeight = defaultValue_default(options.extrudedHeight, height);
|
|
751
|
-
if (!perPositionHeightExtrude) {
|
|
752
|
-
const h = Math.max(height, extrudedHeight);
|
|
753
|
-
extrudedHeight = Math.min(height, extrudedHeight);
|
|
754
|
-
height = h;
|
|
755
|
-
}
|
|
756
|
-
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
|
|
757
|
-
this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
|
|
758
|
-
this._granularity = granularity;
|
|
759
|
-
this._stRotation = stRotation;
|
|
760
|
-
this._height = height;
|
|
761
|
-
this._extrudedHeight = extrudedHeight;
|
|
762
|
-
this._closeTop = defaultValue_default(options.closeTop, true);
|
|
763
|
-
this._closeBottom = defaultValue_default(options.closeBottom, true);
|
|
764
|
-
this._polygonHierarchy = polygonHierarchy;
|
|
765
|
-
this._perPositionHeight = perPositionHeight;
|
|
766
|
-
this._perPositionHeightExtrude = perPositionHeightExtrude;
|
|
767
|
-
this._shadowVolume = defaultValue_default(options.shadowVolume, false);
|
|
768
|
-
this._workerName = "createPolygonGeometry";
|
|
769
|
-
this._offsetAttribute = options.offsetAttribute;
|
|
770
|
-
this._arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
|
|
771
|
-
this._rectangle = void 0;
|
|
772
|
-
this._textureCoordinateRotationPoints = void 0;
|
|
773
|
-
this._textureCoordinates = textureCoordinates;
|
|
774
|
-
this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
|
|
775
|
-
polygonHierarchy,
|
|
776
|
-
Cartesian3_default
|
|
777
|
-
) + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + (textureCoordinates ? PolygonGeometryLibrary_default.computeHierarchyPackedLength(
|
|
778
|
-
textureCoordinates,
|
|
779
|
-
Cartesian2_default
|
|
780
|
-
) : 1) + 12;
|
|
781
|
-
}
|
|
782
|
-
PolygonGeometry.fromPositions = function(options) {
|
|
783
|
-
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
|
|
784
|
-
Check_default.defined("options.positions", options.positions);
|
|
785
|
-
const newOptions = {
|
|
786
|
-
polygonHierarchy: {
|
|
787
|
-
positions: options.positions
|
|
788
|
-
},
|
|
789
|
-
height: options.height,
|
|
790
|
-
extrudedHeight: options.extrudedHeight,
|
|
791
|
-
vertexFormat: options.vertexFormat,
|
|
792
|
-
stRotation: options.stRotation,
|
|
793
|
-
ellipsoid: options.ellipsoid,
|
|
794
|
-
granularity: options.granularity,
|
|
795
|
-
perPositionHeight: options.perPositionHeight,
|
|
796
|
-
closeTop: options.closeTop,
|
|
797
|
-
closeBottom: options.closeBottom,
|
|
798
|
-
offsetAttribute: options.offsetAttribute,
|
|
799
|
-
arcType: options.arcType,
|
|
800
|
-
textureCoordinates: options.textureCoordinates
|
|
801
|
-
};
|
|
802
|
-
return new PolygonGeometry(newOptions);
|
|
803
|
-
};
|
|
804
|
-
PolygonGeometry.pack = function(value, array, startingIndex) {
|
|
805
|
-
Check_default.typeOf.object("value", value);
|
|
806
|
-
Check_default.defined("array", array);
|
|
807
|
-
startingIndex = defaultValue_default(startingIndex, 0);
|
|
808
|
-
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
|
|
809
|
-
value._polygonHierarchy,
|
|
810
|
-
array,
|
|
811
|
-
startingIndex,
|
|
812
|
-
Cartesian3_default
|
|
813
|
-
);
|
|
814
|
-
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
|
|
815
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
816
|
-
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
|
|
817
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
818
|
-
array[startingIndex++] = value._height;
|
|
819
|
-
array[startingIndex++] = value._extrudedHeight;
|
|
820
|
-
array[startingIndex++] = value._granularity;
|
|
821
|
-
array[startingIndex++] = value._stRotation;
|
|
822
|
-
array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
|
|
823
|
-
array[startingIndex++] = value._perPositionHeight ? 1 : 0;
|
|
824
|
-
array[startingIndex++] = value._closeTop ? 1 : 0;
|
|
825
|
-
array[startingIndex++] = value._closeBottom ? 1 : 0;
|
|
826
|
-
array[startingIndex++] = value._shadowVolume ? 1 : 0;
|
|
827
|
-
array[startingIndex++] = defaultValue_default(value._offsetAttribute, -1);
|
|
828
|
-
array[startingIndex++] = value._arcType;
|
|
829
|
-
if (defined_default(value._textureCoordinates)) {
|
|
830
|
-
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
|
|
831
|
-
value._textureCoordinates,
|
|
832
|
-
array,
|
|
833
|
-
startingIndex,
|
|
834
|
-
Cartesian2_default
|
|
835
|
-
);
|
|
836
|
-
} else {
|
|
837
|
-
array[startingIndex++] = -1;
|
|
838
|
-
}
|
|
839
|
-
array[startingIndex++] = value.packedLength;
|
|
840
|
-
return array;
|
|
841
|
-
};
|
|
842
|
-
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
|
|
843
|
-
var scratchVertexFormat = new VertexFormat_default();
|
|
844
|
-
var dummyOptions = {
|
|
845
|
-
polygonHierarchy: {}
|
|
846
|
-
};
|
|
847
|
-
PolygonGeometry.unpack = function(array, startingIndex, result) {
|
|
848
|
-
Check_default.defined("array", array);
|
|
849
|
-
startingIndex = defaultValue_default(startingIndex, 0);
|
|
850
|
-
const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
|
|
851
|
-
array,
|
|
852
|
-
startingIndex,
|
|
853
|
-
Cartesian3_default
|
|
854
|
-
);
|
|
855
|
-
startingIndex = polygonHierarchy.startingIndex;
|
|
856
|
-
delete polygonHierarchy.startingIndex;
|
|
857
|
-
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
|
|
858
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
859
|
-
const vertexFormat = VertexFormat_default.unpack(
|
|
860
|
-
array,
|
|
861
|
-
startingIndex,
|
|
862
|
-
scratchVertexFormat
|
|
863
|
-
);
|
|
864
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
865
|
-
const height = array[startingIndex++];
|
|
866
|
-
const extrudedHeight = array[startingIndex++];
|
|
867
|
-
const granularity = array[startingIndex++];
|
|
868
|
-
const stRotation = array[startingIndex++];
|
|
869
|
-
const perPositionHeightExtrude = array[startingIndex++] === 1;
|
|
870
|
-
const perPositionHeight = array[startingIndex++] === 1;
|
|
871
|
-
const closeTop = array[startingIndex++] === 1;
|
|
872
|
-
const closeBottom = array[startingIndex++] === 1;
|
|
873
|
-
const shadowVolume = array[startingIndex++] === 1;
|
|
874
|
-
const offsetAttribute = array[startingIndex++];
|
|
875
|
-
const arcType = array[startingIndex++];
|
|
876
|
-
const textureCoordinates = array[startingIndex] === -1 ? void 0 : PolygonGeometryLibrary_default.unpackPolygonHierarchy(
|
|
877
|
-
array,
|
|
878
|
-
startingIndex,
|
|
879
|
-
Cartesian2_default
|
|
880
|
-
);
|
|
881
|
-
if (defined_default(textureCoordinates)) {
|
|
882
|
-
startingIndex = textureCoordinates.startingIndex;
|
|
883
|
-
delete textureCoordinates.startingIndex;
|
|
884
|
-
} else {
|
|
885
|
-
startingIndex++;
|
|
886
|
-
}
|
|
887
|
-
const packedLength = array[startingIndex++];
|
|
888
|
-
if (!defined_default(result)) {
|
|
889
|
-
result = new PolygonGeometry(dummyOptions);
|
|
890
|
-
}
|
|
891
|
-
result._polygonHierarchy = polygonHierarchy;
|
|
892
|
-
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
|
|
893
|
-
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
|
|
894
|
-
result._height = height;
|
|
895
|
-
result._extrudedHeight = extrudedHeight;
|
|
896
|
-
result._granularity = granularity;
|
|
897
|
-
result._stRotation = stRotation;
|
|
898
|
-
result._perPositionHeightExtrude = perPositionHeightExtrude;
|
|
899
|
-
result._perPositionHeight = perPositionHeight;
|
|
900
|
-
result._closeTop = closeTop;
|
|
901
|
-
result._closeBottom = closeBottom;
|
|
902
|
-
result._shadowVolume = shadowVolume;
|
|
903
|
-
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
904
|
-
result._arcType = arcType;
|
|
905
|
-
result._textureCoordinates = textureCoordinates;
|
|
906
|
-
result.packedLength = packedLength;
|
|
907
|
-
return result;
|
|
908
|
-
};
|
|
909
|
-
var scratchCartesian0 = new Cartesian2_default();
|
|
910
|
-
var scratchCartesian1 = new Cartesian2_default();
|
|
911
|
-
var scratchPolarClosest = new Stereographic_default();
|
|
912
|
-
function expandRectangle(polar, lastPolar, ellipsoid, arcType, polygon2, result) {
|
|
913
|
-
const longitude = polar.longitude;
|
|
914
|
-
const lonAdjusted = longitude >= 0 ? longitude : longitude + Math_default.TWO_PI;
|
|
915
|
-
polygon2.westOverIdl = Math.min(polygon2.westOverIdl, lonAdjusted);
|
|
916
|
-
polygon2.eastOverIdl = Math.max(polygon2.eastOverIdl, lonAdjusted);
|
|
917
|
-
result.west = Math.min(result.west, longitude);
|
|
918
|
-
result.east = Math.max(result.east, longitude);
|
|
919
|
-
const latitude = polar.getLatitude(ellipsoid);
|
|
920
|
-
let segmentLatitude = latitude;
|
|
921
|
-
result.south = Math.min(result.south, latitude);
|
|
922
|
-
result.north = Math.max(result.north, latitude);
|
|
923
|
-
if (arcType !== ArcType_default.RHUMB) {
|
|
924
|
-
const segment = Cartesian2_default.subtract(
|
|
925
|
-
lastPolar.position,
|
|
926
|
-
polar.position,
|
|
927
|
-
scratchCartesian0
|
|
928
|
-
);
|
|
929
|
-
const t = Cartesian2_default.dot(lastPolar.position, segment) / Cartesian2_default.dot(segment, segment);
|
|
930
|
-
if (t > 0 && t < 1) {
|
|
931
|
-
const projected = Cartesian2_default.add(
|
|
932
|
-
lastPolar.position,
|
|
933
|
-
Cartesian2_default.multiplyByScalar(segment, -t, segment),
|
|
934
|
-
scratchCartesian1
|
|
935
|
-
);
|
|
936
|
-
const closestPolar = Stereographic_default.clone(lastPolar, scratchPolarClosest);
|
|
937
|
-
closestPolar.position = projected;
|
|
938
|
-
const adjustedLatitude = closestPolar.getLatitude(ellipsoid);
|
|
939
|
-
result.south = Math.min(result.south, adjustedLatitude);
|
|
940
|
-
result.north = Math.max(result.north, adjustedLatitude);
|
|
941
|
-
if (Math.abs(latitude) > Math.abs(adjustedLatitude)) {
|
|
942
|
-
segmentLatitude = adjustedLatitude;
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
const direction = lastPolar.x * polar.y - polar.x * lastPolar.y;
|
|
947
|
-
let angle = Math.sign(direction);
|
|
948
|
-
if (angle !== 0) {
|
|
949
|
-
angle *= Cartesian2_default.angleBetween(lastPolar.position, polar.position);
|
|
950
|
-
}
|
|
951
|
-
if (segmentLatitude >= 0) {
|
|
952
|
-
polygon2.northAngle += angle;
|
|
953
|
-
}
|
|
954
|
-
if (segmentLatitude <= 0) {
|
|
955
|
-
polygon2.southAngle += angle;
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
var scratchPolar = new Stereographic_default();
|
|
959
|
-
var scratchPolarPrevious = new Stereographic_default();
|
|
960
|
-
var polygon = {
|
|
961
|
-
northAngle: 0,
|
|
962
|
-
southAngle: 0,
|
|
963
|
-
westOverIdl: 0,
|
|
964
|
-
eastOverIdl: 0
|
|
965
|
-
};
|
|
966
|
-
PolygonGeometry.computeRectangleFromPositions = function(positions, ellipsoid, arcType, result) {
|
|
967
|
-
Check_default.defined("positions", positions);
|
|
968
|
-
if (!defined_default(result)) {
|
|
969
|
-
result = new Rectangle_default();
|
|
970
|
-
}
|
|
971
|
-
if (positions.length < 3) {
|
|
972
|
-
return result;
|
|
973
|
-
}
|
|
974
|
-
result.west = Number.POSITIVE_INFINITY;
|
|
975
|
-
result.east = Number.NEGATIVE_INFINITY;
|
|
976
|
-
result.south = Number.POSITIVE_INFINITY;
|
|
977
|
-
result.north = Number.NEGATIVE_INFINITY;
|
|
978
|
-
polygon.northAngle = 0;
|
|
979
|
-
polygon.southAngle = 0;
|
|
980
|
-
polygon.westOverIdl = Number.POSITIVE_INFINITY;
|
|
981
|
-
polygon.eastOverIdl = Number.NEGATIVE_INFINITY;
|
|
982
|
-
const positionsLength = positions.length;
|
|
983
|
-
let lastPolarPosition = Stereographic_default.fromCartesian(
|
|
984
|
-
positions[0],
|
|
985
|
-
scratchPolarPrevious
|
|
986
|
-
);
|
|
987
|
-
for (let i = 1; i < positionsLength; i++) {
|
|
988
|
-
const polarPosition = Stereographic_default.fromCartesian(
|
|
989
|
-
positions[i],
|
|
990
|
-
scratchPolar
|
|
991
|
-
);
|
|
992
|
-
expandRectangle(
|
|
993
|
-
polarPosition,
|
|
994
|
-
lastPolarPosition,
|
|
995
|
-
ellipsoid,
|
|
996
|
-
arcType,
|
|
997
|
-
polygon,
|
|
998
|
-
result
|
|
999
|
-
);
|
|
1000
|
-
lastPolarPosition = Stereographic_default.clone(polarPosition, lastPolarPosition);
|
|
1001
|
-
}
|
|
1002
|
-
expandRectangle(
|
|
1003
|
-
Stereographic_default.fromCartesian(positions[0], scratchPolar),
|
|
1004
|
-
lastPolarPosition,
|
|
1005
|
-
ellipsoid,
|
|
1006
|
-
arcType,
|
|
1007
|
-
polygon,
|
|
1008
|
-
result
|
|
1009
|
-
);
|
|
1010
|
-
if (result.east - result.west > polygon.eastOverIdl - polygon.westOverIdl) {
|
|
1011
|
-
result.west = polygon.westOverIdl;
|
|
1012
|
-
result.east = polygon.eastOverIdl;
|
|
1013
|
-
if (result.east > Math_default.PI) {
|
|
1014
|
-
result.east = result.east - Math_default.TWO_PI;
|
|
1015
|
-
}
|
|
1016
|
-
if (result.west > Math_default.PI) {
|
|
1017
|
-
result.west = result.west - Math_default.TWO_PI;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
if (Math_default.equalsEpsilon(
|
|
1021
|
-
Math.abs(polygon.northAngle),
|
|
1022
|
-
Math_default.TWO_PI,
|
|
1023
|
-
Math_default.EPSILON10
|
|
1024
|
-
)) {
|
|
1025
|
-
result.north = Math_default.PI_OVER_TWO;
|
|
1026
|
-
result.east = Math_default.PI;
|
|
1027
|
-
result.west = -Math_default.PI;
|
|
1028
|
-
}
|
|
1029
|
-
if (Math_default.equalsEpsilon(
|
|
1030
|
-
Math.abs(polygon.southAngle),
|
|
1031
|
-
Math_default.TWO_PI,
|
|
1032
|
-
Math_default.EPSILON10
|
|
1033
|
-
)) {
|
|
1034
|
-
result.south = -Math_default.PI_OVER_TWO;
|
|
1035
|
-
result.east = Math_default.PI;
|
|
1036
|
-
result.west = -Math_default.PI;
|
|
1037
|
-
}
|
|
1038
|
-
return result;
|
|
1039
|
-
};
|
|
1040
|
-
var scratchPolarForPlane = new Stereographic_default();
|
|
1041
|
-
function getTangentPlane(rectangle, positions, ellipsoid) {
|
|
1042
|
-
if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
|
|
1043
|
-
const polar = Stereographic_default.fromCartesian(
|
|
1044
|
-
positions[0],
|
|
1045
|
-
scratchPolarForPlane
|
|
1046
|
-
);
|
|
1047
|
-
return polar.tangentPlane;
|
|
1048
|
-
}
|
|
1049
|
-
return EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
|
|
1050
|
-
}
|
|
1051
|
-
var scratchCartographicCyllindrical = new Cartographic_default();
|
|
1052
|
-
function createProjectTo2d(rectangle, outerPositions, ellipsoid) {
|
|
1053
|
-
return (positions, results) => {
|
|
1054
|
-
if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
|
|
1055
|
-
if (rectangle.south < 0 && rectangle.north > 0) {
|
|
1056
|
-
if (!defined_default(results)) {
|
|
1057
|
-
results = [];
|
|
1058
|
-
}
|
|
1059
|
-
for (let i = 0; i < positions.length; ++i) {
|
|
1060
|
-
const cartographic = ellipsoid.cartesianToCartographic(
|
|
1061
|
-
positions[i],
|
|
1062
|
-
scratchCartographicCyllindrical
|
|
1063
|
-
);
|
|
1064
|
-
results[i] = new Cartesian2_default(
|
|
1065
|
-
cartographic.longitude / Math_default.PI,
|
|
1066
|
-
cartographic.latitude / Math_default.PI_OVER_TWO
|
|
1067
|
-
);
|
|
1068
|
-
}
|
|
1069
|
-
results.length = positions.length;
|
|
1070
|
-
return results;
|
|
1071
|
-
}
|
|
1072
|
-
return Stereographic_default.fromCartesianArray(positions, results);
|
|
1073
|
-
}
|
|
1074
|
-
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(
|
|
1075
|
-
outerPositions,
|
|
1076
|
-
ellipsoid
|
|
1077
|
-
);
|
|
1078
|
-
return tangentPlane.projectPointsOntoPlane(positions, results);
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
|
-
function createProjectPositionTo2d(rectangle, outerRing, ellipsoid) {
|
|
1082
|
-
if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
|
|
1083
|
-
return (position, result) => {
|
|
1084
|
-
if (rectangle.south < 0 && rectangle.north > 0) {
|
|
1085
|
-
const cartographic = ellipsoid.cartesianToCartographic(
|
|
1086
|
-
position,
|
|
1087
|
-
scratchCartographicCyllindrical
|
|
1088
|
-
);
|
|
1089
|
-
if (!defined_default(result)) {
|
|
1090
|
-
result = new Cartesian2_default();
|
|
1091
|
-
}
|
|
1092
|
-
result.x = cartographic.longitude / Math_default.PI;
|
|
1093
|
-
result.y = cartographic.latitude / Math_default.PI_OVER_TWO;
|
|
1094
|
-
return result;
|
|
1095
|
-
}
|
|
1096
|
-
return Stereographic_default.fromCartesian(position, result);
|
|
1097
|
-
};
|
|
1098
|
-
}
|
|
1099
|
-
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(outerRing, ellipsoid);
|
|
1100
|
-
return (position, result) => {
|
|
1101
|
-
return tangentPlane.projectPointsOntoPlane(position, result);
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
1104
|
-
function createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight) {
|
|
1105
|
-
return (polygons, results) => {
|
|
1106
|
-
if (!perPositionHeight && (rectangle.height >= Math_default.PI_OVER_TWO || rectangle.width >= 2 * Math_default.PI_OVER_THREE)) {
|
|
1107
|
-
return PolygonGeometryLibrary_default.splitPolygonsOnEquator(
|
|
1108
|
-
polygons,
|
|
1109
|
-
ellipsoid,
|
|
1110
|
-
arcType,
|
|
1111
|
-
results
|
|
1112
|
-
);
|
|
1113
|
-
}
|
|
1114
|
-
return polygons;
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
|
-
function computeBoundingRectangle(outerRing, rectangle, ellipsoid, stRotation) {
|
|
1118
|
-
if (rectangle.height >= Math_default.PI || rectangle.width >= Math_default.PI) {
|
|
1119
|
-
return BoundingRectangle_default.fromRectangle(
|
|
1120
|
-
rectangle,
|
|
1121
|
-
void 0,
|
|
1122
|
-
scratchBoundingRectangle
|
|
1123
|
-
);
|
|
1124
|
-
}
|
|
1125
|
-
const outerPositions = outerRing;
|
|
1126
|
-
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(
|
|
1127
|
-
outerPositions,
|
|
1128
|
-
ellipsoid
|
|
1129
|
-
);
|
|
1130
|
-
return PolygonGeometryLibrary_default.computeBoundingRectangle(
|
|
1131
|
-
tangentPlane.plane.normal,
|
|
1132
|
-
tangentPlane.projectPointOntoPlane.bind(tangentPlane),
|
|
1133
|
-
outerPositions,
|
|
1134
|
-
stRotation,
|
|
1135
|
-
scratchBoundingRectangle
|
|
1136
|
-
);
|
|
1137
|
-
}
|
|
1138
|
-
PolygonGeometry.createGeometry = function(polygonGeometry) {
|
|
1139
|
-
const vertexFormat = polygonGeometry._vertexFormat;
|
|
1140
|
-
const ellipsoid = polygonGeometry._ellipsoid;
|
|
1141
|
-
const granularity = polygonGeometry._granularity;
|
|
1142
|
-
const stRotation = polygonGeometry._stRotation;
|
|
1143
|
-
const polygonHierarchy = polygonGeometry._polygonHierarchy;
|
|
1144
|
-
const perPositionHeight = polygonGeometry._perPositionHeight;
|
|
1145
|
-
const closeTop = polygonGeometry._closeTop;
|
|
1146
|
-
const closeBottom = polygonGeometry._closeBottom;
|
|
1147
|
-
const arcType = polygonGeometry._arcType;
|
|
1148
|
-
const textureCoordinates = polygonGeometry._textureCoordinates;
|
|
1149
|
-
const hasTextureCoordinates = defined_default(textureCoordinates);
|
|
1150
|
-
const outerPositions = polygonHierarchy.positions;
|
|
1151
|
-
if (outerPositions.length < 3) {
|
|
1152
|
-
return;
|
|
1153
|
-
}
|
|
1154
|
-
const rectangle = polygonGeometry.rectangle;
|
|
1155
|
-
const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
|
|
1156
|
-
polygonHierarchy,
|
|
1157
|
-
hasTextureCoordinates,
|
|
1158
|
-
createProjectTo2d(rectangle, outerPositions, ellipsoid),
|
|
1159
|
-
!perPositionHeight,
|
|
1160
|
-
ellipsoid,
|
|
1161
|
-
createSplitPolygons(rectangle, ellipsoid, arcType, perPositionHeight)
|
|
1162
|
-
);
|
|
1163
|
-
const hierarchy = results.hierarchy;
|
|
1164
|
-
const polygons = results.polygons;
|
|
1165
|
-
const dummyFunction = function(identity) {
|
|
1166
|
-
return identity;
|
|
1167
|
-
};
|
|
1168
|
-
const textureCoordinatePolygons = hasTextureCoordinates ? PolygonGeometryLibrary_default.polygonsFromHierarchy(
|
|
1169
|
-
textureCoordinates,
|
|
1170
|
-
true,
|
|
1171
|
-
dummyFunction,
|
|
1172
|
-
false,
|
|
1173
|
-
ellipsoid
|
|
1174
|
-
).polygons : void 0;
|
|
1175
|
-
if (hierarchy.length === 0) {
|
|
1176
|
-
return;
|
|
1177
|
-
}
|
|
1178
|
-
const outerRing = hierarchy[0].outerRing;
|
|
1179
|
-
const boundingRectangle = computeBoundingRectangle(
|
|
1180
|
-
outerRing,
|
|
1181
|
-
rectangle,
|
|
1182
|
-
ellipsoid,
|
|
1183
|
-
stRotation
|
|
1184
|
-
);
|
|
1185
|
-
const geometries = [];
|
|
1186
|
-
const height = polygonGeometry._height;
|
|
1187
|
-
const extrudedHeight = polygonGeometry._extrudedHeight;
|
|
1188
|
-
const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
|
|
1189
|
-
const options = {
|
|
1190
|
-
perPositionHeight,
|
|
1191
|
-
vertexFormat,
|
|
1192
|
-
geometry: void 0,
|
|
1193
|
-
rotationAxis: getTangentPlane(rectangle, outerRing, ellipsoid).plane.normal,
|
|
1194
|
-
projectTo2d: createProjectPositionTo2d(rectangle, outerRing, ellipsoid),
|
|
1195
|
-
boundingRectangle,
|
|
1196
|
-
ellipsoid,
|
|
1197
|
-
stRotation,
|
|
1198
|
-
textureCoordinates: void 0,
|
|
1199
|
-
bottom: false,
|
|
1200
|
-
top: true,
|
|
1201
|
-
wall: false,
|
|
1202
|
-
extrude: false,
|
|
1203
|
-
arcType
|
|
1204
|
-
};
|
|
1205
|
-
let i;
|
|
1206
|
-
if (extrude) {
|
|
1207
|
-
options.extrude = true;
|
|
1208
|
-
options.top = closeTop;
|
|
1209
|
-
options.bottom = closeBottom;
|
|
1210
|
-
options.shadowVolume = polygonGeometry._shadowVolume;
|
|
1211
|
-
options.offsetAttribute = polygonGeometry._offsetAttribute;
|
|
1212
|
-
for (i = 0; i < polygons.length; i++) {
|
|
1213
|
-
const splitGeometry = createGeometryFromPositionsExtruded(
|
|
1214
|
-
ellipsoid,
|
|
1215
|
-
polygons[i],
|
|
1216
|
-
hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
|
|
1217
|
-
granularity,
|
|
1218
|
-
hierarchy[i],
|
|
1219
|
-
perPositionHeight,
|
|
1220
|
-
closeTop,
|
|
1221
|
-
closeBottom,
|
|
1222
|
-
vertexFormat,
|
|
1223
|
-
arcType
|
|
1224
|
-
);
|
|
1225
|
-
let topAndBottom;
|
|
1226
|
-
if (closeTop && closeBottom) {
|
|
1227
|
-
topAndBottom = splitGeometry.topAndBottom;
|
|
1228
|
-
options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
|
|
1229
|
-
topAndBottom.geometry,
|
|
1230
|
-
height,
|
|
1231
|
-
extrudedHeight,
|
|
1232
|
-
ellipsoid,
|
|
1233
|
-
perPositionHeight
|
|
1234
|
-
);
|
|
1235
|
-
} else if (closeTop) {
|
|
1236
|
-
topAndBottom = splitGeometry.topAndBottom;
|
|
1237
|
-
topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
1238
|
-
topAndBottom.geometry.attributes.position.values,
|
|
1239
|
-
height,
|
|
1240
|
-
ellipsoid,
|
|
1241
|
-
!perPositionHeight
|
|
1242
|
-
);
|
|
1243
|
-
options.geometry = topAndBottom.geometry;
|
|
1244
|
-
} else if (closeBottom) {
|
|
1245
|
-
topAndBottom = splitGeometry.topAndBottom;
|
|
1246
|
-
topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
1247
|
-
topAndBottom.geometry.attributes.position.values,
|
|
1248
|
-
extrudedHeight,
|
|
1249
|
-
ellipsoid,
|
|
1250
|
-
true
|
|
1251
|
-
);
|
|
1252
|
-
options.geometry = topAndBottom.geometry;
|
|
1253
|
-
}
|
|
1254
|
-
if (closeTop || closeBottom) {
|
|
1255
|
-
options.wall = false;
|
|
1256
|
-
topAndBottom.geometry = computeAttributes(options);
|
|
1257
|
-
geometries.push(topAndBottom);
|
|
1258
|
-
}
|
|
1259
|
-
const walls = splitGeometry.walls;
|
|
1260
|
-
options.wall = true;
|
|
1261
|
-
for (let k = 0; k < walls.length; k++) {
|
|
1262
|
-
const wall = walls[k];
|
|
1263
|
-
options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
|
|
1264
|
-
wall.geometry,
|
|
1265
|
-
height,
|
|
1266
|
-
extrudedHeight,
|
|
1267
|
-
ellipsoid,
|
|
1268
|
-
perPositionHeight
|
|
1269
|
-
);
|
|
1270
|
-
wall.geometry = computeAttributes(options);
|
|
1271
|
-
geometries.push(wall);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
} else {
|
|
1275
|
-
for (i = 0; i < polygons.length; i++) {
|
|
1276
|
-
const geometryInstance = new GeometryInstance_default({
|
|
1277
|
-
geometry: PolygonGeometryLibrary_default.createGeometryFromPositions(
|
|
1278
|
-
ellipsoid,
|
|
1279
|
-
polygons[i],
|
|
1280
|
-
hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
|
|
1281
|
-
granularity,
|
|
1282
|
-
perPositionHeight,
|
|
1283
|
-
vertexFormat,
|
|
1284
|
-
arcType
|
|
1285
|
-
)
|
|
1286
|
-
});
|
|
1287
|
-
geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
1288
|
-
geometryInstance.geometry.attributes.position.values,
|
|
1289
|
-
height,
|
|
1290
|
-
ellipsoid,
|
|
1291
|
-
!perPositionHeight
|
|
1292
|
-
);
|
|
1293
|
-
options.geometry = geometryInstance.geometry;
|
|
1294
|
-
geometryInstance.geometry = computeAttributes(options);
|
|
1295
|
-
if (defined_default(polygonGeometry._offsetAttribute)) {
|
|
1296
|
-
const length = geometryInstance.geometry.attributes.position.values.length;
|
|
1297
|
-
const offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
1298
|
-
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
|
|
1299
|
-
geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default(
|
|
1300
|
-
{
|
|
1301
|
-
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
1302
|
-
componentsPerAttribute: 1,
|
|
1303
|
-
values: applyOffset
|
|
1304
|
-
}
|
|
1305
|
-
);
|
|
1306
|
-
}
|
|
1307
|
-
geometries.push(geometryInstance);
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
|
|
1311
|
-
geometry.attributes.position.values = new Float64Array(
|
|
1312
|
-
geometry.attributes.position.values
|
|
1313
|
-
);
|
|
1314
|
-
geometry.indices = IndexDatatype_default.createTypedArray(
|
|
1315
|
-
geometry.attributes.position.values.length / 3,
|
|
1316
|
-
geometry.indices
|
|
1317
|
-
);
|
|
1318
|
-
const attributes = geometry.attributes;
|
|
1319
|
-
const boundingSphere = BoundingSphere_default.fromVertices(
|
|
1320
|
-
attributes.position.values
|
|
1321
|
-
);
|
|
1322
|
-
if (!vertexFormat.position) {
|
|
1323
|
-
delete attributes.position;
|
|
1324
|
-
}
|
|
1325
|
-
return new Geometry_default({
|
|
1326
|
-
attributes,
|
|
1327
|
-
indices: geometry.indices,
|
|
1328
|
-
primitiveType: geometry.primitiveType,
|
|
1329
|
-
boundingSphere,
|
|
1330
|
-
offsetAttribute: polygonGeometry._offsetAttribute
|
|
1331
|
-
});
|
|
1332
|
-
};
|
|
1333
|
-
PolygonGeometry.createShadowVolume = function(polygonGeometry, minHeightFunc, maxHeightFunc) {
|
|
1334
|
-
const granularity = polygonGeometry._granularity;
|
|
1335
|
-
const ellipsoid = polygonGeometry._ellipsoid;
|
|
1336
|
-
const minHeight = minHeightFunc(granularity, ellipsoid);
|
|
1337
|
-
const maxHeight = maxHeightFunc(granularity, ellipsoid);
|
|
1338
|
-
return new PolygonGeometry({
|
|
1339
|
-
polygonHierarchy: polygonGeometry._polygonHierarchy,
|
|
1340
|
-
ellipsoid,
|
|
1341
|
-
stRotation: polygonGeometry._stRotation,
|
|
1342
|
-
granularity,
|
|
1343
|
-
perPositionHeight: false,
|
|
1344
|
-
extrudedHeight: minHeight,
|
|
1345
|
-
height: maxHeight,
|
|
1346
|
-
vertexFormat: VertexFormat_default.POSITION_ONLY,
|
|
1347
|
-
shadowVolume: true,
|
|
1348
|
-
arcType: polygonGeometry._arcType
|
|
1349
|
-
});
|
|
1350
|
-
};
|
|
1351
|
-
function textureCoordinateRotationPoints(polygonGeometry) {
|
|
1352
|
-
const stRotation = -polygonGeometry._stRotation;
|
|
1353
|
-
if (stRotation === 0) {
|
|
1354
|
-
return [0, 0, 0, 1, 1, 0];
|
|
1355
|
-
}
|
|
1356
|
-
const ellipsoid = polygonGeometry._ellipsoid;
|
|
1357
|
-
const positions = polygonGeometry._polygonHierarchy.positions;
|
|
1358
|
-
const boundingRectangle = polygonGeometry.rectangle;
|
|
1359
|
-
return Geometry_default._textureCoordinateRotationPoints(
|
|
1360
|
-
positions,
|
|
1361
|
-
stRotation,
|
|
1362
|
-
ellipsoid,
|
|
1363
|
-
boundingRectangle
|
|
1364
|
-
);
|
|
1365
|
-
}
|
|
1366
|
-
Object.defineProperties(PolygonGeometry.prototype, {
|
|
1367
|
-
/**
|
|
1368
|
-
* @private
|
|
1369
|
-
*/
|
|
1370
|
-
rectangle: {
|
|
1371
|
-
get: function() {
|
|
1372
|
-
if (!defined_default(this._rectangle)) {
|
|
1373
|
-
const positions = this._polygonHierarchy.positions;
|
|
1374
|
-
this._rectangle = PolygonGeometry.computeRectangleFromPositions(
|
|
1375
|
-
positions,
|
|
1376
|
-
this._ellipsoid,
|
|
1377
|
-
this._arcType
|
|
1378
|
-
);
|
|
1379
|
-
}
|
|
1380
|
-
return this._rectangle;
|
|
1381
|
-
}
|
|
1382
|
-
},
|
|
1383
|
-
/**
|
|
1384
|
-
* For remapping texture coordinates when rendering PolygonGeometries as GroundPrimitives.
|
|
1385
|
-
* @private
|
|
1386
|
-
*/
|
|
1387
|
-
textureCoordinateRotationPoints: {
|
|
1388
|
-
get: function() {
|
|
1389
|
-
if (!defined_default(this._textureCoordinateRotationPoints)) {
|
|
1390
|
-
this._textureCoordinateRotationPoints = textureCoordinateRotationPoints(
|
|
1391
|
-
this
|
|
1392
|
-
);
|
|
1393
|
-
}
|
|
1394
|
-
return this._textureCoordinateRotationPoints;
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
});
|
|
1398
|
-
var PolygonGeometry_default = PolygonGeometry;
|
|
1399
|
-
|
|
1400
|
-
// packages/engine/Source/Workers/createPolygonGeometry.js
|
|
1401
|
-
function createPolygonGeometry(polygonGeometry, offset) {
|
|
1402
|
-
if (defined_default(offset)) {
|
|
1403
|
-
polygonGeometry = PolygonGeometry_default.unpack(polygonGeometry, offset);
|
|
1404
|
-
}
|
|
1405
|
-
polygonGeometry._ellipsoid = Ellipsoid_default.clone(polygonGeometry._ellipsoid);
|
|
1406
|
-
return PolygonGeometry_default.createGeometry(polygonGeometry);
|
|
1407
|
-
}
|
|
1408
|
-
var createPolygonGeometry_default = createPolygonGeometry;
|
|
1409
|
-
export {
|
|
1410
|
-
createPolygonGeometry_default as default
|
|
1411
|
-
};
|
|
26
|
+
import{a as mt}from"./chunk-WGGIH7QW.js";import{a as L}from"./chunk-AJYK4IVJ.js";import{a as st}from"./chunk-J6UP6FLE.js";import{a as rt}from"./chunk-D6AA5QVT.js";import{a as bt}from"./chunk-VW6VD53G.js";import"./chunk-DEPHB2WM.js";import"./chunk-QOUAJ6TL.js";import{a as lt}from"./chunk-GBYLG25F.js";import{a as q}from"./chunk-CYCB63OH.js";import{a as Z}from"./chunk-TCGIRNHN.js";import"./chunk-N4VJKXZS.js";import{a as dt,b as ot}from"./chunk-77IHZJJ3.js";import"./chunk-3W4GT7KQ.js";import"./chunk-G5AGHVVC.js";import{a as wt,b as yt}from"./chunk-DMEY62ID.js";import"./chunk-HTFSEEMT.js";import{a as ct}from"./chunk-OFUUQVMR.js";import"./chunk-A56XVLQR.js";import{c as ut,d as $}from"./chunk-RCV6KWXS.js";import{d as Tt}from"./chunk-4IW2T6GF.js";import{f as at,h as _t}from"./chunk-PSPPBZWI.js";import{a as X}from"./chunk-AU7IKHOH.js";import{a as c,b as et,c as O,d as S,e as D,f as Pt}from"./chunk-64RSHJUE.js";import{a as l}from"./chunk-3SSKC3VN.js";import"./chunk-OSW76XDF.js";import"./chunk-ED5JPB3S.js";import{a as ft,b as Y}from"./chunk-LEYMRMBK.js";import{e as P}from"./chunk-VTAIKJXX.js";function b(t,e){this.position=t,P(this.position)||(this.position=new O),this.tangentPlane=e,P(this.tangentPlane)||(this.tangentPlane=b.NORTH_POLE_TANGENT_PLANE)}Object.defineProperties(b.prototype,{ellipsoid:{get:function(){return this.tangentPlane.ellipsoid}},x:{get:function(){return this.position.x}},y:{get:function(){return this.position.y}},conformalLatitude:{get:function(){let t=O.magnitude(this.position),e=2*this.ellipsoid.maximumRadius;return this.tangentPlane.plane.normal.z*(l.PI_OVER_TWO-2*Math.atan2(t,e))}},longitude:{get:function(){let t=l.PI_OVER_TWO+Math.atan2(this.y,this.x);return t>Math.PI&&(t-=l.TWO_PI),t}}});var nt=new et,Rt=new c;b.prototype.getLatitude=function(t){P(t)||(t=S.default),nt.latitude=this.conformalLatitude,nt.longitude=this.longitude,nt.height=0;let e=this.ellipsoid.cartographicToCartesian(nt,Rt);return t.cartesianToCartographic(e,nt),nt.latitude};var It=new wt,Lt=new c,Ft=new c;b.fromCartesian=function(t,e){Y.defined("cartesian",t);let o=l.signNotZero(t.z),n=b.NORTH_POLE_TANGENT_PLANE,s=b.SOUTH_POLE;o<0&&(n=b.SOUTH_POLE_TANGENT_PLANE,s=b.NORTH_POLE);let i=It;i.origin=n.ellipsoid.scaleToGeocentricSurface(t,i.origin),i.direction=c.subtract(i.origin,s,Lt),c.normalize(i.direction,i.direction);let r=yt.rayPlane(i,n.plane,Ft),f=c.subtract(r,s,r),d=c.dot(n.xAxis,f),p=o*c.dot(n.yAxis,f);return P(e)?(e.position=new O(d,p),e.tangentPlane=n,e):new b(new O(d,p),n)};b.fromCartesianArray=function(t,e){Y.defined("cartesians",t);let o=t.length;P(e)?e.length=o:e=new Array(o);for(let n=0;n<o;n++)e[n]=b.fromCartesian(t[n],e[n]);return e};b.clone=function(t,e){if(P(t))return P(e)?(e.position=t.position,e.tangentPlane=t.tangentPlane,e):new b(t.position,t.tangentPlane)};b.HALF_UNIT_SPHERE=Object.freeze(new S(.5,.5,.5));b.NORTH_POLE=Object.freeze(new c(0,0,.5));b.SOUTH_POLE=Object.freeze(new c(0,0,-.5));b.NORTH_POLE_TANGENT_PLANE=Object.freeze(new Z(b.NORTH_POLE,b.HALF_UNIT_SPHERE));b.SOUTH_POLE_TANGENT_PLANE=Object.freeze(new Z(b.SOUTH_POLE,b.HALF_UNIT_SPHERE));var z=b;var vt=new et,Ot=new et;function St(t,e,o,n){let i=n.cartesianToCartographic(t,vt).height,r=n.cartesianToCartographic(e,Ot);r.height=i,n.cartographicToCartesian(r,e);let f=n.cartesianToCartographic(o,Ot);f.height=i-100,n.cartographicToCartesian(f,o)}var Et=new mt,Vt=new c,Bt=new c,Mt=new c,jt=new c,kt=new c,zt=new c,ht=new c,Q=new c,it=new c,Dt=new O,Ut=new O,Wt=new c,At=new at,Gt=new D,Yt=new D;function gt(t){let e=t.vertexFormat,o=t.geometry,n=t.shadowVolume,s=o.attributes.position.values,i=P(o.attributes.st)?o.attributes.st.values:void 0,r=s.length,f=t.wall,d=t.top||f,p=t.bottom||f;if(e.st||e.normal||e.tangent||e.bitangent||n){let w=t.boundingRectangle,a=t.rotationAxis,H=t.projectTo2d,x=t.ellipsoid,M=t.stRotation,C=t.perPositionHeight,R=Dt;R.x=w.x,R.y=w.y;let V=e.st?new Float32Array(2*(r/3)):void 0,u;e.normal&&(C&&d&&!f?u=o.attributes.normal.values:u=new Float32Array(r));let E=e.tangent?new Float32Array(r):void 0,A=e.bitangent?new Float32Array(r):void 0,F=n?new Float32Array(r):void 0,T=0,y=0,_=Bt,h=Mt,g=jt,j=!0,G=Gt,K=Yt;if(M!==0){let B=at.fromAxisAngle(a,M,At);G=D.fromQuaternion(B,G),B=at.fromAxisAngle(a,-M,At),K=D.fromQuaternion(B,K)}else G=D.clone(D.IDENTITY,G),K=D.clone(D.IDENTITY,K);let m=0,I=0;d&&p&&(m=r/2,I=r/3,r/=2);for(let B=0;B<r;B+=3){let k=c.fromArray(s,B,Wt);if(e.st&&!P(i)){let N=D.multiplyByVector(G,k,Vt);N=x.scaleToGeodeticSurface(N,N);let v=H([N],Ut)[0];O.subtract(v,R,v);let J=l.clamp(v.x/w.width,0,1),tt=l.clamp(v.y/w.height,0,1);p&&(V[T+I]=J,V[T+1+I]=tt),d&&(V[T]=J,V[T+1]=tt),T+=2}if(e.normal||e.tangent||e.bitangent||n){let N=y+1,v=y+2;if(f){if(B+3<r){let J=c.fromArray(s,B+3,kt);if(j){let tt=c.fromArray(s,B+r,zt);C&&St(k,J,tt,x),c.subtract(J,k,J),c.subtract(tt,k,tt),_=c.normalize(c.cross(tt,J,_),_),j=!1}c.equalsEpsilon(J,k,l.EPSILON10)&&(j=!0)}(e.tangent||e.bitangent)&&(g=x.geodeticSurfaceNormal(k,g),e.tangent&&(h=c.normalize(c.cross(g,_,h),h)))}else _=x.geodeticSurfaceNormal(k,_),(e.tangent||e.bitangent)&&(C&&(ht=c.fromArray(u,y,ht),Q=c.cross(c.UNIT_Z,ht,Q),Q=c.normalize(D.multiplyByVector(K,Q,Q),Q),e.bitangent&&(it=c.normalize(c.cross(ht,Q,it),it))),h=c.cross(c.UNIT_Z,_,h),h=c.normalize(D.multiplyByVector(K,h,h),h),e.bitangent&&(g=c.normalize(c.cross(_,h,g),g)));e.normal&&(t.wall?(u[y+m]=_.x,u[N+m]=_.y,u[v+m]=_.z):p&&(u[y+m]=-_.x,u[N+m]=-_.y,u[v+m]=-_.z),(d&&!C||f)&&(u[y]=_.x,u[N]=_.y,u[v]=_.z)),n&&(f&&(_=x.geodeticSurfaceNormal(k,_)),F[y+m]=-_.x,F[N+m]=-_.y,F[v+m]=-_.z),e.tangent&&(t.wall?(E[y+m]=h.x,E[N+m]=h.y,E[v+m]=h.z):p&&(E[y+m]=-h.x,E[N+m]=-h.y,E[v+m]=-h.z),d&&(C?(E[y]=Q.x,E[N]=Q.y,E[v]=Q.z):(E[y]=h.x,E[N]=h.y,E[v]=h.z))),e.bitangent&&(p&&(A[y+m]=g.x,A[N+m]=g.y,A[v+m]=g.z),d&&(C?(A[y]=it.x,A[N]=it.y,A[v]=it.z):(A[y]=g.x,A[N]=g.y,A[v]=g.z))),y+=3}}e.st&&!P(i)&&(o.attributes.st=new $({componentDatatype:X.FLOAT,componentsPerAttribute:2,values:V})),e.normal&&(o.attributes.normal=new $({componentDatatype:X.FLOAT,componentsPerAttribute:3,values:u})),e.tangent&&(o.attributes.tangent=new $({componentDatatype:X.FLOAT,componentsPerAttribute:3,values:E})),e.bitangent&&(o.attributes.bitangent=new $({componentDatatype:X.FLOAT,componentsPerAttribute:3,values:A})),n&&(o.attributes.extrudeDirection=new $({componentDatatype:X.FLOAT,componentsPerAttribute:3,values:F}))}if(t.extrude&&P(t.offsetAttribute)){let w=s.length/3,a=new Uint8Array(w);if(t.offsetAttribute===lt.TOP)d&&p||f?a=a.fill(1,0,w/2):d&&(a=a.fill(1));else{let H=t.offsetAttribute===lt.NONE?0:1;a=a.fill(H)}o.attributes.applyOffset=new $({componentDatatype:X.UNSIGNED_BYTE,componentsPerAttribute:1,values:a})}return o}var Ht=[];function qt(t,e,o,n,s,i,r,f,d,p){let w={walls:[]},a;if(r||f){let u=L.createGeometryFromPositions(t,e,o,n,i,d,p),E=u.attributes.position.values,A=u.indices,F,T;if(r&&f){let y=E.concat(E);F=y.length/3,T=ct.createTypedArray(F,A.length*2),T.set(A);let _=A.length,h=F/2;for(a=0;a<_;a+=3){let g=T[a]+h,j=T[a+1]+h,G=T[a+2]+h;T[a+_]=G,T[a+1+_]=j,T[a+2+_]=g}if(u.attributes.position.values=y,i&&d.normal){let g=u.attributes.normal.values;u.attributes.normal.values=new Float32Array(y.length),u.attributes.normal.values.set(g)}if(d.st&&P(o)){let g=u.attributes.st.values;u.attributes.st.values=new Float32Array(F*2),u.attributes.st.values=g.concat(g)}u.indices=T}else if(f){for(F=E.length/3,T=ct.createTypedArray(F,A.length),a=0;a<A.length;a+=3)T[a]=A[a+2],T[a+1]=A[a+1],T[a+2]=A[a];u.indices=T}w.topAndBottom=new rt({geometry:u})}let H=s.outerRing,x=Z.fromPoints(H,t),M=x.projectPointsOntoPlane(H,Ht),C=ot.computeWindingOrder2D(M);C===dt.CLOCKWISE&&(H=H.slice().reverse());let R=L.computeWallGeometry(H,o,t,n,i,p);w.walls.push(new rt({geometry:R}));let V=s.holes;for(a=0;a<V.length;a++){let u=V[a];M=x.projectPointsOntoPlane(u,Ht),C=ot.computeWindingOrder2D(M),C===dt.COUNTER_CLOCKWISE&&(u=u.slice().reverse()),R=L.computeWallGeometry(u,o,t,n,i,p),w.walls.push(new rt({geometry:R}))}return w}function W(t){if(Y.typeOf.object("options",t),Y.typeOf.object("options.polygonHierarchy",t.polygonHierarchy),P(t.perPositionHeight)&&t.perPositionHeight&&P(t.height))throw new ft("Cannot use both options.perPositionHeight and options.height");if(P(t.arcType)&&t.arcType!==st.GEODESIC&&t.arcType!==st.RHUMB)throw new ft("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");let e=t.polygonHierarchy,o=t.vertexFormat??q.DEFAULT,n=t.ellipsoid??S.default,s=t.granularity??l.RADIANS_PER_DEGREE,i=t.stRotation??0,r=t.textureCoordinates,f=t.perPositionHeight??!1,d=f&&P(t.extrudedHeight),p=t.height??0,w=t.extrudedHeight??p;if(!d){let a=Math.max(p,w);w=Math.min(p,w),p=a}this._vertexFormat=q.clone(o),this._ellipsoid=S.clone(n),this._granularity=s,this._stRotation=i,this._height=p,this._extrudedHeight=w,this._closeTop=t.closeTop??!0,this._closeBottom=t.closeBottom??!0,this._polygonHierarchy=e,this._perPositionHeight=f,this._perPositionHeightExtrude=d,this._shadowVolume=t.shadowVolume??!1,this._workerName="createPolygonGeometry",this._offsetAttribute=t.offsetAttribute,this._arcType=t.arcType??st.GEODESIC,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=r,this.packedLength=L.computeHierarchyPackedLength(e,c)+S.packedLength+q.packedLength+(r?L.computeHierarchyPackedLength(r,O):1)+12}W.fromPositions=function(t){t=t??Pt.EMPTY_OBJECT,Y.defined("options.positions",t.positions);let e={polygonHierarchy:{positions:t.positions},height:t.height,extrudedHeight:t.extrudedHeight,vertexFormat:t.vertexFormat,stRotation:t.stRotation,ellipsoid:t.ellipsoid,granularity:t.granularity,perPositionHeight:t.perPositionHeight,closeTop:t.closeTop,closeBottom:t.closeBottom,offsetAttribute:t.offsetAttribute,arcType:t.arcType,textureCoordinates:t.textureCoordinates};return new W(e)};W.pack=function(t,e,o){return Y.typeOf.object("value",t),Y.defined("array",e),o=o??0,o=L.packPolygonHierarchy(t._polygonHierarchy,e,o,c),S.pack(t._ellipsoid,e,o),o+=S.packedLength,q.pack(t._vertexFormat,e,o),o+=q.packedLength,e[o++]=t._height,e[o++]=t._extrudedHeight,e[o++]=t._granularity,e[o++]=t._stRotation,e[o++]=t._perPositionHeightExtrude?1:0,e[o++]=t._perPositionHeight?1:0,e[o++]=t._closeTop?1:0,e[o++]=t._closeBottom?1:0,e[o++]=t._shadowVolume?1:0,e[o++]=t._offsetAttribute??-1,e[o++]=t._arcType,P(t._textureCoordinates)?o=L.packPolygonHierarchy(t._textureCoordinates,e,o,O):e[o++]=-1,e[o++]=t.packedLength,e};var Qt=S.clone(S.UNIT_SPHERE),Zt=new q,Kt={polygonHierarchy:{}};W.unpack=function(t,e,o){Y.defined("array",t),e=e??0;let n=L.unpackPolygonHierarchy(t,e,c);e=n.startingIndex,delete n.startingIndex;let s=S.unpack(t,e,Qt);e+=S.packedLength;let i=q.unpack(t,e,Zt);e+=q.packedLength;let r=t[e++],f=t[e++],d=t[e++],p=t[e++],w=t[e++]===1,a=t[e++]===1,H=t[e++]===1,x=t[e++]===1,M=t[e++]===1,C=t[e++],R=t[e++],V=t[e]===-1?void 0:L.unpackPolygonHierarchy(t,e,O);P(V)?(e=V.startingIndex,delete V.startingIndex):e++;let u=t[e++];return P(o)||(o=new W(Kt)),o._polygonHierarchy=n,o._ellipsoid=S.clone(s,o._ellipsoid),o._vertexFormat=q.clone(i,o._vertexFormat),o._height=r,o._extrudedHeight=f,o._granularity=d,o._stRotation=p,o._perPositionHeightExtrude=w,o._perPositionHeight=a,o._closeTop=H,o._closeBottom=x,o._shadowVolume=M,o._offsetAttribute=C===-1?void 0:C,o._arcType=R,o._textureCoordinates=V,o.packedLength=u,o};var Jt=new O,Xt=new O,$t=new z;function xt(t,e,o,n,s,i){let r=t.longitude,f=r>=0?r:r+l.TWO_PI;s.westOverIdl=Math.min(s.westOverIdl,f),s.eastOverIdl=Math.max(s.eastOverIdl,f),i.west=Math.min(i.west,r),i.east=Math.max(i.east,r);let d=t.getLatitude(o),p=d;if(i.south=Math.min(i.south,d),i.north=Math.max(i.north,d),n!==st.RHUMB){let H=O.subtract(e.position,t.position,Jt),x=O.dot(e.position,H)/O.dot(H,H);if(x>0&&x<1){let M=O.add(e.position,O.multiplyByScalar(H,-x,H),Xt),C=z.clone(e,$t);C.position=M;let R=C.getLatitude(o);i.south=Math.min(i.south,R),i.north=Math.max(i.north,R),Math.abs(d)>Math.abs(R)&&(p=R)}}let w=e.x*t.y-t.x*e.y,a=Math.sign(w);a!==0&&(a*=O.angleBetween(e.position,t.position)),p>=0&&(s.northAngle+=a),p<=0&&(s.southAngle+=a)}var Ct=new z,te=new z,U={northAngle:0,southAngle:0,westOverIdl:0,eastOverIdl:0};W.computeRectangleFromPositions=function(t,e,o,n){if(Y.defined("positions",t),P(n)||(n=new _t),t.length<3)return n;n.west=Number.POSITIVE_INFINITY,n.east=Number.NEGATIVE_INFINITY,n.south=Number.POSITIVE_INFINITY,n.north=Number.NEGATIVE_INFINITY,U.northAngle=0,U.southAngle=0,U.westOverIdl=Number.POSITIVE_INFINITY,U.eastOverIdl=Number.NEGATIVE_INFINITY;let s=t.length,i=z.fromCartesian(t[0],te);for(let r=1;r<s;r++){let f=z.fromCartesian(t[r],Ct);xt(f,i,e,o,U,n),i=z.clone(f,i)}return xt(z.fromCartesian(t[0],Ct),i,e,o,U,n),n.east-n.west>U.eastOverIdl-U.westOverIdl&&(n.west=U.westOverIdl,n.east=U.eastOverIdl,n.east>l.PI&&(n.east=n.east-l.TWO_PI),n.west>l.PI&&(n.west=n.west-l.TWO_PI)),l.equalsEpsilon(Math.abs(U.northAngle),l.TWO_PI,l.EPSILON10)&&(n.north=l.PI_OVER_TWO,n.east=l.PI,n.west=-l.PI),l.equalsEpsilon(Math.abs(U.southAngle),l.TWO_PI,l.EPSILON10)&&(n.south=-l.PI_OVER_TWO,n.east=l.PI,n.west=-l.PI),n};var ee=new z;function oe(t,e,o){return t.height>=l.PI||t.width>=l.PI?z.fromCartesian(e[0],ee).tangentPlane:Z.fromPoints(e,o)}var Nt=new et;function ne(t,e,o){return(n,s)=>{if(t.height>=l.PI||t.width>=l.PI){if(t.south<0&&t.north>0){P(s)||(s=[]);for(let r=0;r<n.length;++r){let f=o.cartesianToCartographic(n[r],Nt);s[r]=new O(f.longitude/l.PI,f.latitude/l.PI_OVER_TWO)}return s.length=n.length,s}return z.fromCartesianArray(n,s)}return Z.fromPoints(e,o).projectPointsOntoPlane(n,s)}}function ie(t,e,o){if(t.height>=l.PI||t.width>=l.PI)return(s,i)=>{if(t.south<0&&t.north>0){let r=o.cartesianToCartographic(s,Nt);return P(i)||(i=new O),i.x=r.longitude/l.PI,i.y=r.latitude/l.PI_OVER_TWO,i}return z.fromCartesian(s,i)};let n=Z.fromPoints(e,o);return(s,i)=>n.projectPointsOntoPlane(s,i)}function re(t,e,o,n){return(s,i)=>!n&&(t.height>=l.PI_OVER_TWO||t.width>=2*l.PI_OVER_THREE)?L.splitPolygonsOnEquator(s,e,o,i):s}function se(t,e,o,n){if(e.height>=l.PI||e.width>=l.PI)return mt.fromRectangle(e,void 0,Et);let s=t,i=Z.fromPoints(s,o);return L.computeBoundingRectangle(i.plane.normal,i.projectPointOntoPlane.bind(i),s,n,Et)}W.createGeometry=function(t){let e=t._vertexFormat,o=t._ellipsoid,n=t._granularity,s=t._stRotation,i=t._polygonHierarchy,r=t._perPositionHeight,f=t._closeTop,d=t._closeBottom,p=t._arcType,w=t._textureCoordinates,a=P(w),H=i.positions;if(H.length<3)return;let x=t.rectangle,M=L.polygonsFromHierarchy(i,a,ne(x,H,o),!r,o,re(x,o,p,r)),C=M.hierarchy,R=M.polygons,V=function(m){return m},u=a?L.polygonsFromHierarchy(w,!0,V,!1,o).polygons:void 0;if(C.length===0)return;let E=C[0].outerRing,A=se(E,x,o,s),F=[],T=t._height,y=t._extrudedHeight,_=t._perPositionHeightExtrude||!l.equalsEpsilon(T,y,0,l.EPSILON2),h={perPositionHeight:r,vertexFormat:e,geometry:void 0,rotationAxis:oe(x,E,o).plane.normal,projectTo2d:ie(x,E,o),boundingRectangle:A,ellipsoid:o,stRotation:s,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:p},g;if(_)for(h.extrude=!0,h.top=f,h.bottom=d,h.shadowVolume=t._shadowVolume,h.offsetAttribute=t._offsetAttribute,g=0;g<R.length;g++){let m=qt(o,R[g],a?u[g]:void 0,n,C[g],r,f,d,e,p),I;f&&d?(I=m.topAndBottom,h.geometry=L.scaleToGeodeticHeightExtruded(I.geometry,T,y,o,r)):f?(I=m.topAndBottom,I.geometry.attributes.position.values=ot.scaleToGeodeticHeight(I.geometry.attributes.position.values,T,o,!r),h.geometry=I.geometry):d&&(I=m.topAndBottom,I.geometry.attributes.position.values=ot.scaleToGeodeticHeight(I.geometry.attributes.position.values,y,o,!0),h.geometry=I.geometry),(f||d)&&(h.wall=!1,I.geometry=gt(h),F.push(I));let B=m.walls;h.wall=!0;for(let k=0;k<B.length;k++){let N=B[k];h.geometry=L.scaleToGeodeticHeightExtruded(N.geometry,T,y,o,r),N.geometry=gt(h),F.push(N)}}else for(g=0;g<R.length;g++){let m=new rt({geometry:L.createGeometryFromPositions(o,R[g],a?u[g]:void 0,n,r,e,p)});if(m.geometry.attributes.position.values=ot.scaleToGeodeticHeight(m.geometry.attributes.position.values,T,o,!r),h.geometry=m.geometry,m.geometry=gt(h),P(t._offsetAttribute)){let I=m.geometry.attributes.position.values.length,B=t._offsetAttribute===lt.NONE?0:1,k=new Uint8Array(I/3).fill(B);m.geometry.attributes.applyOffset=new $({componentDatatype:X.UNSIGNED_BYTE,componentsPerAttribute:1,values:k})}F.push(m)}let j=bt.combineInstances(F)[0];j.attributes.position.values=new Float64Array(j.attributes.position.values),j.indices=ct.createTypedArray(j.attributes.position.values.length/3,j.indices);let G=j.attributes,K=Tt.fromVertices(G.position.values);return e.position||delete G.position,new ut({attributes:G,indices:j.indices,primitiveType:j.primitiveType,boundingSphere:K,offsetAttribute:t._offsetAttribute})};W.createShadowVolume=function(t,e,o){let n=t._granularity,s=t._ellipsoid,i=e(n,s),r=o(n,s);return new W({polygonHierarchy:t._polygonHierarchy,ellipsoid:s,stRotation:t._stRotation,granularity:n,perPositionHeight:!1,extrudedHeight:i,height:r,vertexFormat:q.POSITION_ONLY,shadowVolume:!0,arcType:t._arcType})};function ae(t){let e=-t._stRotation;if(e===0)return[0,0,0,1,1,0];let o=t._ellipsoid,n=t._polygonHierarchy.positions,s=t.rectangle;return ut._textureCoordinateRotationPoints(n,e,o,s)}Object.defineProperties(W.prototype,{rectangle:{get:function(){if(!P(this._rectangle)){let t=this._polygonHierarchy.positions;this._rectangle=W.computeRectangleFromPositions(t,this._ellipsoid,this._arcType)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return P(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=ae(this)),this._textureCoordinateRotationPoints}}});var pt=W;function ce(t,e){return P(e)&&(t=pt.unpack(t,e)),t._ellipsoid=S.clone(t._ellipsoid),pt.createGeometry(t)}var Xe=ce;export{Xe as default};
|