@cesium/engine 24.0.0 → 26.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 (362) hide show
  1. package/Build/Workers/{chunk-6WLHJFD3.js → chunk-3VFEWOBI.js} +59 -32
  2. package/Build/Workers/{chunk-UQU4RXLT.js → chunk-424RNO3D.js} +50 -45
  3. package/Build/Workers/chunk-4MGMYHOO.js +147 -0
  4. package/Build/Workers/{chunk-AMIHNSST.js → chunk-4S7IE3LB.js} +2 -2
  5. package/Build/Workers/{chunk-J6AW5YHS.js → chunk-52JDLOEM.js} +14 -14
  6. package/Build/Workers/{chunk-6RMS4S72.js → chunk-54I6Y66F.js} +6 -6
  7. package/Build/Workers/{chunk-C6P4IG5P.js → chunk-6YEE6JDR.js} +6 -6
  8. package/Build/Workers/{chunk-72VYSVEW.js → chunk-7J2HKPRH.js} +11 -10
  9. package/Build/Workers/{chunk-7O5XJTVE.js → chunk-7WM2PX4V.js} +5 -5
  10. package/Build/Workers/{chunk-5A2SW66E.js → chunk-ACXQXN46.js} +16 -16
  11. package/Build/Workers/{chunk-VLDEUTOP.js → chunk-AYKR4VBR.js} +2 -2
  12. package/Build/Workers/{chunk-YQFTYQMZ.js → chunk-C6J67V5A.js} +3 -2
  13. package/Build/Workers/{chunk-D4EJ2NXG.js → chunk-C6KNZ7T4.js} +17 -17
  14. package/Build/Workers/{chunk-7MDYBRYJ.js → chunk-CFQP6LYM.js} +4 -4
  15. package/Build/Workers/{chunk-YAOZMOFL.js → chunk-CXOYE2WM.js} +5 -5
  16. package/Build/Workers/{chunk-B6SCUUFP.js → chunk-CZEYZU4N.js} +10 -10
  17. package/Build/Workers/{chunk-NPF7SSHZ.js → chunk-DBOEKL43.js} +7 -7
  18. package/Build/Workers/{chunk-44EMEGKW.js → chunk-DDWSZVMY.js} +5 -5
  19. package/Build/Workers/{chunk-7X322WP2.js → chunk-DOBXCNC3.js} +13 -13
  20. package/Build/Workers/{chunk-JCI63T3K.js → chunk-E7VQ76KE.js} +6 -6
  21. package/Build/Workers/{chunk-7TYLCBGK.js → chunk-EBSIOBXY.js} +12 -10
  22. package/Build/Workers/{chunk-GQUNK2XC.js → chunk-EF2QYXGA.js} +14 -14
  23. package/Build/Workers/{chunk-BJD6QGXZ.js → chunk-EPYXRCDB.js} +12 -12
  24. package/Build/Workers/{chunk-63SIWPLS.js → chunk-F6QDY6HU.js} +13 -13
  25. package/Build/Workers/{chunk-XY6HMDGI.js → chunk-FRQZECAO.js} +5 -5
  26. package/Build/Workers/{chunk-VMVOUQ5J.js → chunk-G7PXZRVF.js} +7 -7
  27. package/Build/Workers/{chunk-N65BAKSH.js → chunk-INUEEEQA.js} +8 -8
  28. package/Build/Workers/{chunk-7QRFIKWQ.js → chunk-IRBKFCEJ.js} +2 -2
  29. package/Build/Workers/{chunk-UIGVOKKI.js → chunk-IYOUHCZB.js} +3 -2
  30. package/Build/Workers/{chunk-5GXYJQ2K.js → chunk-J6BWOHUF.js} +3 -3
  31. package/Build/Workers/{chunk-A47HVBC5.js → chunk-KFSTQKNM.js} +7 -7
  32. package/Build/Workers/{chunk-EV3VGO6Y.js → chunk-KKOSKAZB.js} +17 -17
  33. package/Build/Workers/{chunk-6MPGQEHA.js → chunk-KSSWJIZW.js} +2 -2
  34. package/Build/Workers/{chunk-DHKPFLSJ.js → chunk-M3B5JKSM.js} +3 -2
  35. package/Build/Workers/chunk-MPZHGZU6.js +2342 -0
  36. package/Build/Workers/{chunk-YJZGW74L.js → chunk-MYP774IS.js} +2213 -1349
  37. package/Build/Workers/{chunk-LIB2H534.js → chunk-O3EA5HS7.js} +12 -11
  38. package/Build/Workers/{chunk-ILMFADZA.js → chunk-P3CK7MCY.js} +27 -5
  39. package/Build/Workers/chunk-Q3PY526V.js +3201 -0
  40. package/Build/Workers/chunk-QN67VG36.js +973 -0
  41. package/Build/Workers/{chunk-XJRBB253.js → chunk-QRWGUWI6.js} +11 -11
  42. package/Build/Workers/{chunk-AF3MU2RL.js → chunk-S4MCOY6I.js} +7 -6
  43. package/Build/Workers/{chunk-Y7HNNPNK.js → chunk-SMQZZOW6.js} +10 -10
  44. package/Build/Workers/{chunk-PVV64VFW.js → chunk-TKKIREQ6.js} +3 -2
  45. package/Build/Workers/{chunk-MKM27KGV.js → chunk-U3ZA64U7.js} +2 -2
  46. package/Build/Workers/{chunk-2N4KDHS3.js → chunk-UA25D5MX.js} +12 -11
  47. package/Build/Workers/{chunk-RQNJD3O4.js → chunk-UOOIQ3KX.js} +12 -12
  48. package/Build/Workers/{chunk-GOQBUCXH.js → chunk-V7VQKN6N.js} +709 -431
  49. package/Build/Workers/{chunk-LXMCPFFS.js → chunk-VQYETPWC.js} +4 -4
  50. package/Build/Workers/{chunk-NKT5K3K3.js → chunk-VWV2IJRB.js} +13 -12
  51. package/Build/Workers/chunk-XZMBNNDX.js +1287 -0
  52. package/Build/Workers/{chunk-ISY4EZCA.js → chunk-Y57HREW5.js} +4 -4
  53. package/Build/Workers/{chunk-EDXL4W76.js → chunk-Y5BF6AFU.js} +2 -2
  54. package/Build/Workers/{chunk-Q3C6VQH6.js → chunk-YLY7NKAB.js} +4 -4
  55. package/Build/Workers/{chunk-4TIG36AW.js → chunk-ZK3CF7ZD.js} +12 -12
  56. package/Build/Workers/{chunk-AJLTU6PF.js → chunk-ZP7JMQV4.js} +4 -1
  57. package/Build/Workers/{chunk-HXJMS2ZI.js → chunk-ZZ46LWL6.js} +1 -1
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +175 -118
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +24 -23
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +12 -9
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/ArcType.js +6 -1
  112. package/Source/Core/ArticulationStageType.js +5 -1
  113. package/Source/Core/AssociativeArray.js +100 -94
  114. package/Source/Core/BoundingSphere.js +1296 -1300
  115. package/Source/Core/Cartesian2.js +1 -1
  116. package/Source/Core/Cartesian3.js +2 -3
  117. package/Source/Core/Cartesian4.js +1 -1
  118. package/Source/Core/Cartographic.js +257 -249
  119. package/Source/Core/ClockRange.js +6 -1
  120. package/Source/Core/ClockStep.js +6 -1
  121. package/Source/Core/Color.js +844 -835
  122. package/Source/Core/ComponentDatatype.js +39 -1
  123. package/Source/Core/CornerType.js +6 -1
  124. package/Source/Core/Credit.js +121 -124
  125. package/Source/Core/Ellipsoid.js +637 -660
  126. package/Source/Core/ExtrapolationType.js +6 -1
  127. package/Source/Core/GeocodeType.js +6 -1
  128. package/Source/Core/GeographicProjection.js +74 -74
  129. package/Source/Core/GeographicTilingScheme.js +179 -198
  130. package/Source/Core/GeometryOffsetAttribute.js +7 -1
  131. package/Source/Core/GeometryType.js +7 -1
  132. package/Source/Core/HeightmapEncoding.js +6 -1
  133. package/Source/Core/Iau2006XysData.js +24 -13
  134. package/Source/Core/IndexDatatype.js +3 -1
  135. package/Source/Core/InterpolationType.js +5 -1
  136. package/Source/Core/Intersect.js +6 -1
  137. package/Source/Core/Ion.js +1 -1
  138. package/Source/Core/IonGeocodeProviderType.js +5 -1
  139. package/Source/Core/JulianDate.js +850 -848
  140. package/Source/Core/KeyboardEventModifier.js +6 -1
  141. package/Source/Core/MapProjection.js +40 -44
  142. package/Source/Core/Matrix2.js +906 -893
  143. package/Source/Core/Matrix3.js +1643 -1575
  144. package/Source/Core/Matrix4.js +2903 -2872
  145. package/Source/Core/PixelFormat.js +3 -1
  146. package/Source/Core/PrimitiveType.js +11 -1
  147. package/Source/Core/Ray.js +62 -60
  148. package/Source/Core/Rectangle.js +913 -904
  149. package/Source/Core/ReferenceFrame.js +6 -1
  150. package/Source/Core/RequestScheduler.js +8 -3
  151. package/Source/Core/RequestState.js +6 -1
  152. package/Source/Core/RequestType.js +6 -1
  153. package/Source/Core/Resource.js +1 -1
  154. package/Source/Core/ScreenSpaceEventHandler.js +51 -41
  155. package/Source/Core/ScreenSpaceEventType.js +6 -1
  156. package/Source/Core/TerrainQuantization.js +6 -1
  157. package/Source/Core/TilingScheme.js +100 -98
  158. package/Source/Core/TimeConstants.js +6 -1
  159. package/Source/Core/TimeStandard.js +6 -1
  160. package/Source/Core/TrackingReferenceFrame.js +6 -1
  161. package/Source/Core/Visibility.js +6 -1
  162. package/Source/Core/VulkanConstants.js +6 -1
  163. package/Source/Core/WebGLConstants.js +6 -1
  164. package/Source/Core/WebMercatorProjection.js +108 -109
  165. package/Source/Core/WebMercatorTilingScheme.js +246 -242
  166. package/Source/Core/WindingOrder.js +3 -1
  167. package/Source/Core/createColorRamp.js +37 -0
  168. package/Source/Core/globalTypes.js +25 -0
  169. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +1 -0
  170. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +1 -0
  171. package/Source/DataSources/StripeOrientation.js +6 -1
  172. package/Source/Renderer/BufferUsage.js +20 -9
  173. package/Source/Renderer/Context.js +2 -29
  174. package/Source/Renderer/DrawCommand.js +435 -403
  175. package/Source/Renderer/MipmapHint.js +5 -1
  176. package/Source/Renderer/Pass.js +10 -3
  177. package/Source/Renderer/PickId.js +44 -0
  178. package/Source/Renderer/PixelDatatype.js +3 -1
  179. package/Source/Renderer/RenderbufferFormat.js +5 -1
  180. package/Source/Renderer/ShaderDestination.js +4 -1
  181. package/Source/Renderer/TextureMagnificationFilter.js +3 -1
  182. package/Source/Renderer/TextureMinificationFilter.js +3 -1
  183. package/Source/Renderer/TextureWrap.js +5 -1
  184. package/Source/Renderer/createUniform.js +346 -239
  185. package/Source/Renderer/createUniformArray.js +494 -381
  186. package/Source/Scene/AlphaMode.js +5 -1
  187. package/Source/Scene/ArcGisBaseMapType.js +6 -1
  188. package/Source/Scene/ArcGisMapService.js +1 -1
  189. package/Source/Scene/AttributeType.js +3 -1
  190. package/Source/Scene/Axis.js +3 -1
  191. package/Source/Scene/BingMapsStyle.js +6 -1
  192. package/Source/Scene/BlendEquation.js +6 -1
  193. package/Source/Scene/BlendFunction.js +6 -1
  194. package/Source/Scene/BlendOption.js +6 -1
  195. package/Source/Scene/BlendingState.js +6 -1
  196. package/Source/Scene/BufferLoader.js +0 -2
  197. package/Source/Scene/BufferPoint.js +1 -0
  198. package/Source/Scene/BufferPointCollection.js +17 -1
  199. package/Source/Scene/BufferPolygon.js +3 -2
  200. package/Source/Scene/BufferPolygonCollection.js +13 -1
  201. package/Source/Scene/BufferPolyline.js +1 -0
  202. package/Source/Scene/BufferPolylineCollection.js +5 -1
  203. package/Source/Scene/BufferPrimitiveCollection.js +210 -43
  204. package/Source/Scene/CameraEventAggregator.js +30 -18
  205. package/Source/Scene/CameraEventType.js +6 -1
  206. package/Source/Scene/Cesium3DTile.js +54 -1
  207. package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
  208. package/Source/Scene/Cesium3DTileContent.js +195 -254
  209. package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
  210. package/Source/Scene/Cesium3DTileContentState.js +6 -1
  211. package/Source/Scene/Cesium3DTileContentType.js +3 -1
  212. package/Source/Scene/Cesium3DTileFeature.js +289 -306
  213. package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
  214. package/Source/Scene/Cesium3DTilePass.js +5 -1
  215. package/Source/Scene/Cesium3DTilePointFeature.js +433 -511
  216. package/Source/Scene/Cesium3DTileRefine.js +6 -1
  217. package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
  218. package/Source/Scene/Cesium3DTileset.js +46 -6
  219. package/Source/Scene/ClassificationType.js +3 -1
  220. package/Source/Scene/CloudType.js +3 -1
  221. package/Source/Scene/ColorBlendMode.js +4 -1
  222. package/Source/Scene/Composite3DTileContent.js +254 -292
  223. package/Source/Scene/CullFace.js +6 -1
  224. package/Source/Scene/DepthFunction.js +6 -1
  225. package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
  226. package/Source/Scene/EdgeDisplayMode.js +50 -0
  227. package/Source/Scene/Empty3DTileContent.js +100 -132
  228. package/Source/Scene/EquirectangularPanorama.js +1 -0
  229. package/Source/Scene/ExpressionNodeType.js +6 -1
  230. package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
  231. package/Source/Scene/GeoJsonPrimitive.js +874 -0
  232. package/Source/Scene/Geometry3DTileContent.js +151 -185
  233. package/Source/Scene/GltfBufferViewLoader.js +0 -2
  234. package/Source/Scene/GltfDracoLoader.js +0 -2
  235. package/Source/Scene/GltfImageLoader.js +0 -3
  236. package/Source/Scene/GltfIndexBufferLoader.js +0 -4
  237. package/Source/Scene/GltfJsonLoader.js +0 -2
  238. package/Source/Scene/GltfLoader.js +109 -5
  239. package/Source/Scene/GltfLoaderUtil.js +14 -0
  240. package/Source/Scene/GltfSpzLoader.js +0 -2
  241. package/Source/Scene/GltfStructuralMetadataLoader.js +0 -2
  242. package/Source/Scene/GltfTextureLoader.js +0 -2
  243. package/Source/Scene/GltfVertexBufferLoader.js +0 -4
  244. package/Source/Scene/HeightReference.js +5 -1
  245. package/Source/Scene/HorizontalOrigin.js +6 -1
  246. package/Source/Scene/ImageryProvider.js +1 -1
  247. package/Source/Scene/ImageryState.js +6 -1
  248. package/Source/Scene/Implicit3DTileContent.js +179 -214
  249. package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
  250. package/Source/Scene/InstanceAttributeSemantic.js +3 -1
  251. package/Source/Scene/IonWorldImageryStyle.js +6 -1
  252. package/Source/Scene/JobType.js +6 -1
  253. package/Source/Scene/LabelStyle.js +6 -1
  254. package/Source/Scene/MVTDataProvider.js +147 -0
  255. package/Source/Scene/MapMode2D.js +6 -1
  256. package/Source/Scene/MetadataComponentType.js +3 -1
  257. package/Source/Scene/MetadataSchemaLoader.js +0 -2
  258. package/Source/Scene/MetadataSemantic.js +6 -2
  259. package/Source/Scene/MetadataType.js +3 -1
  260. package/Source/Scene/Model/B3dmLoader.js +0 -3
  261. package/Source/Scene/Model/CustomShaderMode.js +3 -1
  262. package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
  263. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +78 -337
  264. package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
  265. package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
  266. package/Source/Scene/Model/GeoJsonLoader.js +0 -2
  267. package/Source/Scene/Model/I3dmLoader.js +0 -3
  268. package/Source/Scene/Model/InstancingPipelineStage.js +1 -1
  269. package/Source/Scene/Model/LightingModel.js +5 -1
  270. package/Source/Scene/Model/MaterialPipelineStage.js +184 -3
  271. package/Source/Scene/Model/Model.js +34 -0
  272. package/Source/Scene/Model/Model3DTileContent.js +424 -458
  273. package/Source/Scene/Model/ModelDrawCommand.js +31 -3
  274. package/Source/Scene/Model/ModelReader.js +474 -3
  275. package/Source/Scene/Model/ModelRuntimePrimitive.js +2 -1
  276. package/Source/Scene/Model/ModelType.js +3 -1
  277. package/Source/Scene/Model/ModelUtility.js +4 -0
  278. package/Source/Scene/Model/PntsLoader.js +4 -3
  279. package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
  280. package/Source/Scene/Model/UniformType.js +5 -1
  281. package/Source/Scene/Model/VaryingType.js +5 -1
  282. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +500 -139
  283. package/Source/Scene/Model/pickModel.js +94 -299
  284. package/Source/Scene/ModelAnimationLoop.js +6 -1
  285. package/Source/Scene/ModelAnimationState.js +6 -1
  286. package/Source/Scene/ModelComponents.js +47 -2
  287. package/Source/Scene/Multiple3DTileContent.js +291 -334
  288. package/Source/Scene/PrimitiveState.js +7 -1
  289. package/Source/Scene/QuadtreeOccluders.js +20 -15
  290. package/Source/Scene/QuadtreeTile.js +547 -541
  291. package/Source/Scene/QuadtreeTileLoadState.js +6 -1
  292. package/Source/Scene/QuadtreeTileProvider.js +159 -175
  293. package/Source/Scene/ResourceLoader.js +0 -1
  294. package/Source/Scene/ResourceLoaderState.js +7 -1
  295. package/Source/Scene/Scene.js +26 -0
  296. package/Source/Scene/SceneMode.js +4 -1
  297. package/Source/Scene/ShadowMode.js +3 -1
  298. package/Source/Scene/SkyBox.js +1 -1
  299. package/Source/Scene/SplitDirection.js +6 -1
  300. package/Source/Scene/StencilFunction.js +6 -1
  301. package/Source/Scene/StencilOperation.js +6 -1
  302. package/Source/Scene/TerrainState.js +7 -1
  303. package/Source/Scene/TileState.js +7 -1
  304. package/Source/Scene/Tileset3DTileContent.js +113 -146
  305. package/Source/Scene/Tonemapper.js +5 -1
  306. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
  307. package/Source/Scene/Vector3DTileContent.js +205 -234
  308. package/Source/Scene/VectorGltf3DTileContent.js +131 -61
  309. package/Source/Scene/VertexAttributeSemantic.js +3 -1
  310. package/Source/Scene/VerticalOrigin.js +6 -1
  311. package/Source/Scene/VoxelBoxShape.js +12 -6
  312. package/Source/Scene/VoxelContent.js +2 -0
  313. package/Source/Scene/VoxelCylinderShape.js +39 -38
  314. package/Source/Scene/VoxelEllipsoidShape.js +46 -96
  315. package/Source/Scene/VoxelMetadataOrder.js +6 -1
  316. package/Source/Scene/VoxelPrimitive.js +159 -175
  317. package/Source/Scene/VoxelProvider.js +64 -90
  318. package/Source/Scene/VoxelShapeType.js +3 -1
  319. package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
  320. package/Source/Scene/buildVoxelCustomShader.js +199 -0
  321. package/Source/Scene/decodeMVT.js +634 -0
  322. package/Source/Scene/renderBufferPointCollection.js +124 -127
  323. package/Source/Scene/renderBufferPolygonCollection.js +122 -122
  324. package/Source/Scene/renderBufferPolylineCollection.js +386 -238
  325. package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
  326. package/Source/Shaders/BufferPointMaterialFS.js +1 -0
  327. package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
  328. package/Source/Shaders/BufferPointMaterialVS.js +20 -10
  329. package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
  330. package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
  331. package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
  332. package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
  333. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
  334. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
  335. package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
  336. package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
  337. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  338. package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
  339. package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
  340. package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
  341. package/Source/Shaders/Model/ConstantLodStageFS.js +62 -0
  342. package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
  343. package/Source/Shaders/Model/ConstantLodStageVS.js +13 -0
  344. package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
  345. package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
  346. package/Source/Shaders/Model/MaterialStageFS.glsl +46 -20
  347. package/Source/Shaders/Model/MaterialStageFS.js +46 -20
  348. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +0 -1
  349. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +0 -1
  350. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +7 -9
  351. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +7 -9
  352. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +7 -17
  353. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +7 -17
  354. package/Source/Widget/CesiumWidget.js +11 -4
  355. package/index.d.ts +595 -343
  356. package/index.js +392 -378
  357. package/package.json +3 -3
  358. package/Build/Workers/chunk-DVB56LG7.js +0 -114
  359. package/Build/Workers/chunk-HKUES6UG.js +0 -2357
  360. package/Build/Workers/chunk-HRHRYFHS.js +0 -940
  361. package/Build/Workers/chunk-KLPGTXS3.js +0 -642
  362. package/Build/Workers/chunk-ZBZRTRJB.js +0 -1829
@@ -195,603 +195,627 @@ const iso8601ErrorMessage = "Invalid ISO 8601 date.";
195
195
  * part of the date in separate components. In order to be safe for arithmetic and represent
196
196
  * leap seconds, the date is always stored in the International Atomic Time standard
197
197
  * {@link TimeStandard.TAI}.
198
- * @alias JulianDate
199
- * @constructor
200
- *
201
- * @param {number} [julianDayNumber=0.0] The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly.
202
- * @param {number} [secondsOfDay=0.0] The number of seconds into the current Julian Day Number. Fractional seconds, negative seconds and seconds greater than a day will be handled correctly.
203
- * @param {TimeStandard} [timeStandard=TimeStandard.UTC] The time standard in which the first two parameters are defined.
204
198
  */
205
- function JulianDate(julianDayNumber, secondsOfDay, timeStandard) {
199
+ class JulianDate {
206
200
  /**
207
- * Gets or sets the number of whole days.
208
- * @type {number}
201
+ * @param {number} [julianDayNumber=0.0] The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly.
202
+ * @param {number} [secondsOfDay=0.0] The number of seconds into the current Julian Day Number. Fractional seconds, negative seconds and seconds greater than a day will be handled correctly.
203
+ * @param {TimeStandard} [timeStandard=TimeStandard.UTC] The time standard in which the first two parameters are defined.
209
204
  */
210
- this.dayNumber = undefined;
205
+ constructor(julianDayNumber, secondsOfDay, timeStandard) {
206
+ /**
207
+ * Gets or sets the number of whole days.
208
+ * @type {number}
209
+ */
210
+ this.dayNumber = undefined;
211
+
212
+ /**
213
+ * Gets or sets the number of seconds into the current day.
214
+ * @type {number}
215
+ */
216
+ this.secondsOfDay = undefined;
217
+
218
+ julianDayNumber = julianDayNumber ?? 0.0;
219
+ secondsOfDay = secondsOfDay ?? 0.0;
220
+ timeStandard = timeStandard ?? TimeStandard.UTC;
221
+
222
+ //If julianDayNumber is fractional, make it an integer and add the number of seconds the fraction represented.
223
+ const wholeDays = julianDayNumber | 0;
224
+ secondsOfDay =
225
+ secondsOfDay +
226
+ (julianDayNumber - wholeDays) * TimeConstants.SECONDS_PER_DAY;
227
+
228
+ setComponents(wholeDays, secondsOfDay, this);
229
+
230
+ if (timeStandard === TimeStandard.UTC) {
231
+ convertUtcToTai(this);
232
+ }
233
+ }
211
234
 
212
235
  /**
213
- * Gets or sets the number of seconds into the current day.
214
- * @type {number}
236
+ * Creates a new instance from a GregorianDate.
237
+ *
238
+ * @param {GregorianDate} date A GregorianDate.
239
+ * @param {JulianDate} [result] An existing instance to use for the result.
240
+ * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
241
+ *
242
+ * @exception {DeveloperError} date must be a valid GregorianDate.
215
243
  */
216
- this.secondsOfDay = undefined;
217
-
218
- julianDayNumber = julianDayNumber ?? 0.0;
219
- secondsOfDay = secondsOfDay ?? 0.0;
220
- timeStandard = timeStandard ?? TimeStandard.UTC;
221
-
222
- //If julianDayNumber is fractional, make it an integer and add the number of seconds the fraction represented.
223
- const wholeDays = julianDayNumber | 0;
224
- secondsOfDay =
225
- secondsOfDay +
226
- (julianDayNumber - wholeDays) * TimeConstants.SECONDS_PER_DAY;
227
-
228
- setComponents(wholeDays, secondsOfDay, this);
229
-
230
- if (timeStandard === TimeStandard.UTC) {
231
- convertUtcToTai(this);
232
- }
233
- }
244
+ static fromGregorianDate(date, result) {
245
+ //>>includeStart('debug', pragmas.debug);
246
+ if (!(date instanceof GregorianDate)) {
247
+ throw new DeveloperError("date must be a valid GregorianDate.");
248
+ }
249
+ //>>includeEnd('debug');
234
250
 
235
- /**
236
- * Creates a new instance from a GregorianDate.
237
- *
238
- * @param {GregorianDate} date A GregorianDate.
239
- * @param {JulianDate} [result] An existing instance to use for the result.
240
- * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
241
- *
242
- * @exception {DeveloperError} date must be a valid GregorianDate.
243
- */
244
- JulianDate.fromGregorianDate = function (date, result) {
245
- //>>includeStart('debug', pragmas.debug);
246
- if (!(date instanceof GregorianDate)) {
247
- throw new DeveloperError("date must be a valid GregorianDate.");
248
- }
249
- //>>includeEnd('debug');
250
-
251
- const components = computeJulianDateComponents(
252
- date.year,
253
- date.month,
254
- date.day,
255
- date.hour,
256
- date.minute,
257
- date.second,
258
- date.millisecond,
259
- );
260
- if (!defined(result)) {
261
- return new JulianDate(components[0], components[1], TimeStandard.UTC);
251
+ const components = computeJulianDateComponents(
252
+ date.year,
253
+ date.month,
254
+ date.day,
255
+ date.hour,
256
+ date.minute,
257
+ date.second,
258
+ date.millisecond,
259
+ );
260
+ if (!defined(result)) {
261
+ return new JulianDate(components[0], components[1], TimeStandard.UTC);
262
+ }
263
+ setComponents(components[0], components[1], result);
264
+ convertUtcToTai(result);
265
+ return result;
262
266
  }
263
- setComponents(components[0], components[1], result);
264
- convertUtcToTai(result);
265
- return result;
266
- };
267
267
 
268
- /**
269
- * Creates a new instance from a JavaScript Date.
270
- *
271
- * @param {Date} date A JavaScript Date.
272
- * @param {JulianDate} [result] An existing instance to use for the result.
273
- * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
274
- *
275
- * @exception {DeveloperError} date must be a valid JavaScript Date.
276
- */
277
- JulianDate.fromDate = function (date, result) {
278
- //>>includeStart('debug', pragmas.debug);
279
- if (!(date instanceof Date) || isNaN(date.getTime())) {
280
- throw new DeveloperError("date must be a valid JavaScript Date.");
281
- }
282
- //>>includeEnd('debug');
283
-
284
- const components = computeJulianDateComponents(
285
- date.getUTCFullYear(),
286
- date.getUTCMonth() + 1,
287
- date.getUTCDate(),
288
- date.getUTCHours(),
289
- date.getUTCMinutes(),
290
- date.getUTCSeconds(),
291
- date.getUTCMilliseconds(),
292
- );
293
- if (!defined(result)) {
294
- return new JulianDate(components[0], components[1], TimeStandard.UTC);
295
- }
296
- setComponents(components[0], components[1], result);
297
- convertUtcToTai(result);
298
- return result;
299
- };
268
+ /**
269
+ * Creates a new instance from a JavaScript Date.
270
+ *
271
+ * @param {Date} date A JavaScript Date.
272
+ * @param {JulianDate} [result] An existing instance to use for the result.
273
+ * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
274
+ *
275
+ * @exception {DeveloperError} date must be a valid JavaScript Date.
276
+ */
277
+ static fromDate(date, result) {
278
+ //>>includeStart('debug', pragmas.debug);
279
+ if (!(date instanceof Date) || isNaN(date.getTime())) {
280
+ throw new DeveloperError("date must be a valid JavaScript Date.");
281
+ }
282
+ //>>includeEnd('debug');
300
283
 
301
- /**
302
- * Creates a new instance from a from an {@link http://en.wikipedia.org/wiki/ISO_8601|ISO 8601} date.
303
- * This method is superior to <code>Date.parse</code> because it will handle all valid formats defined by the ISO 8601
304
- * specification, including leap seconds and sub-millisecond times, which discarded by most JavaScript implementations.
305
- *
306
- * @param {string} iso8601String An ISO 8601 date.
307
- * @param {JulianDate} [result] An existing instance to use for the result.
308
- * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
309
- *
310
- * @exception {DeveloperError} Invalid ISO 8601 date.
311
- */
312
- JulianDate.fromIso8601 = function (iso8601String, result) {
313
- //>>includeStart('debug', pragmas.debug);
314
- if (typeof iso8601String !== "string") {
315
- throw new DeveloperError(iso8601ErrorMessage);
316
- }
317
- //>>includeEnd('debug');
318
-
319
- //Comma and decimal point both indicate a fractional number according to ISO 8601,
320
- //start out by blanket replacing , with . which is the only valid such symbol in JS.
321
- iso8601String = iso8601String.replace(",", ".");
322
-
323
- //Split the string into its date and time components, denoted by a mandatory T
324
- let tokens = iso8601String.split("T");
325
- let year;
326
- let month = 1;
327
- let day = 1;
328
- let hour = 0;
329
- let minute = 0;
330
- let second = 0;
331
- let millisecond = 0;
332
-
333
- //Lacking a time is okay, but a missing date is illegal.
334
- const date = tokens[0];
335
- const time = tokens[1];
336
- let tmp;
337
- let inLeapYear;
338
- //>>includeStart('debug', pragmas.debug);
339
- if (!defined(date)) {
340
- throw new DeveloperError(iso8601ErrorMessage);
284
+ const components = computeJulianDateComponents(
285
+ date.getUTCFullYear(),
286
+ date.getUTCMonth() + 1,
287
+ date.getUTCDate(),
288
+ date.getUTCHours(),
289
+ date.getUTCMinutes(),
290
+ date.getUTCSeconds(),
291
+ date.getUTCMilliseconds(),
292
+ );
293
+ if (!defined(result)) {
294
+ return new JulianDate(components[0], components[1], TimeStandard.UTC);
295
+ }
296
+ setComponents(components[0], components[1], result);
297
+ convertUtcToTai(result);
298
+ return result;
341
299
  }
342
300
 
343
- let dashCount;
344
- //>>includeEnd('debug');
301
+ /**
302
+ * Creates a new instance from a from an {@link http://en.wikipedia.org/wiki/ISO_8601|ISO 8601} date.
303
+ * This method is superior to <code>Date.parse</code> because it will handle all valid formats defined by the ISO 8601
304
+ * specification, including leap seconds and sub-millisecond times, which discarded by most JavaScript implementations.
305
+ *
306
+ * @param {string} iso8601String An ISO 8601 date.
307
+ * @param {JulianDate} [result] An existing instance to use for the result.
308
+ * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
309
+ *
310
+ * @exception {DeveloperError} Invalid ISO 8601 date.
311
+ */
312
+ static fromIso8601(iso8601String, result) {
313
+ //>>includeStart('debug', pragmas.debug);
314
+ if (typeof iso8601String !== "string") {
315
+ throw new DeveloperError(iso8601ErrorMessage);
316
+ }
317
+ //>>includeEnd('debug');
345
318
 
346
- //First match the date against possible regular expressions.
347
- tokens = date.match(matchCalendarDate);
348
- if (tokens !== null) {
319
+ //Comma and decimal point both indicate a fractional number according to ISO 8601,
320
+ //start out by blanket replacing , with . which is the only valid such symbol in JS.
321
+ iso8601String = iso8601String.replace(",", ".");
322
+
323
+ //Split the string into its date and time components, denoted by a mandatory T
324
+ let tokens = iso8601String.split("T");
325
+ let year;
326
+ let month = 1;
327
+ let day = 1;
328
+ let hour = 0;
329
+ let minute = 0;
330
+ let second = 0;
331
+ let millisecond = 0;
332
+
333
+ //Lacking a time is okay, but a missing date is illegal.
334
+ const date = tokens[0];
335
+ const time = tokens[1];
336
+ let tmp;
337
+ let inLeapYear;
349
338
  //>>includeStart('debug', pragmas.debug);
350
- dashCount = date.split("-").length - 1;
351
- if (dashCount > 0 && dashCount !== 2) {
339
+ if (!defined(date)) {
352
340
  throw new DeveloperError(iso8601ErrorMessage);
353
341
  }
342
+
343
+ let dashCount;
354
344
  //>>includeEnd('debug');
355
- year = +tokens[1];
356
- month = +tokens[2];
357
- day = +tokens[3];
358
- } else {
359
- tokens = date.match(matchCalendarMonth);
345
+
346
+ //First match the date against possible regular expressions.
347
+ tokens = date.match(matchCalendarDate);
360
348
  if (tokens !== null) {
349
+ //>>includeStart('debug', pragmas.debug);
350
+ dashCount = date.split("-").length - 1;
351
+ if (dashCount > 0 && dashCount !== 2) {
352
+ throw new DeveloperError(iso8601ErrorMessage);
353
+ }
354
+ //>>includeEnd('debug');
361
355
  year = +tokens[1];
362
356
  month = +tokens[2];
357
+ day = +tokens[3];
363
358
  } else {
364
- tokens = date.match(matchCalendarYear);
359
+ tokens = date.match(matchCalendarMonth);
365
360
  if (tokens !== null) {
366
361
  year = +tokens[1];
362
+ month = +tokens[2];
367
363
  } else {
368
- //Not a year/month/day so it must be an ordinal date.
369
- let dayOfYear;
370
- tokens = date.match(matchOrdinalDate);
364
+ tokens = date.match(matchCalendarYear);
371
365
  if (tokens !== null) {
372
366
  year = +tokens[1];
373
- dayOfYear = +tokens[2];
374
- inLeapYear = isLeapYear(year);
375
-
376
- //This validation is only applicable for this format.
377
- //>>includeStart('debug', pragmas.debug);
378
- if (
379
- dayOfYear < 1 ||
380
- (inLeapYear && dayOfYear > 366) ||
381
- (!inLeapYear && dayOfYear > 365)
382
- ) {
383
- throw new DeveloperError(iso8601ErrorMessage);
384
- }
385
- //>>includeEnd('debug');
386
367
  } else {
387
- tokens = date.match(matchWeekDate);
368
+ //Not a year/month/day so it must be an ordinal date.
369
+ let dayOfYear;
370
+ tokens = date.match(matchOrdinalDate);
388
371
  if (tokens !== null) {
389
- //ISO week date to ordinal date from
390
- //http://en.wikipedia.org/w/index.php?title=ISO_week_date&oldid=474176775
391
372
  year = +tokens[1];
392
- const weekNumber = +tokens[2];
393
- const dayOfWeek = +tokens[3] || 0;
373
+ dayOfYear = +tokens[2];
374
+ inLeapYear = isLeapYear(year);
394
375
 
376
+ //This validation is only applicable for this format.
395
377
  //>>includeStart('debug', pragmas.debug);
396
- dashCount = date.split("-").length - 1;
397
378
  if (
398
- dashCount > 0 &&
399
- ((!defined(tokens[3]) && dashCount !== 1) ||
400
- (defined(tokens[3]) && dashCount !== 2))
379
+ dayOfYear < 1 ||
380
+ (inLeapYear && dayOfYear > 366) ||
381
+ (!inLeapYear && dayOfYear > 365)
401
382
  ) {
402
383
  throw new DeveloperError(iso8601ErrorMessage);
403
384
  }
404
385
  //>>includeEnd('debug');
405
-
406
- const january4 = new Date(Date.UTC(year, 0, 4));
407
- dayOfYear = weekNumber * 7 + dayOfWeek - january4.getUTCDay() - 3;
408
386
  } else {
409
- //None of our regular expressions succeeded in parsing the date properly.
410
- //>>includeStart('debug', pragmas.debug);
411
- throw new DeveloperError(iso8601ErrorMessage);
412
- //>>includeEnd('debug');
387
+ tokens = date.match(matchWeekDate);
388
+ if (tokens !== null) {
389
+ //ISO week date to ordinal date from
390
+ //http://en.wikipedia.org/w/index.php?title=ISO_week_date&oldid=474176775
391
+ year = +tokens[1];
392
+ const weekNumber = +tokens[2];
393
+ const dayOfWeek = +tokens[3] || 0;
394
+
395
+ //>>includeStart('debug', pragmas.debug);
396
+ dashCount = date.split("-").length - 1;
397
+ if (
398
+ dashCount > 0 &&
399
+ ((!defined(tokens[3]) && dashCount !== 1) ||
400
+ (defined(tokens[3]) && dashCount !== 2))
401
+ ) {
402
+ throw new DeveloperError(iso8601ErrorMessage);
403
+ }
404
+ //>>includeEnd('debug');
405
+
406
+ const january4 = new Date(Date.UTC(year, 0, 4));
407
+ dayOfYear = weekNumber * 7 + dayOfWeek - january4.getUTCDay() - 3;
408
+ } else {
409
+ //None of our regular expressions succeeded in parsing the date properly.
410
+ //>>includeStart('debug', pragmas.debug);
411
+ throw new DeveloperError(iso8601ErrorMessage);
412
+ //>>includeEnd('debug');
413
+ }
413
414
  }
415
+ //Split an ordinal date into month/day.
416
+ tmp = new Date(Date.UTC(year, 0, 1));
417
+ tmp.setUTCDate(dayOfYear);
418
+ month = tmp.getUTCMonth() + 1;
419
+ day = tmp.getUTCDate();
414
420
  }
415
- //Split an ordinal date into month/day.
416
- tmp = new Date(Date.UTC(year, 0, 1));
417
- tmp.setUTCDate(dayOfYear);
418
- month = tmp.getUTCMonth() + 1;
419
- day = tmp.getUTCDate();
420
421
  }
421
422
  }
422
- }
423
-
424
- //Now that we have all of the date components, validate them to make sure nothing is out of range.
425
- inLeapYear = isLeapYear(year);
426
- //>>includeStart('debug', pragmas.debug);
427
- if (
428
- month < 1 ||
429
- month > 12 ||
430
- day < 1 ||
431
- ((month !== 2 || !inLeapYear) && day > daysInMonth[month - 1]) ||
432
- (inLeapYear && month === 2 && day > daysInLeapFebruary)
433
- ) {
434
- throw new DeveloperError(iso8601ErrorMessage);
435
- }
436
- //>>includeEnd('debug');
437
423
 
438
- //Now move onto the time string, which is much simpler.
439
- //If no time is specified, it is considered the beginning of the day, UTC to match Javascript's implementation.
440
- let offsetIndex;
441
- if (defined(time)) {
442
- tokens = time.match(matchHoursMinutesSeconds);
443
- if (tokens !== null) {
444
- //>>includeStart('debug', pragmas.debug);
445
- dashCount = time.split(":").length - 1;
446
- if (dashCount > 0 && dashCount !== 2 && dashCount !== 3) {
447
- throw new DeveloperError(iso8601ErrorMessage);
448
- }
449
- //>>includeEnd('debug');
424
+ //Now that we have all of the date components, validate them to make sure nothing is out of range.
425
+ inLeapYear = isLeapYear(year);
426
+ //>>includeStart('debug', pragmas.debug);
427
+ if (
428
+ month < 1 ||
429
+ month > 12 ||
430
+ day < 1 ||
431
+ ((month !== 2 || !inLeapYear) && day > daysInMonth[month - 1]) ||
432
+ (inLeapYear && month === 2 && day > daysInLeapFebruary)
433
+ ) {
434
+ throw new DeveloperError(iso8601ErrorMessage);
435
+ }
436
+ //>>includeEnd('debug');
450
437
 
451
- hour = +tokens[1];
452
- minute = +tokens[2];
453
- second = +tokens[3];
454
- millisecond = +(tokens[4] || 0) * 1000.0;
455
- offsetIndex = 5;
456
- } else {
457
- tokens = time.match(matchHoursMinutes);
438
+ //Now move onto the time string, which is much simpler.
439
+ //If no time is specified, it is considered the beginning of the day, UTC to match Javascript's implementation.
440
+ let offsetIndex;
441
+ if (defined(time)) {
442
+ tokens = time.match(matchHoursMinutesSeconds);
458
443
  if (tokens !== null) {
459
444
  //>>includeStart('debug', pragmas.debug);
460
445
  dashCount = time.split(":").length - 1;
461
- if (dashCount > 2) {
446
+ if (dashCount > 0 && dashCount !== 2 && dashCount !== 3) {
462
447
  throw new DeveloperError(iso8601ErrorMessage);
463
448
  }
464
449
  //>>includeEnd('debug');
465
450
 
466
451
  hour = +tokens[1];
467
452
  minute = +tokens[2];
468
- second = +(tokens[3] || 0) * 60.0;
469
- offsetIndex = 4;
453
+ second = +tokens[3];
454
+ millisecond = +(tokens[4] || 0) * 1000.0;
455
+ offsetIndex = 5;
470
456
  } else {
471
- tokens = time.match(matchHours);
457
+ tokens = time.match(matchHoursMinutes);
472
458
  if (tokens !== null) {
473
- hour = +tokens[1];
474
- minute = +(tokens[2] || 0) * 60.0;
475
- offsetIndex = 3;
476
- } else {
477
459
  //>>includeStart('debug', pragmas.debug);
478
- throw new DeveloperError(iso8601ErrorMessage);
460
+ dashCount = time.split(":").length - 1;
461
+ if (dashCount > 2) {
462
+ throw new DeveloperError(iso8601ErrorMessage);
463
+ }
479
464
  //>>includeEnd('debug');
465
+
466
+ hour = +tokens[1];
467
+ minute = +tokens[2];
468
+ second = +(tokens[3] || 0) * 60.0;
469
+ offsetIndex = 4;
470
+ } else {
471
+ tokens = time.match(matchHours);
472
+ if (tokens !== null) {
473
+ hour = +tokens[1];
474
+ minute = +(tokens[2] || 0) * 60.0;
475
+ offsetIndex = 3;
476
+ } else {
477
+ //>>includeStart('debug', pragmas.debug);
478
+ throw new DeveloperError(iso8601ErrorMessage);
479
+ //>>includeEnd('debug');
480
+ }
480
481
  }
481
482
  }
482
- }
483
483
 
484
- //Validate that all values are in proper range. Minutes and hours have special cases at 60 and 24.
485
- //>>includeStart('debug', pragmas.debug);
486
- if (
487
- minute >= 60 ||
488
- second >= 61 ||
489
- hour > 24 ||
490
- (hour === 24 && (minute > 0 || second > 0 || millisecond > 0))
491
- ) {
492
- throw new DeveloperError(iso8601ErrorMessage);
484
+ //Validate that all values are in proper range. Minutes and hours have special cases at 60 and 24.
485
+ //>>includeStart('debug', pragmas.debug);
486
+ if (
487
+ minute >= 60 ||
488
+ second >= 61 ||
489
+ hour > 24 ||
490
+ (hour === 24 && (minute > 0 || second > 0 || millisecond > 0))
491
+ ) {
492
+ throw new DeveloperError(iso8601ErrorMessage);
493
+ }
494
+ //>>includeEnd('debug');
495
+
496
+ //Check the UTC offset value, if no value exists, use local time
497
+ //a Z indicates UTC, + or - are offsets.
498
+ const offset = tokens[offsetIndex];
499
+ const offsetHours = +tokens[offsetIndex + 1];
500
+ const offsetMinutes = +(tokens[offsetIndex + 2] || 0);
501
+ switch (offset) {
502
+ case "+":
503
+ hour = hour - offsetHours;
504
+ minute = minute - offsetMinutes;
505
+ break;
506
+ case "-":
507
+ hour = hour + offsetHours;
508
+ minute = minute + offsetMinutes;
509
+ break;
510
+ case "Z":
511
+ break;
512
+ default:
513
+ minute =
514
+ minute +
515
+ new Date(
516
+ Date.UTC(year, month - 1, day, hour, minute),
517
+ ).getTimezoneOffset();
518
+ break;
519
+ }
493
520
  }
494
- //>>includeEnd('debug');
495
521
 
496
- //Check the UTC offset value, if no value exists, use local time
497
- //a Z indicates UTC, + or - are offsets.
498
- const offset = tokens[offsetIndex];
499
- const offsetHours = +tokens[offsetIndex + 1];
500
- const offsetMinutes = +(tokens[offsetIndex + 2] || 0);
501
- switch (offset) {
502
- case "+":
503
- hour = hour - offsetHours;
504
- minute = minute - offsetMinutes;
505
- break;
506
- case "-":
507
- hour = hour + offsetHours;
508
- minute = minute + offsetMinutes;
509
- break;
510
- case "Z":
511
- break;
512
- default:
513
- minute =
514
- minute +
515
- new Date(
516
- Date.UTC(year, month - 1, day, hour, minute),
517
- ).getTimezoneOffset();
518
- break;
522
+ //ISO8601 denotes a leap second by any time having a seconds component of 60 seconds.
523
+ //If that's the case, we need to temporarily subtract a second in order to build a UTC date.
524
+ //Then we add it back in after converting to TAI.
525
+ const isLeapSecond = second === 60;
526
+ if (isLeapSecond) {
527
+ second--;
519
528
  }
520
- }
521
529
 
522
- //ISO8601 denotes a leap second by any time having a seconds component of 60 seconds.
523
- //If that's the case, we need to temporarily subtract a second in order to build a UTC date.
524
- //Then we add it back in after converting to TAI.
525
- const isLeapSecond = second === 60;
526
- if (isLeapSecond) {
527
- second--;
528
- }
530
+ //Even if we successfully parsed the string into its components, after applying UTC offset or
531
+ //special cases like 24:00:00 denoting midnight, we need to normalize the data appropriately.
529
532
 
530
- //Even if we successfully parsed the string into its components, after applying UTC offset or
531
- //special cases like 24:00:00 denoting midnight, we need to normalize the data appropriately.
533
+ //milliseconds can never be greater than 1000, and seconds can't be above 60, so we start with minutes
534
+ while (minute >= 60) {
535
+ minute -= 60;
536
+ hour++;
537
+ }
532
538
 
533
- //milliseconds can never be greater than 1000, and seconds can't be above 60, so we start with minutes
534
- while (minute >= 60) {
535
- minute -= 60;
536
- hour++;
537
- }
539
+ while (hour >= 24) {
540
+ hour -= 24;
541
+ day++;
542
+ }
538
543
 
539
- while (hour >= 24) {
540
- hour -= 24;
541
- day++;
542
- }
544
+ tmp =
545
+ inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
546
+ while (day > tmp) {
547
+ day -= tmp;
548
+ month++;
543
549
 
544
- tmp = inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
545
- while (day > tmp) {
546
- day -= tmp;
547
- month++;
550
+ if (month > 12) {
551
+ month -= 12;
552
+ year++;
553
+ }
548
554
 
549
- if (month > 12) {
550
- month -= 12;
551
- year++;
555
+ tmp =
556
+ inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
552
557
  }
553
558
 
554
- tmp =
555
- inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
556
- }
559
+ //If UTC offset is at the beginning/end of the day, minutes can be negative.
560
+ while (minute < 0) {
561
+ minute += 60;
562
+ hour--;
563
+ }
557
564
 
558
- //If UTC offset is at the beginning/end of the day, minutes can be negative.
559
- while (minute < 0) {
560
- minute += 60;
561
- hour--;
562
- }
565
+ while (hour < 0) {
566
+ hour += 24;
567
+ day--;
568
+ }
563
569
 
564
- while (hour < 0) {
565
- hour += 24;
566
- day--;
567
- }
570
+ while (day < 1) {
571
+ month--;
572
+ if (month < 1) {
573
+ month += 12;
574
+ year--;
575
+ }
568
576
 
569
- while (day < 1) {
570
- month--;
571
- if (month < 1) {
572
- month += 12;
573
- year--;
577
+ tmp =
578
+ inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
579
+ day += tmp;
574
580
  }
575
581
 
576
- tmp =
577
- inLeapYear && month === 2 ? daysInLeapFebruary : daysInMonth[month - 1];
578
- day += tmp;
579
- }
582
+ //Now create the JulianDate components from the Gregorian date and actually create our instance.
583
+ const components = computeJulianDateComponents(
584
+ year,
585
+ month,
586
+ day,
587
+ hour,
588
+ minute,
589
+ second,
590
+ millisecond,
591
+ );
580
592
 
581
- //Now create the JulianDate components from the Gregorian date and actually create our instance.
582
- const components = computeJulianDateComponents(
583
- year,
584
- month,
585
- day,
586
- hour,
587
- minute,
588
- second,
589
- millisecond,
590
- );
593
+ if (!defined(result)) {
594
+ result = new JulianDate(components[0], components[1], TimeStandard.UTC);
595
+ } else {
596
+ setComponents(components[0], components[1], result);
597
+ convertUtcToTai(result);
598
+ }
591
599
 
592
- if (!defined(result)) {
593
- result = new JulianDate(components[0], components[1], TimeStandard.UTC);
594
- } else {
595
- setComponents(components[0], components[1], result);
596
- convertUtcToTai(result);
600
+ //If we were on a leap second, add it back.
601
+ if (isLeapSecond) {
602
+ JulianDate.addSeconds(result, 1, result);
603
+ }
604
+
605
+ return result;
597
606
  }
598
607
 
599
- //If we were on a leap second, add it back.
600
- if (isLeapSecond) {
601
- JulianDate.addSeconds(result, 1, result);
608
+ /**
609
+ * Creates a new instance that represents the current system time.
610
+ * This is equivalent to calling <code>JulianDate.fromDate(new Date());</code>.
611
+ *
612
+ * @param {JulianDate} [result] An existing instance to use for the result.
613
+ * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
614
+ */
615
+ static now(result) {
616
+ return JulianDate.fromDate(new Date(), result);
602
617
  }
603
618
 
604
- return result;
605
- };
619
+ /**
620
+ * Creates a {@link GregorianDate} from the provided instance.
621
+ *
622
+ * @param {JulianDate} julianDate The date to be converted.
623
+ * @param {GregorianDate} [result] An existing instance to use for the result.
624
+ * @returns {GregorianDate} The modified result parameter or a new instance if none was provided.
625
+ */
626
+ static toGregorianDate(julianDate, result) {
627
+ //>>includeStart('debug', pragmas.debug);
628
+ if (!defined(julianDate)) {
629
+ throw new DeveloperError("julianDate is required.");
630
+ }
631
+ //>>includeEnd('debug');
606
632
 
607
- /**
608
- * Creates a new instance that represents the current system time.
609
- * This is equivalent to calling <code>JulianDate.fromDate(new Date());</code>.
610
- *
611
- * @param {JulianDate} [result] An existing instance to use for the result.
612
- * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
613
- */
614
- JulianDate.now = function (result) {
615
- return JulianDate.fromDate(new Date(), result);
616
- };
633
+ let isLeapSecond = false;
634
+ let thisUtc = convertTaiToUtc(julianDate, toGregorianDateScratch);
635
+ if (!defined(thisUtc)) {
636
+ //Conversion to UTC will fail if we are during a leap second.
637
+ //If that's the case, subtract a second and convert again.
638
+ //JavaScript doesn't support leap seconds, so this results in second 59 being repeated twice.
639
+ JulianDate.addSeconds(julianDate, -1, toGregorianDateScratch);
640
+ thisUtc = convertTaiToUtc(toGregorianDateScratch, toGregorianDateScratch);
641
+ isLeapSecond = true;
642
+ }
617
643
 
618
- const toGregorianDateScratch = new JulianDate(0, 0, TimeStandard.TAI);
644
+ let julianDayNumber = thisUtc.dayNumber;
645
+ const secondsOfDay = thisUtc.secondsOfDay;
619
646
 
620
- /**
621
- * Creates a {@link GregorianDate} from the provided instance.
622
- *
623
- * @param {JulianDate} julianDate The date to be converted.
624
- * @param {GregorianDate} [result] An existing instance to use for the result.
625
- * @returns {GregorianDate} The modified result parameter or a new instance if none was provided.
626
- */
627
- JulianDate.toGregorianDate = function (julianDate, result) {
628
- //>>includeStart('debug', pragmas.debug);
629
- if (!defined(julianDate)) {
630
- throw new DeveloperError("julianDate is required.");
631
- }
632
- //>>includeEnd('debug');
633
-
634
- let isLeapSecond = false;
635
- let thisUtc = convertTaiToUtc(julianDate, toGregorianDateScratch);
636
- if (!defined(thisUtc)) {
637
- //Conversion to UTC will fail if we are during a leap second.
638
- //If that's the case, subtract a second and convert again.
639
- //JavaScript doesn't support leap seconds, so this results in second 59 being repeated twice.
640
- JulianDate.addSeconds(julianDate, -1, toGregorianDateScratch);
641
- thisUtc = convertTaiToUtc(toGregorianDateScratch, toGregorianDateScratch);
642
- isLeapSecond = true;
643
- }
647
+ if (secondsOfDay >= 43200.0) {
648
+ julianDayNumber += 1;
649
+ }
644
650
 
645
- let julianDayNumber = thisUtc.dayNumber;
646
- const secondsOfDay = thisUtc.secondsOfDay;
651
+ // Algorithm from page 604 of the Explanatory Supplement to the
652
+ // Astronomical Almanac (Seidelmann 1992).
653
+ let L = (julianDayNumber + 68569) | 0;
654
+ const N = ((4 * L) / 146097) | 0;
655
+ L = (L - (((146097 * N + 3) / 4) | 0)) | 0;
656
+ const I = ((4000 * (L + 1)) / 1461001) | 0;
657
+ L = (L - (((1461 * I) / 4) | 0) + 31) | 0;
658
+ const J = ((80 * L) / 2447) | 0;
659
+ const day = (L - (((2447 * J) / 80) | 0)) | 0;
660
+ L = (J / 11) | 0;
661
+ const month = (J + 2 - 12 * L) | 0;
662
+ const year = (100 * (N - 49) + I + L) | 0;
663
+
664
+ let hour = (secondsOfDay / TimeConstants.SECONDS_PER_HOUR) | 0;
665
+ let remainingSeconds = secondsOfDay - hour * TimeConstants.SECONDS_PER_HOUR;
666
+ const minute = (remainingSeconds / TimeConstants.SECONDS_PER_MINUTE) | 0;
667
+ remainingSeconds =
668
+ remainingSeconds - minute * TimeConstants.SECONDS_PER_MINUTE;
669
+ let second = remainingSeconds | 0;
670
+ const millisecond =
671
+ (remainingSeconds - second) / TimeConstants.SECONDS_PER_MILLISECOND;
672
+
673
+ // JulianDates are noon-based
674
+ hour += 12;
675
+ if (hour > 23) {
676
+ hour -= 24;
677
+ }
647
678
 
648
- if (secondsOfDay >= 43200.0) {
649
- julianDayNumber += 1;
650
- }
679
+ //If we were on a leap second, add it back.
680
+ if (isLeapSecond) {
681
+ second += 1;
682
+ }
651
683
 
652
- // Algorithm from page 604 of the Explanatory Supplement to the
653
- // Astronomical Almanac (Seidelmann 1992).
654
- let L = (julianDayNumber + 68569) | 0;
655
- const N = ((4 * L) / 146097) | 0;
656
- L = (L - (((146097 * N + 3) / 4) | 0)) | 0;
657
- const I = ((4000 * (L + 1)) / 1461001) | 0;
658
- L = (L - (((1461 * I) / 4) | 0) + 31) | 0;
659
- const J = ((80 * L) / 2447) | 0;
660
- const day = (L - (((2447 * J) / 80) | 0)) | 0;
661
- L = (J / 11) | 0;
662
- const month = (J + 2 - 12 * L) | 0;
663
- const year = (100 * (N - 49) + I + L) | 0;
664
-
665
- let hour = (secondsOfDay / TimeConstants.SECONDS_PER_HOUR) | 0;
666
- let remainingSeconds = secondsOfDay - hour * TimeConstants.SECONDS_PER_HOUR;
667
- const minute = (remainingSeconds / TimeConstants.SECONDS_PER_MINUTE) | 0;
668
- remainingSeconds =
669
- remainingSeconds - minute * TimeConstants.SECONDS_PER_MINUTE;
670
- let second = remainingSeconds | 0;
671
- const millisecond =
672
- (remainingSeconds - second) / TimeConstants.SECONDS_PER_MILLISECOND;
684
+ if (!defined(result)) {
685
+ return new GregorianDate(
686
+ year,
687
+ month,
688
+ day,
689
+ hour,
690
+ minute,
691
+ second,
692
+ millisecond,
693
+ isLeapSecond,
694
+ );
695
+ }
673
696
 
674
- // JulianDates are noon-based
675
- hour += 12;
676
- if (hour > 23) {
677
- hour -= 24;
697
+ result.year = year;
698
+ result.month = month;
699
+ result.day = day;
700
+ result.hour = hour;
701
+ result.minute = minute;
702
+ result.second = second;
703
+ result.millisecond = millisecond;
704
+ result.isLeapSecond = isLeapSecond;
705
+ return result;
678
706
  }
679
707
 
680
- //If we were on a leap second, add it back.
681
- if (isLeapSecond) {
682
- second += 1;
683
- }
708
+ /**
709
+ * Creates a JavaScript Date from the provided instance.
710
+ * Since JavaScript dates are only accurate to the nearest millisecond and
711
+ * cannot represent a leap second, consider using {@link JulianDate.toGregorianDate} instead.
712
+ * If the provided JulianDate is during a leap second, the previous second is used.
713
+ *
714
+ * @param {JulianDate} julianDate The date to be converted.
715
+ * @returns {Date} A new instance representing the provided date.
716
+ */
717
+ static toDate(julianDate) {
718
+ //>>includeStart('debug', pragmas.debug);
719
+ if (!defined(julianDate)) {
720
+ throw new DeveloperError("julianDate is required.");
721
+ }
722
+ //>>includeEnd('debug');
684
723
 
685
- if (!defined(result)) {
686
- return new GregorianDate(
687
- year,
688
- month,
689
- day,
690
- hour,
691
- minute,
692
- second,
693
- millisecond,
694
- isLeapSecond,
724
+ const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
725
+ let second = gDate.second;
726
+ if (gDate.isLeapSecond) {
727
+ second -= 1;
728
+ }
729
+ return new Date(
730
+ Date.UTC(
731
+ gDate.year,
732
+ gDate.month - 1,
733
+ gDate.day,
734
+ gDate.hour,
735
+ gDate.minute,
736
+ second,
737
+ gDate.millisecond,
738
+ ),
695
739
  );
696
740
  }
697
741
 
698
- result.year = year;
699
- result.month = month;
700
- result.day = day;
701
- result.hour = hour;
702
- result.minute = minute;
703
- result.second = second;
704
- result.millisecond = millisecond;
705
- result.isLeapSecond = isLeapSecond;
706
- return result;
707
- };
742
+ /**
743
+ * Creates an ISO8601 representation of the provided date.
744
+ *
745
+ * @param {JulianDate} julianDate The date to be converted.
746
+ * @param {number} [precision] The number of fractional digits used to represent the seconds component. By default, the most precise representation is used.
747
+ * @returns {string} The ISO8601 representation of the provided date.
748
+ */
749
+ static toIso8601(julianDate, precision) {
750
+ //>>includeStart('debug', pragmas.debug);
751
+ if (!defined(julianDate)) {
752
+ throw new DeveloperError("julianDate is required.");
753
+ }
754
+ //>>includeEnd('debug');
708
755
 
709
- /**
710
- * Creates a JavaScript Date from the provided instance.
711
- * Since JavaScript dates are only accurate to the nearest millisecond and
712
- * cannot represent a leap second, consider using {@link JulianDate.toGregorianDate} instead.
713
- * If the provided JulianDate is during a leap second, the previous second is used.
714
- *
715
- * @param {JulianDate} julianDate The date to be converted.
716
- * @returns {Date} A new instance representing the provided date.
717
- */
718
- JulianDate.toDate = function (julianDate) {
719
- //>>includeStart('debug', pragmas.debug);
720
- if (!defined(julianDate)) {
721
- throw new DeveloperError("julianDate is required.");
722
- }
723
- //>>includeEnd('debug');
756
+ const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
757
+ let year = gDate.year;
758
+ let month = gDate.month;
759
+ let day = gDate.day;
760
+ let hour = gDate.hour;
761
+ const minute = gDate.minute;
762
+ const second = gDate.second;
763
+ const millisecond = gDate.millisecond;
764
+
765
+ // special case - Iso8601.MAXIMUM_VALUE produces a string which we can't parse unless we adjust.
766
+ // 10000-01-01T00:00:00 is the same instant as 9999-12-31T24:00:00
767
+ if (
768
+ year === 10000 &&
769
+ month === 1 &&
770
+ day === 1 &&
771
+ hour === 0 &&
772
+ minute === 0 &&
773
+ second === 0 &&
774
+ millisecond === 0
775
+ ) {
776
+ year = 9999;
777
+ month = 12;
778
+ day = 31;
779
+ hour = 24;
780
+ }
724
781
 
725
- const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
726
- let second = gDate.second;
727
- if (gDate.isLeapSecond) {
728
- second -= 1;
729
- }
730
- return new Date(
731
- Date.UTC(
732
- gDate.year,
733
- gDate.month - 1,
734
- gDate.day,
735
- gDate.hour,
736
- gDate.minute,
737
- second,
738
- gDate.millisecond,
739
- ),
740
- );
741
- };
782
+ let millisecondStr;
783
+
784
+ if (!defined(precision) && millisecond !== 0) {
785
+ // Forces milliseconds into a number with at least 3 digits.
786
+ const millisecondHundreds = millisecond * 0.01;
787
+ // Below 1e-6, toString returns scientific notation, so it should be replaced by toFixed with appropriate number of digits.
788
+ // 20 digits is a trade-off choice guided by JavaScript's Number representation accuracy (15-17 decimal digits for most numbers).
789
+ // Using toFixed(20) ensures capturing enough precision while avoiding inaccuracies due to floating-point limitations.
790
+ millisecondStr =
791
+ millisecondHundreds < 1e-6
792
+ ? millisecondHundreds.toFixed(20).replace(".", "").replace(/0+$/, "")
793
+ : millisecondHundreds.toString().replace(".", "");
794
+ return `${year.toString().padStart(4, "0")}-${month
795
+ .toString()
796
+ .padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
797
+ .toString()
798
+ .padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second
799
+ .toString()
800
+ .padStart(2, "0")}.${millisecondStr}Z`;
801
+ }
742
802
 
743
- /**
744
- * Creates an ISO8601 representation of the provided date.
745
- *
746
- * @param {JulianDate} julianDate The date to be converted.
747
- * @param {number} [precision] The number of fractional digits used to represent the seconds component. By default, the most precise representation is used.
748
- * @returns {string} The ISO8601 representation of the provided date.
749
- */
750
- JulianDate.toIso8601 = function (julianDate, precision) {
751
- //>>includeStart('debug', pragmas.debug);
752
- if (!defined(julianDate)) {
753
- throw new DeveloperError("julianDate is required.");
754
- }
755
- //>>includeEnd('debug');
756
-
757
- const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
758
- let year = gDate.year;
759
- let month = gDate.month;
760
- let day = gDate.day;
761
- let hour = gDate.hour;
762
- const minute = gDate.minute;
763
- const second = gDate.second;
764
- const millisecond = gDate.millisecond;
765
-
766
- // special case - Iso8601.MAXIMUM_VALUE produces a string which we can't parse unless we adjust.
767
- // 10000-01-01T00:00:00 is the same instant as 9999-12-31T24:00:00
768
- if (
769
- year === 10000 &&
770
- month === 1 &&
771
- day === 1 &&
772
- hour === 0 &&
773
- minute === 0 &&
774
- second === 0 &&
775
- millisecond === 0
776
- ) {
777
- year = 9999;
778
- month = 12;
779
- day = 31;
780
- hour = 24;
781
- }
803
+ //Precision is either 0 or milliseconds is 0 with undefined precision, in either case, leave off milliseconds entirely
804
+ if (!defined(precision) || precision === 0) {
805
+ return `${year.toString().padStart(4, "0")}-${month
806
+ .toString()
807
+ .padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
808
+ .toString()
809
+ .padStart(2, "0")}:${minute
810
+ .toString()
811
+ .padStart(2, "0")}:${second.toString().padStart(2, "0")}Z`;
812
+ }
782
813
 
783
- let millisecondStr;
784
-
785
- if (!defined(precision) && millisecond !== 0) {
786
- // Forces milliseconds into a number with at least 3 digits.
787
- const millisecondHundreds = millisecond * 0.01;
788
- // Below 1e-6, toString returns scientific notation, so it should be replaced by toFixed with appropriate number of digits.
789
- // 20 digits is a trade-off choice guided by JavaScript's Number representation accuracy (15-17 decimal digits for most numbers).
790
- // Using toFixed(20) ensures capturing enough precision while avoiding inaccuracies due to floating-point limitations.
791
- millisecondStr =
792
- millisecondHundreds < 1e-6
793
- ? millisecondHundreds.toFixed(20).replace(".", "").replace(/0+$/, "")
794
- : millisecondHundreds.toString().replace(".", "");
814
+ //Forces milliseconds into a number with at least 3 digits to whatever the specified precision is.
815
+ millisecondStr = (millisecond * 0.01)
816
+ .toFixed(precision)
817
+ .replace(".", "")
818
+ .slice(0, precision);
795
819
  return `${year.toString().padStart(4, "0")}-${month
796
820
  .toString()
797
821
  .padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
@@ -801,395 +825,373 @@ JulianDate.toIso8601 = function (julianDate, precision) {
801
825
  .padStart(2, "0")}.${millisecondStr}Z`;
802
826
  }
803
827
 
804
- //Precision is either 0 or milliseconds is 0 with undefined precision, in either case, leave off milliseconds entirely
805
- if (!defined(precision) || precision === 0) {
806
- return `${year.toString().padStart(4, "0")}-${month
807
- .toString()
808
- .padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
809
- .toString()
810
- .padStart(2, "0")}:${minute
811
- .toString()
812
- .padStart(2, "0")}:${second.toString().padStart(2, "0")}Z`;
828
+ /**
829
+ * Duplicates a JulianDate instance.
830
+ *
831
+ * @param {JulianDate} julianDate The date to duplicate.
832
+ * @param {JulianDate} [result] An existing instance to use for the result.
833
+ * @returns {JulianDate} The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
834
+ */
835
+ static clone(julianDate, result) {
836
+ if (!defined(julianDate)) {
837
+ return undefined;
838
+ }
839
+ if (!defined(result)) {
840
+ return new JulianDate(
841
+ julianDate.dayNumber,
842
+ julianDate.secondsOfDay,
843
+ TimeStandard.TAI,
844
+ );
845
+ }
846
+ result.dayNumber = julianDate.dayNumber;
847
+ result.secondsOfDay = julianDate.secondsOfDay;
848
+ return result;
813
849
  }
814
850
 
815
- //Forces milliseconds into a number with at least 3 digits to whatever the specified precision is.
816
- millisecondStr = (millisecond * 0.01)
817
- .toFixed(precision)
818
- .replace(".", "")
819
- .slice(0, precision);
820
- return `${year.toString().padStart(4, "0")}-${month
821
- .toString()
822
- .padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour
823
- .toString()
824
- .padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second
825
- .toString()
826
- .padStart(2, "0")}.${millisecondStr}Z`;
827
- };
851
+ /**
852
+ * Compares two instances.
853
+ *
854
+ * @param {JulianDate} left The first instance.
855
+ * @param {JulianDate} right The second instance.
856
+ * @returns {number} A negative value if left is less than right, a positive value if left is greater than right, or zero if left and right are equal.
857
+ */
858
+ static compare(left, right) {
859
+ //>>includeStart('debug', pragmas.debug);
860
+ if (!defined(left)) {
861
+ throw new DeveloperError("left is required.");
862
+ }
863
+ if (!defined(right)) {
864
+ throw new DeveloperError("right is required.");
865
+ }
866
+ //>>includeEnd('debug');
828
867
 
829
- /**
830
- * Duplicates a JulianDate instance.
831
- *
832
- * @param {JulianDate} julianDate The date to duplicate.
833
- * @param {JulianDate} [result] An existing instance to use for the result.
834
- * @returns {JulianDate} The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
835
- */
836
- JulianDate.clone = function (julianDate, result) {
837
- if (!defined(julianDate)) {
838
- return undefined;
868
+ const julianDayNumberDifference = left.dayNumber - right.dayNumber;
869
+ if (julianDayNumberDifference !== 0) {
870
+ return julianDayNumberDifference;
871
+ }
872
+ return left.secondsOfDay - right.secondsOfDay;
839
873
  }
840
- if (!defined(result)) {
841
- return new JulianDate(
842
- julianDate.dayNumber,
843
- julianDate.secondsOfDay,
844
- TimeStandard.TAI,
874
+
875
+ /**
876
+ * Compares two instances and returns <code>true</code> if they are equal, <code>false</code> otherwise.
877
+ *
878
+ * @param {JulianDate} [left] The first instance.
879
+ * @param {JulianDate} [right] The second instance.
880
+ * @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
881
+ */
882
+ static equals(left, right) {
883
+ return (
884
+ left === right ||
885
+ (defined(left) &&
886
+ defined(right) &&
887
+ left.dayNumber === right.dayNumber &&
888
+ left.secondsOfDay === right.secondsOfDay)
845
889
  );
846
890
  }
847
- result.dayNumber = julianDate.dayNumber;
848
- result.secondsOfDay = julianDate.secondsOfDay;
849
- return result;
850
- };
851
891
 
852
- /**
853
- * Compares two instances.
854
- *
855
- * @param {JulianDate} left The first instance.
856
- * @param {JulianDate} right The second instance.
857
- * @returns {number} A negative value if left is less than right, a positive value if left is greater than right, or zero if left and right are equal.
858
- */
859
- JulianDate.compare = function (left, right) {
860
- //>>includeStart('debug', pragmas.debug);
861
- if (!defined(left)) {
862
- throw new DeveloperError("left is required.");
863
- }
864
- if (!defined(right)) {
865
- throw new DeveloperError("right is required.");
892
+ /**
893
+ * Compares two instances and returns <code>true</code> if they are within <code>epsilon</code> seconds of
894
+ * each other. That is, in order for the dates to be considered equal (and for
895
+ * this function to return <code>true</code>), the absolute value of the difference between them, in
896
+ * seconds, must be less than <code>epsilon</code>.
897
+ *
898
+ * @param {JulianDate} [left] The first instance.
899
+ * @param {JulianDate} [right] The second instance.
900
+ * @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
901
+ * @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
902
+ */
903
+ static equalsEpsilon(left, right, epsilon) {
904
+ epsilon = epsilon ?? 0;
905
+
906
+ return (
907
+ left === right ||
908
+ (defined(left) &&
909
+ defined(right) &&
910
+ Math.abs(JulianDate.secondsDifference(left, right)) <= epsilon)
911
+ );
866
912
  }
867
- //>>includeEnd('debug');
868
913
 
869
- const julianDayNumberDifference = left.dayNumber - right.dayNumber;
870
- if (julianDayNumberDifference !== 0) {
871
- return julianDayNumberDifference;
914
+ /**
915
+ * Computes the total number of whole and fractional days represented by the provided instance.
916
+ *
917
+ * @param {JulianDate} julianDate The date.
918
+ * @returns {number} The Julian date as single floating point number.
919
+ */
920
+ static totalDays(julianDate) {
921
+ //>>includeStart('debug', pragmas.debug);
922
+ if (!defined(julianDate)) {
923
+ throw new DeveloperError("julianDate is required.");
924
+ }
925
+ //>>includeEnd('debug');
926
+ return (
927
+ julianDate.dayNumber +
928
+ julianDate.secondsOfDay / TimeConstants.SECONDS_PER_DAY
929
+ );
872
930
  }
873
- return left.secondsOfDay - right.secondsOfDay;
874
- };
875
-
876
- /**
877
- * Compares two instances and returns <code>true</code> if they are equal, <code>false</code> otherwise.
878
- *
879
- * @param {JulianDate} [left] The first instance.
880
- * @param {JulianDate} [right] The second instance.
881
- * @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
882
- */
883
- JulianDate.equals = function (left, right) {
884
- return (
885
- left === right ||
886
- (defined(left) &&
887
- defined(right) &&
888
- left.dayNumber === right.dayNumber &&
889
- left.secondsOfDay === right.secondsOfDay)
890
- );
891
- };
892
-
893
- /**
894
- * Compares two instances and returns <code>true</code> if they are within <code>epsilon</code> seconds of
895
- * each other. That is, in order for the dates to be considered equal (and for
896
- * this function to return <code>true</code>), the absolute value of the difference between them, in
897
- * seconds, must be less than <code>epsilon</code>.
898
- *
899
- * @param {JulianDate} [left] The first instance.
900
- * @param {JulianDate} [right] The second instance.
901
- * @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
902
- * @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
903
- */
904
- JulianDate.equalsEpsilon = function (left, right, epsilon) {
905
- epsilon = epsilon ?? 0;
906
-
907
- return (
908
- left === right ||
909
- (defined(left) &&
910
- defined(right) &&
911
- Math.abs(JulianDate.secondsDifference(left, right)) <= epsilon)
912
- );
913
- };
914
931
 
915
- /**
916
- * Computes the total number of whole and fractional days represented by the provided instance.
917
- *
918
- * @param {JulianDate} julianDate The date.
919
- * @returns {number} The Julian date as single floating point number.
920
- */
921
- JulianDate.totalDays = function (julianDate) {
922
- //>>includeStart('debug', pragmas.debug);
923
- if (!defined(julianDate)) {
924
- throw new DeveloperError("julianDate is required.");
925
- }
926
- //>>includeEnd('debug');
927
- return (
928
- julianDate.dayNumber +
929
- julianDate.secondsOfDay / TimeConstants.SECONDS_PER_DAY
930
- );
931
- };
932
+ /**
933
+ * Computes the difference in seconds between the provided instance.
934
+ *
935
+ * @param {JulianDate} left The first instance.
936
+ * @param {JulianDate} right The second instance.
937
+ * @returns {number} The difference, in seconds, when subtracting <code>right</code> from <code>left</code>.
938
+ */
939
+ static secondsDifference(left, right) {
940
+ //>>includeStart('debug', pragmas.debug);
941
+ if (!defined(left)) {
942
+ throw new DeveloperError("left is required.");
943
+ }
944
+ if (!defined(right)) {
945
+ throw new DeveloperError("right is required.");
946
+ }
947
+ //>>includeEnd('debug');
932
948
 
933
- /**
934
- * Computes the difference in seconds between the provided instance.
935
- *
936
- * @param {JulianDate} left The first instance.
937
- * @param {JulianDate} right The second instance.
938
- * @returns {number} The difference, in seconds, when subtracting <code>right</code> from <code>left</code>.
939
- */
940
- JulianDate.secondsDifference = function (left, right) {
941
- //>>includeStart('debug', pragmas.debug);
942
- if (!defined(left)) {
943
- throw new DeveloperError("left is required.");
944
- }
945
- if (!defined(right)) {
946
- throw new DeveloperError("right is required.");
949
+ const dayDifference =
950
+ (left.dayNumber - right.dayNumber) * TimeConstants.SECONDS_PER_DAY;
951
+ return dayDifference + (left.secondsOfDay - right.secondsOfDay);
947
952
  }
948
- //>>includeEnd('debug');
949
953
 
950
- const dayDifference =
951
- (left.dayNumber - right.dayNumber) * TimeConstants.SECONDS_PER_DAY;
952
- return dayDifference + (left.secondsOfDay - right.secondsOfDay);
953
- };
954
+ /**
955
+ * Computes the difference in days between the provided instance.
956
+ *
957
+ * @param {JulianDate} left The first instance.
958
+ * @param {JulianDate} right The second instance.
959
+ * @returns {number} The difference, in days, when subtracting <code>right</code> from <code>left</code>.
960
+ */
961
+ static daysDifference(left, right) {
962
+ //>>includeStart('debug', pragmas.debug);
963
+ if (!defined(left)) {
964
+ throw new DeveloperError("left is required.");
965
+ }
966
+ if (!defined(right)) {
967
+ throw new DeveloperError("right is required.");
968
+ }
969
+ //>>includeEnd('debug');
954
970
 
955
- /**
956
- * Computes the difference in days between the provided instance.
957
- *
958
- * @param {JulianDate} left The first instance.
959
- * @param {JulianDate} right The second instance.
960
- * @returns {number} The difference, in days, when subtracting <code>right</code> from <code>left</code>.
961
- */
962
- JulianDate.daysDifference = function (left, right) {
963
- //>>includeStart('debug', pragmas.debug);
964
- if (!defined(left)) {
965
- throw new DeveloperError("left is required.");
966
- }
967
- if (!defined(right)) {
968
- throw new DeveloperError("right is required.");
971
+ const dayDifference = left.dayNumber - right.dayNumber;
972
+ const secondDifference =
973
+ (left.secondsOfDay - right.secondsOfDay) / TimeConstants.SECONDS_PER_DAY;
974
+ return dayDifference + secondDifference;
969
975
  }
970
- //>>includeEnd('debug');
971
976
 
972
- const dayDifference = left.dayNumber - right.dayNumber;
973
- const secondDifference =
974
- (left.secondsOfDay - right.secondsOfDay) / TimeConstants.SECONDS_PER_DAY;
975
- return dayDifference + secondDifference;
976
- };
977
-
978
- /**
979
- * Computes the number of seconds the provided instance is ahead of UTC.
980
- *
981
- * @param {JulianDate} julianDate The date.
982
- * @returns {number} The number of seconds the provided instance is ahead of UTC
983
- */
984
- JulianDate.computeTaiMinusUtc = function (julianDate) {
985
- binarySearchScratchLeapSecond.julianDate = julianDate;
986
- const leapSeconds = JulianDate.leapSeconds;
987
- let index = binarySearch(
988
- leapSeconds,
989
- binarySearchScratchLeapSecond,
990
- compareLeapSecondDates,
991
- );
992
- if (index < 0) {
993
- index = ~index;
994
- --index;
977
+ /**
978
+ * Computes the number of seconds the provided instance is ahead of UTC.
979
+ *
980
+ * @param {JulianDate} julianDate The date.
981
+ * @returns {number} The number of seconds the provided instance is ahead of UTC
982
+ */
983
+ static computeTaiMinusUtc(julianDate) {
984
+ binarySearchScratchLeapSecond.julianDate = julianDate;
985
+ const leapSeconds = JulianDate.leapSeconds;
986
+ let index = binarySearch(
987
+ leapSeconds,
988
+ binarySearchScratchLeapSecond,
989
+ compareLeapSecondDates,
990
+ );
995
991
  if (index < 0) {
996
- index = 0;
992
+ index = ~index;
993
+ --index;
994
+ if (index < 0) {
995
+ index = 0;
996
+ }
997
997
  }
998
+ return leapSeconds[index].offset;
998
999
  }
999
- return leapSeconds[index].offset;
1000
- };
1001
1000
 
1002
- /**
1003
- * Adds the provided number of seconds to the provided date instance.
1004
- *
1005
- * @param {JulianDate} julianDate The date.
1006
- * @param {number} seconds The number of seconds to add or subtract.
1007
- * @param {JulianDate} result An existing instance to use for the result.
1008
- * @returns {JulianDate} The modified result parameter.
1009
- */
1010
- JulianDate.addSeconds = function (julianDate, seconds, result) {
1011
- //>>includeStart('debug', pragmas.debug);
1012
- if (!defined(julianDate)) {
1013
- throw new DeveloperError("julianDate is required.");
1014
- }
1015
- if (!defined(seconds)) {
1016
- throw new DeveloperError("seconds is required.");
1017
- }
1018
- if (!defined(result)) {
1019
- throw new DeveloperError("result is required.");
1001
+ /**
1002
+ * Adds the provided number of seconds to the provided date instance.
1003
+ *
1004
+ * @param {JulianDate} julianDate The date.
1005
+ * @param {number} seconds The number of seconds to add or subtract.
1006
+ * @param {JulianDate} result An existing instance to use for the result.
1007
+ * @returns {JulianDate} The modified result parameter.
1008
+ */
1009
+ static addSeconds(julianDate, seconds, result) {
1010
+ //>>includeStart('debug', pragmas.debug);
1011
+ if (!defined(julianDate)) {
1012
+ throw new DeveloperError("julianDate is required.");
1013
+ }
1014
+ if (!defined(seconds)) {
1015
+ throw new DeveloperError("seconds is required.");
1016
+ }
1017
+ if (!defined(result)) {
1018
+ throw new DeveloperError("result is required.");
1019
+ }
1020
+ //>>includeEnd('debug');
1021
+
1022
+ return setComponents(
1023
+ julianDate.dayNumber,
1024
+ julianDate.secondsOfDay + seconds,
1025
+ result,
1026
+ );
1020
1027
  }
1021
- //>>includeEnd('debug');
1022
1028
 
1023
- return setComponents(
1024
- julianDate.dayNumber,
1025
- julianDate.secondsOfDay + seconds,
1026
- result,
1027
- );
1028
- };
1029
+ /**
1030
+ * Adds the provided number of minutes to the provided date instance.
1031
+ *
1032
+ * @param {JulianDate} julianDate The date.
1033
+ * @param {number} minutes The number of minutes to add or subtract.
1034
+ * @param {JulianDate} result An existing instance to use for the result.
1035
+ * @returns {JulianDate} The modified result parameter.
1036
+ */
1037
+ static addMinutes(julianDate, minutes, result) {
1038
+ //>>includeStart('debug', pragmas.debug);
1039
+ if (!defined(julianDate)) {
1040
+ throw new DeveloperError("julianDate is required.");
1041
+ }
1042
+ if (!defined(minutes)) {
1043
+ throw new DeveloperError("minutes is required.");
1044
+ }
1045
+ if (!defined(result)) {
1046
+ throw new DeveloperError("result is required.");
1047
+ }
1048
+ //>>includeEnd('debug');
1029
1049
 
1030
- /**
1031
- * Adds the provided number of minutes to the provided date instance.
1032
- *
1033
- * @param {JulianDate} julianDate The date.
1034
- * @param {number} minutes The number of minutes to add or subtract.
1035
- * @param {JulianDate} result An existing instance to use for the result.
1036
- * @returns {JulianDate} The modified result parameter.
1037
- */
1038
- JulianDate.addMinutes = function (julianDate, minutes, result) {
1039
- //>>includeStart('debug', pragmas.debug);
1040
- if (!defined(julianDate)) {
1041
- throw new DeveloperError("julianDate is required.");
1042
- }
1043
- if (!defined(minutes)) {
1044
- throw new DeveloperError("minutes is required.");
1050
+ const newSecondsOfDay =
1051
+ julianDate.secondsOfDay + minutes * TimeConstants.SECONDS_PER_MINUTE;
1052
+ return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
1045
1053
  }
1046
- if (!defined(result)) {
1047
- throw new DeveloperError("result is required.");
1048
- }
1049
- //>>includeEnd('debug');
1050
1054
 
1051
- const newSecondsOfDay =
1052
- julianDate.secondsOfDay + minutes * TimeConstants.SECONDS_PER_MINUTE;
1053
- return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
1054
- };
1055
+ /**
1056
+ * Adds the provided number of hours to the provided date instance.
1057
+ *
1058
+ * @param {JulianDate} julianDate The date.
1059
+ * @param {number} hours The number of hours to add or subtract.
1060
+ * @param {JulianDate} result An existing instance to use for the result.
1061
+ * @returns {JulianDate} The modified result parameter.
1062
+ */
1063
+ static addHours(julianDate, hours, result) {
1064
+ //>>includeStart('debug', pragmas.debug);
1065
+ if (!defined(julianDate)) {
1066
+ throw new DeveloperError("julianDate is required.");
1067
+ }
1068
+ if (!defined(hours)) {
1069
+ throw new DeveloperError("hours is required.");
1070
+ }
1071
+ if (!defined(result)) {
1072
+ throw new DeveloperError("result is required.");
1073
+ }
1074
+ //>>includeEnd('debug');
1055
1075
 
1056
- /**
1057
- * Adds the provided number of hours to the provided date instance.
1058
- *
1059
- * @param {JulianDate} julianDate The date.
1060
- * @param {number} hours The number of hours to add or subtract.
1061
- * @param {JulianDate} result An existing instance to use for the result.
1062
- * @returns {JulianDate} The modified result parameter.
1063
- */
1064
- JulianDate.addHours = function (julianDate, hours, result) {
1065
- //>>includeStart('debug', pragmas.debug);
1066
- if (!defined(julianDate)) {
1067
- throw new DeveloperError("julianDate is required.");
1068
- }
1069
- if (!defined(hours)) {
1070
- throw new DeveloperError("hours is required.");
1071
- }
1072
- if (!defined(result)) {
1073
- throw new DeveloperError("result is required.");
1076
+ const newSecondsOfDay =
1077
+ julianDate.secondsOfDay + hours * TimeConstants.SECONDS_PER_HOUR;
1078
+ return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
1074
1079
  }
1075
- //>>includeEnd('debug');
1076
1080
 
1077
- const newSecondsOfDay =
1078
- julianDate.secondsOfDay + hours * TimeConstants.SECONDS_PER_HOUR;
1079
- return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
1080
- };
1081
+ /**
1082
+ * Adds the provided number of days to the provided date instance.
1083
+ *
1084
+ * @param {JulianDate} julianDate The date.
1085
+ * @param {number} days The number of days to add or subtract.
1086
+ * @param {JulianDate} result An existing instance to use for the result.
1087
+ * @returns {JulianDate} The modified result parameter.
1088
+ */
1089
+ static addDays(julianDate, days, result) {
1090
+ //>>includeStart('debug', pragmas.debug);
1091
+ if (!defined(julianDate)) {
1092
+ throw new DeveloperError("julianDate is required.");
1093
+ }
1094
+ if (!defined(days)) {
1095
+ throw new DeveloperError("days is required.");
1096
+ }
1097
+ if (!defined(result)) {
1098
+ throw new DeveloperError("result is required.");
1099
+ }
1100
+ //>>includeEnd('debug');
1081
1101
 
1082
- /**
1083
- * Adds the provided number of days to the provided date instance.
1084
- *
1085
- * @param {JulianDate} julianDate The date.
1086
- * @param {number} days The number of days to add or subtract.
1087
- * @param {JulianDate} result An existing instance to use for the result.
1088
- * @returns {JulianDate} The modified result parameter.
1089
- */
1090
- JulianDate.addDays = function (julianDate, days, result) {
1091
- //>>includeStart('debug', pragmas.debug);
1092
- if (!defined(julianDate)) {
1093
- throw new DeveloperError("julianDate is required.");
1094
- }
1095
- if (!defined(days)) {
1096
- throw new DeveloperError("days is required.");
1097
- }
1098
- if (!defined(result)) {
1099
- throw new DeveloperError("result is required.");
1102
+ const newJulianDayNumber = julianDate.dayNumber + days;
1103
+ return setComponents(newJulianDayNumber, julianDate.secondsOfDay, result);
1100
1104
  }
1101
- //>>includeEnd('debug');
1102
1105
 
1103
- const newJulianDayNumber = julianDate.dayNumber + days;
1104
- return setComponents(newJulianDayNumber, julianDate.secondsOfDay, result);
1105
- };
1106
+ /**
1107
+ * Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
1108
+ *
1109
+ * @param {JulianDate} left The first instance.
1110
+ * @param {JulianDate} right The second instance.
1111
+ * @returns {boolean} <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
1112
+ */
1113
+ static lessThan(left, right) {
1114
+ return JulianDate.compare(left, right) < 0;
1115
+ }
1106
1116
 
1107
- /**
1108
- * Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
1109
- *
1110
- * @param {JulianDate} left The first instance.
1111
- * @param {JulianDate} right The second instance.
1112
- * @returns {boolean} <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.
1113
- */
1114
- JulianDate.lessThan = function (left, right) {
1115
- return JulianDate.compare(left, right) < 0;
1116
- };
1117
+ /**
1118
+ * Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
1119
+ *
1120
+ * @param {JulianDate} left The first instance.
1121
+ * @param {JulianDate} right The second instance.
1122
+ * @returns {boolean} <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
1123
+ */
1124
+ static lessThanOrEquals(left, right) {
1125
+ return JulianDate.compare(left, right) <= 0;
1126
+ }
1117
1127
 
1118
- /**
1119
- * Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
1120
- *
1121
- * @param {JulianDate} left The first instance.
1122
- * @param {JulianDate} right The second instance.
1123
- * @returns {boolean} <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.
1124
- */
1125
- JulianDate.lessThanOrEquals = function (left, right) {
1126
- return JulianDate.compare(left, right) <= 0;
1127
- };
1128
+ /**
1129
+ * Compares the provided instances and returns <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
1130
+ *
1131
+ * @param {JulianDate} left The first instance.
1132
+ * @param {JulianDate} right The second instance.
1133
+ * @returns {boolean} <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
1134
+ */
1135
+ static greaterThan(left, right) {
1136
+ return JulianDate.compare(left, right) > 0;
1137
+ }
1128
1138
 
1129
- /**
1130
- * Compares the provided instances and returns <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
1131
- *
1132
- * @param {JulianDate} left The first instance.
1133
- * @param {JulianDate} right The second instance.
1134
- * @returns {boolean} <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.
1135
- */
1136
- JulianDate.greaterThan = function (left, right) {
1137
- return JulianDate.compare(left, right) > 0;
1138
- };
1139
+ /**
1140
+ * Compares the provided instances and returns <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
1141
+ *
1142
+ * @param {JulianDate} left The first instance.
1143
+ * @param {JulianDate} right The second instance.
1144
+ * @returns {boolean} <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
1145
+ */
1146
+ static greaterThanOrEquals(left, right) {
1147
+ return JulianDate.compare(left, right) >= 0;
1148
+ }
1139
1149
 
1140
- /**
1141
- * Compares the provided instances and returns <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
1142
- *
1143
- * @param {JulianDate} left The first instance.
1144
- * @param {JulianDate} right The second instance.
1145
- * @returns {boolean} <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.
1146
- */
1147
- JulianDate.greaterThanOrEquals = function (left, right) {
1148
- return JulianDate.compare(left, right) >= 0;
1149
- };
1150
+ /**
1151
+ * Duplicates this instance.
1152
+ *
1153
+ * @param {JulianDate} [result] An existing instance to use for the result.
1154
+ * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
1155
+ */
1156
+ clone(result) {
1157
+ return JulianDate.clone(this, result);
1158
+ }
1150
1159
 
1151
- /**
1152
- * Duplicates this instance.
1153
- *
1154
- * @param {JulianDate} [result] An existing instance to use for the result.
1155
- * @returns {JulianDate} The modified result parameter or a new instance if none was provided.
1156
- */
1157
- JulianDate.prototype.clone = function (result) {
1158
- return JulianDate.clone(this, result);
1159
- };
1160
+ /**
1161
+ * Compares this and the provided instance and returns <code>true</code> if they are equal, <code>false</code> otherwise.
1162
+ *
1163
+ * @param {JulianDate} [right] The second instance.
1164
+ * @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
1165
+ */
1166
+ equals(right) {
1167
+ return JulianDate.equals(this, right);
1168
+ }
1160
1169
 
1161
- /**
1162
- * Compares this and the provided instance and returns <code>true</code> if they are equal, <code>false</code> otherwise.
1163
- *
1164
- * @param {JulianDate} [right] The second instance.
1165
- * @returns {boolean} <code>true</code> if the dates are equal; otherwise, <code>false</code>.
1166
- */
1167
- JulianDate.prototype.equals = function (right) {
1168
- return JulianDate.equals(this, right);
1169
- };
1170
+ /**
1171
+ * Compares this and the provided instance and returns <code>true</code> if they are within <code>epsilon</code> seconds of
1172
+ * each other. That is, in order for the dates to be considered equal (and for
1173
+ * this function to return <code>true</code>), the absolute value of the difference between them, in
1174
+ * seconds, must be less than <code>epsilon</code>.
1175
+ *
1176
+ * @param {JulianDate} [right] The second instance.
1177
+ * @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
1178
+ * @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
1179
+ */
1180
+ equalsEpsilon(right, epsilon) {
1181
+ return JulianDate.equalsEpsilon(this, right, epsilon);
1182
+ }
1170
1183
 
1171
- /**
1172
- * Compares this and the provided instance and returns <code>true</code> if they are within <code>epsilon</code> seconds of
1173
- * each other. That is, in order for the dates to be considered equal (and for
1174
- * this function to return <code>true</code>), the absolute value of the difference between them, in
1175
- * seconds, must be less than <code>epsilon</code>.
1176
- *
1177
- * @param {JulianDate} [right] The second instance.
1178
- * @param {number} [epsilon=0] The maximum number of seconds that should separate the two instances.
1179
- * @returns {boolean} <code>true</code> if the two dates are within <code>epsilon</code> seconds of each other; otherwise <code>false</code>.
1180
- */
1181
- JulianDate.prototype.equalsEpsilon = function (right, epsilon) {
1182
- return JulianDate.equalsEpsilon(this, right, epsilon);
1183
- };
1184
+ /**
1185
+ * Creates a string representing this date in ISO8601 format.
1186
+ *
1187
+ * @returns {string} A string representing this date in ISO8601 format.
1188
+ */
1189
+ toString() {
1190
+ return JulianDate.toIso8601(this);
1191
+ }
1192
+ }
1184
1193
 
1185
- /**
1186
- * Creates a string representing this date in ISO8601 format.
1187
- *
1188
- * @returns {string} A string representing this date in ISO8601 format.
1189
- */
1190
- JulianDate.prototype.toString = function () {
1191
- return JulianDate.toIso8601(this);
1192
- };
1194
+ const toGregorianDateScratch = new JulianDate(0, 0, TimeStandard.TAI);
1193
1195
 
1194
1196
  /**
1195
1197
  * Gets or sets the list of leap seconds used throughout Cesium.