@cesium/engine 3.0.2 → 4.0.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.
Files changed (230) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +605 -0
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +800 -0
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +502 -0
  4. package/Build/Workers/chunk-27R2KRIK.js +634 -0
  5. package/Build/Workers/chunk-2C65EKYA.js +55 -0
  6. package/Build/Workers/chunk-2NLMZNJI.js +138 -0
  7. package/Build/Workers/chunk-4V6RCTVH.js +289 -0
  8. package/Build/Workers/chunk-4VWUFKYW.js +368 -0
  9. package/Build/Workers/chunk-527JG4D7.js +629 -0
  10. package/Build/Workers/chunk-5U4UHRZ2.js +8644 -0
  11. package/Build/Workers/chunk-7CZEWQWE.js +353 -0
  12. package/Build/Workers/chunk-7IMAWM6A.js +842 -0
  13. package/Build/Workers/{package.js → chunk-A6EA6KIE.js} +13 -2
  14. package/Build/Workers/chunk-AXGQUPXA.js +1075 -0
  15. package/Build/Workers/chunk-BT6YIL2N.js +39 -0
  16. package/Build/Workers/chunk-C6MRR5YL.js +476 -0
  17. package/Build/Workers/chunk-DJUTBX6A.js +1860 -0
  18. package/Build/Workers/chunk-EQ6ZAP37.js +218 -0
  19. package/Build/Workers/chunk-F7P2HCYZ.js +73 -0
  20. package/Build/Workers/chunk-FE2XG3SS.js +73 -0
  21. package/Build/Workers/chunk-FKHRSGKP.js +781 -0
  22. package/Build/Workers/chunk-FVDTKX3F.js +58 -0
  23. package/Build/Workers/chunk-FYHCAKU6.js +684 -0
  24. package/Build/Workers/chunk-G3MOT7BZ.js +157 -0
  25. package/Build/Workers/chunk-H52L6U76.js +421 -0
  26. package/Build/Workers/chunk-H6MBQ4W4.js +305 -0
  27. package/Build/Workers/chunk-HCZR75II.js +2716 -0
  28. package/Build/Workers/chunk-I5MQWHBR.js +102 -0
  29. package/Build/Workers/chunk-KAFF2QX3.js +258 -0
  30. package/Build/Workers/chunk-LGSGX2RH.js +757 -0
  31. package/Build/Workers/chunk-LQRFWCNX.js +124 -0
  32. package/Build/Workers/chunk-N5MMDSD2.js +44 -0
  33. package/Build/Workers/chunk-NRETMGYL.js +390 -0
  34. package/Build/Workers/chunk-P4M4QUNQ.js +196 -0
  35. package/Build/Workers/chunk-P7PWX5HR.js +430 -0
  36. package/Build/Workers/chunk-PGB3EFR7.js +171 -0
  37. package/Build/Workers/chunk-PW5CA4MJ.js +3273 -0
  38. package/Build/Workers/chunk-PWDYKCNC.js +501 -0
  39. package/Build/Workers/chunk-QIS3NB7U.js +1258 -0
  40. package/Build/Workers/chunk-QVJ6IRKV.js +77 -0
  41. package/Build/Workers/chunk-RDCDRNJ7.js +117 -0
  42. package/Build/Workers/chunk-RDM3BKNC.js +1009 -0
  43. package/Build/Workers/chunk-RRUPTJ6P.js +452 -0
  44. package/Build/Workers/chunk-SGRWJKNO.js +400 -0
  45. package/Build/Workers/chunk-TF5D2H7B.js +138 -0
  46. package/Build/Workers/chunk-TVYIHH4V.js +513 -0
  47. package/Build/Workers/chunk-U5LKG6LX.js +101 -0
  48. package/Build/Workers/chunk-UGZGTV5K.js +302 -0
  49. package/Build/Workers/chunk-UN7AK64D.js +163 -0
  50. package/Build/Workers/chunk-V2LKNJGT.js +59 -0
  51. package/Build/Workers/chunk-VSCXSFHE.js +1477 -0
  52. package/Build/Workers/chunk-XJCTFTBM.js +2041 -0
  53. package/Build/Workers/chunk-XZVQMPWG.js +100 -0
  54. package/Build/Workers/chunk-YLAFWVOW.js +834 -0
  55. package/Build/Workers/chunk-YLS3FX3U.js +236 -0
  56. package/Build/Workers/chunk-YMJPANZZ.js +693 -0
  57. package/Build/Workers/combineGeometry.js +65 -15
  58. package/Build/Workers/createBoxGeometry.js +55 -10
  59. package/Build/Workers/createBoxOutlineGeometry.js +231 -310
  60. package/Build/Workers/createCircleGeometry.js +185 -202
  61. package/Build/Workers/createCircleOutlineGeometry.js +141 -155
  62. package/Build/Workers/createCoplanarPolygonGeometry.js +477 -557
  63. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  64. package/Build/Workers/createCorridorGeometry.js +1162 -1307
  65. package/Build/Workers/createCorridorOutlineGeometry.js +533 -569
  66. package/Build/Workers/createCylinderGeometry.js +57 -10
  67. package/Build/Workers/createCylinderOutlineGeometry.js +224 -258
  68. package/Build/Workers/createEllipseGeometry.js +68 -12
  69. package/Build/Workers/createEllipseOutlineGeometry.js +61 -12
  70. package/Build/Workers/createEllipsoidGeometry.js +56 -10
  71. package/Build/Workers/createEllipsoidOutlineGeometry.js +58 -13
  72. package/Build/Workers/createFrustumGeometry.js +55 -10
  73. package/Build/Workers/createFrustumOutlineGeometry.js +226 -243
  74. package/Build/Workers/createGeometry.js +143 -48
  75. package/Build/Workers/createGroundPolylineGeometry.js +1484 -2012
  76. package/Build/Workers/createPlaneGeometry.js +216 -243
  77. package/Build/Workers/createPlaneOutlineGeometry.js +121 -113
  78. package/Build/Workers/createPolygonGeometry.js +1041 -1327
  79. package/Build/Workers/createPolygonOutlineGeometry.js +516 -657
  80. package/Build/Workers/createPolylineGeometry.js +471 -547
  81. package/Build/Workers/createPolylineVolumeGeometry.js +352 -384
  82. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +271 -295
  83. package/Build/Workers/createRectangleGeometry.js +1128 -1331
  84. package/Build/Workers/createRectangleOutlineGeometry.js +445 -500
  85. package/Build/Workers/createSimplePolylineGeometry.js +381 -440
  86. package/Build/Workers/createSphereGeometry.js +112 -118
  87. package/Build/Workers/createSphereOutlineGeometry.js +112 -121
  88. package/Build/Workers/createTaskProcessorWorker.js +32 -127
  89. package/Build/Workers/createVectorTileClampedPolylines.js +462 -505
  90. package/Build/Workers/createVectorTileGeometries.js +377 -436
  91. package/Build/Workers/createVectorTilePoints.js +110 -77
  92. package/Build/Workers/createVectorTilePolygons.js +369 -391
  93. package/Build/Workers/createVectorTilePolylines.js +252 -244
  94. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  95. package/Build/Workers/createVerticesFromHeightmap.js +2244 -2677
  96. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -904
  97. package/Build/Workers/createWallGeometry.js +459 -593
  98. package/Build/Workers/createWallOutlineGeometry.js +324 -419
  99. package/Build/Workers/decodeDraco.js +327 -347
  100. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  101. package/Build/Workers/decodeI3S.js +765 -970
  102. package/Build/Workers/transcodeKTX2.js +3351 -1473
  103. package/Build/Workers/transferTypedArrayTest.js +3 -4
  104. package/Build/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  105. package/LICENSE.md +0 -12
  106. package/Source/Core/CesiumTerrainProvider.js +1 -2
  107. package/Source/Core/FeatureDetection.js +9 -0
  108. package/Source/Core/GoogleMaps.js +1 -1
  109. package/Source/Core/Ion.js +1 -1
  110. package/Source/Core/KTX2Transcoder.js +7 -3
  111. package/Source/Core/TaskProcessor.js +150 -146
  112. package/Source/Core/Transforms.js +2 -2
  113. package/Source/Core/buildModuleUrl.js +6 -5
  114. package/Source/Scene/ArcGisMapService.js +1 -1
  115. package/Source/Scene/DracoLoader.js +26 -3
  116. package/Source/Scene/I3SDataProvider.js +0 -27
  117. package/Source/Scene/I3SDecoder.js +127 -0
  118. package/Source/Scene/I3SNode.js +32 -110
  119. package/Source/Scene/Implicit3DTileContent.js +13 -0
  120. package/Source/Scene/ImplicitTileset.js +5 -0
  121. package/Source/Scene/Model/I3dmLoader.js +5 -1
  122. package/Source/Scene/Model/Model.js +4 -1
  123. package/Source/Scene/OpenStreetMapImageryProvider.js +4 -1
  124. package/Source/Scene/SingleTileImageryProvider.js +4 -2
  125. package/Source/ThirdParty/Workers/basis_transcoder.js +1 -1
  126. package/Source/{WorkersES6 → Workers}/createGeometry.js +11 -12
  127. package/Source/{WorkersES6 → Workers}/createTaskProcessorWorker.js +43 -59
  128. package/Source/{WorkersES6 → Workers}/decodeDraco.js +19 -25
  129. package/Source/{WorkersES6 → Workers}/decodeI3S.js +18 -32
  130. package/Source/{WorkersES6 → Workers}/transcodeKTX2.js +19 -26
  131. package/Source/Workers/transferTypedArrayTest.js +0 -6
  132. package/index.d.ts +16 -7
  133. package/index.js +252 -251
  134. package/package.json +2 -1
  135. package/Build/Workers/ArcType-2d9abbbc.js +0 -37
  136. package/Build/Workers/AttributeCompression-f9f6c717.js +0 -716
  137. package/Build/Workers/AxisAlignedBoundingBox-a03420b1.js +0 -258
  138. package/Build/Workers/BoundingRectangle-32fa8a4a.js +0 -369
  139. package/Build/Workers/BoxGeometry-cd550612.js +0 -884
  140. package/Build/Workers/Check-6ede7e26.js +0 -290
  141. package/Build/Workers/Color-571a6085.js +0 -2262
  142. package/Build/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  143. package/Build/Workers/CoplanarPolygonGeometryLibrary-488b1a9f.js +0 -132
  144. package/Build/Workers/CorridorGeometryLibrary-fc4ff147.js +0 -498
  145. package/Build/Workers/CylinderGeometry-bc26926d.js +0 -467
  146. package/Build/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  147. package/Build/Workers/EllipseGeometry-89533a10.js +0 -1304
  148. package/Build/Workers/EllipseGeometryLibrary-b0d7df17.js +0 -366
  149. package/Build/Workers/EllipseOutlineGeometry-63ff7a87.js +0 -443
  150. package/Build/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  151. package/Build/Workers/EllipsoidGeometry-07e99d2d.js +0 -637
  152. package/Build/Workers/EllipsoidOutlineGeometry-ba5c7ee2.js +0 -454
  153. package/Build/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  154. package/Build/Workers/EllipsoidTangentPlane-65d41b3e.js +0 -373
  155. package/Build/Workers/EncodedCartesian3-57415c8a.js +0 -171
  156. package/Build/Workers/FrustumGeometry-4a7589ed.js +0 -2540
  157. package/Build/Workers/GeometryAttribute-a5b6275b.js +0 -619
  158. package/Build/Workers/GeometryAttributes-ad136444.js +0 -91
  159. package/Build/Workers/GeometryInstance-34d9e21e.js +0 -121
  160. package/Build/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  161. package/Build/Workers/GeometryPipeline-fa9e6ffc.js +0 -3690
  162. package/Build/Workers/IndexDatatype-2643aa47.js +0 -200
  163. package/Build/Workers/IntersectionTests-feace3da.js +0 -1836
  164. package/Build/Workers/Math-0a2ac845.js +0 -1340
  165. package/Build/Workers/Matrix2-e1298525.js +0 -7086
  166. package/Build/Workers/Matrix3-41c58dde.js +0 -4283
  167. package/Build/Workers/OrientedBoundingBox-6b94d955.js +0 -1259
  168. package/Build/Workers/Plane-4c3d403b.js +0 -309
  169. package/Build/Workers/PolygonGeometryLibrary-4ffc457d.js +0 -1074
  170. package/Build/Workers/PolygonPipeline-d5e66350.js +0 -1344
  171. package/Build/Workers/PolylinePipeline-83410f0c.js +0 -573
  172. package/Build/Workers/PolylineVolumeGeometryLibrary-290e7aec.js +0 -781
  173. package/Build/Workers/PrimitivePipeline-6081d138.js +0 -966
  174. package/Build/Workers/RectangleGeometryLibrary-986710d8.js +0 -280
  175. package/Build/Workers/RuntimeError-ef395448.js +0 -68
  176. package/Build/Workers/TerrainEncoding-528e1d68.js +0 -1227
  177. package/Build/Workers/Transforms-b527bb09.js +0 -14714
  178. package/Build/Workers/VertexFormat-030f11ff.js +0 -312
  179. package/Build/Workers/WallGeometryLibrary-faf583f8.js +0 -211
  180. package/Build/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  181. package/Build/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  182. package/Build/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  183. package/Build/Workers/cesiumWorkerBootstrapper.js +0 -1363
  184. package/Build/Workers/combine-d9581036.js +0 -82
  185. package/Build/Workers/defaultValue-fe22d8c0.js +0 -51
  186. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  187. package/Source/Workers/cesiumWorkerBootstrapper.js +0 -2290
  188. package/Source/Workers/package.json +0 -1
  189. /package/Source/{WorkersES6 → Workers}/combineGeometry.js +0 -0
  190. /package/Source/{WorkersES6 → Workers}/createBoxGeometry.js +0 -0
  191. /package/Source/{WorkersES6 → Workers}/createBoxOutlineGeometry.js +0 -0
  192. /package/Source/{WorkersES6 → Workers}/createCircleGeometry.js +0 -0
  193. /package/Source/{WorkersES6 → Workers}/createCircleOutlineGeometry.js +0 -0
  194. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonGeometry.js +0 -0
  195. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonOutlineGeometry.js +0 -0
  196. /package/Source/{WorkersES6 → Workers}/createCorridorGeometry.js +0 -0
  197. /package/Source/{WorkersES6 → Workers}/createCorridorOutlineGeometry.js +0 -0
  198. /package/Source/{WorkersES6 → Workers}/createCylinderGeometry.js +0 -0
  199. /package/Source/{WorkersES6 → Workers}/createCylinderOutlineGeometry.js +0 -0
  200. /package/Source/{WorkersES6 → Workers}/createEllipseGeometry.js +0 -0
  201. /package/Source/{WorkersES6 → Workers}/createEllipseOutlineGeometry.js +0 -0
  202. /package/Source/{WorkersES6 → Workers}/createEllipsoidGeometry.js +0 -0
  203. /package/Source/{WorkersES6 → Workers}/createEllipsoidOutlineGeometry.js +0 -0
  204. /package/Source/{WorkersES6 → Workers}/createFrustumGeometry.js +0 -0
  205. /package/Source/{WorkersES6 → Workers}/createFrustumOutlineGeometry.js +0 -0
  206. /package/Source/{WorkersES6 → Workers}/createGroundPolylineGeometry.js +0 -0
  207. /package/Source/{WorkersES6 → Workers}/createPlaneGeometry.js +0 -0
  208. /package/Source/{WorkersES6 → Workers}/createPlaneOutlineGeometry.js +0 -0
  209. /package/Source/{WorkersES6 → Workers}/createPolygonGeometry.js +0 -0
  210. /package/Source/{WorkersES6 → Workers}/createPolygonOutlineGeometry.js +0 -0
  211. /package/Source/{WorkersES6 → Workers}/createPolylineGeometry.js +0 -0
  212. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeGeometry.js +0 -0
  213. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeOutlineGeometry.js +0 -0
  214. /package/Source/{WorkersES6 → Workers}/createRectangleGeometry.js +0 -0
  215. /package/Source/{WorkersES6 → Workers}/createRectangleOutlineGeometry.js +0 -0
  216. /package/Source/{WorkersES6 → Workers}/createSimplePolylineGeometry.js +0 -0
  217. /package/Source/{WorkersES6 → Workers}/createSphereGeometry.js +0 -0
  218. /package/Source/{WorkersES6 → Workers}/createSphereOutlineGeometry.js +0 -0
  219. /package/Source/{WorkersES6 → Workers}/createVectorTileClampedPolylines.js +0 -0
  220. /package/Source/{WorkersES6 → Workers}/createVectorTileGeometries.js +0 -0
  221. /package/Source/{WorkersES6 → Workers}/createVectorTilePoints.js +0 -0
  222. /package/Source/{WorkersES6 → Workers}/createVectorTilePolygons.js +0 -0
  223. /package/Source/{WorkersES6 → Workers}/createVectorTilePolylines.js +0 -0
  224. /package/Source/{WorkersES6 → Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -0
  225. /package/Source/{WorkersES6 → Workers}/createVerticesFromHeightmap.js +0 -0
  226. /package/Source/{WorkersES6 → Workers}/createVerticesFromQuantizedTerrainMesh.js +0 -0
  227. /package/Source/{WorkersES6 → Workers}/createWallGeometry.js +0 -0
  228. /package/Source/{WorkersES6 → Workers}/createWallOutlineGeometry.js +0 -0
  229. /package/Source/{WorkersES6 → Workers}/decodeGoogleEarthEnterprisePacket.js +0 -0
  230. /package/Source/{WorkersES6 → Workers}/upsampleQuantizedTerrainMesh.js +0 -0
@@ -1,683 +1,542 @@
1
- define(['./defaultValue-fe22d8c0', './Matrix3-41c58dde', './ArcType-2d9abbbc', './Transforms-b527bb09', './Check-6ede7e26', './ComponentDatatype-cf1fa08e', './EllipsoidTangentPlane-65d41b3e', './GeometryAttribute-a5b6275b', './GeometryAttributes-ad136444', './GeometryInstance-34d9e21e', './GeometryOffsetAttribute-9ad0019c', './GeometryPipeline-fa9e6ffc', './IndexDatatype-2643aa47', './Math-0a2ac845', './PolygonGeometryLibrary-4ffc457d', './PolygonPipeline-d5e66350', './Matrix2-e1298525', './RuntimeError-ef395448', './combine-d9581036', './WebGLConstants-0b1ce7ba', './AxisAlignedBoundingBox-a03420b1', './IntersectionTests-feace3da', './Plane-4c3d403b', './AttributeCompression-f9f6c717', './EncodedCartesian3-57415c8a', './arrayRemoveDuplicates-d2061e85', './EllipsoidRhumbLine-ef872433'], (function (defaultValue, Matrix3, ArcType, Transforms, Check, ComponentDatatype, EllipsoidTangentPlane, GeometryAttribute, GeometryAttributes, GeometryInstance, GeometryOffsetAttribute, GeometryPipeline, IndexDatatype, Math$1, PolygonGeometryLibrary, PolygonPipeline, Matrix2, RuntimeError, combine, WebGLConstants, AxisAlignedBoundingBox, IntersectionTests, Plane, AttributeCompression, EncodedCartesian3, arrayRemoveDuplicates, EllipsoidRhumbLine) { 'use strict';
2
-
3
- const createGeometryFromPositionsPositions = [];
4
- const createGeometryFromPositionsSubdivided = [];
5
-
6
- function createGeometryFromPositions(
7
- ellipsoid,
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 1.109
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
+ PolygonGeometryLibrary_default
28
+ } from "./chunk-7IMAWM6A.js";
29
+ import {
30
+ ArcType_default
31
+ } from "./chunk-2C65EKYA.js";
32
+ import {
33
+ GeometryInstance_default
34
+ } from "./chunk-V2LKNJGT.js";
35
+ import {
36
+ GeometryPipeline_default
37
+ } from "./chunk-HCZR75II.js";
38
+ import "./chunk-P7PWX5HR.js";
39
+ import "./chunk-I5MQWHBR.js";
40
+ import {
41
+ GeometryOffsetAttribute_default
42
+ } from "./chunk-A6EA6KIE.js";
43
+ import {
44
+ EllipsoidTangentPlane_default
45
+ } from "./chunk-4V6RCTVH.js";
46
+ import "./chunk-G3MOT7BZ.js";
47
+ import {
48
+ PolygonPipeline_default,
49
+ WindingOrder_default
50
+ } from "./chunk-RDM3BKNC.js";
51
+ import "./chunk-XZVQMPWG.js";
52
+ import "./chunk-RRUPTJ6P.js";
53
+ import "./chunk-QIS3NB7U.js";
54
+ import "./chunk-PGB3EFR7.js";
55
+ import {
56
+ IndexDatatype_default
57
+ } from "./chunk-TF5D2H7B.js";
58
+ import {
59
+ GeometryAttributes_default
60
+ } from "./chunk-N5MMDSD2.js";
61
+ import {
62
+ GeometryAttribute_default,
63
+ Geometry_default,
64
+ PrimitiveType_default
65
+ } from "./chunk-UGZGTV5K.js";
66
+ import {
67
+ BoundingSphere_default
68
+ } from "./chunk-5U4UHRZ2.js";
69
+ import "./chunk-FE2XG3SS.js";
70
+ import "./chunk-PW5CA4MJ.js";
71
+ import {
72
+ ComponentDatatype_default
73
+ } from "./chunk-KAFF2QX3.js";
74
+ import {
75
+ Cartesian3_default,
76
+ Ellipsoid_default
77
+ } from "./chunk-XJCTFTBM.js";
78
+ import {
79
+ Math_default
80
+ } from "./chunk-PWDYKCNC.js";
81
+ import "./chunk-527JG4D7.js";
82
+ import "./chunk-FVDTKX3F.js";
83
+ import {
84
+ defaultValue_default
85
+ } from "./chunk-BT6YIL2N.js";
86
+ import {
87
+ Check_default,
88
+ DeveloperError_default
89
+ } from "./chunk-UN7AK64D.js";
90
+ import {
91
+ defined_default
92
+ } from "./chunk-QVJ6IRKV.js";
93
+
94
+ // packages/engine/Source/Core/PolygonOutlineGeometry.js
95
+ var createGeometryFromPositionsPositions = [];
96
+ var createGeometryFromPositionsSubdivided = [];
97
+ function createGeometryFromPositions(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
98
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
99
+ const positions2D = tangentPlane.projectPointsOntoPlane(
8
100
  positions,
9
- minDistance,
10
- perPositionHeight,
11
- arcType
12
- ) {
13
- const tangentPlane = EllipsoidTangentPlane.EllipsoidTangentPlane.fromPoints(positions, ellipsoid);
14
- const positions2D = tangentPlane.projectPointsOntoPlane(
15
- positions,
16
- createGeometryFromPositionsPositions
17
- );
18
-
19
- const originalWindingOrder = PolygonPipeline.PolygonPipeline.computeWindingOrder2D(
20
- positions2D
21
- );
22
- if (originalWindingOrder === PolygonPipeline.WindingOrder.CLOCKWISE) {
23
- positions2D.reverse();
24
- positions = positions.slice().reverse();
25
- }
26
-
27
- let subdividedPositions;
28
- let i;
29
-
30
- let length = positions.length;
31
- let index = 0;
32
-
33
- if (!perPositionHeight) {
34
- let numVertices = 0;
35
- if (arcType === ArcType.ArcType.GEODESIC) {
36
- for (i = 0; i < length; i++) {
37
- numVertices += PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideLineCount(
38
- positions[i],
39
- positions[(i + 1) % length],
40
- minDistance
41
- );
42
- }
43
- } else if (arcType === ArcType.ArcType.RHUMB) {
44
- for (i = 0; i < length; i++) {
45
- numVertices += PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideRhumbLineCount(
46
- ellipsoid,
47
- positions[i],
48
- positions[(i + 1) % length],
49
- minDistance
50
- );
51
- }
52
- }
53
- subdividedPositions = new Float64Array(numVertices * 3);
101
+ createGeometryFromPositionsPositions
102
+ );
103
+ const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
104
+ positions2D
105
+ );
106
+ if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
107
+ positions2D.reverse();
108
+ positions = positions.slice().reverse();
109
+ }
110
+ let subdividedPositions;
111
+ let i;
112
+ let length = positions.length;
113
+ let index = 0;
114
+ if (!perPositionHeight) {
115
+ let numVertices = 0;
116
+ if (arcType === ArcType_default.GEODESIC) {
54
117
  for (i = 0; i < length; i++) {
55
- let tempPositions;
56
- if (arcType === ArcType.ArcType.GEODESIC) {
57
- tempPositions = PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideLine(
58
- positions[i],
59
- positions[(i + 1) % length],
60
- minDistance,
61
- createGeometryFromPositionsSubdivided
62
- );
63
- } else if (arcType === ArcType.ArcType.RHUMB) {
64
- tempPositions = PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideRhumbLine(
65
- ellipsoid,
66
- positions[i],
67
- positions[(i + 1) % length],
68
- minDistance,
69
- createGeometryFromPositionsSubdivided
70
- );
71
- }
72
- const tempPositionsLength = tempPositions.length;
73
- for (let j = 0; j < tempPositionsLength; ++j) {
74
- subdividedPositions[index++] = tempPositions[j];
75
- }
118
+ numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
119
+ positions[i],
120
+ positions[(i + 1) % length],
121
+ minDistance
122
+ );
76
123
  }
77
- } else {
78
- subdividedPositions = new Float64Array(length * 2 * 3);
124
+ } else if (arcType === ArcType_default.RHUMB) {
79
125
  for (i = 0; i < length; i++) {
80
- const p0 = positions[i];
81
- const p1 = positions[(i + 1) % length];
82
- subdividedPositions[index++] = p0.x;
83
- subdividedPositions[index++] = p0.y;
84
- subdividedPositions[index++] = p0.z;
85
- subdividedPositions[index++] = p1.x;
86
- subdividedPositions[index++] = p1.y;
87
- subdividedPositions[index++] = p1.z;
126
+ numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
127
+ ellipsoid,
128
+ positions[i],
129
+ positions[(i + 1) % length],
130
+ minDistance
131
+ );
88
132
  }
89
133
  }
90
-
91
- length = subdividedPositions.length / 3;
92
- const indicesSize = length * 2;
93
- const indices = IndexDatatype.IndexDatatype.createTypedArray(length, indicesSize);
94
- index = 0;
95
- for (i = 0; i < length - 1; i++) {
96
- indices[index++] = i;
97
- indices[index++] = i + 1;
98
- }
99
- indices[index++] = length - 1;
100
- indices[index++] = 0;
101
-
102
- return new GeometryInstance.GeometryInstance({
103
- geometry: new GeometryAttribute.Geometry({
104
- attributes: new GeometryAttributes.GeometryAttributes({
105
- position: new GeometryAttribute.GeometryAttribute({
106
- componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
107
- componentsPerAttribute: 3,
108
- values: subdividedPositions,
109
- }),
110
- }),
111
- indices: indices,
112
- primitiveType: GeometryAttribute.PrimitiveType.LINES,
113
- }),
114
- });
115
- }
116
-
117
- function createGeometryFromPositionsExtruded(
118
- ellipsoid,
119
- positions,
120
- minDistance,
121
- perPositionHeight,
122
- arcType
123
- ) {
124
- const tangentPlane = EllipsoidTangentPlane.EllipsoidTangentPlane.fromPoints(positions, ellipsoid);
125
- const positions2D = tangentPlane.projectPointsOntoPlane(
126
- positions,
127
- createGeometryFromPositionsPositions
128
- );
129
-
130
- const originalWindingOrder = PolygonPipeline.PolygonPipeline.computeWindingOrder2D(
131
- positions2D
132
- );
133
- if (originalWindingOrder === PolygonPipeline.WindingOrder.CLOCKWISE) {
134
- positions2D.reverse();
135
- positions = positions.slice().reverse();
136
- }
137
-
138
- let subdividedPositions;
139
- let i;
140
-
141
- let length = positions.length;
142
- const corners = new Array(length);
143
- let index = 0;
144
-
145
- if (!perPositionHeight) {
146
- let numVertices = 0;
147
- if (arcType === ArcType.ArcType.GEODESIC) {
148
- for (i = 0; i < length; i++) {
149
- numVertices += PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideLineCount(
150
- positions[i],
151
- positions[(i + 1) % length],
152
- minDistance
153
- );
154
- }
155
- } else if (arcType === ArcType.ArcType.RHUMB) {
156
- for (i = 0; i < length; i++) {
157
- numVertices += PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideRhumbLineCount(
158
- ellipsoid,
159
- positions[i],
160
- positions[(i + 1) % length],
161
- minDistance
162
- );
163
- }
164
- }
165
-
166
- subdividedPositions = new Float64Array(numVertices * 3 * 2);
167
- for (i = 0; i < length; ++i) {
168
- corners[i] = index / 3;
169
- let tempPositions;
170
- if (arcType === ArcType.ArcType.GEODESIC) {
171
- tempPositions = PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideLine(
172
- positions[i],
173
- positions[(i + 1) % length],
174
- minDistance,
175
- createGeometryFromPositionsSubdivided
176
- );
177
- } else if (arcType === ArcType.ArcType.RHUMB) {
178
- tempPositions = PolygonGeometryLibrary.PolygonGeometryLibrary.subdivideRhumbLine(
179
- ellipsoid,
180
- positions[i],
181
- positions[(i + 1) % length],
182
- minDistance,
183
- createGeometryFromPositionsSubdivided
184
- );
185
- }
186
- const tempPositionsLength = tempPositions.length;
187
- for (let j = 0; j < tempPositionsLength; ++j) {
188
- subdividedPositions[index++] = tempPositions[j];
189
- }
134
+ subdividedPositions = new Float64Array(numVertices * 3);
135
+ for (i = 0; i < length; i++) {
136
+ let tempPositions;
137
+ if (arcType === ArcType_default.GEODESIC) {
138
+ tempPositions = PolygonGeometryLibrary_default.subdivideLine(
139
+ positions[i],
140
+ positions[(i + 1) % length],
141
+ minDistance,
142
+ createGeometryFromPositionsSubdivided
143
+ );
144
+ } else if (arcType === ArcType_default.RHUMB) {
145
+ tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
146
+ ellipsoid,
147
+ positions[i],
148
+ positions[(i + 1) % length],
149
+ minDistance,
150
+ createGeometryFromPositionsSubdivided
151
+ );
190
152
  }
191
- } else {
192
- subdividedPositions = new Float64Array(length * 2 * 3 * 2);
193
- for (i = 0; i < length; ++i) {
194
- corners[i] = index / 3;
195
- const p0 = positions[i];
196
- const p1 = positions[(i + 1) % length];
197
-
198
- subdividedPositions[index++] = p0.x;
199
- subdividedPositions[index++] = p0.y;
200
- subdividedPositions[index++] = p0.z;
201
- subdividedPositions[index++] = p1.x;
202
- subdividedPositions[index++] = p1.y;
203
- subdividedPositions[index++] = p1.z;
153
+ const tempPositionsLength = tempPositions.length;
154
+ for (let j = 0; j < tempPositionsLength; ++j) {
155
+ subdividedPositions[index++] = tempPositions[j];
204
156
  }
205
157
  }
206
-
207
- length = subdividedPositions.length / (3 * 2);
208
- const cornersLength = corners.length;
209
-
210
- const indicesSize = (length * 2 + cornersLength) * 2;
211
- const indices = IndexDatatype.IndexDatatype.createTypedArray(
212
- length + cornersLength,
213
- indicesSize
214
- );
215
-
216
- index = 0;
217
- for (i = 0; i < length; ++i) {
218
- indices[index++] = i;
219
- indices[index++] = (i + 1) % length;
220
- indices[index++] = i + length;
221
- indices[index++] = ((i + 1) % length) + length;
158
+ } else {
159
+ subdividedPositions = new Float64Array(length * 2 * 3);
160
+ for (i = 0; i < length; i++) {
161
+ const p0 = positions[i];
162
+ const p1 = positions[(i + 1) % length];
163
+ subdividedPositions[index++] = p0.x;
164
+ subdividedPositions[index++] = p0.y;
165
+ subdividedPositions[index++] = p0.z;
166
+ subdividedPositions[index++] = p1.x;
167
+ subdividedPositions[index++] = p1.y;
168
+ subdividedPositions[index++] = p1.z;
222
169
  }
223
-
224
- for (i = 0; i < cornersLength; i++) {
225
- const corner = corners[i];
226
- indices[index++] = corner;
227
- indices[index++] = corner + length;
228
- }
229
-
230
- return new GeometryInstance.GeometryInstance({
231
- geometry: new GeometryAttribute.Geometry({
232
- attributes: new GeometryAttributes.GeometryAttributes({
233
- position: new GeometryAttribute.GeometryAttribute({
234
- componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
235
- componentsPerAttribute: 3,
236
- values: subdividedPositions,
237
- }),
238
- }),
239
- indices: indices,
240
- primitiveType: GeometryAttribute.PrimitiveType.LINES,
241
- }),
242
- });
243
170
  }
244
-
245
- /**
246
- * A description of the outline of a polygon on the ellipsoid. The polygon is defined by a polygon hierarchy.
247
- *
248
- * @alias PolygonOutlineGeometry
249
- * @constructor
250
- *
251
- * @param {object} options Object with the following properties:
252
- * @param {PolygonHierarchy} options.polygonHierarchy A polygon hierarchy that can include holes.
253
- * @param {number} [options.height=0.0] The distance in meters between the polygon and the ellipsoid surface.
254
- * @param {number} [options.extrudedHeight] The distance in meters between the polygon's extruded face and the ellipsoid surface.
255
- * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
256
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
257
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
258
- * @param {boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
259
- * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of path the outline must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
260
- *
261
- * @see PolygonOutlineGeometry#createGeometry
262
- * @see PolygonOutlineGeometry#fromPositions
263
- *
264
- * @example
265
- * // 1. create a polygon outline from points
266
- * const polygon = new Cesium.PolygonOutlineGeometry({
267
- * polygonHierarchy : new Cesium.PolygonHierarchy(
268
- * Cesium.Cartesian3.fromDegreesArray([
269
- * -72.0, 40.0,
270
- * -70.0, 35.0,
271
- * -75.0, 30.0,
272
- * -70.0, 30.0,
273
- * -68.0, 40.0
274
- * ])
275
- * )
276
- * });
277
- * const geometry = Cesium.PolygonOutlineGeometry.createGeometry(polygon);
278
- *
279
- * // 2. create a nested polygon with holes outline
280
- * const polygonWithHole = new Cesium.PolygonOutlineGeometry({
281
- * polygonHierarchy : new Cesium.PolygonHierarchy(
282
- * Cesium.Cartesian3.fromDegreesArray([
283
- * -109.0, 30.0,
284
- * -95.0, 30.0,
285
- * -95.0, 40.0,
286
- * -109.0, 40.0
287
- * ]),
288
- * [new Cesium.PolygonHierarchy(
289
- * Cesium.Cartesian3.fromDegreesArray([
290
- * -107.0, 31.0,
291
- * -107.0, 39.0,
292
- * -97.0, 39.0,
293
- * -97.0, 31.0
294
- * ]),
295
- * [new Cesium.PolygonHierarchy(
296
- * Cesium.Cartesian3.fromDegreesArray([
297
- * -105.0, 33.0,
298
- * -99.0, 33.0,
299
- * -99.0, 37.0,
300
- * -105.0, 37.0
301
- * ]),
302
- * [new Cesium.PolygonHierarchy(
303
- * Cesium.Cartesian3.fromDegreesArray([
304
- * -103.0, 34.0,
305
- * -101.0, 34.0,
306
- * -101.0, 36.0,
307
- * -103.0, 36.0
308
- * ])
309
- * )]
310
- * )]
311
- * )]
312
- * )
313
- * });
314
- * const geometry = Cesium.PolygonOutlineGeometry.createGeometry(polygonWithHole);
315
- *
316
- * // 3. create extruded polygon outline
317
- * const extrudedPolygon = new Cesium.PolygonOutlineGeometry({
318
- * polygonHierarchy : new Cesium.PolygonHierarchy(
319
- * Cesium.Cartesian3.fromDegreesArray([
320
- * -72.0, 40.0,
321
- * -70.0, 35.0,
322
- * -75.0, 30.0,
323
- * -70.0, 30.0,
324
- * -68.0, 40.0
325
- * ])
326
- * ),
327
- * extrudedHeight: 300000
328
- * });
329
- * const geometry = Cesium.PolygonOutlineGeometry.createGeometry(extrudedPolygon);
330
- */
331
- function PolygonOutlineGeometry(options) {
332
- //>>includeStart('debug', pragmas.debug);
333
- Check.Check.typeOf.object("options", options);
334
- Check.Check.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
335
-
336
- if (options.perPositionHeight && defaultValue.defined(options.height)) {
337
- throw new Check.DeveloperError(
338
- "Cannot use both options.perPositionHeight and options.height"
339
- );
340
- }
341
- if (
342
- defaultValue.defined(options.arcType) &&
343
- options.arcType !== ArcType.ArcType.GEODESIC &&
344
- options.arcType !== ArcType.ArcType.RHUMB
345
- ) {
346
- throw new Check.DeveloperError(
347
- "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
348
- );
349
- }
350
- //>>includeEnd('debug');
351
-
352
- const polygonHierarchy = options.polygonHierarchy;
353
- const ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix3.Ellipsoid.WGS84);
354
- const granularity = defaultValue.defaultValue(
355
- options.granularity,
356
- Math$1.CesiumMath.RADIANS_PER_DEGREE
357
- );
358
- const perPositionHeight = defaultValue.defaultValue(options.perPositionHeight, false);
359
- const perPositionHeightExtrude =
360
- perPositionHeight && defaultValue.defined(options.extrudedHeight);
361
- const arcType = defaultValue.defaultValue(options.arcType, ArcType.ArcType.GEODESIC);
362
-
363
- let height = defaultValue.defaultValue(options.height, 0.0);
364
- let extrudedHeight = defaultValue.defaultValue(options.extrudedHeight, height);
365
-
366
- if (!perPositionHeightExtrude) {
367
- const h = Math.max(height, extrudedHeight);
368
- extrudedHeight = Math.min(height, extrudedHeight);
369
- height = h;
370
- }
371
-
372
- this._ellipsoid = Matrix3.Ellipsoid.clone(ellipsoid);
373
- this._granularity = granularity;
374
- this._height = height;
375
- this._extrudedHeight = extrudedHeight;
376
- this._arcType = arcType;
377
- this._polygonHierarchy = polygonHierarchy;
378
- this._perPositionHeight = perPositionHeight;
379
- this._perPositionHeightExtrude = perPositionHeightExtrude;
380
- this._offsetAttribute = options.offsetAttribute;
381
- this._workerName = "createPolygonOutlineGeometry";
382
-
383
- /**
384
- * The number of elements used to pack the object into an array.
385
- * @type {number}
386
- */
387
- this.packedLength =
388
- PolygonGeometryLibrary.PolygonGeometryLibrary.computeHierarchyPackedLength(
389
- polygonHierarchy,
390
- Matrix3.Cartesian3
391
- ) +
392
- Matrix3.Ellipsoid.packedLength +
393
- 8;
171
+ length = subdividedPositions.length / 3;
172
+ const indicesSize = length * 2;
173
+ const indices = IndexDatatype_default.createTypedArray(length, indicesSize);
174
+ index = 0;
175
+ for (i = 0; i < length - 1; i++) {
176
+ indices[index++] = i;
177
+ indices[index++] = i + 1;
394
178
  }
395
-
396
- /**
397
- * Stores the provided instance into the provided array.
398
- *
399
- * @param {PolygonOutlineGeometry} value The value to pack.
400
- * @param {number[]} array The array to pack into.
401
- * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
402
- *
403
- * @returns {number[]} The array that was packed into
404
- */
405
- PolygonOutlineGeometry.pack = function (value, array, startingIndex) {
406
- //>>includeStart('debug', pragmas.debug);
407
- Check.Check.typeOf.object("value", value);
408
- Check.Check.defined("array", array);
409
- //>>includeEnd('debug');
410
-
411
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
412
-
413
- startingIndex = PolygonGeometryLibrary.PolygonGeometryLibrary.packPolygonHierarchy(
414
- value._polygonHierarchy,
415
- array,
416
- startingIndex,
417
- Matrix3.Cartesian3
418
- );
419
-
420
- Matrix3.Ellipsoid.pack(value._ellipsoid, array, startingIndex);
421
- startingIndex += Matrix3.Ellipsoid.packedLength;
422
-
423
- array[startingIndex++] = value._height;
424
- array[startingIndex++] = value._extrudedHeight;
425
- array[startingIndex++] = value._granularity;
426
- array[startingIndex++] = value._perPositionHeightExtrude ? 1.0 : 0.0;
427
- array[startingIndex++] = value._perPositionHeight ? 1.0 : 0.0;
428
- array[startingIndex++] = value._arcType;
429
- array[startingIndex++] = defaultValue.defaultValue(value._offsetAttribute, -1);
430
- array[startingIndex] = value.packedLength;
431
-
432
- return array;
433
- };
434
-
435
- const scratchEllipsoid = Matrix3.Ellipsoid.clone(Matrix3.Ellipsoid.UNIT_SPHERE);
436
- const dummyOptions = {
437
- polygonHierarchy: {},
438
- };
439
-
440
- /**
441
- * Retrieves an instance from a packed array.
442
- *
443
- * @param {number[]} array The packed array.
444
- * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
445
- * @param {PolygonOutlineGeometry} [result] The object into which to store the result.
446
- * @returns {PolygonOutlineGeometry} The modified result parameter or a new PolygonOutlineGeometry instance if one was not provided.
447
- */
448
- PolygonOutlineGeometry.unpack = function (array, startingIndex, result) {
449
- //>>includeStart('debug', pragmas.debug);
450
- Check.Check.defined("array", array);
451
- //>>includeEnd('debug');
452
-
453
- startingIndex = defaultValue.defaultValue(startingIndex, 0);
454
-
455
- const polygonHierarchy = PolygonGeometryLibrary.PolygonGeometryLibrary.unpackPolygonHierarchy(
456
- array,
457
- startingIndex,
458
- Matrix3.Cartesian3
459
- );
460
- startingIndex = polygonHierarchy.startingIndex;
461
- delete polygonHierarchy.startingIndex;
462
-
463
- const ellipsoid = Matrix3.Ellipsoid.unpack(array, startingIndex, scratchEllipsoid);
464
- startingIndex += Matrix3.Ellipsoid.packedLength;
465
-
466
- const height = array[startingIndex++];
467
- const extrudedHeight = array[startingIndex++];
468
- const granularity = array[startingIndex++];
469
- const perPositionHeightExtrude = array[startingIndex++] === 1.0;
470
- const perPositionHeight = array[startingIndex++] === 1.0;
471
- const arcType = array[startingIndex++];
472
- const offsetAttribute = array[startingIndex++];
473
- const packedLength = array[startingIndex];
474
-
475
- if (!defaultValue.defined(result)) {
476
- result = new PolygonOutlineGeometry(dummyOptions);
477
- }
478
-
479
- result._polygonHierarchy = polygonHierarchy;
480
- result._ellipsoid = Matrix3.Ellipsoid.clone(ellipsoid, result._ellipsoid);
481
- result._height = height;
482
- result._extrudedHeight = extrudedHeight;
483
- result._granularity = granularity;
484
- result._perPositionHeight = perPositionHeight;
485
- result._perPositionHeightExtrude = perPositionHeightExtrude;
486
- result._arcType = arcType;
487
- result._offsetAttribute =
488
- offsetAttribute === -1 ? undefined : offsetAttribute;
489
- result.packedLength = packedLength;
490
-
491
- return result;
492
- };
493
-
494
- /**
495
- * A description of a polygon outline from an array of positions.
496
- *
497
- * @param {object} options Object with the following properties:
498
- * @param {Cartesian3[]} options.positions An array of positions that defined the corner points of the polygon.
499
- * @param {number} [options.height=0.0] The height of the polygon.
500
- * @param {number} [options.extrudedHeight] The height of the polygon extrusion.
501
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
502
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
503
- * @param {boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
504
- * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of path the outline must follow. Valid options are {@link LinkType.GEODESIC} and {@link ArcType.RHUMB}.
505
- * @returns {PolygonOutlineGeometry}
506
- *
507
- *
508
- * @example
509
- * // create a polygon from points
510
- * const polygon = Cesium.PolygonOutlineGeometry.fromPositions({
511
- * positions : Cesium.Cartesian3.fromDegreesArray([
512
- * -72.0, 40.0,
513
- * -70.0, 35.0,
514
- * -75.0, 30.0,
515
- * -70.0, 30.0,
516
- * -68.0, 40.0
517
- * ])
518
- * });
519
- * const geometry = Cesium.PolygonOutlineGeometry.createGeometry(polygon);
520
- *
521
- * @see PolygonOutlineGeometry#createGeometry
522
- */
523
- PolygonOutlineGeometry.fromPositions = function (options) {
524
- options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
525
-
526
- //>>includeStart('debug', pragmas.debug);
527
- Check.Check.defined("options.positions", options.positions);
528
- //>>includeEnd('debug');
529
-
530
- const newOptions = {
531
- polygonHierarchy: {
532
- positions: options.positions,
533
- },
534
- height: options.height,
535
- extrudedHeight: options.extrudedHeight,
536
- ellipsoid: options.ellipsoid,
537
- granularity: options.granularity,
538
- perPositionHeight: options.perPositionHeight,
539
- arcType: options.arcType,
540
- offsetAttribute: options.offsetAttribute,
541
- };
542
- return new PolygonOutlineGeometry(newOptions);
543
- };
544
-
545
- /**
546
- * Computes the geometric representation of a polygon outline, including its vertices, indices, and a bounding sphere.
547
- *
548
- * @param {PolygonOutlineGeometry} polygonGeometry A description of the polygon outline.
549
- * @returns {Geometry|undefined} The computed vertices and indices.
550
- */
551
- PolygonOutlineGeometry.createGeometry = function (polygonGeometry) {
552
- const ellipsoid = polygonGeometry._ellipsoid;
553
- const granularity = polygonGeometry._granularity;
554
- const polygonHierarchy = polygonGeometry._polygonHierarchy;
555
- const perPositionHeight = polygonGeometry._perPositionHeight;
556
- const arcType = polygonGeometry._arcType;
557
-
558
- const polygons = PolygonGeometryLibrary.PolygonGeometryLibrary.polygonOutlinesFromHierarchy(
559
- polygonHierarchy,
560
- !perPositionHeight,
561
- ellipsoid
562
- );
563
-
564
- if (polygons.length === 0) {
565
- return undefined;
566
- }
567
-
568
- let geometryInstance;
569
- const geometries = [];
570
- const minDistance = Math$1.CesiumMath.chordLength(
571
- granularity,
572
- ellipsoid.maximumRadius
573
- );
574
-
575
- const height = polygonGeometry._height;
576
- const extrudedHeight = polygonGeometry._extrudedHeight;
577
- const extrude =
578
- polygonGeometry._perPositionHeightExtrude ||
579
- !Math$1.CesiumMath.equalsEpsilon(height, extrudedHeight, 0, Math$1.CesiumMath.EPSILON2);
580
- let offsetValue;
581
- let i;
582
- if (extrude) {
583
- for (i = 0; i < polygons.length; i++) {
584
- geometryInstance = createGeometryFromPositionsExtruded(
585
- ellipsoid,
586
- polygons[i],
587
- minDistance,
588
- perPositionHeight,
589
- arcType
179
+ indices[index++] = length - 1;
180
+ indices[index++] = 0;
181
+ return new GeometryInstance_default({
182
+ geometry: new Geometry_default({
183
+ attributes: new GeometryAttributes_default({
184
+ position: new GeometryAttribute_default({
185
+ componentDatatype: ComponentDatatype_default.DOUBLE,
186
+ componentsPerAttribute: 3,
187
+ values: subdividedPositions
188
+ })
189
+ }),
190
+ indices,
191
+ primitiveType: PrimitiveType_default.LINES
192
+ })
193
+ });
194
+ }
195
+ function createGeometryFromPositionsExtruded(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
196
+ const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
197
+ const positions2D = tangentPlane.projectPointsOntoPlane(
198
+ positions,
199
+ createGeometryFromPositionsPositions
200
+ );
201
+ const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
202
+ positions2D
203
+ );
204
+ if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
205
+ positions2D.reverse();
206
+ positions = positions.slice().reverse();
207
+ }
208
+ let subdividedPositions;
209
+ let i;
210
+ let length = positions.length;
211
+ const corners = new Array(length);
212
+ let index = 0;
213
+ if (!perPositionHeight) {
214
+ let numVertices = 0;
215
+ if (arcType === ArcType_default.GEODESIC) {
216
+ for (i = 0; i < length; i++) {
217
+ numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
218
+ positions[i],
219
+ positions[(i + 1) % length],
220
+ minDistance
590
221
  );
591
- geometryInstance.geometry = PolygonGeometryLibrary.PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(
592
- geometryInstance.geometry,
593
- height,
594
- extrudedHeight,
222
+ }
223
+ } else if (arcType === ArcType_default.RHUMB) {
224
+ for (i = 0; i < length; i++) {
225
+ numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
595
226
  ellipsoid,
596
- perPositionHeight
227
+ positions[i],
228
+ positions[(i + 1) % length],
229
+ minDistance
597
230
  );
598
- if (defaultValue.defined(polygonGeometry._offsetAttribute)) {
599
- const size =
600
- geometryInstance.geometry.attributes.position.values.length / 3;
601
- let offsetAttribute = new Uint8Array(size);
602
- if (polygonGeometry._offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.TOP) {
603
- offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
604
- } else {
605
- offsetValue =
606
- polygonGeometry._offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.NONE
607
- ? 0
608
- : 1;
609
- offsetAttribute = offsetAttribute.fill(offsetValue);
610
- }
611
-
612
- geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute.GeometryAttribute(
613
- {
614
- componentDatatype: ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE,
615
- componentsPerAttribute: 1,
616
- values: offsetAttribute,
617
- }
618
- );
619
- }
620
- geometries.push(geometryInstance);
621
231
  }
622
- } else {
623
- for (i = 0; i < polygons.length; i++) {
624
- geometryInstance = createGeometryFromPositions(
625
- ellipsoid,
626
- polygons[i],
232
+ }
233
+ subdividedPositions = new Float64Array(numVertices * 3 * 2);
234
+ for (i = 0; i < length; ++i) {
235
+ corners[i] = index / 3;
236
+ let tempPositions;
237
+ if (arcType === ArcType_default.GEODESIC) {
238
+ tempPositions = PolygonGeometryLibrary_default.subdivideLine(
239
+ positions[i],
240
+ positions[(i + 1) % length],
627
241
  minDistance,
628
- perPositionHeight,
629
- arcType
242
+ createGeometryFromPositionsSubdivided
630
243
  );
631
- geometryInstance.geometry.attributes.position.values = PolygonPipeline.PolygonPipeline.scaleToGeodeticHeight(
632
- geometryInstance.geometry.attributes.position.values,
633
- height,
244
+ } else if (arcType === ArcType_default.RHUMB) {
245
+ tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
634
246
  ellipsoid,
635
- !perPositionHeight
247
+ positions[i],
248
+ positions[(i + 1) % length],
249
+ minDistance,
250
+ createGeometryFromPositionsSubdivided
636
251
  );
637
-
638
- if (defaultValue.defined(polygonGeometry._offsetAttribute)) {
639
- const length =
640
- geometryInstance.geometry.attributes.position.values.length;
641
- offsetValue =
642
- polygonGeometry._offsetAttribute === GeometryOffsetAttribute.GeometryOffsetAttribute.NONE
643
- ? 0
644
- : 1;
645
- const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
646
- geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute.GeometryAttribute(
647
- {
648
- componentDatatype: ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE,
649
- componentsPerAttribute: 1,
650
- values: applyOffset,
651
- }
652
- );
653
- }
654
-
655
- geometries.push(geometryInstance);
252
+ }
253
+ const tempPositionsLength = tempPositions.length;
254
+ for (let j = 0; j < tempPositionsLength; ++j) {
255
+ subdividedPositions[index++] = tempPositions[j];
656
256
  }
657
257
  }
658
-
659
- const geometry = GeometryPipeline.GeometryPipeline.combineInstances(geometries)[0];
660
- const boundingSphere = Transforms.BoundingSphere.fromVertices(
661
- geometry.attributes.position.values
258
+ } else {
259
+ subdividedPositions = new Float64Array(length * 2 * 3 * 2);
260
+ for (i = 0; i < length; ++i) {
261
+ corners[i] = index / 3;
262
+ const p0 = positions[i];
263
+ const p1 = positions[(i + 1) % length];
264
+ subdividedPositions[index++] = p0.x;
265
+ subdividedPositions[index++] = p0.y;
266
+ subdividedPositions[index++] = p0.z;
267
+ subdividedPositions[index++] = p1.x;
268
+ subdividedPositions[index++] = p1.y;
269
+ subdividedPositions[index++] = p1.z;
270
+ }
271
+ }
272
+ length = subdividedPositions.length / (3 * 2);
273
+ const cornersLength = corners.length;
274
+ const indicesSize = (length * 2 + cornersLength) * 2;
275
+ const indices = IndexDatatype_default.createTypedArray(
276
+ length + cornersLength,
277
+ indicesSize
278
+ );
279
+ index = 0;
280
+ for (i = 0; i < length; ++i) {
281
+ indices[index++] = i;
282
+ indices[index++] = (i + 1) % length;
283
+ indices[index++] = i + length;
284
+ indices[index++] = (i + 1) % length + length;
285
+ }
286
+ for (i = 0; i < cornersLength; i++) {
287
+ const corner = corners[i];
288
+ indices[index++] = corner;
289
+ indices[index++] = corner + length;
290
+ }
291
+ return new GeometryInstance_default({
292
+ geometry: new Geometry_default({
293
+ attributes: new GeometryAttributes_default({
294
+ position: new GeometryAttribute_default({
295
+ componentDatatype: ComponentDatatype_default.DOUBLE,
296
+ componentsPerAttribute: 3,
297
+ values: subdividedPositions
298
+ })
299
+ }),
300
+ indices,
301
+ primitiveType: PrimitiveType_default.LINES
302
+ })
303
+ });
304
+ }
305
+ function PolygonOutlineGeometry(options) {
306
+ Check_default.typeOf.object("options", options);
307
+ Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
308
+ if (options.perPositionHeight && defined_default(options.height)) {
309
+ throw new DeveloperError_default(
310
+ "Cannot use both options.perPositionHeight and options.height"
662
311
  );
663
-
664
- return new GeometryAttribute.Geometry({
665
- attributes: geometry.attributes,
666
- indices: geometry.indices,
667
- primitiveType: geometry.primitiveType,
668
- boundingSphere: boundingSphere,
669
- offsetAttribute: polygonGeometry._offsetAttribute,
670
- });
312
+ }
313
+ if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
314
+ throw new DeveloperError_default(
315
+ "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
316
+ );
317
+ }
318
+ const polygonHierarchy = options.polygonHierarchy;
319
+ const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
320
+ const granularity = defaultValue_default(
321
+ options.granularity,
322
+ Math_default.RADIANS_PER_DEGREE
323
+ );
324
+ const perPositionHeight = defaultValue_default(options.perPositionHeight, false);
325
+ const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
326
+ const arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
327
+ let height = defaultValue_default(options.height, 0);
328
+ let extrudedHeight = defaultValue_default(options.extrudedHeight, height);
329
+ if (!perPositionHeightExtrude) {
330
+ const h = Math.max(height, extrudedHeight);
331
+ extrudedHeight = Math.min(height, extrudedHeight);
332
+ height = h;
333
+ }
334
+ this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
335
+ this._granularity = granularity;
336
+ this._height = height;
337
+ this._extrudedHeight = extrudedHeight;
338
+ this._arcType = arcType;
339
+ this._polygonHierarchy = polygonHierarchy;
340
+ this._perPositionHeight = perPositionHeight;
341
+ this._perPositionHeightExtrude = perPositionHeightExtrude;
342
+ this._offsetAttribute = options.offsetAttribute;
343
+ this._workerName = "createPolygonOutlineGeometry";
344
+ this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
345
+ polygonHierarchy,
346
+ Cartesian3_default
347
+ ) + Ellipsoid_default.packedLength + 8;
348
+ }
349
+ PolygonOutlineGeometry.pack = function(value, array, startingIndex) {
350
+ Check_default.typeOf.object("value", value);
351
+ Check_default.defined("array", array);
352
+ startingIndex = defaultValue_default(startingIndex, 0);
353
+ startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
354
+ value._polygonHierarchy,
355
+ array,
356
+ startingIndex,
357
+ Cartesian3_default
358
+ );
359
+ Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
360
+ startingIndex += Ellipsoid_default.packedLength;
361
+ array[startingIndex++] = value._height;
362
+ array[startingIndex++] = value._extrudedHeight;
363
+ array[startingIndex++] = value._granularity;
364
+ array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
365
+ array[startingIndex++] = value._perPositionHeight ? 1 : 0;
366
+ array[startingIndex++] = value._arcType;
367
+ array[startingIndex++] = defaultValue_default(value._offsetAttribute, -1);
368
+ array[startingIndex] = value.packedLength;
369
+ return array;
370
+ };
371
+ var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
372
+ var dummyOptions = {
373
+ polygonHierarchy: {}
374
+ };
375
+ PolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
376
+ Check_default.defined("array", array);
377
+ startingIndex = defaultValue_default(startingIndex, 0);
378
+ const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
379
+ array,
380
+ startingIndex,
381
+ Cartesian3_default
382
+ );
383
+ startingIndex = polygonHierarchy.startingIndex;
384
+ delete polygonHierarchy.startingIndex;
385
+ const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
386
+ startingIndex += Ellipsoid_default.packedLength;
387
+ const height = array[startingIndex++];
388
+ const extrudedHeight = array[startingIndex++];
389
+ const granularity = array[startingIndex++];
390
+ const perPositionHeightExtrude = array[startingIndex++] === 1;
391
+ const perPositionHeight = array[startingIndex++] === 1;
392
+ const arcType = array[startingIndex++];
393
+ const offsetAttribute = array[startingIndex++];
394
+ const packedLength = array[startingIndex];
395
+ if (!defined_default(result)) {
396
+ result = new PolygonOutlineGeometry(dummyOptions);
397
+ }
398
+ result._polygonHierarchy = polygonHierarchy;
399
+ result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
400
+ result._height = height;
401
+ result._extrudedHeight = extrudedHeight;
402
+ result._granularity = granularity;
403
+ result._perPositionHeight = perPositionHeight;
404
+ result._perPositionHeightExtrude = perPositionHeightExtrude;
405
+ result._arcType = arcType;
406
+ result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
407
+ result.packedLength = packedLength;
408
+ return result;
409
+ };
410
+ PolygonOutlineGeometry.fromPositions = function(options) {
411
+ options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
412
+ Check_default.defined("options.positions", options.positions);
413
+ const newOptions = {
414
+ polygonHierarchy: {
415
+ positions: options.positions
416
+ },
417
+ height: options.height,
418
+ extrudedHeight: options.extrudedHeight,
419
+ ellipsoid: options.ellipsoid,
420
+ granularity: options.granularity,
421
+ perPositionHeight: options.perPositionHeight,
422
+ arcType: options.arcType,
423
+ offsetAttribute: options.offsetAttribute
671
424
  };
672
-
673
- function createPolygonOutlineGeometry(polygonGeometry, offset) {
674
- if (defaultValue.defined(offset)) {
675
- polygonGeometry = PolygonOutlineGeometry.unpack(polygonGeometry, offset);
425
+ return new PolygonOutlineGeometry(newOptions);
426
+ };
427
+ PolygonOutlineGeometry.createGeometry = function(polygonGeometry) {
428
+ const ellipsoid = polygonGeometry._ellipsoid;
429
+ const granularity = polygonGeometry._granularity;
430
+ const polygonHierarchy = polygonGeometry._polygonHierarchy;
431
+ const perPositionHeight = polygonGeometry._perPositionHeight;
432
+ const arcType = polygonGeometry._arcType;
433
+ const polygons = PolygonGeometryLibrary_default.polygonOutlinesFromHierarchy(
434
+ polygonHierarchy,
435
+ !perPositionHeight,
436
+ ellipsoid
437
+ );
438
+ if (polygons.length === 0) {
439
+ return void 0;
440
+ }
441
+ let geometryInstance;
442
+ const geometries = [];
443
+ const minDistance = Math_default.chordLength(
444
+ granularity,
445
+ ellipsoid.maximumRadius
446
+ );
447
+ const height = polygonGeometry._height;
448
+ const extrudedHeight = polygonGeometry._extrudedHeight;
449
+ const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
450
+ let offsetValue;
451
+ let i;
452
+ if (extrude) {
453
+ for (i = 0; i < polygons.length; i++) {
454
+ geometryInstance = createGeometryFromPositionsExtruded(
455
+ ellipsoid,
456
+ polygons[i],
457
+ minDistance,
458
+ perPositionHeight,
459
+ arcType
460
+ );
461
+ geometryInstance.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
462
+ geometryInstance.geometry,
463
+ height,
464
+ extrudedHeight,
465
+ ellipsoid,
466
+ perPositionHeight
467
+ );
468
+ if (defined_default(polygonGeometry._offsetAttribute)) {
469
+ const size = geometryInstance.geometry.attributes.position.values.length / 3;
470
+ let offsetAttribute = new Uint8Array(size);
471
+ if (polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.TOP) {
472
+ offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
473
+ } else {
474
+ offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
475
+ offsetAttribute = offsetAttribute.fill(offsetValue);
476
+ }
477
+ geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default(
478
+ {
479
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
480
+ componentsPerAttribute: 1,
481
+ values: offsetAttribute
482
+ }
483
+ );
484
+ }
485
+ geometries.push(geometryInstance);
486
+ }
487
+ } else {
488
+ for (i = 0; i < polygons.length; i++) {
489
+ geometryInstance = createGeometryFromPositions(
490
+ ellipsoid,
491
+ polygons[i],
492
+ minDistance,
493
+ perPositionHeight,
494
+ arcType
495
+ );
496
+ geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
497
+ geometryInstance.geometry.attributes.position.values,
498
+ height,
499
+ ellipsoid,
500
+ !perPositionHeight
501
+ );
502
+ if (defined_default(polygonGeometry._offsetAttribute)) {
503
+ const length = geometryInstance.geometry.attributes.position.values.length;
504
+ offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
505
+ const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
506
+ geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default(
507
+ {
508
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
509
+ componentsPerAttribute: 1,
510
+ values: applyOffset
511
+ }
512
+ );
513
+ }
514
+ geometries.push(geometryInstance);
676
515
  }
677
- polygonGeometry._ellipsoid = Matrix3.Ellipsoid.clone(polygonGeometry._ellipsoid);
678
- return PolygonOutlineGeometry.createGeometry(polygonGeometry);
679
516
  }
680
-
681
- return createPolygonOutlineGeometry;
682
-
683
- }));
517
+ const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
518
+ const boundingSphere = BoundingSphere_default.fromVertices(
519
+ geometry.attributes.position.values
520
+ );
521
+ return new Geometry_default({
522
+ attributes: geometry.attributes,
523
+ indices: geometry.indices,
524
+ primitiveType: geometry.primitiveType,
525
+ boundingSphere,
526
+ offsetAttribute: polygonGeometry._offsetAttribute
527
+ });
528
+ };
529
+ var PolygonOutlineGeometry_default = PolygonOutlineGeometry;
530
+
531
+ // packages/engine/Source/Workers/createPolygonOutlineGeometry.js
532
+ function createPolygonOutlineGeometry(polygonGeometry, offset) {
533
+ if (defined_default(offset)) {
534
+ polygonGeometry = PolygonOutlineGeometry_default.unpack(polygonGeometry, offset);
535
+ }
536
+ polygonGeometry._ellipsoid = Ellipsoid_default.clone(polygonGeometry._ellipsoid);
537
+ return PolygonOutlineGeometry_default.createGeometry(polygonGeometry);
538
+ }
539
+ var createPolygonOutlineGeometry_default = createPolygonOutlineGeometry;
540
+ export {
541
+ createPolygonOutlineGeometry_default as default
542
+ };