@pggis/pg-sdk 3.3.10 → 4.3.3

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.
Files changed (163) hide show
  1. package/README.md +8 -8
  2. package/dist/index.js +1966 -4
  3. package/dist/pggis.min.css +1 -1
  4. package/dist/pggis.min.js +10980 -7539
  5. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
  6. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
  7. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
  8. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
  9. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  10. package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
  11. package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
  12. package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
  13. package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
  14. package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
  15. package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
  16. package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
  17. package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
  18. package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
  19. package/dist/resources/Workers/{chunk-F3YA3Y2Z.js → chunk-A56XVLQR.js} +2 -13
  20. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  21. package/dist/resources/Workers/{chunk-EHWHNOEX.js → chunk-ARG42DC4.js} +2 -31
  22. package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
  23. package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
  24. package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
  25. package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
  26. package/dist/resources/Workers/{chunk-4H7PY4U5.js → chunk-D6AA5QVT.js} +2 -20
  27. package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
  28. package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
  29. package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
  30. package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
  31. package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
  32. package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
  33. package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
  34. package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
  35. package/dist/resources/Workers/{chunk-BBWDMCVU.js → chunk-GBYLG25F.js} +2 -15
  36. package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
  37. package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
  38. package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
  39. package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
  40. package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
  41. package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
  42. package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
  43. package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
  44. package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
  45. package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
  46. package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
  47. package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
  48. package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
  49. package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
  50. package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
  51. package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
  52. package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
  53. package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
  54. package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
  55. package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
  56. package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
  57. package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
  58. package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
  59. package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
  60. package/dist/resources/Workers/chunk-WZDE3RYP.js +28 -0
  61. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  62. package/dist/resources/Workers/combineGeometry.js +2 -44
  63. package/dist/resources/Workers/createBoxGeometry.js +2 -34
  64. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -211
  65. package/dist/resources/Workers/createCircleGeometry.js +2 -173
  66. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -123
  67. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -482
  68. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -201
  69. package/dist/resources/Workers/createCorridorGeometry.js +2 -1239
  70. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -544
  71. package/dist/resources/Workers/createCylinderGeometry.js +2 -36
  72. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -207
  73. package/dist/resources/Workers/createEllipseGeometry.js +2 -47
  74. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -40
  75. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -35
  76. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -37
  77. package/dist/resources/Workers/createFrustumGeometry.js +2 -34
  78. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -211
  79. package/dist/resources/Workers/createGeometry.js +2 -147
  80. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1584
  81. package/dist/resources/Workers/createPlaneGeometry.js +2 -200
  82. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -100
  83. package/dist/resources/Workers/createPolygonGeometry.js +2 -1387
  84. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -519
  85. package/dist/resources/Workers/createPolylineGeometry.js +2 -472
  86. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -355
  87. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -253
  88. package/dist/resources/Workers/createRectangleGeometry.js +2 -1250
  89. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -455
  90. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -376
  91. package/dist/resources/Workers/createSphereGeometry.js +2 -94
  92. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -94
  93. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  94. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -468
  95. package/dist/resources/Workers/createVectorTileGeometries.js +2 -363
  96. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  97. package/dist/resources/Workers/createVectorTilePolygons.js +2 -361
  98. package/dist/resources/Workers/createVectorTilePolylines.js +2 -238
  99. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -545
  100. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2254
  101. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -722
  102. package/dist/resources/Workers/createWallGeometry.js +2 -466
  103. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -314
  104. package/dist/resources/Workers/decodeDraco.js +2 -345
  105. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2626
  106. package/dist/resources/Workers/decodeI3S.js +2 -1320
  107. package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
  108. package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
  109. package/dist/resources/Workers/transcodeKTX2.js +29 -3398
  110. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  111. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -795
  112. package/package.json +9 -8
  113. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
  114. package/dist/resources/Workers/chunk-23UFSGND.js +0 -236
  115. package/dist/resources/Workers/chunk-2A75IWRS.js +0 -218
  116. package/dist/resources/Workers/chunk-2FRVPMCS.js +0 -1258
  117. package/dist/resources/Workers/chunk-2FWRMUTY.js +0 -138
  118. package/dist/resources/Workers/chunk-2UPKWTMJ.js +0 -117
  119. package/dist/resources/Workers/chunk-34FXV7D7.js +0 -73
  120. package/dist/resources/Workers/chunk-3VAZEH7M.js +0 -101
  121. package/dist/resources/Workers/chunk-4DO5W5XZ.js +0 -196
  122. package/dist/resources/Workers/chunk-5QULIR53.js +0 -501
  123. package/dist/resources/Workers/chunk-7TC63SJW.js +0 -302
  124. package/dist/resources/Workers/chunk-7ZFGPDJA.js +0 -122
  125. package/dist/resources/Workers/chunk-A5DWLWCY.js +0 -834
  126. package/dist/resources/Workers/chunk-BG4UCVXN.js +0 -73
  127. package/dist/resources/Workers/chunk-BIKA3NRA.js +0 -59
  128. package/dist/resources/Workers/chunk-BROJAZRZ.js +0 -390
  129. package/dist/resources/Workers/chunk-DDUQAJ4P.js +0 -476
  130. package/dist/resources/Workers/chunk-EERJKOAF.js +0 -305
  131. package/dist/resources/Workers/chunk-EG6PTBY2.js +0 -2716
  132. package/dist/resources/Workers/chunk-F4HFJMGM.js +0 -353
  133. package/dist/resources/Workers/chunk-FJKNFAKQ.js +0 -8219
  134. package/dist/resources/Workers/chunk-FNIRWHJB.js +0 -289
  135. package/dist/resources/Workers/chunk-FZRIVR7Y.js +0 -100
  136. package/dist/resources/Workers/chunk-G43QFN4Q.js +0 -157
  137. package/dist/resources/Workers/chunk-GATZHF3K.js +0 -1860
  138. package/dist/resources/Workers/chunk-GRC2ZTAF.js +0 -398
  139. package/dist/resources/Workers/chunk-HU6N6EXB.js +0 -767
  140. package/dist/resources/Workers/chunk-I46ZRR5W.js +0 -1052
  141. package/dist/resources/Workers/chunk-JURN7NPV.js +0 -1075
  142. package/dist/resources/Workers/chunk-KKCR2YOP.js +0 -421
  143. package/dist/resources/Workers/chunk-LPR3YNP2.js +0 -138
  144. package/dist/resources/Workers/chunk-M7ERACJJ.js +0 -511
  145. package/dist/resources/Workers/chunk-MDWEGWPA.js +0 -1007
  146. package/dist/resources/Workers/chunk-OGXZVPPM.js +0 -2365
  147. package/dist/resources/Workers/chunk-PGSJK77E.js +0 -634
  148. package/dist/resources/Workers/chunk-PPH7OFP3.js +0 -258
  149. package/dist/resources/Workers/chunk-SH5USDPI.js +0 -456
  150. package/dist/resources/Workers/chunk-SOWMRMWA.js +0 -629
  151. package/dist/resources/Workers/chunk-STW2DGFI.js +0 -58
  152. package/dist/resources/Workers/chunk-T3XIFPYR.js +0 -1477
  153. package/dist/resources/Workers/chunk-TTUZP4BO.js +0 -501
  154. package/dist/resources/Workers/chunk-UEXTBDBE.js +0 -693
  155. package/dist/resources/Workers/chunk-VOXYEYJT.js +0 -684
  156. package/dist/resources/Workers/chunk-X4356LRH.js +0 -368
  157. package/dist/resources/Workers/chunk-XGI5BXZY.js +0 -163
  158. package/dist/resources/Workers/chunk-Y2ME2IJV.js +0 -781
  159. package/dist/resources/Workers/chunk-Y5UQJLYE.js +0 -171
  160. package/dist/resources/Workers/chunk-YJEBABKH.js +0 -2977
  161. package/dist/resources/Workers/chunk-YWTJ2B4B.js +0 -77
  162. package/dist/resources/Workers/chunk-Z3TIFFGF.js +0 -430
  163. package/dist/resources/Workers/chunk-ZT7KWISZ.js +0 -102
@@ -1,1052 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.115
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
- ArcType_default
28
- } from "./chunk-EHWHNOEX.js";
29
- import {
30
- GeometryPipeline_default
31
- } from "./chunk-EG6PTBY2.js";
32
- import {
33
- PolygonPipeline_default,
34
- WindingOrder_default
35
- } from "./chunk-MDWEGWPA.js";
36
- import {
37
- arrayRemoveDuplicates_default
38
- } from "./chunk-FZRIVR7Y.js";
39
- import {
40
- EllipsoidRhumbLine_default
41
- } from "./chunk-SH5USDPI.js";
42
- import {
43
- IntersectionTests_default
44
- } from "./chunk-2FRVPMCS.js";
45
- import {
46
- Plane_default
47
- } from "./chunk-Y5UQJLYE.js";
48
- import {
49
- IndexDatatype_default
50
- } from "./chunk-LPR3YNP2.js";
51
- import {
52
- GeometryAttributes_default
53
- } from "./chunk-4H7PY4U5.js";
54
- import {
55
- GeometryAttribute_default,
56
- Geometry_default,
57
- PrimitiveType_default
58
- } from "./chunk-7TC63SJW.js";
59
- import {
60
- Quaternion_default
61
- } from "./chunk-FJKNFAKQ.js";
62
- import {
63
- ComponentDatatype_default
64
- } from "./chunk-PPH7OFP3.js";
65
- import {
66
- Cartesian2_default,
67
- Cartesian3_default,
68
- Cartographic_default,
69
- Ellipsoid_default,
70
- Matrix3_default
71
- } from "./chunk-OGXZVPPM.js";
72
- import {
73
- Math_default
74
- } from "./chunk-5QULIR53.js";
75
- import {
76
- defaultValue_default
77
- } from "./chunk-BBWDMCVU.js";
78
- import {
79
- defined_default
80
- } from "./chunk-YWTJ2B4B.js";
81
-
82
- // packages/engine/Source/Core/PolygonHierarchy.js
83
- function PolygonHierarchy(positions, holes) {
84
- this.positions = defined_default(positions) ? positions : [];
85
- this.holes = defined_default(holes) ? holes : [];
86
- }
87
- var PolygonHierarchy_default = PolygonHierarchy;
88
-
89
- // packages/engine/Source/Core/Queue.js
90
- function Queue() {
91
- this._array = [];
92
- this._offset = 0;
93
- this._length = 0;
94
- }
95
- Object.defineProperties(Queue.prototype, {
96
- /**
97
- * The length of the queue.
98
- *
99
- * @memberof Queue.prototype
100
- *
101
- * @type {number}
102
- * @readonly
103
- */
104
- length: {
105
- get: function() {
106
- return this._length;
107
- }
108
- }
109
- });
110
- Queue.prototype.enqueue = function(item) {
111
- this._array.push(item);
112
- this._length++;
113
- };
114
- Queue.prototype.dequeue = function() {
115
- if (this._length === 0) {
116
- return void 0;
117
- }
118
- const array = this._array;
119
- let offset = this._offset;
120
- const item = array[offset];
121
- array[offset] = void 0;
122
- offset++;
123
- if (offset > 10 && offset * 2 > array.length) {
124
- this._array = array.slice(offset);
125
- offset = 0;
126
- }
127
- this._offset = offset;
128
- this._length--;
129
- return item;
130
- };
131
- Queue.prototype.peek = function() {
132
- if (this._length === 0) {
133
- return void 0;
134
- }
135
- return this._array[this._offset];
136
- };
137
- Queue.prototype.contains = function(item) {
138
- return this._array.indexOf(item) !== -1;
139
- };
140
- Queue.prototype.clear = function() {
141
- this._array.length = this._offset = this._length = 0;
142
- };
143
- Queue.prototype.sort = function(compareFunction) {
144
- if (this._offset > 0) {
145
- this._array = this._array.slice(this._offset);
146
- this._offset = 0;
147
- }
148
- this._array.sort(compareFunction);
149
- };
150
- var Queue_default = Queue;
151
-
152
- // packages/engine/Source/Core/PolygonGeometryLibrary.js
153
- var PolygonGeometryLibrary = {};
154
- PolygonGeometryLibrary.computeHierarchyPackedLength = function(polygonHierarchy, CartesianX) {
155
- let numComponents = 0;
156
- const stack = [polygonHierarchy];
157
- while (stack.length > 0) {
158
- const hierarchy = stack.pop();
159
- if (!defined_default(hierarchy)) {
160
- continue;
161
- }
162
- numComponents += 2;
163
- const positions = hierarchy.positions;
164
- const holes = hierarchy.holes;
165
- if (defined_default(positions) && positions.length > 0) {
166
- numComponents += positions.length * CartesianX.packedLength;
167
- }
168
- if (defined_default(holes)) {
169
- const length = holes.length;
170
- for (let i = 0; i < length; ++i) {
171
- stack.push(holes[i]);
172
- }
173
- }
174
- }
175
- return numComponents;
176
- };
177
- PolygonGeometryLibrary.packPolygonHierarchy = function(polygonHierarchy, array, startingIndex, CartesianX) {
178
- const stack = [polygonHierarchy];
179
- while (stack.length > 0) {
180
- const hierarchy = stack.pop();
181
- if (!defined_default(hierarchy)) {
182
- continue;
183
- }
184
- const positions = hierarchy.positions;
185
- const holes = hierarchy.holes;
186
- array[startingIndex++] = defined_default(positions) ? positions.length : 0;
187
- array[startingIndex++] = defined_default(holes) ? holes.length : 0;
188
- if (defined_default(positions)) {
189
- const positionsLength = positions.length;
190
- for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
191
- CartesianX.pack(positions[i], array, startingIndex);
192
- }
193
- }
194
- if (defined_default(holes)) {
195
- const holesLength = holes.length;
196
- for (let j = 0; j < holesLength; ++j) {
197
- stack.push(holes[j]);
198
- }
199
- }
200
- }
201
- return startingIndex;
202
- };
203
- PolygonGeometryLibrary.unpackPolygonHierarchy = function(array, startingIndex, CartesianX) {
204
- const positionsLength = array[startingIndex++];
205
- const holesLength = array[startingIndex++];
206
- const positions = new Array(positionsLength);
207
- const holes = holesLength > 0 ? new Array(holesLength) : void 0;
208
- for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
209
- positions[i] = CartesianX.unpack(array, startingIndex);
210
- }
211
- for (let j = 0; j < holesLength; ++j) {
212
- holes[j] = PolygonGeometryLibrary.unpackPolygonHierarchy(
213
- array,
214
- startingIndex,
215
- CartesianX
216
- );
217
- startingIndex = holes[j].startingIndex;
218
- delete holes[j].startingIndex;
219
- }
220
- return {
221
- positions,
222
- holes,
223
- startingIndex
224
- };
225
- };
226
- var distance2DScratch = new Cartesian2_default();
227
- function getPointAtDistance2D(p0, p1, distance, length) {
228
- Cartesian2_default.subtract(p1, p0, distance2DScratch);
229
- Cartesian2_default.multiplyByScalar(
230
- distance2DScratch,
231
- distance / length,
232
- distance2DScratch
233
- );
234
- Cartesian2_default.add(p0, distance2DScratch, distance2DScratch);
235
- return [distance2DScratch.x, distance2DScratch.y];
236
- }
237
- var distanceScratch = new Cartesian3_default();
238
- function getPointAtDistance(p0, p1, distance, length) {
239
- Cartesian3_default.subtract(p1, p0, distanceScratch);
240
- Cartesian3_default.multiplyByScalar(
241
- distanceScratch,
242
- distance / length,
243
- distanceScratch
244
- );
245
- Cartesian3_default.add(p0, distanceScratch, distanceScratch);
246
- return [distanceScratch.x, distanceScratch.y, distanceScratch.z];
247
- }
248
- PolygonGeometryLibrary.subdivideLineCount = function(p0, p1, minDistance) {
249
- const distance = Cartesian3_default.distance(p0, p1);
250
- const n = distance / minDistance;
251
- const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
252
- return Math.pow(2, countDivide);
253
- };
254
- var scratchCartographic0 = new Cartographic_default();
255
- var scratchCartographic1 = new Cartographic_default();
256
- var scratchCartographic2 = new Cartographic_default();
257
- var scratchCartesian0 = new Cartesian3_default();
258
- var scratchRhumbLine = new EllipsoidRhumbLine_default();
259
- PolygonGeometryLibrary.subdivideRhumbLineCount = function(ellipsoid, p0, p1, minDistance) {
260
- const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
261
- const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
262
- const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
263
- const n = rhumb.surfaceDistance / minDistance;
264
- const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
265
- return Math.pow(2, countDivide);
266
- };
267
- PolygonGeometryLibrary.subdivideTexcoordLine = function(t0, t1, p0, p1, minDistance, result) {
268
- const subdivisions = PolygonGeometryLibrary.subdivideLineCount(
269
- p0,
270
- p1,
271
- minDistance
272
- );
273
- const length2D = Cartesian2_default.distance(t0, t1);
274
- const distanceBetweenCoords = length2D / subdivisions;
275
- const texcoords = result;
276
- texcoords.length = subdivisions * 2;
277
- let index = 0;
278
- for (let i = 0; i < subdivisions; i++) {
279
- const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
280
- texcoords[index++] = t[0];
281
- texcoords[index++] = t[1];
282
- }
283
- return texcoords;
284
- };
285
- PolygonGeometryLibrary.subdivideLine = function(p0, p1, minDistance, result) {
286
- const numVertices = PolygonGeometryLibrary.subdivideLineCount(
287
- p0,
288
- p1,
289
- minDistance
290
- );
291
- const length = Cartesian3_default.distance(p0, p1);
292
- const distanceBetweenVertices = length / numVertices;
293
- if (!defined_default(result)) {
294
- result = [];
295
- }
296
- const positions = result;
297
- positions.length = numVertices * 3;
298
- let index = 0;
299
- for (let i = 0; i < numVertices; i++) {
300
- const p = getPointAtDistance(p0, p1, i * distanceBetweenVertices, length);
301
- positions[index++] = p[0];
302
- positions[index++] = p[1];
303
- positions[index++] = p[2];
304
- }
305
- return positions;
306
- };
307
- PolygonGeometryLibrary.subdivideTexcoordRhumbLine = function(t0, t1, ellipsoid, p0, p1, minDistance, result) {
308
- const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
309
- const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
310
- scratchRhumbLine.setEndPoints(c0, c1);
311
- const n = scratchRhumbLine.surfaceDistance / minDistance;
312
- const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
313
- const subdivisions = Math.pow(2, countDivide);
314
- const length2D = Cartesian2_default.distance(t0, t1);
315
- const distanceBetweenCoords = length2D / subdivisions;
316
- const texcoords = result;
317
- texcoords.length = subdivisions * 2;
318
- let index = 0;
319
- for (let i = 0; i < subdivisions; i++) {
320
- const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
321
- texcoords[index++] = t[0];
322
- texcoords[index++] = t[1];
323
- }
324
- return texcoords;
325
- };
326
- PolygonGeometryLibrary.subdivideRhumbLine = function(ellipsoid, p0, p1, minDistance, result) {
327
- const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
328
- const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
329
- const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
330
- const n = rhumb.surfaceDistance / minDistance;
331
- const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
332
- const numVertices = Math.pow(2, countDivide);
333
- const distanceBetweenVertices = rhumb.surfaceDistance / numVertices;
334
- if (!defined_default(result)) {
335
- result = [];
336
- }
337
- const positions = result;
338
- positions.length = numVertices * 3;
339
- let index = 0;
340
- for (let i = 0; i < numVertices; i++) {
341
- const c = rhumb.interpolateUsingSurfaceDistance(
342
- i * distanceBetweenVertices,
343
- scratchCartographic2
344
- );
345
- const p = ellipsoid.cartographicToCartesian(c, scratchCartesian0);
346
- positions[index++] = p.x;
347
- positions[index++] = p.y;
348
- positions[index++] = p.z;
349
- }
350
- return positions;
351
- };
352
- var scaleToGeodeticHeightN1 = new Cartesian3_default();
353
- var scaleToGeodeticHeightN2 = new Cartesian3_default();
354
- var scaleToGeodeticHeightP1 = new Cartesian3_default();
355
- var scaleToGeodeticHeightP2 = new Cartesian3_default();
356
- PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid, perPositionHeight) {
357
- ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
358
- const n1 = scaleToGeodeticHeightN1;
359
- let n2 = scaleToGeodeticHeightN2;
360
- const p = scaleToGeodeticHeightP1;
361
- let p2 = scaleToGeodeticHeightP2;
362
- if (defined_default(geometry) && defined_default(geometry.attributes) && defined_default(geometry.attributes.position)) {
363
- const positions = geometry.attributes.position.values;
364
- const length = positions.length / 2;
365
- for (let i = 0; i < length; i += 3) {
366
- Cartesian3_default.fromArray(positions, i, p);
367
- ellipsoid.geodeticSurfaceNormal(p, n1);
368
- p2 = ellipsoid.scaleToGeodeticSurface(p, p2);
369
- n2 = Cartesian3_default.multiplyByScalar(n1, minHeight, n2);
370
- n2 = Cartesian3_default.add(p2, n2, n2);
371
- positions[i + length] = n2.x;
372
- positions[i + 1 + length] = n2.y;
373
- positions[i + 2 + length] = n2.z;
374
- if (perPositionHeight) {
375
- p2 = Cartesian3_default.clone(p, p2);
376
- }
377
- n2 = Cartesian3_default.multiplyByScalar(n1, maxHeight, n2);
378
- n2 = Cartesian3_default.add(p2, n2, n2);
379
- positions[i] = n2.x;
380
- positions[i + 1] = n2.y;
381
- positions[i + 2] = n2.z;
382
- }
383
- }
384
- return geometry;
385
- };
386
- PolygonGeometryLibrary.polygonOutlinesFromHierarchy = function(polygonHierarchy, scaleToEllipsoidSurface, ellipsoid) {
387
- const polygons = [];
388
- const queue = new Queue_default();
389
- queue.enqueue(polygonHierarchy);
390
- let i;
391
- let j;
392
- let length;
393
- while (queue.length !== 0) {
394
- const outerNode = queue.dequeue();
395
- let outerRing = outerNode.positions;
396
- if (scaleToEllipsoidSurface) {
397
- length = outerRing.length;
398
- for (i = 0; i < length; i++) {
399
- ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
400
- }
401
- }
402
- outerRing = arrayRemoveDuplicates_default(
403
- outerRing,
404
- Cartesian3_default.equalsEpsilon,
405
- true
406
- );
407
- if (outerRing.length < 3) {
408
- continue;
409
- }
410
- const numChildren = outerNode.holes ? outerNode.holes.length : 0;
411
- for (i = 0; i < numChildren; i++) {
412
- const hole = outerNode.holes[i];
413
- let holePositions = hole.positions;
414
- if (scaleToEllipsoidSurface) {
415
- length = holePositions.length;
416
- for (j = 0; j < length; ++j) {
417
- ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
418
- }
419
- }
420
- holePositions = arrayRemoveDuplicates_default(
421
- holePositions,
422
- Cartesian3_default.equalsEpsilon,
423
- true
424
- );
425
- if (holePositions.length < 3) {
426
- continue;
427
- }
428
- polygons.push(holePositions);
429
- let numGrandchildren = 0;
430
- if (defined_default(hole.holes)) {
431
- numGrandchildren = hole.holes.length;
432
- }
433
- for (j = 0; j < numGrandchildren; j++) {
434
- queue.enqueue(hole.holes[j]);
435
- }
436
- }
437
- polygons.push(outerRing);
438
- }
439
- return polygons;
440
- };
441
- var scratchRhumbIntersection = new Cartographic_default();
442
- function computeEquatorIntersectionRhumb(start, end, ellipsoid) {
443
- const c0 = ellipsoid.cartesianToCartographic(start, scratchCartographic0);
444
- const c1 = ellipsoid.cartesianToCartographic(end, scratchCartographic1);
445
- if (Math.sign(c0.latitude) === Math.sign(c1.latitude)) {
446
- return;
447
- }
448
- scratchRhumbLine.setEndPoints(c0, c1);
449
- const intersection = scratchRhumbLine.findIntersectionWithLatitude(
450
- 0,
451
- scratchRhumbIntersection
452
- );
453
- if (!defined_default(intersection)) {
454
- return;
455
- }
456
- let minLongitude = Math.min(c0.longitude, c1.longitude);
457
- let maxLongitude = Math.max(c0.longitude, c1.longitude);
458
- if (Math.abs(maxLongitude - minLongitude) > Math_default.PI) {
459
- const swap = minLongitude;
460
- minLongitude = maxLongitude;
461
- maxLongitude = swap;
462
- }
463
- if (intersection.longitude < minLongitude || intersection.longitude > maxLongitude) {
464
- return;
465
- }
466
- return ellipsoid.cartographicToCartesian(intersection);
467
- }
468
- function computeEquatorIntersection(start, end, ellipsoid, arcType) {
469
- if (arcType === ArcType_default.RHUMB) {
470
- return computeEquatorIntersectionRhumb(start, end, ellipsoid);
471
- }
472
- const intersection = IntersectionTests_default.lineSegmentPlane(
473
- start,
474
- end,
475
- Plane_default.ORIGIN_XY_PLANE
476
- );
477
- if (!defined_default(intersection)) {
478
- return;
479
- }
480
- return ellipsoid.scaleToGeodeticSurface(intersection, intersection);
481
- }
482
- var scratchCartographic = new Cartographic_default();
483
- function computeEdgesOnPlane(positions, ellipsoid, arcType) {
484
- const edgesOnPlane = [];
485
- let startPoint, endPoint, type, next, intersection, i = 0;
486
- while (i < positions.length) {
487
- startPoint = positions[i];
488
- endPoint = positions[(i + 1) % positions.length];
489
- type = Math_default.sign(startPoint.z);
490
- next = Math_default.sign(endPoint.z);
491
- const getLongitude = (position) => {
492
- const cartographic = ellipsoid.cartesianToCartographic(
493
- position,
494
- scratchCartographic
495
- );
496
- return cartographic.longitude;
497
- };
498
- if (type === 0) {
499
- edgesOnPlane.push({
500
- position: i,
501
- type,
502
- visited: false,
503
- next,
504
- theta: getLongitude(startPoint)
505
- });
506
- } else if (next !== 0) {
507
- intersection = computeEquatorIntersection(
508
- startPoint,
509
- endPoint,
510
- ellipsoid,
511
- arcType
512
- );
513
- ++i;
514
- if (!defined_default(intersection)) {
515
- continue;
516
- }
517
- positions.splice(i, 0, intersection);
518
- edgesOnPlane.push({
519
- position: i,
520
- type,
521
- visited: false,
522
- next,
523
- theta: getLongitude(intersection)
524
- });
525
- }
526
- ++i;
527
- }
528
- return edgesOnPlane;
529
- }
530
- function wirePolygon(polygons, polygonIndex, positions, edgesOnPlane, toDelete, startIndex, abovePlane) {
531
- const polygon = [];
532
- let i = startIndex;
533
- const getMatchingEdge = (i2) => (edge) => edge.position === i2;
534
- const polygonsToWire = [];
535
- do {
536
- const position = positions[i];
537
- polygon.push(position);
538
- const edgeIndex = edgesOnPlane.findIndex(getMatchingEdge(i));
539
- const edge = edgesOnPlane[edgeIndex];
540
- if (!defined_default(edge)) {
541
- ++i;
542
- continue;
543
- }
544
- const { visited: hasBeenVisited, type, next } = edge;
545
- edge.visited = true;
546
- if (type === 0) {
547
- if (next === 0) {
548
- const previousEdge = edgesOnPlane[edgeIndex - (abovePlane ? 1 : -1)];
549
- if (previousEdge?.position === i + 1) {
550
- previousEdge.visited = true;
551
- } else {
552
- ++i;
553
- continue;
554
- }
555
- }
556
- if (!hasBeenVisited && abovePlane && next > 0 || startIndex === i && !abovePlane && next < 0) {
557
- ++i;
558
- continue;
559
- }
560
- }
561
- const followEdge = abovePlane ? type >= 0 : type <= 0;
562
- if (!followEdge) {
563
- ++i;
564
- continue;
565
- }
566
- if (!hasBeenVisited) {
567
- polygonsToWire.push(i);
568
- }
569
- const nextEdgeIndex = edgeIndex + (abovePlane ? 1 : -1);
570
- const nextEdge = edgesOnPlane[nextEdgeIndex];
571
- if (!defined_default(nextEdge)) {
572
- ++i;
573
- continue;
574
- }
575
- i = nextEdge.position;
576
- } while (i < positions.length && i >= 0 && i !== startIndex && polygon.length < positions.length);
577
- polygons.splice(polygonIndex, toDelete, polygon);
578
- for (const index of polygonsToWire) {
579
- polygonIndex = wirePolygon(
580
- polygons,
581
- ++polygonIndex,
582
- positions,
583
- edgesOnPlane,
584
- 0,
585
- index,
586
- !abovePlane
587
- );
588
- }
589
- return polygonIndex;
590
- }
591
- PolygonGeometryLibrary.splitPolygonsOnEquator = function(outerRings, ellipsoid, arcType, result) {
592
- if (!defined_default(result)) {
593
- result = [];
594
- }
595
- result.splice(0, 0, ...outerRings);
596
- result.length = outerRings.length;
597
- let currentPolygon = 0;
598
- while (currentPolygon < result.length) {
599
- const outerRing = result[currentPolygon];
600
- const positions = outerRing.slice();
601
- if (outerRing.length < 3) {
602
- result[currentPolygon] = positions;
603
- ++currentPolygon;
604
- continue;
605
- }
606
- const edgesOnPlane = computeEdgesOnPlane(positions, ellipsoid, arcType);
607
- if (positions.length === outerRing.length || edgesOnPlane.length <= 1) {
608
- result[currentPolygon] = positions;
609
- ++currentPolygon;
610
- continue;
611
- }
612
- edgesOnPlane.sort((a, b) => {
613
- return a.theta - b.theta;
614
- });
615
- const north = positions[0].z >= 0;
616
- currentPolygon = wirePolygon(
617
- result,
618
- currentPolygon,
619
- positions,
620
- edgesOnPlane,
621
- 1,
622
- 0,
623
- north
624
- );
625
- }
626
- return result;
627
- };
628
- PolygonGeometryLibrary.polygonsFromHierarchy = function(polygonHierarchy, keepDuplicates, projectPointsTo2D, scaleToEllipsoidSurface, ellipsoid, splitPolygons) {
629
- const hierarchy = [];
630
- const polygons = [];
631
- const queue = new Queue_default();
632
- queue.enqueue(polygonHierarchy);
633
- let split = defined_default(splitPolygons);
634
- while (queue.length !== 0) {
635
- const outerNode = queue.dequeue();
636
- let outerRing = outerNode.positions;
637
- const holes = outerNode.holes;
638
- let i;
639
- let length;
640
- if (scaleToEllipsoidSurface) {
641
- length = outerRing.length;
642
- for (i = 0; i < length; i++) {
643
- ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
644
- }
645
- }
646
- if (!keepDuplicates) {
647
- outerRing = arrayRemoveDuplicates_default(
648
- outerRing,
649
- Cartesian3_default.equalsEpsilon,
650
- true
651
- );
652
- }
653
- if (outerRing.length < 3) {
654
- continue;
655
- }
656
- let positions2D = projectPointsTo2D(outerRing);
657
- if (!defined_default(positions2D)) {
658
- continue;
659
- }
660
- const holeIndices = [];
661
- let originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
662
- positions2D
663
- );
664
- if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
665
- positions2D.reverse();
666
- outerRing = outerRing.slice().reverse();
667
- }
668
- if (split) {
669
- split = false;
670
- let polygons2 = [outerRing];
671
- polygons2 = splitPolygons(polygons2, polygons2);
672
- if (polygons2.length > 1) {
673
- for (const positions2 of polygons2) {
674
- queue.enqueue(new PolygonHierarchy_default(positions2, holes));
675
- }
676
- continue;
677
- }
678
- }
679
- let positions = outerRing.slice();
680
- const numChildren = defined_default(holes) ? holes.length : 0;
681
- const polygonHoles = [];
682
- let j;
683
- for (i = 0; i < numChildren; i++) {
684
- const hole = holes[i];
685
- let holePositions = hole.positions;
686
- if (scaleToEllipsoidSurface) {
687
- length = holePositions.length;
688
- for (j = 0; j < length; ++j) {
689
- ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
690
- }
691
- }
692
- if (!keepDuplicates) {
693
- holePositions = arrayRemoveDuplicates_default(
694
- holePositions,
695
- Cartesian3_default.equalsEpsilon,
696
- true
697
- );
698
- }
699
- if (holePositions.length < 3) {
700
- continue;
701
- }
702
- const holePositions2D = projectPointsTo2D(holePositions);
703
- if (!defined_default(holePositions2D)) {
704
- continue;
705
- }
706
- originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
707
- holePositions2D
708
- );
709
- if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
710
- holePositions2D.reverse();
711
- holePositions = holePositions.slice().reverse();
712
- }
713
- polygonHoles.push(holePositions);
714
- holeIndices.push(positions.length);
715
- positions = positions.concat(holePositions);
716
- positions2D = positions2D.concat(holePositions2D);
717
- let numGrandchildren = 0;
718
- if (defined_default(hole.holes)) {
719
- numGrandchildren = hole.holes.length;
720
- }
721
- for (j = 0; j < numGrandchildren; j++) {
722
- queue.enqueue(hole.holes[j]);
723
- }
724
- }
725
- hierarchy.push({
726
- outerRing,
727
- holes: polygonHoles
728
- });
729
- polygons.push({
730
- positions,
731
- positions2D,
732
- holes: holeIndices
733
- });
734
- }
735
- return {
736
- hierarchy,
737
- polygons
738
- };
739
- };
740
- var computeBoundingRectangleCartesian2 = new Cartesian2_default();
741
- var computeBoundingRectangleCartesian3 = new Cartesian3_default();
742
- var computeBoundingRectangleQuaternion = new Quaternion_default();
743
- var computeBoundingRectangleMatrix3 = new Matrix3_default();
744
- PolygonGeometryLibrary.computeBoundingRectangle = function(planeNormal, projectPointTo2D, positions, angle, result) {
745
- const rotation = Quaternion_default.fromAxisAngle(
746
- planeNormal,
747
- angle,
748
- computeBoundingRectangleQuaternion
749
- );
750
- const textureMatrix = Matrix3_default.fromQuaternion(
751
- rotation,
752
- computeBoundingRectangleMatrix3
753
- );
754
- let minX = Number.POSITIVE_INFINITY;
755
- let maxX = Number.NEGATIVE_INFINITY;
756
- let minY = Number.POSITIVE_INFINITY;
757
- let maxY = Number.NEGATIVE_INFINITY;
758
- const length = positions.length;
759
- for (let i = 0; i < length; ++i) {
760
- const p = Cartesian3_default.clone(
761
- positions[i],
762
- computeBoundingRectangleCartesian3
763
- );
764
- Matrix3_default.multiplyByVector(textureMatrix, p, p);
765
- const st = projectPointTo2D(p, computeBoundingRectangleCartesian2);
766
- if (defined_default(st)) {
767
- minX = Math.min(minX, st.x);
768
- maxX = Math.max(maxX, st.x);
769
- minY = Math.min(minY, st.y);
770
- maxY = Math.max(maxY, st.y);
771
- }
772
- }
773
- result.x = minX;
774
- result.y = minY;
775
- result.width = maxX - minX;
776
- result.height = maxY - minY;
777
- return result;
778
- };
779
- PolygonGeometryLibrary.createGeometryFromPositions = function(ellipsoid, polygon, textureCoordinates, granularity, perPositionHeight, vertexFormat, arcType) {
780
- let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
781
- if (indices.length < 3) {
782
- indices = [0, 1, 2];
783
- }
784
- const positions = polygon.positions;
785
- const hasTexcoords = defined_default(textureCoordinates);
786
- const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
787
- if (perPositionHeight) {
788
- const length = positions.length;
789
- const flattenedPositions = new Array(length * 3);
790
- let index = 0;
791
- for (let i = 0; i < length; i++) {
792
- const p = positions[i];
793
- flattenedPositions[index++] = p.x;
794
- flattenedPositions[index++] = p.y;
795
- flattenedPositions[index++] = p.z;
796
- }
797
- const geometryOptions = {
798
- attributes: {
799
- position: new GeometryAttribute_default({
800
- componentDatatype: ComponentDatatype_default.DOUBLE,
801
- componentsPerAttribute: 3,
802
- values: flattenedPositions
803
- })
804
- },
805
- indices,
806
- primitiveType: PrimitiveType_default.TRIANGLES
807
- };
808
- if (hasTexcoords) {
809
- geometryOptions.attributes.st = new GeometryAttribute_default({
810
- componentDatatype: ComponentDatatype_default.FLOAT,
811
- componentsPerAttribute: 2,
812
- values: Cartesian2_default.packArray(texcoords)
813
- });
814
- }
815
- const geometry = new Geometry_default(geometryOptions);
816
- if (vertexFormat.normal) {
817
- return GeometryPipeline_default.computeNormal(geometry);
818
- }
819
- return geometry;
820
- }
821
- if (arcType === ArcType_default.GEODESIC) {
822
- return PolygonPipeline_default.computeSubdivision(
823
- ellipsoid,
824
- positions,
825
- indices,
826
- texcoords,
827
- granularity
828
- );
829
- } else if (arcType === ArcType_default.RHUMB) {
830
- return PolygonPipeline_default.computeRhumbLineSubdivision(
831
- ellipsoid,
832
- positions,
833
- indices,
834
- texcoords,
835
- granularity
836
- );
837
- }
838
- };
839
- var computeWallTexcoordsSubdivided = [];
840
- var computeWallIndicesSubdivided = [];
841
- var p1Scratch = new Cartesian3_default();
842
- var p2Scratch = new Cartesian3_default();
843
- PolygonGeometryLibrary.computeWallGeometry = function(positions, textureCoordinates, ellipsoid, granularity, perPositionHeight, arcType) {
844
- let edgePositions;
845
- let topEdgeLength;
846
- let i;
847
- let p1;
848
- let p2;
849
- let t1;
850
- let t2;
851
- let edgeTexcoords;
852
- let topEdgeTexcoordLength;
853
- let length = positions.length;
854
- let index = 0;
855
- let textureIndex = 0;
856
- const hasTexcoords = defined_default(textureCoordinates);
857
- const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
858
- if (!perPositionHeight) {
859
- const minDistance = Math_default.chordLength(
860
- granularity,
861
- ellipsoid.maximumRadius
862
- );
863
- let numVertices = 0;
864
- if (arcType === ArcType_default.GEODESIC) {
865
- for (i = 0; i < length; i++) {
866
- numVertices += PolygonGeometryLibrary.subdivideLineCount(
867
- positions[i],
868
- positions[(i + 1) % length],
869
- minDistance
870
- );
871
- }
872
- } else if (arcType === ArcType_default.RHUMB) {
873
- for (i = 0; i < length; i++) {
874
- numVertices += PolygonGeometryLibrary.subdivideRhumbLineCount(
875
- ellipsoid,
876
- positions[i],
877
- positions[(i + 1) % length],
878
- minDistance
879
- );
880
- }
881
- }
882
- topEdgeLength = (numVertices + length) * 3;
883
- edgePositions = new Array(topEdgeLength * 2);
884
- if (hasTexcoords) {
885
- topEdgeTexcoordLength = (numVertices + length) * 2;
886
- edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
887
- }
888
- for (i = 0; i < length; i++) {
889
- p1 = positions[i];
890
- p2 = positions[(i + 1) % length];
891
- let tempPositions;
892
- let tempTexcoords;
893
- if (hasTexcoords) {
894
- t1 = texcoords[i];
895
- t2 = texcoords[(i + 1) % length];
896
- }
897
- if (arcType === ArcType_default.GEODESIC) {
898
- tempPositions = PolygonGeometryLibrary.subdivideLine(
899
- p1,
900
- p2,
901
- minDistance,
902
- computeWallIndicesSubdivided
903
- );
904
- if (hasTexcoords) {
905
- tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordLine(
906
- t1,
907
- t2,
908
- p1,
909
- p2,
910
- minDistance,
911
- computeWallTexcoordsSubdivided
912
- );
913
- }
914
- } else if (arcType === ArcType_default.RHUMB) {
915
- tempPositions = PolygonGeometryLibrary.subdivideRhumbLine(
916
- ellipsoid,
917
- p1,
918
- p2,
919
- minDistance,
920
- computeWallIndicesSubdivided
921
- );
922
- if (hasTexcoords) {
923
- tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordRhumbLine(
924
- t1,
925
- t2,
926
- ellipsoid,
927
- p1,
928
- p2,
929
- minDistance,
930
- computeWallTexcoordsSubdivided
931
- );
932
- }
933
- }
934
- const tempPositionsLength = tempPositions.length;
935
- for (let j = 0; j < tempPositionsLength; ++j, ++index) {
936
- edgePositions[index] = tempPositions[j];
937
- edgePositions[index + topEdgeLength] = tempPositions[j];
938
- }
939
- edgePositions[index] = p2.x;
940
- edgePositions[index + topEdgeLength] = p2.x;
941
- ++index;
942
- edgePositions[index] = p2.y;
943
- edgePositions[index + topEdgeLength] = p2.y;
944
- ++index;
945
- edgePositions[index] = p2.z;
946
- edgePositions[index + topEdgeLength] = p2.z;
947
- ++index;
948
- if (hasTexcoords) {
949
- const tempTexcoordsLength = tempTexcoords.length;
950
- for (let k = 0; k < tempTexcoordsLength; ++k, ++textureIndex) {
951
- edgeTexcoords[textureIndex] = tempTexcoords[k];
952
- edgeTexcoords[textureIndex + topEdgeTexcoordLength] = tempTexcoords[k];
953
- }
954
- edgeTexcoords[textureIndex] = t2.x;
955
- edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
956
- ++textureIndex;
957
- edgeTexcoords[textureIndex] = t2.y;
958
- edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
959
- ++textureIndex;
960
- }
961
- }
962
- } else {
963
- topEdgeLength = length * 3 * 2;
964
- edgePositions = new Array(topEdgeLength * 2);
965
- if (hasTexcoords) {
966
- topEdgeTexcoordLength = length * 2 * 2;
967
- edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
968
- }
969
- for (i = 0; i < length; i++) {
970
- p1 = positions[i];
971
- p2 = positions[(i + 1) % length];
972
- edgePositions[index] = edgePositions[index + topEdgeLength] = p1.x;
973
- ++index;
974
- edgePositions[index] = edgePositions[index + topEdgeLength] = p1.y;
975
- ++index;
976
- edgePositions[index] = edgePositions[index + topEdgeLength] = p1.z;
977
- ++index;
978
- edgePositions[index] = edgePositions[index + topEdgeLength] = p2.x;
979
- ++index;
980
- edgePositions[index] = edgePositions[index + topEdgeLength] = p2.y;
981
- ++index;
982
- edgePositions[index] = edgePositions[index + topEdgeLength] = p2.z;
983
- ++index;
984
- if (hasTexcoords) {
985
- t1 = texcoords[i];
986
- t2 = texcoords[(i + 1) % length];
987
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.x;
988
- ++textureIndex;
989
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.y;
990
- ++textureIndex;
991
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
992
- ++textureIndex;
993
- edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
994
- ++textureIndex;
995
- }
996
- }
997
- }
998
- length = edgePositions.length;
999
- const indices = IndexDatatype_default.createTypedArray(
1000
- length / 3,
1001
- length - positions.length * 6
1002
- );
1003
- let edgeIndex = 0;
1004
- length /= 6;
1005
- for (i = 0; i < length; i++) {
1006
- const UL = i;
1007
- const UR = UL + 1;
1008
- const LL = UL + length;
1009
- const LR = LL + 1;
1010
- p1 = Cartesian3_default.fromArray(edgePositions, UL * 3, p1Scratch);
1011
- p2 = Cartesian3_default.fromArray(edgePositions, UR * 3, p2Scratch);
1012
- if (Cartesian3_default.equalsEpsilon(
1013
- p1,
1014
- p2,
1015
- Math_default.EPSILON10,
1016
- Math_default.EPSILON10
1017
- )) {
1018
- continue;
1019
- }
1020
- indices[edgeIndex++] = UL;
1021
- indices[edgeIndex++] = LL;
1022
- indices[edgeIndex++] = UR;
1023
- indices[edgeIndex++] = UR;
1024
- indices[edgeIndex++] = LL;
1025
- indices[edgeIndex++] = LR;
1026
- }
1027
- const geometryOptions = {
1028
- attributes: new GeometryAttributes_default({
1029
- position: new GeometryAttribute_default({
1030
- componentDatatype: ComponentDatatype_default.DOUBLE,
1031
- componentsPerAttribute: 3,
1032
- values: edgePositions
1033
- })
1034
- }),
1035
- indices,
1036
- primitiveType: PrimitiveType_default.TRIANGLES
1037
- };
1038
- if (hasTexcoords) {
1039
- geometryOptions.attributes.st = new GeometryAttribute_default({
1040
- componentDatatype: ComponentDatatype_default.FLOAT,
1041
- componentsPerAttribute: 2,
1042
- values: edgeTexcoords
1043
- });
1044
- }
1045
- const geometry = new Geometry_default(geometryOptions);
1046
- return geometry;
1047
- };
1048
- var PolygonGeometryLibrary_default = PolygonGeometryLibrary;
1049
-
1050
- export {
1051
- PolygonGeometryLibrary_default
1052
- };