@cesium/engine 6.1.1 → 7.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 (229) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
  2. package/Build/Workers/{chunk-FRG2Z7DE.js → chunk-2HJWSU7B.js} +4 -4
  3. package/Build/Workers/{chunk-ZTYE74E2.js → chunk-46UD5ABS.js} +4 -4
  4. package/Build/Workers/{chunk-VODWDCX6.js → chunk-4EBHOMFX.js} +18 -20
  5. package/Build/Workers/{chunk-N7TYCDTR.js → chunk-5HDYHG3F.js} +13 -13
  6. package/Build/Workers/{chunk-C53JYYKX.js → chunk-5M3U6ZMA.js} +1 -1
  7. package/Build/Workers/{chunk-GTEXWEAP.js → chunk-5WQ523AW.js} +5 -5
  8. package/Build/Workers/{chunk-SEFDWMCW.js → chunk-5YLJ77FF.js} +31 -21
  9. package/Build/Workers/{chunk-VNRUVNIK.js → chunk-6HZQPRUS.js} +1 -1
  10. package/Build/Workers/{chunk-PB7BIXHI.js → chunk-6VJVYK2V.js} +2 -2
  11. package/Build/Workers/{chunk-PHQVHDVI.js → chunk-72SANQJV.js} +325 -5
  12. package/Build/Workers/{chunk-D325WRAY.js → chunk-7XEAYGZK.js} +35 -11
  13. package/Build/Workers/{chunk-FGUP2QEP.js → chunk-AIPU2VSX.js} +6 -6
  14. package/Build/Workers/{chunk-QUXSQQEF.js → chunk-AR5DNBJ4.js} +6 -6
  15. package/Build/Workers/{chunk-ZVUAJKAL.js → chunk-BZP4T2JJ.js} +11 -13
  16. package/Build/Workers/{chunk-K6Q5IRBK.js → chunk-DTAIXKTO.js} +6 -6
  17. package/Build/Workers/{chunk-D4YHO4NZ.js → chunk-F6SE42BK.js} +133 -101
  18. package/Build/Workers/{chunk-QY2WY5XJ.js → chunk-FP6GYBFX.js} +11 -11
  19. package/Build/Workers/{chunk-Z6LPXA7S.js → chunk-GEJTYLCO.js} +5 -5
  20. package/Build/Workers/{chunk-VKTKOIYG.js → chunk-GV56Q4LU.js} +11 -11
  21. package/Build/Workers/{chunk-KUB2HQXR.js → chunk-IQBYFRVW.js} +8 -8
  22. package/Build/Workers/{chunk-235MRXLH.js → chunk-IX2JCCNM.js} +1 -1
  23. package/Build/Workers/{chunk-3FCUUN6M.js → chunk-JCNXK6EL.js} +11 -11
  24. package/Build/Workers/{chunk-364TQORK.js → chunk-JJ4VBOQ3.js} +5 -7
  25. package/Build/Workers/{chunk-66CXKODF.js → chunk-JXDC723O.js} +2 -2
  26. package/Build/Workers/{chunk-OTBRPBCC.js → chunk-JY5YEZFA.js} +9 -9
  27. package/Build/Workers/{chunk-LSGUCCKJ.js → chunk-L2ZN645J.js} +6 -6
  28. package/Build/Workers/{chunk-VLDDXYKI.js → chunk-LZ7JIV3K.js} +18 -18
  29. package/Build/Workers/{chunk-36ESDRIZ.js → chunk-LZGHD6NY.js} +16 -16
  30. package/Build/Workers/{chunk-PXLFBN2Q.js → chunk-MY3VNFGQ.js} +7 -7
  31. package/Build/Workers/{chunk-W7F5VTH6.js → chunk-NKPBIX7F.js} +1 -1
  32. package/Build/Workers/{chunk-XBZSOW3F.js → chunk-NY3K4IM3.js} +12 -12
  33. package/Build/Workers/{chunk-AI3KSNM6.js → chunk-ODW7WYM4.js} +2 -2
  34. package/Build/Workers/{chunk-6PWSSCRA.js → chunk-OVLG3FRS.js} +6 -6
  35. package/Build/Workers/{chunk-MOLGJDJV.js → chunk-PNBGBETF.js} +11 -11
  36. package/Build/Workers/{chunk-T73B27DG.js → chunk-PTQQUQC3.js} +13 -13
  37. package/Build/Workers/{chunk-RSWBNJPT.js → chunk-QZAD5O7I.js} +8 -304
  38. package/Build/Workers/{chunk-I6TVJ6T7.js → chunk-R5X4OQT4.js} +8 -8
  39. package/Build/Workers/{chunk-DTNN3ODA.js → chunk-RAEV7K66.js} +5 -5
  40. package/Build/Workers/{chunk-IZED7ODV.js → chunk-RV7ZYPFT.js} +4 -4
  41. package/Build/Workers/{chunk-7FEGZO3D.js → chunk-S4MAZ3SS.js} +2 -2
  42. package/Build/Workers/{chunk-J3U6Z5YQ.js → chunk-S6SKF6DT.js} +5 -5
  43. package/Build/Workers/{chunk-CHDJ66UM.js → chunk-U2VCRRQW.js} +6 -6
  44. package/Build/Workers/{chunk-R22RQAAM.js → chunk-UAEW6HKG.js} +13 -13
  45. package/Build/Workers/{chunk-S7IBK36I.js → chunk-UDO6BFSF.js} +14 -16
  46. package/Build/Workers/{chunk-YS4KPNLC.js → chunk-UGK3FCDY.js} +1 -1
  47. package/Build/Workers/{chunk-SJDXMQSP.js → chunk-VK3EJHWI.js} +2 -2
  48. package/Build/Workers/{chunk-HEROVJML.js → chunk-VRGFV2UO.js} +7 -7
  49. package/Build/Workers/{chunk-VOAZN4IP.js → chunk-WBQCVXR3.js} +4 -4
  50. package/Build/Workers/{chunk-HSW63JN4.js → chunk-WZU2YLWG.js} +3 -3
  51. package/Build/Workers/{chunk-4EYB62WJ.js → chunk-XWXM2O2R.js} +6 -6
  52. package/Build/Workers/{chunk-ZGMOBRTG.js → chunk-YUCVWAY6.js} +7 -7
  53. package/Build/Workers/{chunk-CLVEIRXT.js → chunk-ZK5JOS3D.js} +15 -17
  54. package/Build/Workers/{chunk-5NZTU5YL.js → chunk-ZUA2UUNV.js} +2 -2
  55. package/Build/Workers/combineGeometry.js +23 -23
  56. package/Build/Workers/createBoxGeometry.js +17 -17
  57. package/Build/Workers/createBoxOutlineGeometry.js +15 -15
  58. package/Build/Workers/createCircleGeometry.js +25 -25
  59. package/Build/Workers/createCircleOutlineGeometry.js +18 -18
  60. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
  61. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +30 -30
  62. package/Build/Workers/createCorridorGeometry.js +28 -29
  63. package/Build/Workers/createCorridorOutlineGeometry.js +27 -28
  64. package/Build/Workers/createCylinderGeometry.js +19 -19
  65. package/Build/Workers/createCylinderOutlineGeometry.js +18 -19
  66. package/Build/Workers/createEllipseGeometry.js +25 -25
  67. package/Build/Workers/createEllipseOutlineGeometry.js +18 -18
  68. package/Build/Workers/createEllipsoidGeometry.js +18 -18
  69. package/Build/Workers/createEllipsoidOutlineGeometry.js +17 -17
  70. package/Build/Workers/createFrustumGeometry.js +17 -17
  71. package/Build/Workers/createFrustumOutlineGeometry.js +17 -17
  72. package/Build/Workers/createGeometry.js +23 -23
  73. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  74. package/Build/Workers/createPlaneGeometry.js +15 -15
  75. package/Build/Workers/createPlaneOutlineGeometry.js +14 -14
  76. package/Build/Workers/createPolygonGeometry.js +32 -167
  77. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  78. package/Build/Workers/createPolylineGeometry.js +24 -24
  79. package/Build/Workers/createPolylineVolumeGeometry.js +32 -35
  80. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -29
  81. package/Build/Workers/createRectangleGeometry.js +27 -27
  82. package/Build/Workers/createRectangleOutlineGeometry.js +21 -23
  83. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  84. package/Build/Workers/createSphereGeometry.js +18 -18
  85. package/Build/Workers/createSphereOutlineGeometry.js +17 -17
  86. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  87. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  88. package/Build/Workers/createVectorTileGeometries.js +23 -23
  89. package/Build/Workers/createVectorTilePoints.js +12 -12
  90. package/Build/Workers/createVectorTilePolygons.js +21 -21
  91. package/Build/Workers/createVectorTilePolylines.js +14 -14
  92. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  93. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  94. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -19
  95. package/Build/Workers/createWallGeometry.js +23 -23
  96. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  97. package/Build/Workers/decodeDraco.js +11 -11
  98. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  99. package/Build/Workers/decodeI3S.js +9 -9
  100. package/Build/Workers/transcodeKTX2.js +7 -7
  101. package/Build/Workers/transferTypedArrayTest.js +1 -1
  102. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  103. package/LICENSE.md +1 -1
  104. package/Source/Assets/approximateTerrainHeights.json +1 -1
  105. package/Source/Core/Ellipsoid.js +45 -0
  106. package/Source/Core/GregorianDate.js +85 -0
  107. package/Source/Core/HeadingPitchRange.js +2 -2
  108. package/Source/Core/Ion.js +1 -1
  109. package/Source/Core/PolygonGeometry.js +0 -169
  110. package/Source/Core/Quaternion.js +6 -2
  111. package/Source/Core/RectangleOutlineGeometry.js +2 -4
  112. package/Source/Core/RequestScheduler.js +3 -9
  113. package/Source/Core/Resource.js +30 -69
  114. package/Source/Core/TerrainEncoding.js +2 -2
  115. package/Source/Core/Transforms.js +27 -18
  116. package/Source/Core/VerticalExaggeration.js +69 -0
  117. package/Source/Core/createWorldBathymetryAsync.js +45 -0
  118. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
  119. package/Source/DataSources/Entity.js +8 -5
  120. package/Source/DataSources/EntityCollection.js +1 -2
  121. package/Source/DataSources/GeometryUpdater.js +1 -2
  122. package/Source/DataSources/GroundGeometryUpdater.js +6 -3
  123. package/Source/DataSources/ModelVisualizer.js +19 -98
  124. package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
  125. package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
  126. package/Source/DataSources/TerrainOffsetProperty.js +15 -23
  127. package/Source/Renderer/AutomaticUniforms.js +173 -0
  128. package/Source/Renderer/UniformState.js +246 -1
  129. package/Source/Scene/ArcGisMapService.js +1 -1
  130. package/Source/Scene/Atmosphere.js +127 -0
  131. package/Source/Scene/Billboard.js +29 -26
  132. package/Source/Scene/BillboardCollection.js +3 -3
  133. package/Source/Scene/Camera.js +1 -1
  134. package/Source/Scene/Cesium3DTile.js +123 -10
  135. package/Source/Scene/Cesium3DTileContent.js +14 -0
  136. package/Source/Scene/Cesium3DTileset.js +326 -45
  137. package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
  138. package/Source/Scene/Composite3DTileContent.js +42 -0
  139. package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
  140. package/Source/Scene/Empty3DTileContent.js +4 -0
  141. package/Source/Scene/Fog.js +1 -0
  142. package/Source/Scene/FrameState.js +13 -5
  143. package/Source/Scene/Geometry3DTileContent.js +4 -0
  144. package/Source/Scene/Globe.js +69 -21
  145. package/Source/Scene/GlobeSurfaceTile.js +4 -4
  146. package/Source/Scene/GlobeSurfaceTileProvider.js +24 -22
  147. package/Source/Scene/GltfLoader.js +15 -5
  148. package/Source/Scene/GroundPrimitive.js +5 -5
  149. package/Source/Scene/HeightReference.js +59 -2
  150. package/Source/Scene/ImageryLayer.js +3 -3
  151. package/Source/Scene/Implicit3DTileContent.js +4 -0
  152. package/Source/Scene/LabelCollection.js +2 -2
  153. package/Source/Scene/MapboxImageryProvider.js +2 -2
  154. package/Source/Scene/Megatexture.js +1 -1
  155. package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
  156. package/Source/Scene/Model/B3dmLoader.js +4 -0
  157. package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
  158. package/Source/Scene/Model/I3dmLoader.js +4 -0
  159. package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
  160. package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
  161. package/Source/Scene/Model/Model.js +93 -32
  162. package/Source/Scene/Model/Model3DTileContent.js +31 -0
  163. package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
  164. package/Source/Scene/Model/ModelRuntimePrimitive.js +6 -0
  165. package/Source/Scene/Model/ModelSceneGraph.js +6 -0
  166. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +60 -0
  167. package/Source/Scene/Model/pickModel.js +408 -0
  168. package/Source/Scene/Multiple3DTileContent.js +42 -0
  169. package/Source/Scene/QuadtreePrimitive.js +1 -1
  170. package/Source/Scene/Scene.js +226 -19
  171. package/Source/Scene/ScreenSpaceCameraController.js +14 -25
  172. package/Source/Scene/SkyAtmosphere.js +5 -6
  173. package/Source/Scene/Terrain.js +49 -0
  174. package/Source/Scene/TerrainFillMesh.js +2 -2
  175. package/Source/Scene/TileBoundingS2Cell.js +2 -2
  176. package/Source/Scene/TileOrientedBoundingBox.js +1 -1
  177. package/Source/Scene/Tileset3DTileContent.js +4 -0
  178. package/Source/Scene/Vector3DTileContent.js +4 -0
  179. package/Source/Scene/VoxelPrimitive.js +73 -2
  180. package/Source/Shaders/AtmosphereCommon.glsl +3 -11
  181. package/Source/Shaders/AtmosphereCommon.js +3 -11
  182. package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
  183. package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
  184. package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
  185. package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
  186. package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
  187. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
  188. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
  189. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
  190. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
  191. package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
  192. package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
  193. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
  194. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
  195. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
  196. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
  197. package/Source/Shaders/GlobeFS.glsl +16 -25
  198. package/Source/Shaders/GlobeFS.js +16 -25
  199. package/Source/Shaders/GlobeVS.glsl +4 -4
  200. package/Source/Shaders/GlobeVS.js +4 -4
  201. package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
  202. package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
  203. package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
  204. package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
  205. package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
  206. package/Source/Shaders/Model/GeometryStageFS.js +1 -1
  207. package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
  208. package/Source/Shaders/Model/GeometryStageVS.js +4 -4
  209. package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
  210. package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
  211. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  212. package/Source/Shaders/Model/ModelFS.js +4 -0
  213. package/Source/Shaders/Model/ModelVS.glsl +13 -4
  214. package/Source/Shaders/Model/ModelVS.js +13 -4
  215. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +39 -0
  216. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +41 -0
  217. package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
  218. package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
  219. package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
  220. package/Source/Shaders/SkyAtmosphereFS.js +5 -10
  221. package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
  222. package/Source/Shaders/SkyAtmosphereVS.js +3 -2
  223. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  224. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  225. package/index.d.ts +318 -83
  226. package/index.js +77 -62
  227. package/package.json +3 -3
  228. package/Build/Workers/chunk-7ONRI7T4.js +0 -55
  229. package/Source/Core/TerrainExaggeration.js +0 -49
@@ -1,3 +1,4 @@
1
+ import Cartesian2 from "./Cartesian2.js";
1
2
  import Cartesian3 from "./Cartesian3.js";
2
3
  import Cartographic from "./Cartographic.js";
3
4
  import Check from "./Check.js";
@@ -694,6 +695,50 @@ Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function (
694
695
  return result;
695
696
  };
696
697
 
698
+ const scratchEndpoint = new Cartesian3();
699
+
700
+ /**
701
+ * Computes the ellipsoid curvatures at a given position on the surface.
702
+ *
703
+ * @param {Cartesian3} surfacePosition The position on the ellipsoid surface where curvatures will be calculated.
704
+ * @param {Cartesian2} [result] The cartesian to which to copy the result, or undefined to create and return a new instance.
705
+ * @returns {Cartesian2} The local curvature of the ellipsoid surface at the provided position, in east and north directions.
706
+ *
707
+ * @exception {DeveloperError} position is required.
708
+ */
709
+ Ellipsoid.prototype.getLocalCurvature = function (surfacePosition, result) {
710
+ //>>includeStart('debug', pragmas.debug);
711
+ Check.typeOf.object("surfacePosition", surfacePosition);
712
+ //>>includeEnd('debug');
713
+
714
+ if (!defined(result)) {
715
+ result = new Cartesian2();
716
+ }
717
+
718
+ const primeVerticalEndpoint = this.getSurfaceNormalIntersectionWithZAxis(
719
+ surfacePosition,
720
+ 0.0,
721
+ scratchEndpoint
722
+ );
723
+ const primeVerticalRadius = Cartesian3.distance(
724
+ surfacePosition,
725
+ primeVerticalEndpoint
726
+ );
727
+ // meridional radius = (1 - e^2) * primeVerticalRadius^3 / a^2
728
+ // where 1 - e^2 = b^2 / a^2,
729
+ // so meridional = b^2 * primeVerticalRadius^3 / a^4
730
+ // = (b * primeVerticalRadius / a^2)^2 * primeVertical
731
+ const radiusRatio =
732
+ (this.minimumRadius * primeVerticalRadius) / this.maximumRadius ** 2;
733
+ const meridionalRadius = primeVerticalRadius * radiusRatio ** 2;
734
+
735
+ return Cartesian2.fromElements(
736
+ 1.0 / primeVerticalRadius,
737
+ 1.0 / meridionalRadius,
738
+ result
739
+ );
740
+ };
741
+
697
742
  const abscissas = [
698
743
  0.14887433898163,
699
744
  0.43339539412925,
@@ -1,3 +1,10 @@
1
+ import Check from "./Check.js";
2
+ import defaultValue from "./defaultValue.js";
3
+ import DeveloperError from "./DeveloperError.js";
4
+ import isLeapYear from "./isLeapYear.js";
5
+
6
+ const daysInYear = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
7
+
1
8
  /**
2
9
  * Represents a Gregorian date in a more precise format than the JavaScript Date object.
3
10
  * In addition to submillisecond precision, this object can also represent leap seconds.
@@ -25,6 +32,27 @@ function GregorianDate(
25
32
  millisecond,
26
33
  isLeapSecond
27
34
  ) {
35
+ const minimumYear = 1;
36
+ const minimumMonth = 1;
37
+ const minimumDay = 1;
38
+ const minimumHour = 0;
39
+ const minimumMinute = 0;
40
+ const minimumSecond = 0;
41
+ const minimumMillisecond = 0;
42
+
43
+ year = defaultValue(year, minimumYear);
44
+ month = defaultValue(month, minimumMonth);
45
+ day = defaultValue(day, minimumDay);
46
+ hour = defaultValue(hour, minimumHour);
47
+ minute = defaultValue(minute, minimumMinute);
48
+ second = defaultValue(second, minimumSecond);
49
+ millisecond = defaultValue(millisecond, minimumMillisecond);
50
+ isLeapSecond = defaultValue(isLeapSecond, false);
51
+ //>>includeStart('debug', pragmas.debug);
52
+ validateRange();
53
+ validateDate();
54
+ //>>includeEnd('debug');
55
+
28
56
  /**
29
57
  * Gets or sets the year as a whole number.
30
58
  * @type {number}
@@ -65,5 +93,62 @@ function GregorianDate(
65
93
  * @type {boolean}
66
94
  */
67
95
  this.isLeapSecond = isLeapSecond;
96
+
97
+ function validateRange() {
98
+ const maximumYear = 9999;
99
+ const maximumMonth = 12;
100
+ const maximumDay = 31;
101
+ const maximumHour = 23;
102
+ const maximumMinute = 59;
103
+ const maximumSecond = 59;
104
+ const excludedMaximumMilisecond = 1000;
105
+
106
+ Check.typeOf.number.greaterThanOrEquals("Year", year, minimumYear);
107
+ Check.typeOf.number.lessThanOrEquals("Year", year, maximumYear);
108
+
109
+ Check.typeOf.number.greaterThanOrEquals("Month", month, minimumMonth);
110
+ Check.typeOf.number.lessThanOrEquals("Month", month, maximumMonth);
111
+
112
+ Check.typeOf.number.greaterThanOrEquals("Day", day, minimumDay);
113
+ Check.typeOf.number.lessThanOrEquals("Day", day, maximumDay);
114
+
115
+ Check.typeOf.number.greaterThanOrEquals("Hour", hour, minimumHour);
116
+ Check.typeOf.number.lessThanOrEquals("Hour", hour, maximumHour);
117
+
118
+ Check.typeOf.number.greaterThanOrEquals("Minute", minute, minimumMinute);
119
+ Check.typeOf.number.lessThanOrEquals("Minute", minute, maximumMinute);
120
+
121
+ Check.typeOf.bool("IsLeapSecond", isLeapSecond);
122
+
123
+ Check.typeOf.number.greaterThanOrEquals("Second", second, minimumSecond);
124
+ Check.typeOf.number.lessThanOrEquals(
125
+ "Second",
126
+ second,
127
+ isLeapSecond ? maximumSecond + 1 : maximumSecond
128
+ );
129
+
130
+ Check.typeOf.number.greaterThanOrEquals(
131
+ "Millisecond",
132
+ millisecond,
133
+ minimumMillisecond
134
+ );
135
+ Check.typeOf.number.lessThan(
136
+ "Millisecond",
137
+ millisecond,
138
+ excludedMaximumMilisecond
139
+ );
140
+ }
141
+
142
+ // Javascript date object supports only dates greater than 1901. Thus validating with custom logic
143
+ function validateDate() {
144
+ const daysInMonth =
145
+ month === 2 && isLeapYear(year)
146
+ ? daysInYear[month - 1] + 1
147
+ : daysInYear[month - 1];
148
+
149
+ if (day > daysInMonth) {
150
+ throw new DeveloperError("Month and Day represents invalid date");
151
+ }
152
+ }
68
153
  }
69
154
  export default GregorianDate;
@@ -3,7 +3,7 @@ import defined from "./defined.js";
3
3
 
4
4
  /**
5
5
  * Defines a heading angle, pitch angle, and range in a local frame.
6
- * Heading is the rotation from the local north direction where a positive angle is increasing eastward.
6
+ * Heading is the rotation from the local east direction where a positive angle is increasing southward.
7
7
  * Pitch is the rotation from the local xy-plane. Positive pitch angles are above the plane. Negative pitch
8
8
  * angles are below the plane. Range is the distance from the center of the frame.
9
9
  * @alias HeadingPitchRange
@@ -15,7 +15,7 @@ import defined from "./defined.js";
15
15
  */
16
16
  function HeadingPitchRange(heading, pitch, range) {
17
17
  /**
18
- * Heading is the rotation from the local north direction where a positive angle is increasing eastward.
18
+ * Heading is the rotation from the local east direction where a positive angle is increasing southward.
19
19
  * @type {number}
20
20
  * @default 0.0
21
21
  */
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzN2UwMjViMC0xOTJhLTQxMmItOWEzMS1kMjJiNmZiY2E5N2YiLCJpZCI6MjU5LCJpYXQiOjE3MDE0NTc1NjB9.bMNhc7S4cuG1qUnRUiLxr5lunSH1k6-UfkRXSqVFYyM";
7
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiOGQ5NjRhYy1lYzBmLTRjYjktODA5MC01M2FhYmE4YjliZTIiLCJpZCI6MjU5LCJpYXQiOjE3MDY4MDU1MTR9.3b1XUfaoUwtY0Mi87tOQUGTnU4oMyyzSwAYqkDENcHo";
8
8
  /**
9
9
  * Default settings for accessing the Cesium ion API.
10
10
  *
@@ -8,10 +8,8 @@ import Check from "./Check.js";
8
8
  import ComponentDatatype from "./ComponentDatatype.js";
9
9
  import defaultValue from "./defaultValue.js";
10
10
  import defined from "./defined.js";
11
- import deprecationWarning from "./deprecationWarning.js";
12
11
  import DeveloperError from "./DeveloperError.js";
13
12
  import Ellipsoid from "./Ellipsoid.js";
14
- import EllipsoidGeodesic from "./EllipsoidGeodesic.js";
15
13
  import EllipsoidTangentPlane from "./EllipsoidTangentPlane.js";
16
14
  import Geometry from "./Geometry.js";
17
15
  import GeometryAttribute from "./GeometryAttribute.js";
@@ -425,123 +423,6 @@ function computeAttributes(options) {
425
423
  return geometry;
426
424
  }
427
425
 
428
- const startCartographicScratch = new Cartographic();
429
- const endCartographicScratch = new Cartographic();
430
- const idlCross = {
431
- westOverIDL: 0.0,
432
- eastOverIDL: 0.0,
433
- };
434
- let ellipsoidGeodesic = new EllipsoidGeodesic();
435
- function computeRectangle(positions, ellipsoid, arcType, granularity, result) {
436
- result = defaultValue(result, new Rectangle());
437
- if (!defined(positions) || positions.length < 3) {
438
- result.west = 0.0;
439
- result.north = 0.0;
440
- result.south = 0.0;
441
- result.east = 0.0;
442
- return result;
443
- }
444
-
445
- if (arcType === ArcType.RHUMB) {
446
- return Rectangle.fromCartesianArray(positions, ellipsoid, result);
447
- }
448
-
449
- if (!ellipsoidGeodesic.ellipsoid.equals(ellipsoid)) {
450
- ellipsoidGeodesic = new EllipsoidGeodesic(undefined, undefined, ellipsoid);
451
- }
452
-
453
- result.west = Number.POSITIVE_INFINITY;
454
- result.east = Number.NEGATIVE_INFINITY;
455
- result.south = Number.POSITIVE_INFINITY;
456
- result.north = Number.NEGATIVE_INFINITY;
457
-
458
- idlCross.westOverIDL = Number.POSITIVE_INFINITY;
459
- idlCross.eastOverIDL = Number.NEGATIVE_INFINITY;
460
-
461
- const inverseChordLength =
462
- 1.0 / CesiumMath.chordLength(granularity, ellipsoid.maximumRadius);
463
- const positionsLength = positions.length;
464
- let endCartographic = ellipsoid.cartesianToCartographic(
465
- positions[0],
466
- endCartographicScratch
467
- );
468
- let startCartographic = startCartographicScratch;
469
- let swap;
470
-
471
- for (let i = 1; i < positionsLength; i++) {
472
- swap = startCartographic;
473
- startCartographic = endCartographic;
474
- endCartographic = ellipsoid.cartesianToCartographic(positions[i], swap);
475
- ellipsoidGeodesic.setEndPoints(startCartographic, endCartographic);
476
- interpolateAndGrowRectangle(
477
- ellipsoidGeodesic,
478
- inverseChordLength,
479
- result,
480
- idlCross
481
- );
482
- }
483
-
484
- swap = startCartographic;
485
- startCartographic = endCartographic;
486
- endCartographic = ellipsoid.cartesianToCartographic(positions[0], swap);
487
- ellipsoidGeodesic.setEndPoints(startCartographic, endCartographic);
488
- interpolateAndGrowRectangle(
489
- ellipsoidGeodesic,
490
- inverseChordLength,
491
- result,
492
- idlCross
493
- );
494
-
495
- if (result.east - result.west > idlCross.eastOverIDL - idlCross.westOverIDL) {
496
- result.west = idlCross.westOverIDL;
497
- result.east = idlCross.eastOverIDL;
498
-
499
- if (result.east > CesiumMath.PI) {
500
- result.east = result.east - CesiumMath.TWO_PI;
501
- }
502
- if (result.west > CesiumMath.PI) {
503
- result.west = result.west - CesiumMath.TWO_PI;
504
- }
505
- }
506
-
507
- return result;
508
- }
509
-
510
- const interpolatedCartographicScratch = new Cartographic();
511
- function interpolateAndGrowRectangle(
512
- ellipsoidGeodesic,
513
- inverseChordLength,
514
- result,
515
- idlCross
516
- ) {
517
- const segmentLength = ellipsoidGeodesic.surfaceDistance;
518
-
519
- const numPoints = Math.ceil(segmentLength * inverseChordLength);
520
- const subsegmentDistance =
521
- numPoints > 0 ? segmentLength / (numPoints - 1) : Number.POSITIVE_INFINITY;
522
- let interpolationDistance = 0.0;
523
-
524
- for (let i = 0; i < numPoints; i++) {
525
- const interpolatedCartographic = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
526
- interpolationDistance,
527
- interpolatedCartographicScratch
528
- );
529
- interpolationDistance += subsegmentDistance;
530
- const longitude = interpolatedCartographic.longitude;
531
- const latitude = interpolatedCartographic.latitude;
532
-
533
- result.west = Math.min(result.west, longitude);
534
- result.east = Math.max(result.east, longitude);
535
- result.south = Math.min(result.south, latitude);
536
- result.north = Math.max(result.north, latitude);
537
-
538
- const lonAdjusted =
539
- longitude >= 0 ? longitude : longitude + CesiumMath.TWO_PI;
540
- idlCross.westOverIDL = Math.min(idlCross.westOverIDL, lonAdjusted);
541
- idlCross.eastOverIDL = Math.max(idlCross.eastOverIDL, lonAdjusted);
542
- }
543
- }
544
-
545
426
  const createGeometryFromPositionsExtrudedPositions = [];
546
427
 
547
428
  function createGeometryFromPositionsExtruded(
@@ -1264,56 +1145,6 @@ PolygonGeometry.computeRectangleFromPositions = function (
1264
1145
  return result;
1265
1146
  };
1266
1147
 
1267
- /**
1268
- * Returns the bounding rectangle given the provided options
1269
- *
1270
- * @param {object} options Object with the following properties:
1271
- * @param {PolygonHierarchy} options.polygonHierarchy A polygon hierarchy that can include holes.
1272
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions sampled.
1273
- * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
1274
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
1275
- * @param {Rectangle} [result] An object in which to store the result.
1276
- *
1277
- * @returns {Rectangle} The result rectangle
1278
- *
1279
- * @deprecated
1280
- */
1281
- PolygonGeometry.computeRectangle = function (options, result) {
1282
- //>>includeStart('debug', pragmas.debug);
1283
- Check.typeOf.object("options", options);
1284
- Check.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
1285
- //>>includeEnd('debug');
1286
-
1287
- deprecationWarning(
1288
- "PolygonGeometry.computeRectangle",
1289
- "PolygonGeometry.computeRectangle was deprecated in CesiumJS 1.110. It will be removed in CesiumJS 1.112. Use PolygonGeometry.computeRectangleFromPositions instead."
1290
- );
1291
-
1292
- const granularity = defaultValue(
1293
- options.granularity,
1294
- CesiumMath.RADIANS_PER_DEGREE
1295
- );
1296
- const arcType = defaultValue(options.arcType, ArcType.GEODESIC);
1297
- //>>includeStart('debug', pragmas.debug);
1298
- if (arcType !== ArcType.GEODESIC && arcType !== ArcType.RHUMB) {
1299
- throw new DeveloperError(
1300
- "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
1301
- );
1302
- }
1303
- //>>includeEnd('debug');
1304
-
1305
- const polygonHierarchy = options.polygonHierarchy;
1306
- const ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
1307
-
1308
- return computeRectangle(
1309
- polygonHierarchy.positions,
1310
- ellipsoid,
1311
- arcType,
1312
- granularity,
1313
- result
1314
- );
1315
- };
1316
-
1317
1148
  const scratchPolarForPlane = new Stereographic();
1318
1149
  function getTangentPlane(rectangle, positions, ellipsoid) {
1319
1150
  if (rectangle.height >= CesiumMath.PI || rectangle.width >= CesiumMath.PI) {
@@ -677,8 +677,12 @@ Quaternion.computeAxis = function (quaternion, result) {
677
677
  //>>includeEnd('debug');
678
678
 
679
679
  const w = quaternion.w;
680
- if (Math.abs(w - 1.0) < CesiumMath.EPSILON6) {
681
- result.x = result.y = result.z = 0;
680
+ if (
681
+ Math.abs(w - 1.0) < CesiumMath.EPSILON6 ||
682
+ Math.abs(w + 1.0) < CesiumMath.EPSILON6
683
+ ) {
684
+ result.x = 1;
685
+ result.y = result.z = 0;
682
686
  return result;
683
687
  }
684
688
 
@@ -159,11 +159,9 @@ function constructRectangle(geometry, computedOptions) {
159
159
  }
160
160
 
161
161
  function constructExtrudedRectangle(rectangleGeometry, computedOptions) {
162
- const surfaceHeight = rectangleGeometry._surfaceHeight;
163
- const extrudedHeight = rectangleGeometry._extrudedHeight;
162
+ const maxHeight = rectangleGeometry._surfaceHeight;
163
+ const minHeight = rectangleGeometry._extrudedHeight;
164
164
  const ellipsoid = rectangleGeometry._ellipsoid;
165
- const minHeight = extrudedHeight;
166
- const maxHeight = surfaceHeight;
167
165
  const geo = constructRectangle(rectangleGeometry, computedOptions);
168
166
 
169
167
  const height = computedOptions.height;
@@ -60,9 +60,9 @@ RequestScheduler.maximumRequests = 50;
60
60
  * The maximum number of simultaneous active requests per server. Un-throttled requests or servers specifically
61
61
  * listed in {@link requestsByServer} do not observe this limit.
62
62
  * @type {number}
63
- * @default 6
63
+ * @default 18
64
64
  */
65
- RequestScheduler.maximumRequestsPerServer = 6;
65
+ RequestScheduler.maximumRequestsPerServer = 18;
66
66
 
67
67
  /**
68
68
  * A per server key list of overrides to use for throttling instead of <code>maximumRequestsPerServer</code>.
@@ -78,13 +78,7 @@ RequestScheduler.maximumRequestsPerServer = 6;
78
78
  * "assets.cesium.com:443": 18,
79
79
  * };
80
80
  */
81
- RequestScheduler.requestsByServer = {
82
- "api.cesium.com:443": 18,
83
- "assets.ion.cesium.com:443": 18,
84
- "ibasemaps-api.arcgis.com:443": 18,
85
- "tile.googleapis.com:443": 18,
86
- "tile.openstreetmap.org:443": 18,
87
- };
81
+ RequestScheduler.requestsByServer = {};
88
82
 
89
83
  /**
90
84
  * Specifies if the request scheduler should throttle incoming requests, or let the browser queue requests under its control.
@@ -2045,17 +2045,6 @@ Resource.createImageBitmapFromBlob = function (blob, options) {
2045
2045
  });
2046
2046
  };
2047
2047
 
2048
- function decodeResponse(loadWithHttpResponse, responseType) {
2049
- switch (responseType) {
2050
- case "text":
2051
- return loadWithHttpResponse.toString("utf8");
2052
- case "json":
2053
- return JSON.parse(loadWithHttpResponse.toString("utf8"));
2054
- default:
2055
- return new Uint8Array(loadWithHttpResponse).buffer;
2056
- }
2057
- }
2058
-
2059
2048
  function loadWithHttpRequest(
2060
2049
  url,
2061
2050
  responseType,
@@ -2066,64 +2055,36 @@ function loadWithHttpRequest(
2066
2055
  overrideMimeType
2067
2056
  ) {
2068
2057
  // Note: only the 'json' and 'text' responseTypes transforms the loaded buffer
2069
- let URL;
2070
- let zlib;
2071
- Promise.all([import("url"), import("zlib")])
2072
- .then(([urlImport, zlibImport]) => {
2073
- URL = urlImport.parse(url);
2074
- zlib = zlibImport;
2075
-
2076
- return URL.protocol === "https:" ? import("https") : import("http");
2077
- })
2078
- .then((http) => {
2079
- const options = {
2080
- protocol: URL.protocol,
2081
- hostname: URL.hostname,
2082
- port: URL.port,
2083
- path: URL.path,
2084
- query: URL.query,
2085
- method: method,
2086
- headers: headers,
2087
- };
2088
- http
2089
- .request(options)
2090
- .on("response", function (res) {
2091
- if (res.statusCode < 200 || res.statusCode >= 300) {
2092
- deferred.reject(
2093
- new RequestErrorEvent(res.statusCode, res, res.headers)
2094
- );
2095
- return;
2096
- }
2097
-
2098
- const chunkArray = [];
2099
- res.on("data", function (chunk) {
2100
- chunkArray.push(chunk);
2101
- });
2058
+ fetch(url, {
2059
+ method,
2060
+ headers,
2061
+ })
2062
+ .then(async (response) => {
2063
+ if (!response.ok) {
2064
+ const responseHeaders = {};
2065
+ response.headers.forEach((value, key) => {
2066
+ responseHeaders[key] = value;
2067
+ });
2068
+ deferred.reject(
2069
+ new RequestErrorEvent(response.status, response, responseHeaders)
2070
+ );
2071
+ return;
2072
+ }
2102
2073
 
2103
- res.on("end", function () {
2104
- // eslint-disable-next-line no-undef
2105
- const result = Buffer.concat(chunkArray);
2106
- if (res.headers["content-encoding"] === "gzip") {
2107
- zlib.gunzip(result, function (error, resultUnzipped) {
2108
- if (error) {
2109
- deferred.reject(
2110
- new RuntimeError("Error decompressing response.")
2111
- );
2112
- } else {
2113
- deferred.resolve(
2114
- decodeResponse(resultUnzipped, responseType)
2115
- );
2116
- }
2117
- });
2118
- } else {
2119
- deferred.resolve(decodeResponse(result, responseType));
2120
- }
2121
- });
2122
- })
2123
- .on("error", function (e) {
2124
- deferred.reject(new RequestErrorEvent());
2125
- })
2126
- .end();
2074
+ switch (responseType) {
2075
+ case "text":
2076
+ deferred.resolve(response.text());
2077
+ break;
2078
+ case "json":
2079
+ deferred.resolve(response.json());
2080
+ break;
2081
+ default:
2082
+ deferred.resolve(new Uint8Array(await response.arrayBuffer()).buffer);
2083
+ break;
2084
+ }
2085
+ })
2086
+ .catch(() => {
2087
+ deferred.reject(new RequestErrorEvent());
2127
2088
  });
2128
2089
  }
2129
2090
 
@@ -2226,7 +2187,7 @@ Resource._Implementations.loadWithXhr = function (
2226
2187
  //or do not support the xhr.response property.
2227
2188
  if (xhr.status === 204) {
2228
2189
  // accept no content
2229
- deferred.resolve();
2190
+ deferred.resolve(undefined);
2230
2191
  } else if (
2231
2192
  defined(response) &&
2232
2193
  (!defined(responseType) || browserResponseType === responseType)
@@ -6,7 +6,7 @@ import defaultValue from "./defaultValue.js";
6
6
  import defined from "./defined.js";
7
7
  import CesiumMath from "./Math.js";
8
8
  import Matrix4 from "./Matrix4.js";
9
- import TerrainExaggeration from "./TerrainExaggeration.js";
9
+ import VerticalExaggeration from "./VerticalExaggeration.js";
10
10
  import TerrainQuantization from "./TerrainQuantization.js";
11
11
 
12
12
  const cartesian3Scratch = new Cartesian3();
@@ -386,7 +386,7 @@ TerrainEncoding.prototype.getExaggeratedPosition = function (
386
386
  );
387
387
  const rawHeight = this.decodeHeight(buffer, index);
388
388
  const heightDifference =
389
- TerrainExaggeration.getHeight(
389
+ VerticalExaggeration.getHeight(
390
390
  rawHeight,
391
391
  exaggeration,
392
392
  exaggerationRelativeHeight
@@ -360,7 +360,7 @@ const scratchHPRMatrix4 = new Matrix4();
360
360
 
361
361
  /**
362
362
  * Computes a 4x4 transformation matrix from a reference frame with axes computed from the heading-pitch-roll angles
363
- * centered at the provided origin to the provided ellipsoid's fixed reference frame. Heading is the rotation from the local north
363
+ * centered at the provided origin to the provided ellipsoid's fixed reference frame. Heading is the rotation from the local east
364
364
  * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles
365
365
  * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
366
366
  *
@@ -415,7 +415,7 @@ const scratchHPRMatrix3 = new Matrix3();
415
415
 
416
416
  /**
417
417
  * Computes a quaternion from a reference frame with axes computed from the heading-pitch-roll angles
418
- * centered at the provided origin. Heading is the rotation from the local north
418
+ * centered at the provided origin. Heading is the rotation from the local east
419
419
  * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles
420
420
  * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
421
421
  *
@@ -465,7 +465,7 @@ const hprTransformScratch = new Matrix4();
465
465
  const hprRotationScratch = new Matrix3();
466
466
  const hprQuaternionScratch = new Quaternion();
467
467
  /**
468
- * Computes heading-pitch-roll angles from a transform in a particular reference frame. Heading is the rotation from the local north
468
+ * Computes heading-pitch-roll angles from a transform in a particular reference frame. Heading is the rotation from the local east
469
469
  * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles
470
470
  * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
471
471
  *
@@ -1045,21 +1045,30 @@ Transforms.basisTo2D = function (projection, matrix, result) {
1045
1045
  const rtcCenter = Matrix4.getTranslation(matrix, scratchCenter);
1046
1046
  const ellipsoid = projection.ellipsoid;
1047
1047
 
1048
- // Get the 2D Center
1049
- const cartographic = ellipsoid.cartesianToCartographic(
1050
- rtcCenter,
1051
- scratchCartographic
1052
- );
1053
- const projectedPosition = projection.project(
1054
- cartographic,
1055
- scratchCartesian3Projection
1056
- );
1057
- Cartesian3.fromElements(
1058
- projectedPosition.z,
1059
- projectedPosition.x,
1060
- projectedPosition.y,
1061
- projectedPosition
1062
- );
1048
+ let projectedPosition;
1049
+ if (Cartesian3.equals(rtcCenter, Cartesian3.ZERO)) {
1050
+ projectedPosition = Cartesian3.clone(
1051
+ Cartesian3.ZERO,
1052
+ scratchCartesian3Projection
1053
+ );
1054
+ } else {
1055
+ // Get the 2D Center
1056
+ const cartographic = ellipsoid.cartesianToCartographic(
1057
+ rtcCenter,
1058
+ scratchCartographic
1059
+ );
1060
+
1061
+ projectedPosition = projection.project(
1062
+ cartographic,
1063
+ scratchCartesian3Projection
1064
+ );
1065
+ Cartesian3.fromElements(
1066
+ projectedPosition.z,
1067
+ projectedPosition.x,
1068
+ projectedPosition.y,
1069
+ projectedPosition
1070
+ );
1071
+ }
1063
1072
 
1064
1073
  // Assuming the instance are positioned in WGS84, invert the WGS84 transform to get the local transform and then convert to 2D
1065
1074
  const fromENU = Transforms.eastNorthUpToFixedFrame(