@gmgis/gm-sdk 1.12.5 → 2.0.2

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 (159) hide show
  1. package/dist/dist/index.js +1848 -0
  2. package/dist/gm.min.js +16983 -16483
  3. package/dist/index.js +1436 -1434
  4. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
  5. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
  6. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
  7. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
  8. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  9. package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
  10. package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
  11. package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
  12. package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
  13. package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
  14. package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
  15. package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
  16. package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
  17. package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
  18. package/dist/resources/Workers/{chunk-I2ITFFPX.js → chunk-A56XVLQR.js} +2 -13
  19. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  20. package/dist/resources/Workers/{chunk-PRGYLLJT.js → chunk-ARG42DC4.js} +2 -31
  21. package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
  22. package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
  23. package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
  24. package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
  25. package/dist/resources/Workers/{chunk-DI5NGJUP.js → chunk-D6AA5QVT.js} +2 -20
  26. package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
  27. package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
  28. package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
  29. package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
  30. package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
  31. package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
  32. package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
  33. package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
  34. package/dist/resources/Workers/{chunk-7JO7GPJN.js → chunk-GBYLG25F.js} +2 -15
  35. package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
  36. package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
  37. package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
  38. package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
  39. package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
  40. package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
  41. package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
  42. package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
  43. package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
  44. package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
  45. package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
  46. package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
  47. package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
  48. package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
  49. package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
  50. package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
  51. package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
  52. package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
  53. package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
  54. package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
  55. package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
  56. package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
  57. package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
  58. package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
  59. package/dist/resources/Workers/{chunk-6CHGCNMW.js → chunk-WZDE3RYP.js} +4 -34
  60. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  61. package/dist/resources/Workers/combineGeometry.js +2 -40
  62. package/dist/resources/Workers/createBoxGeometry.js +2 -32
  63. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -209
  64. package/dist/resources/Workers/createCircleGeometry.js +2 -175
  65. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -121
  66. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -481
  67. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -199
  68. package/dist/resources/Workers/createCorridorGeometry.js +2 -1237
  69. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -542
  70. package/dist/resources/Workers/createCylinderGeometry.js +2 -34
  71. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -205
  72. package/dist/resources/Workers/createEllipseGeometry.js +2 -45
  73. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -38
  74. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -33
  75. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -35
  76. package/dist/resources/Workers/createFrustumGeometry.js +2 -32
  77. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -210
  78. package/dist/resources/Workers/createGeometry.js +2 -144
  79. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1582
  80. package/dist/resources/Workers/createPlaneGeometry.js +2 -198
  81. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -98
  82. package/dist/resources/Workers/createPolygonGeometry.js +2 -1381
  83. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -509
  84. package/dist/resources/Workers/createPolylineGeometry.js +2 -470
  85. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -354
  86. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -251
  87. package/dist/resources/Workers/createRectangleGeometry.js +2 -1246
  88. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -453
  89. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -374
  90. package/dist/resources/Workers/createSphereGeometry.js +2 -92
  91. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -92
  92. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  93. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -466
  94. package/dist/resources/Workers/createVectorTileGeometries.js +2 -361
  95. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  96. package/dist/resources/Workers/createVectorTilePolygons.js +2 -359
  97. package/dist/resources/Workers/createVectorTilePolylines.js +2 -236
  98. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -539
  99. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2252
  100. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -729
  101. package/dist/resources/Workers/createWallGeometry.js +2 -464
  102. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -312
  103. package/dist/resources/Workers/decodeDraco.js +2 -345
  104. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2642
  105. package/dist/resources/Workers/decodeI3S.js +2 -1319
  106. package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
  107. package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
  108. package/dist/resources/Workers/transcodeKTX2.js +29 -3360
  109. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  110. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -793
  111. package/package.json +74 -74
  112. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
  113. package/dist/resources/Workers/chunk-26GA3JAM.js +0 -139
  114. package/dist/resources/Workers/chunk-27HUZ7SA.js +0 -305
  115. package/dist/resources/Workers/chunk-2ZGOQXYU.js +0 -171
  116. package/dist/resources/Workers/chunk-3Q2L65QU.js +0 -1258
  117. package/dist/resources/Workers/chunk-472HQ3EH.js +0 -100
  118. package/dist/resources/Workers/chunk-5ODQSF26.js +0 -101
  119. package/dist/resources/Workers/chunk-5OOFQLKF.js +0 -634
  120. package/dist/resources/Workers/chunk-5PTXS2GO.js +0 -10390
  121. package/dist/resources/Workers/chunk-76BYBWHP.js +0 -122
  122. package/dist/resources/Workers/chunk-7BMOHCPM.js +0 -390
  123. package/dist/resources/Workers/chunk-7KTQP4VB.js +0 -59
  124. package/dist/resources/Workers/chunk-7O373FFS.js +0 -665
  125. package/dist/resources/Workers/chunk-AD63PIY6.js +0 -163
  126. package/dist/resources/Workers/chunk-BHQJ2NT7.js +0 -353
  127. package/dist/resources/Workers/chunk-C6YYBQXW.js +0 -102
  128. package/dist/resources/Workers/chunk-CKY7HOHV.js +0 -287
  129. package/dist/resources/Workers/chunk-DHYHSFFJ.js +0 -73
  130. package/dist/resources/Workers/chunk-E27BLMDD.js +0 -115
  131. package/dist/resources/Workers/chunk-E63IIM5T.js +0 -75
  132. package/dist/resources/Workers/chunk-E6V6SQZW.js +0 -456
  133. package/dist/resources/Workers/chunk-EJZTDTUH.js +0 -138
  134. package/dist/resources/Workers/chunk-FDOV2LBJ.js +0 -220
  135. package/dist/resources/Workers/chunk-FIGIZHAQ.js +0 -684
  136. package/dist/resources/Workers/chunk-GESF4OXQ.js +0 -1800
  137. package/dist/resources/Workers/chunk-GGZJN2TI.js +0 -2717
  138. package/dist/resources/Workers/chunk-GNBFYG7F.js +0 -1481
  139. package/dist/resources/Workers/chunk-GWCFU2SA.js +0 -300
  140. package/dist/resources/Workers/chunk-IBLIYJZR.js +0 -196
  141. package/dist/resources/Workers/chunk-JW4FOI6M.js +0 -476
  142. package/dist/resources/Workers/chunk-K4GQUNB5.js +0 -262
  143. package/dist/resources/Workers/chunk-M3GMB5OP.js +0 -834
  144. package/dist/resources/Workers/chunk-MXIZJAPH.js +0 -629
  145. package/dist/resources/Workers/chunk-N5KJGGCM.js +0 -1073
  146. package/dist/resources/Workers/chunk-NGPPMXRM.js +0 -435
  147. package/dist/resources/Workers/chunk-O3E4OAOE.js +0 -511
  148. package/dist/resources/Workers/chunk-PGRPDNHG.js +0 -1048
  149. package/dist/resources/Workers/chunk-S6MRMMQU.js +0 -157
  150. package/dist/resources/Workers/chunk-SMDOP47J.js +0 -945
  151. package/dist/resources/Workers/chunk-TGONEMZO.js +0 -421
  152. package/dist/resources/Workers/chunk-TKVT5GQM.js +0 -781
  153. package/dist/resources/Workers/chunk-U72QNFOJ.js +0 -758
  154. package/dist/resources/Workers/chunk-VJZB3WAV.js +0 -963
  155. package/dist/resources/Workers/chunk-VU2MNO7L.js +0 -239
  156. package/dist/resources/Workers/chunk-XY4BATBS.js +0 -500
  157. package/dist/resources/Workers/chunk-YFXQECWV.js +0 -2857
  158. package/dist/resources/Workers/chunk-YSGTGQQO.js +0 -398
  159. package/dist/resources/Workers/chunk-YZ733KKS.js +0 -368
@@ -1,665 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.122
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
- PolylinePipeline_default
28
- } from "./chunk-TGONEMZO.js";
29
- import {
30
- EllipsoidTangentPlane_default
31
- } from "./chunk-CKY7HOHV.js";
32
- import {
33
- Cartesian4_default,
34
- Matrix4_default,
35
- Quaternion_default,
36
- Transforms_default,
37
- oneTimeWarning_default
38
- } from "./chunk-5PTXS2GO.js";
39
- import {
40
- Cartesian2_default,
41
- Cartesian3_default,
42
- Cartographic_default,
43
- Matrix3_default
44
- } from "./chunk-YFXQECWV.js";
45
- import {
46
- Math_default
47
- } from "./chunk-XY4BATBS.js";
48
-
49
- // packages/engine/Source/Core/CornerType.js
50
- var CornerType = {
51
- /**
52
- * <img src="Images/CornerTypeRounded.png" style="vertical-align: middle;" width="186" height="189" />
53
- *
54
- * Corner has a smooth edge.
55
- * @type {number}
56
- * @constant
57
- */
58
- ROUNDED: 0,
59
- /**
60
- * <img src="Images/CornerTypeMitered.png" style="vertical-align: middle;" width="186" height="189" />
61
- *
62
- * Corner point is the intersection of adjacent edges.
63
- * @type {number}
64
- * @constant
65
- */
66
- MITERED: 1,
67
- /**
68
- * <img src="Images/CornerTypeBeveled.png" style="vertical-align: middle;" width="186" height="189" />
69
- *
70
- * Corner is clipped.
71
- * @type {number}
72
- * @constant
73
- */
74
- BEVELED: 2
75
- };
76
- var CornerType_default = Object.freeze(CornerType);
77
-
78
- // packages/engine/Source/Core/PolylineVolumeGeometryLibrary.js
79
- var scratch2Array = [new Cartesian3_default(), new Cartesian3_default()];
80
- var scratchCartesian1 = new Cartesian3_default();
81
- var scratchCartesian2 = new Cartesian3_default();
82
- var scratchCartesian3 = new Cartesian3_default();
83
- var scratchCartesian4 = new Cartesian3_default();
84
- var scratchCartesian5 = new Cartesian3_default();
85
- var scratchCartesian6 = new Cartesian3_default();
86
- var scratchCartesian7 = new Cartesian3_default();
87
- var scratchCartesian8 = new Cartesian3_default();
88
- var scratchCartesian9 = new Cartesian3_default();
89
- var scratch1 = new Cartesian3_default();
90
- var scratch2 = new Cartesian3_default();
91
- var PolylineVolumeGeometryLibrary = {};
92
- var cartographic = new Cartographic_default();
93
- function scaleToSurface(positions, ellipsoid) {
94
- const heights = new Array(positions.length);
95
- for (let i = 0; i < positions.length; i++) {
96
- const pos = positions[i];
97
- cartographic = ellipsoid.cartesianToCartographic(pos, cartographic);
98
- heights[i] = cartographic.height;
99
- positions[i] = ellipsoid.scaleToGeodeticSurface(pos, pos);
100
- }
101
- return heights;
102
- }
103
- function subdivideHeights(points, h0, h1, granularity) {
104
- const p0 = points[0];
105
- const p1 = points[1];
106
- const angleBetween = Cartesian3_default.angleBetween(p0, p1);
107
- const numPoints = Math.ceil(angleBetween / granularity);
108
- const heights = new Array(numPoints);
109
- let i;
110
- if (h0 === h1) {
111
- for (i = 0; i < numPoints; i++) {
112
- heights[i] = h0;
113
- }
114
- heights.push(h1);
115
- return heights;
116
- }
117
- const dHeight = h1 - h0;
118
- const heightPerVertex = dHeight / numPoints;
119
- for (i = 1; i < numPoints; i++) {
120
- const h = h0 + i * heightPerVertex;
121
- heights[i] = h;
122
- }
123
- heights[0] = h0;
124
- heights.push(h1);
125
- return heights;
126
- }
127
- var nextScratch = new Cartesian3_default();
128
- var prevScratch = new Cartesian3_default();
129
- function computeRotationAngle(start, end, position, ellipsoid) {
130
- const tangentPlane = new EllipsoidTangentPlane_default(position, ellipsoid);
131
- const next = tangentPlane.projectPointOntoPlane(
132
- Cartesian3_default.add(position, start, nextScratch),
133
- nextScratch
134
- );
135
- const prev = tangentPlane.projectPointOntoPlane(
136
- Cartesian3_default.add(position, end, prevScratch),
137
- prevScratch
138
- );
139
- const angle = Cartesian2_default.angleBetween(next, prev);
140
- return prev.x * next.y - prev.y * next.x >= 0 ? -angle : angle;
141
- }
142
- var negativeX = new Cartesian3_default(-1, 0, 0);
143
- var transform = new Matrix4_default();
144
- var translation = new Matrix4_default();
145
- var rotationZ = new Matrix3_default();
146
- var scaleMatrix = Matrix3_default.IDENTITY.clone();
147
- var westScratch = new Cartesian3_default();
148
- var finalPosScratch = new Cartesian4_default();
149
- var heightCartesian = new Cartesian3_default();
150
- function addPosition(center, left, shape, finalPositions, ellipsoid, height, xScalar, repeat) {
151
- let west = westScratch;
152
- let finalPosition = finalPosScratch;
153
- transform = Transforms_default.eastNorthUpToFixedFrame(center, ellipsoid, transform);
154
- west = Matrix4_default.multiplyByPointAsVector(transform, negativeX, west);
155
- west = Cartesian3_default.normalize(west, west);
156
- const angle = computeRotationAngle(west, left, center, ellipsoid);
157
- rotationZ = Matrix3_default.fromRotationZ(angle, rotationZ);
158
- heightCartesian.z = height;
159
- transform = Matrix4_default.multiplyTransformation(
160
- transform,
161
- Matrix4_default.fromRotationTranslation(rotationZ, heightCartesian, translation),
162
- transform
163
- );
164
- const scale = scaleMatrix;
165
- scale[0] = xScalar;
166
- for (let j = 0; j < repeat; j++) {
167
- for (let i = 0; i < shape.length; i += 3) {
168
- finalPosition = Cartesian3_default.fromArray(shape, i, finalPosition);
169
- finalPosition = Matrix3_default.multiplyByVector(
170
- scale,
171
- finalPosition,
172
- finalPosition
173
- );
174
- finalPosition = Matrix4_default.multiplyByPoint(
175
- transform,
176
- finalPosition,
177
- finalPosition
178
- );
179
- finalPositions.push(finalPosition.x, finalPosition.y, finalPosition.z);
180
- }
181
- }
182
- return finalPositions;
183
- }
184
- var centerScratch = new Cartesian3_default();
185
- function addPositions(centers, left, shape, finalPositions, ellipsoid, heights, xScalar) {
186
- for (let i = 0; i < centers.length; i += 3) {
187
- const center = Cartesian3_default.fromArray(centers, i, centerScratch);
188
- finalPositions = addPosition(
189
- center,
190
- left,
191
- shape,
192
- finalPositions,
193
- ellipsoid,
194
- heights[i / 3],
195
- xScalar,
196
- 1
197
- );
198
- }
199
- return finalPositions;
200
- }
201
- function convertShapeTo3DDuplicate(shape2D, boundingRectangle) {
202
- const length = shape2D.length;
203
- const shape = new Array(length * 6);
204
- let index = 0;
205
- const xOffset = boundingRectangle.x + boundingRectangle.width / 2;
206
- const yOffset = boundingRectangle.y + boundingRectangle.height / 2;
207
- let point = shape2D[0];
208
- shape[index++] = point.x - xOffset;
209
- shape[index++] = 0;
210
- shape[index++] = point.y - yOffset;
211
- for (let i = 1; i < length; i++) {
212
- point = shape2D[i];
213
- const x = point.x - xOffset;
214
- const z = point.y - yOffset;
215
- shape[index++] = x;
216
- shape[index++] = 0;
217
- shape[index++] = z;
218
- shape[index++] = x;
219
- shape[index++] = 0;
220
- shape[index++] = z;
221
- }
222
- point = shape2D[0];
223
- shape[index++] = point.x - xOffset;
224
- shape[index++] = 0;
225
- shape[index++] = point.y - yOffset;
226
- return shape;
227
- }
228
- function convertShapeTo3D(shape2D, boundingRectangle) {
229
- const length = shape2D.length;
230
- const shape = new Array(length * 3);
231
- let index = 0;
232
- const xOffset = boundingRectangle.x + boundingRectangle.width / 2;
233
- const yOffset = boundingRectangle.y + boundingRectangle.height / 2;
234
- for (let i = 0; i < length; i++) {
235
- shape[index++] = shape2D[i].x - xOffset;
236
- shape[index++] = 0;
237
- shape[index++] = shape2D[i].y - yOffset;
238
- }
239
- return shape;
240
- }
241
- var quaterion = new Quaternion_default();
242
- var startPointScratch = new Cartesian3_default();
243
- var rotMatrix = new Matrix3_default();
244
- function computeRoundCorner(pivot, startPoint, endPoint, cornerType, leftIsOutside, ellipsoid, finalPositions, shape, height, duplicatePoints) {
245
- const angle = Cartesian3_default.angleBetween(
246
- Cartesian3_default.subtract(startPoint, pivot, scratch1),
247
- Cartesian3_default.subtract(endPoint, pivot, scratch2)
248
- );
249
- const granularity = cornerType === CornerType_default.BEVELED ? 0 : Math.ceil(angle / Math_default.toRadians(5));
250
- let m;
251
- if (leftIsOutside) {
252
- m = Matrix3_default.fromQuaternion(
253
- Quaternion_default.fromAxisAngle(
254
- Cartesian3_default.negate(pivot, scratch1),
255
- angle / (granularity + 1),
256
- quaterion
257
- ),
258
- rotMatrix
259
- );
260
- } else {
261
- m = Matrix3_default.fromQuaternion(
262
- Quaternion_default.fromAxisAngle(pivot, angle / (granularity + 1), quaterion),
263
- rotMatrix
264
- );
265
- }
266
- let left;
267
- let surfacePoint;
268
- startPoint = Cartesian3_default.clone(startPoint, startPointScratch);
269
- if (granularity > 0) {
270
- const repeat = duplicatePoints ? 2 : 1;
271
- for (let i = 0; i < granularity; i++) {
272
- startPoint = Matrix3_default.multiplyByVector(m, startPoint, startPoint);
273
- left = Cartesian3_default.subtract(startPoint, pivot, scratch1);
274
- left = Cartesian3_default.normalize(left, left);
275
- if (!leftIsOutside) {
276
- left = Cartesian3_default.negate(left, left);
277
- }
278
- surfacePoint = ellipsoid.scaleToGeodeticSurface(startPoint, scratch2);
279
- finalPositions = addPosition(
280
- surfacePoint,
281
- left,
282
- shape,
283
- finalPositions,
284
- ellipsoid,
285
- height,
286
- 1,
287
- repeat
288
- );
289
- }
290
- } else {
291
- left = Cartesian3_default.subtract(startPoint, pivot, scratch1);
292
- left = Cartesian3_default.normalize(left, left);
293
- if (!leftIsOutside) {
294
- left = Cartesian3_default.negate(left, left);
295
- }
296
- surfacePoint = ellipsoid.scaleToGeodeticSurface(startPoint, scratch2);
297
- finalPositions = addPosition(
298
- surfacePoint,
299
- left,
300
- shape,
301
- finalPositions,
302
- ellipsoid,
303
- height,
304
- 1,
305
- 1
306
- );
307
- endPoint = Cartesian3_default.clone(endPoint, startPointScratch);
308
- left = Cartesian3_default.subtract(endPoint, pivot, scratch1);
309
- left = Cartesian3_default.normalize(left, left);
310
- if (!leftIsOutside) {
311
- left = Cartesian3_default.negate(left, left);
312
- }
313
- surfacePoint = ellipsoid.scaleToGeodeticSurface(endPoint, scratch2);
314
- finalPositions = addPosition(
315
- surfacePoint,
316
- left,
317
- shape,
318
- finalPositions,
319
- ellipsoid,
320
- height,
321
- 1,
322
- 1
323
- );
324
- }
325
- return finalPositions;
326
- }
327
- PolylineVolumeGeometryLibrary.removeDuplicatesFromShape = function(shapePositions) {
328
- const length = shapePositions.length;
329
- const cleanedPositions = [];
330
- for (let i0 = length - 1, i1 = 0; i1 < length; i0 = i1++) {
331
- const v0 = shapePositions[i0];
332
- const v1 = shapePositions[i1];
333
- if (!Cartesian2_default.equals(v0, v1)) {
334
- cleanedPositions.push(v1);
335
- }
336
- }
337
- return cleanedPositions;
338
- };
339
- PolylineVolumeGeometryLibrary.angleIsGreaterThanPi = function(forward, backward, position, ellipsoid) {
340
- const tangentPlane = new EllipsoidTangentPlane_default(position, ellipsoid);
341
- const next = tangentPlane.projectPointOntoPlane(
342
- Cartesian3_default.add(position, forward, nextScratch),
343
- nextScratch
344
- );
345
- const prev = tangentPlane.projectPointOntoPlane(
346
- Cartesian3_default.add(position, backward, prevScratch),
347
- prevScratch
348
- );
349
- return prev.x * next.y - prev.y * next.x >= 0;
350
- };
351
- var scratchForwardProjection = new Cartesian3_default();
352
- var scratchBackwardProjection = new Cartesian3_default();
353
- PolylineVolumeGeometryLibrary.computePositions = function(positions, shape2D, boundingRectangle, geometry, duplicatePoints) {
354
- const ellipsoid = geometry._ellipsoid;
355
- const heights = scaleToSurface(positions, ellipsoid);
356
- const granularity = geometry._granularity;
357
- const cornerType = geometry._cornerType;
358
- const shapeForSides = duplicatePoints ? convertShapeTo3DDuplicate(shape2D, boundingRectangle) : convertShapeTo3D(shape2D, boundingRectangle);
359
- const shapeForEnds = duplicatePoints ? convertShapeTo3D(shape2D, boundingRectangle) : void 0;
360
- const heightOffset = boundingRectangle.height / 2;
361
- const width = boundingRectangle.width / 2;
362
- let length = positions.length;
363
- let finalPositions = [];
364
- let ends = duplicatePoints ? [] : void 0;
365
- let forward = scratchCartesian1;
366
- let backward = scratchCartesian2;
367
- let cornerDirection = scratchCartesian3;
368
- let surfaceNormal = scratchCartesian4;
369
- let pivot = scratchCartesian5;
370
- let start = scratchCartesian6;
371
- let end = scratchCartesian7;
372
- let left = scratchCartesian8;
373
- let previousPosition = scratchCartesian9;
374
- let position = positions[0];
375
- let nextPosition = positions[1];
376
- surfaceNormal = ellipsoid.geodeticSurfaceNormal(position, surfaceNormal);
377
- forward = Cartesian3_default.subtract(nextPosition, position, forward);
378
- forward = Cartesian3_default.normalize(forward, forward);
379
- left = Cartesian3_default.cross(surfaceNormal, forward, left);
380
- left = Cartesian3_default.normalize(left, left);
381
- let h0 = heights[0];
382
- let h1 = heights[1];
383
- if (duplicatePoints) {
384
- ends = addPosition(
385
- position,
386
- left,
387
- shapeForEnds,
388
- ends,
389
- ellipsoid,
390
- h0 + heightOffset,
391
- 1,
392
- 1
393
- );
394
- }
395
- previousPosition = Cartesian3_default.clone(position, previousPosition);
396
- position = nextPosition;
397
- backward = Cartesian3_default.negate(forward, backward);
398
- let subdividedHeights;
399
- let subdividedPositions;
400
- for (let i = 1; i < length - 1; i++) {
401
- const repeat = duplicatePoints ? 2 : 1;
402
- nextPosition = positions[i + 1];
403
- if (position.equals(nextPosition)) {
404
- oneTimeWarning_default(
405
- "Positions are too close and are considered equivalent with rounding error."
406
- );
407
- continue;
408
- }
409
- forward = Cartesian3_default.subtract(nextPosition, position, forward);
410
- forward = Cartesian3_default.normalize(forward, forward);
411
- cornerDirection = Cartesian3_default.add(forward, backward, cornerDirection);
412
- cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
413
- surfaceNormal = ellipsoid.geodeticSurfaceNormal(position, surfaceNormal);
414
- const forwardProjection = Cartesian3_default.multiplyByScalar(
415
- surfaceNormal,
416
- Cartesian3_default.dot(forward, surfaceNormal),
417
- scratchForwardProjection
418
- );
419
- Cartesian3_default.subtract(forward, forwardProjection, forwardProjection);
420
- Cartesian3_default.normalize(forwardProjection, forwardProjection);
421
- const backwardProjection = Cartesian3_default.multiplyByScalar(
422
- surfaceNormal,
423
- Cartesian3_default.dot(backward, surfaceNormal),
424
- scratchBackwardProjection
425
- );
426
- Cartesian3_default.subtract(backward, backwardProjection, backwardProjection);
427
- Cartesian3_default.normalize(backwardProjection, backwardProjection);
428
- const doCorner = !Math_default.equalsEpsilon(
429
- Math.abs(Cartesian3_default.dot(forwardProjection, backwardProjection)),
430
- 1,
431
- Math_default.EPSILON7
432
- );
433
- if (doCorner) {
434
- cornerDirection = Cartesian3_default.cross(
435
- cornerDirection,
436
- surfaceNormal,
437
- cornerDirection
438
- );
439
- cornerDirection = Cartesian3_default.cross(
440
- surfaceNormal,
441
- cornerDirection,
442
- cornerDirection
443
- );
444
- cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
445
- const scalar = 1 / Math.max(
446
- 0.25,
447
- Cartesian3_default.magnitude(
448
- Cartesian3_default.cross(cornerDirection, backward, scratch1)
449
- )
450
- );
451
- const leftIsOutside = PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(
452
- forward,
453
- backward,
454
- position,
455
- ellipsoid
456
- );
457
- if (leftIsOutside) {
458
- pivot = Cartesian3_default.add(
459
- position,
460
- Cartesian3_default.multiplyByScalar(
461
- cornerDirection,
462
- scalar * width,
463
- cornerDirection
464
- ),
465
- pivot
466
- );
467
- start = Cartesian3_default.add(
468
- pivot,
469
- Cartesian3_default.multiplyByScalar(left, width, start),
470
- start
471
- );
472
- scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
473
- scratch2Array[1] = Cartesian3_default.clone(start, scratch2Array[1]);
474
- subdividedHeights = subdivideHeights(
475
- scratch2Array,
476
- h0 + heightOffset,
477
- h1 + heightOffset,
478
- granularity
479
- );
480
- subdividedPositions = PolylinePipeline_default.generateArc({
481
- positions: scratch2Array,
482
- granularity,
483
- ellipsoid
484
- });
485
- finalPositions = addPositions(
486
- subdividedPositions,
487
- left,
488
- shapeForSides,
489
- finalPositions,
490
- ellipsoid,
491
- subdividedHeights,
492
- 1
493
- );
494
- left = Cartesian3_default.cross(surfaceNormal, forward, left);
495
- left = Cartesian3_default.normalize(left, left);
496
- end = Cartesian3_default.add(
497
- pivot,
498
- Cartesian3_default.multiplyByScalar(left, width, end),
499
- end
500
- );
501
- if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
502
- computeRoundCorner(
503
- pivot,
504
- start,
505
- end,
506
- cornerType,
507
- leftIsOutside,
508
- ellipsoid,
509
- finalPositions,
510
- shapeForSides,
511
- h1 + heightOffset,
512
- duplicatePoints
513
- );
514
- } else {
515
- cornerDirection = Cartesian3_default.negate(cornerDirection, cornerDirection);
516
- finalPositions = addPosition(
517
- position,
518
- cornerDirection,
519
- shapeForSides,
520
- finalPositions,
521
- ellipsoid,
522
- h1 + heightOffset,
523
- scalar,
524
- repeat
525
- );
526
- }
527
- previousPosition = Cartesian3_default.clone(end, previousPosition);
528
- } else {
529
- pivot = Cartesian3_default.add(
530
- position,
531
- Cartesian3_default.multiplyByScalar(
532
- cornerDirection,
533
- scalar * width,
534
- cornerDirection
535
- ),
536
- pivot
537
- );
538
- start = Cartesian3_default.add(
539
- pivot,
540
- Cartesian3_default.multiplyByScalar(left, -width, start),
541
- start
542
- );
543
- scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
544
- scratch2Array[1] = Cartesian3_default.clone(start, scratch2Array[1]);
545
- subdividedHeights = subdivideHeights(
546
- scratch2Array,
547
- h0 + heightOffset,
548
- h1 + heightOffset,
549
- granularity
550
- );
551
- subdividedPositions = PolylinePipeline_default.generateArc({
552
- positions: scratch2Array,
553
- granularity,
554
- ellipsoid
555
- });
556
- finalPositions = addPositions(
557
- subdividedPositions,
558
- left,
559
- shapeForSides,
560
- finalPositions,
561
- ellipsoid,
562
- subdividedHeights,
563
- 1
564
- );
565
- left = Cartesian3_default.cross(surfaceNormal, forward, left);
566
- left = Cartesian3_default.normalize(left, left);
567
- end = Cartesian3_default.add(
568
- pivot,
569
- Cartesian3_default.multiplyByScalar(left, -width, end),
570
- end
571
- );
572
- if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
573
- computeRoundCorner(
574
- pivot,
575
- start,
576
- end,
577
- cornerType,
578
- leftIsOutside,
579
- ellipsoid,
580
- finalPositions,
581
- shapeForSides,
582
- h1 + heightOffset,
583
- duplicatePoints
584
- );
585
- } else {
586
- finalPositions = addPosition(
587
- position,
588
- cornerDirection,
589
- shapeForSides,
590
- finalPositions,
591
- ellipsoid,
592
- h1 + heightOffset,
593
- scalar,
594
- repeat
595
- );
596
- }
597
- previousPosition = Cartesian3_default.clone(end, previousPosition);
598
- }
599
- backward = Cartesian3_default.negate(forward, backward);
600
- } else {
601
- finalPositions = addPosition(
602
- previousPosition,
603
- left,
604
- shapeForSides,
605
- finalPositions,
606
- ellipsoid,
607
- h0 + heightOffset,
608
- 1,
609
- 1
610
- );
611
- previousPosition = position;
612
- }
613
- h0 = h1;
614
- h1 = heights[i + 1];
615
- position = nextPosition;
616
- }
617
- scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
618
- scratch2Array[1] = Cartesian3_default.clone(position, scratch2Array[1]);
619
- subdividedHeights = subdivideHeights(
620
- scratch2Array,
621
- h0 + heightOffset,
622
- h1 + heightOffset,
623
- granularity
624
- );
625
- subdividedPositions = PolylinePipeline_default.generateArc({
626
- positions: scratch2Array,
627
- granularity,
628
- ellipsoid
629
- });
630
- finalPositions = addPositions(
631
- subdividedPositions,
632
- left,
633
- shapeForSides,
634
- finalPositions,
635
- ellipsoid,
636
- subdividedHeights,
637
- 1
638
- );
639
- if (duplicatePoints) {
640
- ends = addPosition(
641
- position,
642
- left,
643
- shapeForEnds,
644
- ends,
645
- ellipsoid,
646
- h1 + heightOffset,
647
- 1,
648
- 1
649
- );
650
- }
651
- length = finalPositions.length;
652
- const posLength = duplicatePoints ? length + ends.length : length;
653
- const combinedPositions = new Float64Array(posLength);
654
- combinedPositions.set(finalPositions);
655
- if (duplicatePoints) {
656
- combinedPositions.set(ends, length);
657
- }
658
- return combinedPositions;
659
- };
660
- var PolylineVolumeGeometryLibrary_default = PolylineVolumeGeometryLibrary;
661
-
662
- export {
663
- CornerType_default,
664
- PolylineVolumeGeometryLibrary_default
665
- };