@cesium/engine 2.1.0 → 2.3.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 (240) hide show
  1. package/Build/Workers/{AttributeCompression-8a5a065e.js → AttributeCompression-f9f6c717.js} +1 -1
  2. package/Build/Workers/{AxisAlignedBoundingBox-a6f9f0e5.js → AxisAlignedBoundingBox-31fadcf0.js} +1 -1
  3. package/Build/Workers/{BoundingRectangle-b0a68595.js → BoundingRectangle-995f0079.js} +1 -1
  4. package/Build/Workers/{BoxGeometry-baedd794.js → BoxGeometry-7eb1af60.js} +1 -1
  5. package/Build/Workers/{Color-f85df1be.js → Color-2dc49658.js} +1 -1
  6. package/Build/Workers/{CoplanarPolygonGeometryLibrary-30516950.js → CoplanarPolygonGeometryLibrary-d7d972d6.js} +1 -1
  7. package/Build/Workers/{CorridorGeometryLibrary-5d5d3b3a.js → CorridorGeometryLibrary-1f5ef7b3.js} +1 -1
  8. package/Build/Workers/{CylinderGeometry-d899ae26.js → CylinderGeometry-23c67a6c.js} +1 -1
  9. package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
  10. package/Build/Workers/{EllipseGeometry-a49f8449.js → EllipseGeometry-37014da4.js} +1 -1
  11. package/Build/Workers/{EllipseGeometryLibrary-cba7edde.js → EllipseGeometryLibrary-92ab6b1e.js} +1 -1
  12. package/Build/Workers/{EllipseOutlineGeometry-8095c8cb.js → EllipseOutlineGeometry-12b6fef5.js} +1 -1
  13. package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
  14. package/Build/Workers/{EllipsoidGeometry-ed93f571.js → EllipsoidGeometry-508da15c.js} +1 -1
  15. package/Build/Workers/{EllipsoidOutlineGeometry-e4854854.js → EllipsoidOutlineGeometry-40d97455.js} +1 -1
  16. package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
  17. package/Build/Workers/{EllipsoidTangentPlane-7ae1aa9a.js → EllipsoidTangentPlane-46d4d9c2.js} +1 -1
  18. package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
  19. package/Build/Workers/{FrustumGeometry-b62db3e3.js → FrustumGeometry-38605e69.js} +32 -4
  20. package/Build/Workers/{GeometryAttribute-780af4fa.js → GeometryAttribute-a466e9c7.js} +1 -1
  21. package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
  22. package/Build/Workers/{GeometryPipeline-36b61c99.js → GeometryPipeline-dcf79306.js} +1 -1
  23. package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
  24. package/Build/Workers/{IntersectionTests-e889fcf0.js → IntersectionTests-88c49b2e.js} +1 -1
  25. package/Build/Workers/{Math-dad82b4d.js → Math-0a2ac845.js} +12 -2
  26. package/Build/Workers/{Matrix2-1e403d0e.js → Matrix2-e1298525.js} +1 -1
  27. package/Build/Workers/{Matrix3-fa806b97.js → Matrix3-41c58dde.js} +1 -1
  28. package/Build/Workers/{OrientedBoundingBox-43478ac8.js → OrientedBoundingBox-2dd47921.js} +5 -3
  29. package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
  30. package/Build/Workers/{PolygonGeometryLibrary-38a98276.js → PolygonGeometryLibrary-59126025.js} +1 -1
  31. package/Build/Workers/PolygonPipeline-1fe328c0.js +1344 -0
  32. package/Build/Workers/{PolylinePipeline-30e4cec9.js → PolylinePipeline-896735cc.js} +1 -1
  33. package/Build/Workers/{PolylineVolumeGeometryLibrary-90551d26.js → PolylineVolumeGeometryLibrary-9c0639f7.js} +1 -1
  34. package/Build/Workers/{PrimitivePipeline-558d9cb0.js → PrimitivePipeline-fc1a47ff.js} +1 -1
  35. package/Build/Workers/{RectangleGeometryLibrary-815c68df.js → RectangleGeometryLibrary-a23c9ebe.js} +1 -1
  36. package/Build/Workers/{TerrainEncoding-341ead52.js → TerrainEncoding-51b8b33b.js} +1 -1
  37. package/Build/Workers/Transforms-bc45e707.js +14699 -0
  38. package/Build/Workers/{WallGeometryLibrary-ccf90976.js → WallGeometryLibrary-007e9883.js} +1 -1
  39. package/Build/Workers/{WebMercatorProjection-76a3fcc0.js → WebMercatorProjection-13ed1a6e.js} +1 -1
  40. package/Build/Workers/{arrayRemoveDuplicates-fac118a8.js → arrayRemoveDuplicates-d2061e85.js} +1 -1
  41. package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
  42. package/Build/Workers/combineGeometry.js +1 -1
  43. package/Build/Workers/createBoxGeometry.js +1 -1
  44. package/Build/Workers/createBoxOutlineGeometry.js +1 -1
  45. package/Build/Workers/createCircleGeometry.js +1 -1
  46. package/Build/Workers/createCircleOutlineGeometry.js +1 -1
  47. package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
  48. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
  49. package/Build/Workers/createCorridorGeometry.js +1 -1
  50. package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
  51. package/Build/Workers/createCylinderGeometry.js +1 -1
  52. package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
  53. package/Build/Workers/createEllipseGeometry.js +1 -1
  54. package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
  55. package/Build/Workers/createEllipsoidGeometry.js +1 -1
  56. package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
  57. package/Build/Workers/createFrustumGeometry.js +1 -1
  58. package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
  59. package/Build/Workers/createGeometry.js +1 -1
  60. package/Build/Workers/createGroundPolylineGeometry.js +1 -1
  61. package/Build/Workers/createPlaneGeometry.js +1 -1
  62. package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
  63. package/Build/Workers/createPolygonGeometry.js +1 -1
  64. package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
  65. package/Build/Workers/createPolylineGeometry.js +1 -1
  66. package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
  67. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
  68. package/Build/Workers/createRectangleGeometry.js +1 -1
  69. package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
  70. package/Build/Workers/createSimplePolylineGeometry.js +1 -1
  71. package/Build/Workers/createSphereGeometry.js +1 -1
  72. package/Build/Workers/createSphereOutlineGeometry.js +1 -1
  73. package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
  74. package/Build/Workers/createVectorTileGeometries.js +1 -1
  75. package/Build/Workers/createVectorTilePoints.js +1 -1
  76. package/Build/Workers/createVectorTilePolygons.js +1 -1
  77. package/Build/Workers/createVectorTilePolylines.js +1 -1
  78. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
  79. package/Build/Workers/createVerticesFromHeightmap.js +5 -8
  80. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +10 -15
  81. package/Build/Workers/createWallGeometry.js +1 -1
  82. package/Build/Workers/createWallOutlineGeometry.js +1 -1
  83. package/Build/Workers/decodeDraco.js +1 -1
  84. package/Build/Workers/decodeI3S.js +1 -1
  85. package/Build/Workers/package.js +1 -1
  86. package/Build/Workers/transferTypedArrayTest.js +1 -1
  87. package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
  88. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +291 -191
  89. package/Source/Core/BingMapsGeocoderService.js +19 -1
  90. package/Source/Core/CartographicGeocoderService.js +15 -0
  91. package/Source/Core/CesiumTerrainProvider.js +571 -434
  92. package/Source/Core/Credit.js +1 -1
  93. package/Source/Core/CustomHeightmapTerrainProvider.js +12 -0
  94. package/Source/Core/EllipsoidTerrainProvider.js +17 -10
  95. package/Source/Core/FrustumGeometry.js +4 -3
  96. package/Source/Core/GeocoderService.js +32 -1
  97. package/Source/Core/GoogleEarthEnterpriseMetadata.js +86 -34
  98. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +119 -82
  99. package/Source/Core/Ion.js +1 -1
  100. package/Source/Core/IonGeocoderService.js +17 -2
  101. package/Source/Core/IonResource.js +14 -3
  102. package/Source/Core/OpenCageGeocoderService.js +18 -1
  103. package/Source/Core/OrientedBoundingBox.js +4 -2
  104. package/Source/Core/OrthographicFrustum.js +13 -0
  105. package/Source/Core/PeliasGeocoderService.js +14 -1
  106. package/Source/Core/PerspectiveFrustum.js +14 -0
  107. package/Source/Core/Request.js +3 -2
  108. package/Source/Core/RequestScheduler.js +10 -5
  109. package/Source/Core/Resource.js +230 -236
  110. package/Source/Core/TerrainProvider.js +9 -14
  111. package/Source/Core/TileProviderError.js +8 -8
  112. package/Source/Core/VRTheWorldTerrainProvider.js +193 -124
  113. package/Source/Core/buildModuleUrl.js +4 -3
  114. package/Source/Core/createWorldTerrain.js +20 -2
  115. package/Source/Core/createWorldTerrainAsync.js +48 -0
  116. package/Source/Core/sampleTerrain.js +9 -10
  117. package/Source/Core/sampleTerrainMostDetailed.js +66 -72
  118. package/Source/DataSources/Cesium3DTilesetVisualizer.js +37 -26
  119. package/Source/DataSources/DataSourceDisplay.js +2 -2
  120. package/Source/DataSources/Entity.js +6 -1
  121. package/Source/DataSources/EntityCluster.js +126 -128
  122. package/Source/DataSources/ModelVisualizer.js +104 -34
  123. package/Source/DataSources/PolygonGraphics.js +1 -1
  124. package/Source/Renderer/UniformState.js +3 -2
  125. package/Source/Renderer/demodernizeShader.js +5 -5
  126. package/Source/Scene/ArcGisBaseMapType.js +12 -0
  127. package/Source/Scene/ArcGisMapServerImageryProvider.js +694 -376
  128. package/Source/Scene/ArcGisMapService.js +83 -0
  129. package/Source/Scene/BingMapsImageryProvider.js +511 -305
  130. package/Source/Scene/BufferLoader.js +29 -34
  131. package/Source/Scene/Camera.js +8 -7
  132. package/Source/Scene/Cesium3DTile.js +392 -254
  133. package/Source/Scene/Cesium3DTileBatchTable.js +2 -2
  134. package/Source/Scene/Cesium3DTileContent.js +16 -0
  135. package/Source/Scene/Cesium3DTileContentFactory.js +4 -4
  136. package/Source/Scene/Cesium3DTilePass.js +8 -11
  137. package/Source/Scene/Cesium3DTileStyleEngine.js +1 -1
  138. package/Source/Scene/Cesium3DTilesVoxelProvider.js +225 -117
  139. package/Source/Scene/Cesium3DTileset.js +756 -482
  140. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +301 -0
  141. package/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js +33 -46
  142. package/Source/Scene/Cesium3DTilesetSkipTraversal.js +421 -0
  143. package/Source/Scene/Cesium3DTilesetTraversal.js +219 -671
  144. package/Source/Scene/ClassificationPrimitive.js +7 -0
  145. package/Source/Scene/Composite3DTileContent.js +69 -26
  146. package/Source/Scene/CreditDisplay.js +132 -20
  147. package/Source/Scene/DepthPlane.js +1 -1
  148. package/Source/Scene/Empty3DTileContent.js +31 -1
  149. package/Source/Scene/Geometry3DTileContent.js +47 -7
  150. package/Source/Scene/Globe.js +5 -1
  151. package/Source/Scene/GlobeSurfaceTile.js +2 -1
  152. package/Source/Scene/GlobeSurfaceTileProvider.js +53 -30
  153. package/Source/Scene/GltfBufferViewLoader.js +47 -91
  154. package/Source/Scene/GltfDracoLoader.js +110 -112
  155. package/Source/Scene/GltfImageLoader.js +71 -78
  156. package/Source/Scene/GltfIndexBufferLoader.js +108 -121
  157. package/Source/Scene/GltfJsonLoader.js +87 -74
  158. package/Source/Scene/GltfLoader.js +381 -300
  159. package/Source/Scene/GltfStructuralMetadataLoader.js +109 -110
  160. package/Source/Scene/GltfTextureLoader.js +97 -96
  161. package/Source/Scene/GltfVertexBufferLoader.js +128 -133
  162. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +353 -225
  163. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +491 -331
  164. package/Source/Scene/GridImageryProvider.js +267 -104
  165. package/Source/Scene/GroundPolylinePrimitive.js +12 -1
  166. package/Source/Scene/GroundPrimitive.js +8 -1
  167. package/Source/Scene/I3SDataProvider.js +214 -113
  168. package/Source/Scene/I3SFeature.js +7 -6
  169. package/Source/Scene/I3SLayer.js +26 -37
  170. package/Source/Scene/I3SNode.js +59 -66
  171. package/Source/Scene/Imagery.js +6 -1
  172. package/Source/Scene/ImageryLayer.js +299 -48
  173. package/Source/Scene/ImageryLayerCollection.js +26 -0
  174. package/Source/Scene/ImageryProvider.js +129 -111
  175. package/Source/Scene/Implicit3DTileContent.js +72 -23
  176. package/Source/Scene/ImplicitSubtree.js +66 -45
  177. package/Source/Scene/IonImageryProvider.js +482 -275
  178. package/Source/Scene/MapboxImageryProvider.js +272 -112
  179. package/Source/Scene/MapboxStyleImageryProvider.js +270 -111
  180. package/Source/Scene/MetadataSchemaLoader.js +26 -36
  181. package/Source/Scene/Model/B3dmLoader.js +42 -46
  182. package/Source/Scene/Model/GeoJsonLoader.js +8 -32
  183. package/Source/Scene/Model/I3dmLoader.js +48 -74
  184. package/Source/Scene/Model/MaterialPipelineStage.js +12 -12
  185. package/Source/Scene/Model/Model.js +514 -135
  186. package/Source/Scene/Model/Model3DTileContent.js +83 -31
  187. package/Source/Scene/Model/ModelAnimationCollection.js +3 -3
  188. package/Source/Scene/Model/ModelDrawCommand.js +15 -26
  189. package/Source/Scene/Model/ModelUtility.js +16 -16
  190. package/Source/Scene/Model/PntsLoader.js +27 -32
  191. package/Source/Scene/Model/UniformType.js +1 -1
  192. package/Source/Scene/Multiple3DTileContent.js +134 -115
  193. package/Source/Scene/Picking.js +3 -2
  194. package/Source/Scene/PointCloud.js +11 -19
  195. package/Source/Scene/Primitive.js +20 -0
  196. package/Source/Scene/QuadtreePrimitive.js +5 -2
  197. package/Source/Scene/QuadtreeTileProvider.js +4 -8
  198. package/Source/Scene/ResourceCache.js +47 -105
  199. package/Source/Scene/ResourceCacheStatistics.js +24 -58
  200. package/Source/Scene/ResourceLoader.js +5 -17
  201. package/Source/Scene/ResourceLoaderState.js +12 -4
  202. package/Source/Scene/Scene.js +65 -0
  203. package/Source/Scene/SceneTransforms.js +3 -2
  204. package/Source/Scene/ScreenSpaceCameraController.js +2 -2
  205. package/Source/Scene/SingleTileImageryProvider.js +382 -209
  206. package/Source/Scene/Terrain.js +196 -0
  207. package/Source/Scene/TileCoordinatesImageryProvider.js +267 -104
  208. package/Source/Scene/TileMapServiceImageryProvider.js +177 -85
  209. package/Source/Scene/Tileset3DTileContent.js +47 -5
  210. package/Source/Scene/TimeDynamicPointCloud.js +15 -2
  211. package/Source/Scene/UrlTemplateImageryProvider.js +343 -215
  212. package/Source/Scene/Vector3DTileClampedPolylines.js +96 -84
  213. package/Source/Scene/Vector3DTileContent.js +47 -22
  214. package/Source/Scene/Vector3DTileGeometry.js +57 -52
  215. package/Source/Scene/Vector3DTilePoints.js +97 -81
  216. package/Source/Scene/Vector3DTilePolygons.js +118 -117
  217. package/Source/Scene/Vector3DTilePolylines.js +86 -82
  218. package/Source/Scene/Vector3DTilePrimitive.js +0 -1
  219. package/Source/Scene/VoxelContent.js +61 -63
  220. package/Source/Scene/VoxelPrimitive.js +39 -91
  221. package/Source/Scene/VoxelProvider.js +2 -2
  222. package/Source/Scene/WebMapServiceImageryProvider.js +272 -111
  223. package/Source/Scene/WebMapTileServiceImageryProvider.js +270 -107
  224. package/Source/Scene/computeFlyToLocationForRectangle.js +33 -37
  225. package/Source/Scene/createOsmBuildings.js +6 -0
  226. package/Source/Scene/createOsmBuildingsAsync.js +82 -0
  227. package/Source/Scene/createWorldImagery.js +14 -5
  228. package/Source/Scene/createWorldImageryAsync.js +39 -0
  229. package/Source/Shaders/AtmosphereCommon.glsl +51 -8
  230. package/Source/Shaders/AtmosphereCommon.js +51 -8
  231. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +1 -1
  232. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +1 -1
  233. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +3 -3
  234. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +3 -3
  235. package/Source/Widget/CesiumWidget.js +67 -27
  236. package/index.d.ts +2429 -1475
  237. package/index.js +324 -315
  238. package/package.json +4 -4
  239. package/Build/Workers/PolygonPipeline-d31ff61c.js +0 -1345
  240. package/Build/Workers/Transforms-9e9df299.js +0 -14714
@@ -2,6 +2,7 @@ import ColorGeometryInstanceAttribute from "../Core/ColorGeometryInstanceAttribu
2
2
  import combine from "../Core/combine.js";
3
3
  import defaultValue from "../Core/defaultValue.js";
4
4
  import defined from "../Core/defined.js";
5
+ import deprecationWarning from "../Core/deprecationWarning.js";
5
6
  import destroyObject from "../Core/destroyObject.js";
6
7
  import DeveloperError from "../Core/DeveloperError.js";
7
8
  import GeometryInstance from "../Core/GeometryInstance.js";
@@ -164,6 +165,7 @@ function ClassificationPrimitive(options) {
164
165
  this._ready = false;
165
166
 
166
167
  const classificationPrimitive = this;
168
+ // This is here for backwards compatibility. This promise wrapper can be removed once readyPromise is removed.
167
169
  this._readyPromise = new Promise((resolve, reject) => {
168
170
  classificationPrimitive._completeLoad = () => {
169
171
  if (this._ready) {
@@ -340,9 +342,14 @@ Object.defineProperties(ClassificationPrimitive.prototype, {
340
342
  * @memberof ClassificationPrimitive.prototype
341
343
  * @type {Promise<ClassificationPrimitive>}
342
344
  * @readonly
345
+ * @deprecated
343
346
  */
344
347
  readyPromise: {
345
348
  get: function () {
349
+ deprecationWarning(
350
+ "ClassificationPrimitive.readyPromise",
351
+ "ClassificationPrimitive.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for ClassificationPrimitive.ready to return true instead."
352
+ );
346
353
  return this._readyPromise;
347
354
  },
348
355
  },
@@ -1,5 +1,6 @@
1
1
  import defaultValue from "../Core/defaultValue.js";
2
2
  import defined from "../Core/defined.js";
3
+ import deprecationWarning from "../Core/deprecationWarning.js";
3
4
  import destroyObject from "../Core/destroyObject.js";
4
5
  import getMagic from "../Core/getMagic.js";
5
6
  import RuntimeError from "../Core/RuntimeError.js";
@@ -17,23 +18,24 @@ import RuntimeError from "../Core/RuntimeError.js";
17
18
  *
18
19
  * @private
19
20
  */
20
- function Composite3DTileContent(
21
- tileset,
22
- tile,
23
- resource,
24
- arrayBuffer,
25
- byteOffset,
26
- factory
27
- ) {
21
+ function Composite3DTileContent(tileset, tile, resource, contents) {
28
22
  this._tileset = tileset;
29
23
  this._tile = tile;
30
24
  this._resource = resource;
31
- this._contents = [];
25
+
26
+ if (!defined(contents)) {
27
+ contents = [];
28
+ }
29
+ this._contents = contents;
32
30
 
33
31
  this._metadata = undefined;
34
32
  this._group = undefined;
33
+ this._ready = false;
35
34
 
36
- this._readyPromise = initialize(this, arrayBuffer, byteOffset, factory);
35
+ this._resolveContent = undefined;
36
+ this._readyPromise = new Promise((resolve) => {
37
+ this._resolveContent = resolve;
38
+ });
37
39
  }
38
40
 
39
41
  Object.defineProperties(Composite3DTileContent.prototype, {
@@ -130,8 +132,37 @@ Object.defineProperties(Composite3DTileContent.prototype, {
130
132
  },
131
133
  },
132
134
 
135
+ /**
136
+ * Returns true when the tile's content is ready to render; otherwise false
137
+ *
138
+ * @memberof Composite3DTileContent.prototype
139
+ *
140
+ * @type {boolean}
141
+ * @readonly
142
+ * @private
143
+ */
144
+ ready: {
145
+ get: function () {
146
+ return this._ready;
147
+ },
148
+ },
149
+
150
+ /**
151
+ * Gets the promise that will be resolved when the tile's content is ready to render.
152
+ *
153
+ * @memberof Composite3DTileContent.prototype
154
+ *
155
+ * @type {Promise<Composite3DTileContent>}
156
+ * @readonly
157
+ * @deprecated
158
+ * @private
159
+ */
133
160
  readyPromise: {
134
161
  get: function () {
162
+ deprecationWarning(
163
+ "Composite3DTileContent.readyPromise",
164
+ "Composite3DTileContent.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for Composite3DTileContent.ready to return true instead."
165
+ );
135
166
  return this._readyPromise;
136
167
  },
137
168
  },
@@ -210,7 +241,14 @@ Object.defineProperties(Composite3DTileContent.prototype, {
210
241
 
211
242
  const sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT;
212
243
 
213
- function initialize(content, arrayBuffer, byteOffset, factory) {
244
+ Composite3DTileContent.fromTileType = async function (
245
+ tileset,
246
+ tile,
247
+ resource,
248
+ arrayBuffer,
249
+ byteOffset,
250
+ factory
251
+ ) {
214
252
  byteOffset = defaultValue(byteOffset, 0);
215
253
 
216
254
  const uint8Array = new Uint8Array(arrayBuffer);
@@ -231,14 +269,11 @@ function initialize(content, arrayBuffer, byteOffset, factory) {
231
269
  const tilesLength = view.getUint32(byteOffset, true);
232
270
  byteOffset += sizeOfUint32;
233
271
 
234
- const contentPromises = [];
235
-
236
272
  // For caching purposes, models within the composite tile must be
237
273
  // distinguished. To do this, add a query parameter ?compositeIndex=i.
238
274
  // Since composite tiles may contain other composite tiles, check for an
239
275
  // existing prefix and separate them with underscores. e.g.
240
276
  // ?compositeIndex=0_1_1
241
- const resource = content._resource;
242
277
  let prefix = resource.queryParameters.compositeIndex;
243
278
  if (defined(prefix)) {
244
279
  // We'll be adding another value at the end, so add an underscore.
@@ -248,6 +283,8 @@ function initialize(content, arrayBuffer, byteOffset, factory) {
248
283
  prefix = "";
249
284
  }
250
285
 
286
+ const promises = [];
287
+ promises.length = tilesLength;
251
288
  for (let i = 0; i < tilesLength; ++i) {
252
289
  const tileType = getMagic(uint8Array, byteOffset);
253
290
 
@@ -265,15 +302,9 @@ function initialize(content, arrayBuffer, byteOffset, factory) {
265
302
  });
266
303
 
267
304
  if (defined(contentFactory)) {
268
- const innerContent = contentFactory(
269
- content._tileset,
270
- content._tile,
271
- childResource,
272
- arrayBuffer,
273
- byteOffset
305
+ promises[i] = Promise.resolve(
306
+ contentFactory(tileset, tile, childResource, arrayBuffer, byteOffset)
274
307
  );
275
- content._contents.push(innerContent);
276
- contentPromises.push(innerContent.readyPromise);
277
308
  } else {
278
309
  throw new RuntimeError(
279
310
  `Unknown tile content type, ${tileType}, inside Composite tile`
@@ -283,10 +314,15 @@ function initialize(content, arrayBuffer, byteOffset, factory) {
283
314
  byteOffset += tileByteLength;
284
315
  }
285
316
 
286
- return Promise.all(contentPromises).then(function () {
287
- return content;
288
- });
289
- }
317
+ const innerContents = await Promise.all(promises);
318
+ const content = new Composite3DTileContent(
319
+ tileset,
320
+ tile,
321
+ resource,
322
+ innerContents
323
+ );
324
+ return content;
325
+ };
290
326
 
291
327
  /**
292
328
  * Part of the {@link Cesium3DTileContent} interface. <code>Composite3DTileContent</code>
@@ -326,8 +362,15 @@ Composite3DTileContent.prototype.applyStyle = function (style) {
326
362
  Composite3DTileContent.prototype.update = function (tileset, frameState) {
327
363
  const contents = this._contents;
328
364
  const length = contents.length;
365
+ let ready = true;
329
366
  for (let i = 0; i < length; ++i) {
330
367
  contents[i].update(tileset, frameState);
368
+ ready = ready && contents[i].ready;
369
+ }
370
+
371
+ if (!this._ready && ready) {
372
+ this._ready = true;
373
+ this._resolveContent(this);
331
374
  }
332
375
  };
333
376
 
@@ -4,6 +4,7 @@ import Check from "../Core/Check.js";
4
4
  import Credit from "../Core/Credit.js";
5
5
  import defaultValue from "../Core/defaultValue.js";
6
6
  import defined from "../Core/defined.js";
7
+ import deprecationWarning from "../Core/deprecationWarning.js";
7
8
  import destroyObject from "../Core/destroyObject.js";
8
9
  import Uri from "urijs";
9
10
 
@@ -174,7 +175,7 @@ function addStyle(selector, styles) {
174
175
  return style;
175
176
  }
176
177
 
177
- function appendCss() {
178
+ function appendCss(container) {
178
179
  let style = "";
179
180
  style += addStyle(".cesium-credit-lightbox-overlay", {
180
181
  display: "none",
@@ -270,10 +271,26 @@ function appendCss() {
270
271
  }
271
272
  );
272
273
 
273
- const head = document.head;
274
+ function getShadowRoot(container) {
275
+ if (container.shadowRoot) {
276
+ return container.shadowRoot;
277
+ }
278
+ if (container.getRootNode) {
279
+ const root = container.getRootNode();
280
+ if (root instanceof ShadowRoot) {
281
+ return root;
282
+ }
283
+ }
284
+ return undefined;
285
+ }
286
+
287
+ const shadowRootOrDocumentHead = defaultValue(
288
+ getShadowRoot(container),
289
+ document.head
290
+ );
274
291
  const css = document.createElement("style");
275
292
  css.innerHTML = style;
276
- head.insertBefore(css, head.firstChild);
293
+ shadowRootOrDocumentHead.appendChild(css);
277
294
  }
278
295
 
279
296
  /**
@@ -287,7 +304,14 @@ function appendCss() {
287
304
  * @constructor
288
305
  *
289
306
  * @example
290
- * const creditDisplay = new Cesium.CreditDisplay(creditContainer);
307
+ * // Add a credit with a tooltip, image and link to display onscreen
308
+ * const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
309
+ * viewer.creditDisplay.addStaticCredit(credit);
310
+ *
311
+ * @example
312
+ * // Add a credit with a plaintext link to display in the lightbox
313
+ * const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
314
+ * viewer.creditDisplay.addStaticCredit(credit);
291
315
  */
292
316
  function CreditDisplay(container, delimiter, viewport) {
293
317
  //>>includeStart('debug', pragmas.debug);
@@ -343,7 +367,7 @@ function CreditDisplay(container, delimiter, viewport) {
343
367
  expandLink.textContent = "Data attribution";
344
368
  container.appendChild(expandLink);
345
369
 
346
- appendCss();
370
+ appendCss(container);
347
371
  const cesiumCredit = Credit.clone(CreditDisplay.cesiumCredit);
348
372
 
349
373
  this._delimiter = defaultValue(delimiter, " • ");
@@ -357,7 +381,7 @@ function CreditDisplay(container, delimiter, viewport) {
357
381
  this._hideLightbox = hideLightbox;
358
382
  this._expandLink = expandLink;
359
383
  this._expanded = false;
360
- this._defaultCredits = [];
384
+ this._staticCredits = [];
361
385
  this._cesiumCredit = cesiumCredit;
362
386
  this._previousCesiumCredit = undefined;
363
387
  this._currentCesiumCredit = cesiumCredit;
@@ -402,17 +426,36 @@ function setCredit(creditDisplay, credits, credit, count) {
402
426
  }
403
427
  /**
404
428
  * Adds a credit to the list of current credits to be displayed in the credit container
429
+ * for the next frame
405
430
  *
406
431
  * @param {Credit} credit The credit to display
432
+ * @deprecated
407
433
  */
408
434
  CreditDisplay.prototype.addCredit = function (credit) {
435
+ deprecationWarning(
436
+ "CreditDisplay.addCredit",
437
+ "CreditDisplay.addCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addCreditToNextFrame instead."
438
+ );
439
+
440
+ this.addCreditToNextFrame(credit);
441
+ };
442
+
443
+ /**
444
+ * Adds a {@link Credit} that will show on screen or in the lightbox until
445
+ * the next frame. This is mostly for internal use. Use {@link CreditDisplay.addStaticCredit} to add a persistent credit to the screen.
446
+ *
447
+ * @see CreditDisplay.addStaticCredit
448
+ *
449
+ * @param {Credit} credit The credit to display in the next frame.
450
+ */
451
+ CreditDisplay.prototype.addCreditToNextFrame = function (credit) {
409
452
  //>>includeStart('debug', pragmas.debug);
410
453
  Check.defined("credit", credit);
411
454
  //>>includeEnd('debug');
412
455
 
413
456
  if (credit._isIon) {
414
457
  // If this is the an ion logo credit from the ion server
415
- // Juse use the default credit (which is identical) to avoid blinking
458
+ // Just use the default credit (which is identical) to avoid blinking
416
459
  if (!defined(this._defaultCredit)) {
417
460
  this._defaultCredit = Credit.clone(getDefaultCredit());
418
461
  }
@@ -434,40 +477,94 @@ CreditDisplay.prototype.addCredit = function (credit) {
434
477
  * Adds credits that will persist until they are removed
435
478
  *
436
479
  * @param {Credit} credit The credit to added to defaults
480
+ *
481
+ * @deprecated
437
482
  */
438
483
  CreditDisplay.prototype.addDefaultCredit = function (credit) {
439
484
  //>>includeStart('debug', pragmas.debug);
440
485
  Check.defined("credit", credit);
441
486
  //>>includeEnd('debug');
442
487
 
443
- const defaultCredits = this._defaultCredits;
488
+ deprecationWarning(
489
+ "CreditDisplay.addDefaultCredit",
490
+ "CreditDisplay.addDefaultCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addStaticCredit instead."
491
+ );
492
+
493
+ const defaultCredits = this._staticCredits;
444
494
  if (!contains(defaultCredits, credit)) {
495
+ credit.showOnScreen = true;
445
496
  defaultCredits.push(credit);
446
497
  }
447
498
  };
448
499
 
449
500
  /**
450
- * Removes a default credit
501
+ * Adds a {@link Credit} that will show on screen or in the lightbox until removed with {@link CreditDisplay.removeStaticCredit}.
451
502
  *
452
- * @param {Credit} credit The credit to be removed from defaults
503
+ * @param {Credit} credit The credit to added
504
+ *
505
+ * @example
506
+ * // Add a credit with a tooltip, image and link to display onscreen
507
+ * const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
508
+ * viewer.creditDisplay.addStaticCredit(credit);
509
+ *
510
+ * @example
511
+ * // Add a credit with a plaintext link to display in the lightbox
512
+ * const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
513
+ * viewer.creditDisplay.addStaticCredit(credit);
453
514
  */
454
- CreditDisplay.prototype.removeDefaultCredit = function (credit) {
515
+ CreditDisplay.prototype.addStaticCredit = function (credit) {
516
+ //>>includeStart('debug', pragmas.debug);
517
+ Check.defined("credit", credit);
518
+ //>>includeEnd('debug');
519
+
520
+ const staticCredits = this._staticCredits;
521
+ if (!contains(staticCredits, credit)) {
522
+ staticCredits.push(credit);
523
+ }
524
+ };
525
+
526
+ /**
527
+ * Removes a static credit shown on screen or in the lightbox.
528
+ *
529
+ * @param {Credit} credit The credit to be removed.
530
+ */
531
+ CreditDisplay.prototype.removeStaticCredit = function (credit) {
455
532
  //>>includeStart('debug', pragmas.debug);
456
533
  Check.defined("credit", credit);
457
534
  //>>includeEnd('debug');
458
535
 
459
- const defaultCredits = this._defaultCredits;
460
- const index = defaultCredits.indexOf(credit);
536
+ const staticCredits = this._staticCredits;
537
+ const index = staticCredits.indexOf(credit);
461
538
  if (index !== -1) {
462
- defaultCredits.splice(index, 1);
539
+ staticCredits.splice(index, 1);
463
540
  }
464
541
  };
465
542
 
543
+ /**
544
+ * Removes a default credit.
545
+ *
546
+ * @param {Credit} credit The credit to be removed from defaults
547
+ */
548
+ CreditDisplay.prototype.removeDefaultCredit = function (credit) {
549
+ deprecationWarning(
550
+ "CreditDisplay.removeDefaultCredit",
551
+ "CreditDisplay.removeDefaultCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addStaticCredit instead."
552
+ );
553
+
554
+ this.removeStaticCredit(credit);
555
+ };
556
+
557
+ /**
558
+ * @private
559
+ */
466
560
  CreditDisplay.prototype.showLightbox = function () {
467
561
  this._lightbox.style.display = "block";
468
562
  this._expanded = true;
469
563
  };
470
564
 
565
+ /**
566
+ * @private
567
+ */
471
568
  CreditDisplay.prototype.hideLightbox = function () {
472
569
  this._lightbox.style.display = "none";
473
570
  this._expanded = false;
@@ -490,14 +587,29 @@ CreditDisplay.prototype.beginFrame = function () {
490
587
  this._creditDisplayElementPoolIndex = 0;
491
588
 
492
589
  const screenCredits = currentFrameCredits.screenCredits;
590
+ const lightboxCredits = currentFrameCredits.lightboxCredits;
591
+
493
592
  screenCredits.removeAll();
494
- const defaultCredits = this._defaultCredits;
495
- for (let i = 0; i < defaultCredits.length; ++i) {
496
- const defaultCredit = defaultCredits[i];
497
- setCredit(this, screenCredits, defaultCredit, Number.MAX_VALUE);
498
- }
593
+ lightboxCredits.removeAll();
594
+
595
+ const staticCredits = this._staticCredits;
596
+ for (let i = 0; i < staticCredits.length; ++i) {
597
+ const staticCredit = staticCredits[i];
598
+ const creditCollection = staticCredit.showOnScreen
599
+ ? screenCredits
600
+ : lightboxCredits;
499
601
 
500
- currentFrameCredits.lightboxCredits.removeAll();
602
+ if (
603
+ staticCredit._isIon &&
604
+ Credit.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)
605
+ ) {
606
+ // If this is an ion logo credit from the ion server,
607
+ // make sure to de-duplicate with the default ion credit
608
+ continue;
609
+ }
610
+
611
+ setCredit(this, creditCollection, staticCredit, Number.MAX_VALUE);
612
+ }
501
613
 
502
614
  if (!Credit.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)) {
503
615
  this._cesiumCredit = Credit.clone(CreditDisplay.cesiumCredit);
@@ -125,7 +125,7 @@ DepthPlane.prototype.update = function (frameState) {
125
125
 
126
126
  const context = frameState.context;
127
127
 
128
- // Allow offsetting the ellipsoid radius to address rendering artefacts below ellipsoid zero elevation.
128
+ // Allow offsetting the ellipsoid radius to address rendering artifacts below ellipsoid zero elevation.
129
129
  const radii = frameState.mapProjection.ellipsoid.radii;
130
130
  const ellipsoid = new Ellipsoid(
131
131
  radii.x + this._ellipsoidOffset,
@@ -1,3 +1,4 @@
1
+ import deprecationWarning from "../Core/deprecationWarning.js";
1
2
  import destroyObject from "../Core/destroyObject.js";
2
3
  import DeveloperError from "../Core/DeveloperError.js";
3
4
 
@@ -64,9 +65,38 @@ Object.defineProperties(Empty3DTileContent.prototype, {
64
65
  },
65
66
  },
66
67
 
68
+ /**
69
+ * Returns true when the tile's content is ready to render; otherwise false
70
+ *
71
+ * @memberof Empty3DTileContent.prototype
72
+ *
73
+ * @type {boolean}
74
+ * @readonly
75
+ * @private
76
+ */
77
+ ready: {
78
+ get: function () {
79
+ return true;
80
+ },
81
+ },
82
+
83
+ /**
84
+ * Gets the promise that will be resolved when the tile's content is ready to render.
85
+ *
86
+ * @memberof Empty3DTileContent.prototype
87
+ *
88
+ * @type {Promise<Empty3DTileContent>}
89
+ * @readonly
90
+ * @deprecated
91
+ * @private
92
+ */
67
93
  readyPromise: {
68
94
  get: function () {
69
- return undefined;
95
+ deprecationWarning(
96
+ "Empty3DTileContent.readyPromise",
97
+ "Empty3DTileContent.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for Empty3DTileContent.ready to return true instead."
98
+ );
99
+ return Promise.resolve(this);
70
100
  },
71
101
  },
72
102
 
@@ -1,6 +1,7 @@
1
1
  import Cartesian3 from "../Core/Cartesian3.js";
2
2
  import defaultValue from "../Core/defaultValue.js";
3
3
  import defined from "../Core/defined.js";
4
+ import deprecationWarning from "../Core/deprecationWarning.js";
4
5
  import destroyObject from "../Core/destroyObject.js";
5
6
  import DeveloperError from "../Core/DeveloperError.js";
6
7
  import getJsonFromTypedArray from "../Core/getJsonFromTypedArray.js";
@@ -42,7 +43,15 @@ function Geometry3DTileContent(
42
43
  this.featurePropertiesDirty = false;
43
44
  this._group = undefined;
44
45
 
45
- this._readyPromise = initialize(this, arrayBuffer, byteOffset);
46
+ this._ready = false;
47
+
48
+ // This is for backwards compatibility. It can be removed once readyPromise is removed.
49
+ this._resolveContent = undefined;
50
+ this._readyPromise = new Promise((resolve) => {
51
+ this._resolveContent = resolve;
52
+ });
53
+
54
+ initialize(this, arrayBuffer, byteOffset);
46
55
  }
47
56
 
48
57
  Object.defineProperties(Geometry3DTileContent.prototype, {
@@ -96,8 +105,37 @@ Object.defineProperties(Geometry3DTileContent.prototype, {
96
105
  },
97
106
  },
98
107
 
108
+ /**
109
+ * Returns true when the tile's content is ready to render; otherwise false
110
+ *
111
+ * @memberof Geometry3DTileContent.prototype
112
+ *
113
+ * @type {boolean}
114
+ * @readonly
115
+ * @private
116
+ */
117
+ ready: {
118
+ get: function () {
119
+ return this._ready;
120
+ },
121
+ },
122
+
123
+ /**
124
+ * Gets the promise that will be resolved when the tile's content is ready to render.
125
+ *
126
+ * @memberof Geometry3DTileContent.prototype
127
+ *
128
+ * @type {Promise<Geometry3DTileContent>}
129
+ * @readonly
130
+ * @deprecated
131
+ * @private
132
+ */
99
133
  readyPromise: {
100
134
  get: function () {
135
+ deprecationWarning(
136
+ "Geometry3DTileContent.readyPromise",
137
+ "Geometry3DTileContent.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for Geometry3DTileContent.ready to return true instead."
138
+ );
101
139
  return this._readyPromise;
102
140
  },
103
141
  },
@@ -224,7 +262,7 @@ function getBatchIds(featureTableJson, featureTableBinary) {
224
262
 
225
263
  if (atLeastOneDefined && atLeastOneUndefined) {
226
264
  throw new RuntimeError(
227
- "If one group of batch ids is defined, then all batch ids must be defined."
265
+ "If one group of batch ids is defined, then all batch ids must be defined"
228
266
  );
229
267
  }
230
268
 
@@ -290,7 +328,8 @@ function initialize(content, arrayBuffer, byteOffset) {
290
328
  byteOffset += sizeOfUint32;
291
329
 
292
330
  if (byteLength === 0) {
293
- content._readyPromise.resolve(content);
331
+ content._ready = true;
332
+ content._resolveContent(content);
294
333
  return;
295
334
  }
296
335
 
@@ -451,9 +490,7 @@ function initialize(content, arrayBuffer, byteOffset) {
451
490
  boundingVolume: content.tile.boundingVolume.boundingVolume,
452
491
  });
453
492
 
454
- return content._geometries.readyPromise.then(function () {
455
- return content;
456
- });
493
+ return content;
457
494
  }
458
495
 
459
496
  return Promise.resolve(content);
@@ -509,8 +546,11 @@ Geometry3DTileContent.prototype.update = function (tileset, frameState) {
509
546
  this._geometries.debugWireframe = this._tileset.debugWireframe;
510
547
  this._geometries.update(frameState);
511
548
  }
512
- if (defined(this._batchTable) && this._geometries._ready) {
549
+
550
+ if (defined(this._batchTable) && this._geometries.ready) {
513
551
  this._batchTable.update(tileset, frameState);
552
+ this._ready = true;
553
+ this._resolveContent(this);
514
554
  }
515
555
  };
516
556
 
@@ -436,6 +436,7 @@ Object.defineProperties(Globe.prototype, {
436
436
  return true;
437
437
  }
438
438
  return (
439
+ // ready is deprecated. This is here for backwards compatibility
439
440
  this._surface.tileProvider.ready &&
440
441
  this._surface._tileLoadQueueHigh.length === 0 &&
441
442
  this._surface._tileLoadQueueMedium.length === 0 &&
@@ -984,7 +985,10 @@ Globe.prototype.beginFrame = function (frameState) {
984
985
  const terrainProvider = this.terrainProvider;
985
986
  const hasWaterMask =
986
987
  this.showWaterEffect &&
987
- terrainProvider.ready &&
988
+ defined(terrainProvider) &&
989
+ terrainProvider.hasWaterMask &&
990
+ // ready is deprecated; This is here for backwards compatibility
991
+ terrainProvider._ready &&
988
992
  terrainProvider.hasWaterMask;
989
993
 
990
994
  if (hasWaterMask && this._oceanNormalMapResourceDirty) {
@@ -345,7 +345,8 @@ GlobeSurfaceTile.prototype.processImagery = function (
345
345
 
346
346
  if (tileImagery.loadingImagery.state === ImageryState.PLACEHOLDER) {
347
347
  const imageryLayer = tileImagery.loadingImagery.imageryLayer;
348
- if (imageryLayer.imageryProvider.ready) {
348
+ // ImageryProvider.ready is deprecated. This is here for backwards compatibility
349
+ if (imageryLayer.ready && imageryLayer.imageryProvider._ready) {
349
350
  // Remove the placeholder and add the actual skeletons (if any)
350
351
  // at the same position. Then continue the loop at the same index.
351
352
  tileImagery.freeResources();