@cesium/engine 13.0.0 → 14.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 (150) hide show
  1. package/Build/Workers/{chunk-BZMHXDKV.js → chunk-3JBEPBPL.js} +13 -13
  2. package/Build/Workers/{chunk-W2E67GLE.js → chunk-3LYROPON.js} +13 -13
  3. package/Build/Workers/{chunk-3ZMTG4X5.js → chunk-3PIZQT3I.js} +4 -4
  4. package/Build/Workers/{chunk-Q4MTXEB7.js → chunk-3QLSKXKF.js} +6 -6
  5. package/Build/Workers/{chunk-EXDSJZ7J.js → chunk-4CHMVQTQ.js} +4 -4
  6. package/Build/Workers/{chunk-2TSF7N76.js → chunk-5KWRW7YL.js} +2 -2
  7. package/Build/Workers/{chunk-KRCUHV7P.js → chunk-5S5OOA6U.js} +1 -1
  8. package/Build/Workers/{chunk-MSKD73KW.js → chunk-77XPS7ZA.js} +10 -10
  9. package/Build/Workers/{chunk-2IIE2UZ3.js → chunk-7EO56M5R.js} +2 -2
  10. package/Build/Workers/{chunk-H7BML7HH.js → chunk-7UHKH6M3.js} +6 -6
  11. package/Build/Workers/{chunk-KCCTLUKK.js → chunk-7ZB2RVIQ.js} +10 -10
  12. package/Build/Workers/{chunk-OUIF26MQ.js → chunk-B4GSRXE3.js} +6 -6
  13. package/Build/Workers/{chunk-D3VPMNUR.js → chunk-CI2HEJFC.js} +13 -13
  14. package/Build/Workers/{chunk-Z7OYBX6P.js → chunk-D7ZBZPHV.js} +5 -5
  15. package/Build/Workers/{chunk-GJZQSAES.js → chunk-DT5NFR5C.js} +7 -7
  16. package/Build/Workers/{chunk-ZIWULRRD.js → chunk-ED6GLQTK.js} +1 -1
  17. package/Build/Workers/{chunk-CQDSGG3R.js → chunk-EWDGNOJE.js} +7 -7
  18. package/Build/Workers/{chunk-RGZWZ4PP.js → chunk-F4CUH4MR.js} +4 -4
  19. package/Build/Workers/{chunk-6HWW6KNV.js → chunk-FFBJDW4A.js} +6 -6
  20. package/Build/Workers/{chunk-FLPIQK2R.js → chunk-FX4R4MTH.js} +6 -6
  21. package/Build/Workers/{chunk-2OD54CUD.js → chunk-FYGLNDKG.js} +7 -7
  22. package/Build/Workers/{chunk-YDEZMDB7.js → chunk-G3BVMPWG.js} +2 -2
  23. package/Build/Workers/{chunk-YBDL7YPF.js → chunk-HEZHXDYB.js} +1 -1
  24. package/Build/Workers/{chunk-RIQGQMS4.js → chunk-HKHQ3EDR.js} +4 -4
  25. package/Build/Workers/{chunk-PMNQULFU.js → chunk-HUFQVUMY.js} +7 -7
  26. package/Build/Workers/{chunk-6ZOS2ACR.js → chunk-J7IH4EYI.js} +7 -7
  27. package/Build/Workers/{chunk-RR4M3ZGF.js → chunk-JHBPC4LK.js} +7 -7
  28. package/Build/Workers/{chunk-WXJY6NDI.js → chunk-JPDKYBLF.js} +13 -13
  29. package/Build/Workers/{chunk-W2DVQETH.js → chunk-K4AH3TDT.js} +35 -21
  30. package/Build/Workers/{chunk-S4SCKDK4.js → chunk-KHWLAQVA.js} +1 -1
  31. package/Build/Workers/{chunk-XQP37R5E.js → chunk-KM6MITPF.js} +5 -5
  32. package/Build/Workers/{chunk-H4Y7ADFL.js → chunk-KSYBJA4M.js} +5 -5
  33. package/Build/Workers/{chunk-3VHIUS7I.js → chunk-LJBJM6VI.js} +6 -6
  34. package/Build/Workers/{chunk-MMILY4S7.js → chunk-LNSWJ43X.js} +11 -11
  35. package/Build/Workers/{chunk-CUMDCSMT.js → chunk-LOZ4NKY3.js} +11 -11
  36. package/Build/Workers/{chunk-4IM6WQEI.js → chunk-LS3KVHYY.js} +6 -6
  37. package/Build/Workers/{chunk-GBXJIWAZ.js → chunk-MVM4JV5U.js} +9 -9
  38. package/Build/Workers/{chunk-HMMPNR4Z.js → chunk-N2XAJBC6.js} +12 -12
  39. package/Build/Workers/{chunk-FANORJU6.js → chunk-OMXHEJTK.js} +2 -2
  40. package/Build/Workers/{chunk-GNG3V432.js → chunk-PWF4EY5P.js} +4 -4
  41. package/Build/Workers/{chunk-KKVKSTWC.js → chunk-Q4ZVWJXX.js} +5 -5
  42. package/Build/Workers/{chunk-RC5N5SJL.js → chunk-SDIDRZDG.js} +7 -7
  43. package/Build/Workers/{chunk-BLTSMJIP.js → chunk-TVL3F7IU.js} +1 -1
  44. package/Build/Workers/{chunk-22NU5WU5.js → chunk-TY4DKOWR.js} +2 -2
  45. package/Build/Workers/{chunk-DIAH2ZTB.js → chunk-VCNOFQYH.js} +9 -9
  46. package/Build/Workers/{chunk-BFNZUP2C.js → chunk-WEHZP4SE.js} +14 -13
  47. package/Build/Workers/{chunk-PD2MCNV7.js → chunk-WVNLSTOF.js} +2 -2
  48. package/Build/Workers/{chunk-T5H7YWC7.js → chunk-XK4OP6VA.js} +17 -17
  49. package/Build/Workers/{chunk-NVFEDMX4.js → chunk-YJX7X577.js} +15 -15
  50. package/Build/Workers/{chunk-4HS475MU.js → chunk-Z3QWTHI7.js} +14 -14
  51. package/Build/Workers/{chunk-OZZD3VY4.js → chunk-ZGFIT57T.js} +17 -17
  52. package/Build/Workers/{chunk-JISDBAYP.js → chunk-ZMNLEL6W.js} +5 -5
  53. package/Build/Workers/combineGeometry.js +22 -22
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +22 -22
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +30 -30
  75. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +25 -25
  80. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  91. package/Build/Workers/createVerticesFromHeightmap.js +20 -20
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +15 -14
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +7 -7
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Core/Check.d.ts +2 -1
  102. package/Source/Core/Color.js +3 -3
  103. package/Source/Core/Credit.js +3 -3
  104. package/Source/Core/DistanceDisplayCondition.js +3 -3
  105. package/Source/Core/ITwinPlatform.js +3 -38
  106. package/Source/Core/Ion.js +1 -1
  107. package/Source/Core/JulianDate.js +14 -7
  108. package/Source/Core/OrientedBoundingBox.js +2 -2
  109. package/Source/Core/Spherical.js +3 -3
  110. package/Source/Core/defined.d.ts +11 -0
  111. package/Source/Core/writeTextToCanvas.js +0 -1
  112. package/Source/DataSources/BoundingSphereState.js +3 -3
  113. package/Source/DataSources/DataSourceClock.js +1 -1
  114. package/Source/DataSources/DataSourceDisplay.js +5 -2
  115. package/Source/DataSources/ModelGraphics.js +23 -1
  116. package/Source/DataSources/ModelVisualizer.js +22 -1
  117. package/Source/Renderer/AutomaticUniforms.js +2 -2
  118. package/Source/Scene/ArcGisMapService.js +1 -1
  119. package/Source/Scene/Billboard.js +1 -1
  120. package/Source/Scene/Cesium3DTile.js +56 -28
  121. package/Source/Scene/Cesium3DTilesVoxelProvider.js +17 -0
  122. package/Source/Scene/Cesium3DTileset.js +1 -1
  123. package/Source/Scene/ClippingPolygon.js +2 -2
  124. package/Source/Scene/DynamicEnvironmentMapManager.js +123 -66
  125. package/Source/Scene/GltfDracoLoader.js +45 -0
  126. package/Source/Scene/GltfIndexBufferLoader.js +5 -0
  127. package/Source/Scene/GltfLoader.js +17 -2
  128. package/Source/Scene/GltfVertexBufferLoader.js +13 -0
  129. package/Source/Scene/ITwinData.js +116 -0
  130. package/Source/Scene/ImageryLayer.js +1 -1
  131. package/Source/Scene/Label.js +1 -1
  132. package/Source/Scene/LabelCollection.js +0 -11
  133. package/Source/Scene/Model/Model.js +1 -1
  134. package/Source/Scene/Multiple3DTileContent.js +21 -8
  135. package/Source/Scene/PointPrimitive.js +1 -1
  136. package/Source/Scene/ResourceCache.js +17 -1
  137. package/Source/Scene/VoxelPrimitive.js +124 -0
  138. package/Source/Scene/VoxelProvider.js +10 -0
  139. package/Source/Scene/VoxelTraversal.js +88 -12
  140. package/Source/Scene/WebMapTileServiceImageryProvider.js +2 -2
  141. package/Source/Scene/createGooglePhotorealistic3DTileset.js +5 -8
  142. package/Source/Shaders/DepthPlaneVS.glsl +1 -1
  143. package/Source/Shaders/DepthPlaneVS.js +1 -1
  144. package/Source/Shaders/PolylineCommon.glsl +1 -1
  145. package/Source/Shaders/PolylineCommon.js +1 -1
  146. package/Source/Widget/CesiumWidget.js +16 -10
  147. package/Source/Workers/decodeDraco.js +4 -4
  148. package/index.d.ts +178 -42
  149. package/index.js +247 -247
  150. package/package.json +1 -1
@@ -26,6 +26,7 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
26
26
  * @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
27
27
  * @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
28
28
  * @param {number} [options.bufferViewId] The bufferView ID corresponding to the vertex buffer.
29
+ * @param {object} [options.primitive] The primitive containing the Draco extension.
29
30
  * @param {object} [options.draco] The Draco extension object.
30
31
  * @param {string} [options.attributeSemantic] The attribute semantic, e.g. POSITION or NORMAL.
31
32
  * @param {number} [options.accessorId] The accessor id.
@@ -47,6 +48,7 @@ function GltfVertexBufferLoader(options) {
47
48
  const gltfResource = options.gltfResource;
48
49
  const baseResource = options.baseResource;
49
50
  const bufferViewId = options.bufferViewId;
51
+ const primitive = options.primitive;
50
52
  const draco = options.draco;
51
53
  const attributeSemantic = options.attributeSemantic;
52
54
  const accessorId = options.accessorId;
@@ -67,6 +69,7 @@ function GltfVertexBufferLoader(options) {
67
69
  }
68
70
 
69
71
  const hasBufferViewId = defined(bufferViewId);
72
+ const hasPrimitive = defined(primitive);
70
73
  const hasDraco = hasDracoCompression(draco, attributeSemantic);
71
74
  const hasAttributeSemantic = defined(attributeSemantic);
72
75
  const hasAccessorId = defined(accessorId);
@@ -89,7 +92,14 @@ function GltfVertexBufferLoader(options) {
89
92
  );
90
93
  }
91
94
 
95
+ if (hasDraco && !hasPrimitive) {
96
+ throw new DeveloperError(
97
+ "When options.draco is defined options.primitive must also be defined.",
98
+ );
99
+ }
100
+
92
101
  if (hasDraco) {
102
+ Check.typeOf.object("options.primitive", primitive);
93
103
  Check.typeOf.object("options.draco", draco);
94
104
  Check.typeOf.string("options.attributeSemantic", attributeSemantic);
95
105
  Check.typeOf.number("options.accessorId", accessorId);
@@ -101,6 +111,7 @@ function GltfVertexBufferLoader(options) {
101
111
  this._baseResource = baseResource;
102
112
  this._gltf = gltf;
103
113
  this._bufferViewId = bufferViewId;
114
+ this._primitive = primitive;
104
115
  this._draco = draco;
105
116
  this._attributeSemantic = attributeSemantic;
106
117
  this._accessorId = accessorId;
@@ -265,6 +276,7 @@ async function loadFromDraco(vertexBufferLoader) {
265
276
  try {
266
277
  const dracoLoader = resourceCache.getDracoLoader({
267
278
  gltf: vertexBufferLoader._gltf,
279
+ primitive: vertexBufferLoader._primitive,
268
280
  draco: vertexBufferLoader._draco,
269
281
  gltfResource: vertexBufferLoader._gltfResource,
270
282
  baseResource: vertexBufferLoader._baseResource,
@@ -467,6 +479,7 @@ GltfVertexBufferLoader.prototype.unload = function () {
467
479
  this._typedArray = undefined;
468
480
  this._buffer = undefined;
469
481
  this._gltf = undefined;
482
+ this._primitive = undefined;
470
483
  };
471
484
 
472
485
  export default GltfVertexBufferLoader;
@@ -4,6 +4,9 @@ import Resource from "../Core/Resource.js";
4
4
  import ITwinPlatform from "../Core/ITwinPlatform.js";
5
5
  import RuntimeError from "../Core/RuntimeError.js";
6
6
  import Check from "../Core/Check.js";
7
+ import KmlDataSource from "../DataSources/KmlDataSource.js";
8
+ import GeoJsonDataSource from "../DataSources/GeoJsonDataSource.js";
9
+ import DeveloperError from "../Core/DeveloperError.js";
7
10
 
8
11
  /**
9
12
  * Methods for loading iTwin platform data into CesiumJS
@@ -86,6 +89,8 @@ ITwinData.createTilesetFromIModelId = async function (iModelId, options) {
86
89
  * @param {ITwinPlatform.RealityDataType} [type] The type of this reality data
87
90
  * @param {string} [rootDocument] The path of the root document for this reality data
88
91
  * @returns {Promise<Cesium3DTileset>}
92
+ *
93
+ * @throws {RuntimeError} if the type of reality data is not supported by this function
89
94
  */
90
95
  ITwinData.createTilesetForRealityDataId = async function (
91
96
  iTwinId,
@@ -135,4 +140,115 @@ ITwinData.createTilesetForRealityDataId = async function (
135
140
  });
136
141
  };
137
142
 
143
+ /**
144
+ * Create a data source of the correct type for the specified reality data id.
145
+ * This function only works for KML and GeoJSON type data.
146
+ *
147
+ * If the <code>type</code> or <code>rootDocument</code> are not provided this function
148
+ * will first request the full metadata for the specified reality data to fill these values.
149
+ *
150
+ * @param {string} iTwinId The id of the iTwin to load data from
151
+ * @param {string} realityDataId The id of the reality data to load
152
+ * @param {ITwinPlatform.RealityDataType} [type] The type of this reality data
153
+ * @param {string} [rootDocument] The path of the root document for this reality data
154
+ * @returns {Promise<GeoJsonDataSource | KmlDataSource>}
155
+ *
156
+ * @throws {RuntimeError} if the type of reality data is not supported by this function
157
+ */
158
+ ITwinData.createDataSourceForRealityDataId = async function (
159
+ iTwinId,
160
+ realityDataId,
161
+ type,
162
+ rootDocument,
163
+ ) {
164
+ //>>includeStart('debug', pragmas.debug);
165
+ Check.typeOf.string("iTwinId", iTwinId);
166
+ Check.typeOf.string("realityDataId", realityDataId);
167
+ if (defined(type)) {
168
+ Check.typeOf.string("type", type);
169
+ }
170
+ if (defined(rootDocument)) {
171
+ Check.typeOf.string("rootDocument", rootDocument);
172
+ }
173
+ //>>includeEnd('debug')
174
+
175
+ if (!defined(type) || !defined(rootDocument)) {
176
+ const metadata = await ITwinPlatform.getRealityDataMetadata(
177
+ iTwinId,
178
+ realityDataId,
179
+ );
180
+ rootDocument = metadata.rootDocument;
181
+ type = metadata.type;
182
+ }
183
+
184
+ const supportedRealityDataTypes = [
185
+ ITwinPlatform.RealityDataType.KML,
186
+ ITwinPlatform.RealityDataType.GeoJSON,
187
+ ];
188
+
189
+ if (!supportedRealityDataTypes.includes(type)) {
190
+ throw new RuntimeError(
191
+ `Reality data type is not a data source type: ${type}`,
192
+ );
193
+ }
194
+
195
+ const tilesetAccessUrl = await ITwinPlatform.getRealityDataURL(
196
+ iTwinId,
197
+ realityDataId,
198
+ rootDocument,
199
+ );
200
+
201
+ if (type === ITwinPlatform.RealityDataType.GeoJSON) {
202
+ return GeoJsonDataSource.load(tilesetAccessUrl);
203
+ }
204
+
205
+ // If we get here it's guaranteed to be a KML type
206
+ return KmlDataSource.load(tilesetAccessUrl);
207
+ };
208
+
209
+ /**
210
+ * Load data from the Geospatial Features API as GeoJSON.
211
+ *
212
+ * @param {string} iTwinId The id of the iTwin to load data from
213
+ * @param {string} collectionId The id of the data collection to load
214
+ * @param {number} [limit=10000] number of items per page, must be between 1 and 10,000 inclusive
215
+ * @returns {Promise<GeoJsonDataSource>}
216
+ */
217
+ ITwinData.loadGeospatialFeatures = async function (
218
+ iTwinId,
219
+ collectionId,
220
+ limit,
221
+ ) {
222
+ //>>includeStart('debug', pragmas.debug);
223
+ Check.typeOf.string("iTwinId", iTwinId);
224
+ Check.typeOf.string("collectionId", collectionId);
225
+ if (defined(limit)) {
226
+ Check.typeOf.number("limit", limit);
227
+ Check.typeOf.number.lessThanOrEquals("limit", limit, 10000);
228
+ Check.typeOf.number.greaterThanOrEquals("limit", limit, 1);
229
+ }
230
+ if (!defined(ITwinPlatform.defaultAccessToken)) {
231
+ throw new DeveloperError("Must set ITwinPlatform.defaultAccessToken first");
232
+ }
233
+ //>>includeEnd('debug')
234
+
235
+ const pageLimit = limit ?? 10000;
236
+
237
+ const tilesetUrl = `${ITwinPlatform.apiEndpoint}geospatial-features/itwins/${iTwinId}/ogc/collections/${collectionId}/items`;
238
+
239
+ const resource = new Resource({
240
+ url: tilesetUrl,
241
+ headers: {
242
+ Authorization: `Bearer ${ITwinPlatform.defaultAccessToken}`,
243
+ Accept: "application/vnd.bentley.itwin-platform.v1+json",
244
+ },
245
+ queryParameters: {
246
+ limit: pageLimit,
247
+ client: "CesiumJS",
248
+ },
249
+ });
250
+
251
+ return GeoJsonDataSource.load(resource);
252
+ };
253
+
138
254
  export default ITwinData;
@@ -511,7 +511,7 @@ ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 0.004;
511
511
  * Create a new imagery layer from an asynchronous imagery provider. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
512
512
  *
513
513
  * @param {Promise<ImageryProvider>} imageryProviderPromise A promise which resolves to a imagery provider
514
- * @param {ImageryLayer.ConstructorOptions} options An object describing initialization options
514
+ * @param {ImageryLayer.ConstructorOptions} [options] An object describing initialization options
515
515
  * @returns {ImageryLayer} The created imagery layer.
516
516
  *
517
517
  * @example
@@ -1364,7 +1364,7 @@ Label.filterUnsupportedCharacters = function (text) {
1364
1364
  * Determines if this label equals another label. Labels are equal if all their properties
1365
1365
  * are equal. Labels in different collections can be equal.
1366
1366
  *
1367
- * @param {Label} other The label to compare for equality.
1367
+ * @param {Label} [other] The label to compare for equality.
1368
1368
  * @returns {boolean} <code>true</code> if the labels are equal; otherwise, <code>false</code>.
1369
1369
  */
1370
1370
  Label.prototype.equals = function (other) {
@@ -68,7 +68,6 @@ function createGlyphCanvas(
68
68
  outlineColor,
69
69
  outlineWidth,
70
70
  style,
71
- verticalOrigin,
72
71
  ) {
73
72
  writeTextToCanvasParameters.font = font;
74
73
  writeTextToCanvasParameters.fillColor = fillColor;
@@ -77,15 +76,6 @@ function createGlyphCanvas(
77
76
  // Setting the padding to something bigger is necessary to get enough space for the outlining.
78
77
  writeTextToCanvasParameters.padding = SDFSettings.PADDING;
79
78
 
80
- if (verticalOrigin === VerticalOrigin.CENTER) {
81
- writeTextToCanvasParameters.textBaseline = "middle";
82
- } else if (verticalOrigin === VerticalOrigin.TOP) {
83
- writeTextToCanvasParameters.textBaseline = "top";
84
- } else {
85
- // VerticalOrigin.BOTTOM and VerticalOrigin.BASELINE
86
- writeTextToCanvasParameters.textBaseline = "bottom";
87
- }
88
-
89
79
  writeTextToCanvasParameters.fill =
90
80
  style === LabelStyle.FILL || style === LabelStyle.FILL_AND_OUTLINE;
91
81
  writeTextToCanvasParameters.stroke =
@@ -211,7 +201,6 @@ function rebindAllGlyphs(labelCollection, label) {
211
201
  Color.WHITE,
212
202
  0.0,
213
203
  LabelStyle.FILL,
214
- verticalOrigin,
215
204
  );
216
205
 
217
206
  glyphTextureInfo = new GlyphTextureInfo(
@@ -1823,7 +1823,7 @@ Model.prototype.applyArticulations = function () {
1823
1823
  *
1824
1824
  * The given name may be the name of a glTF extension, like `"EXT_example_extension"`.
1825
1825
  * If the specified extension was present in the root of the underlying glTF asset,
1826
- * and a loder for the specified extension has processed the extension data, then
1826
+ * and a loader for the specified extension has processed the extension data, then
1827
1827
  * this will return the model representation of the extension.
1828
1828
  *
1829
1829
  * @param {string} extensionName The name of the extension
@@ -6,7 +6,6 @@ import Request from "../Core/Request.js";
6
6
  import RequestScheduler from "../Core/RequestScheduler.js";
7
7
  import RequestState from "../Core/RequestState.js";
8
8
  import RequestType from "../Core/RequestType.js";
9
- import RuntimeError from "../Core/RuntimeError.js";
10
9
  import Cesium3DContentGroup from "./Cesium3DContentGroup.js";
11
10
  import Cesium3DTileContentType from "./Cesium3DTileContentType.js";
12
11
  import Cesium3DTileContentFactory from "./Cesium3DTileContentFactory.js";
@@ -52,6 +51,11 @@ function Multiple3DTileContent(tileset, tile, tilesetResource, contentsJson) {
52
51
  // used to help short-circuit computations after a tile was canceled.
53
52
  this._cancelCount = 0;
54
53
 
54
+ // The number of contents that turned out to be external tilesets
55
+ // in createInnerContent. When all contents are external tilesets,
56
+ // then tile.hasRenderableContent will become `false`
57
+ this._externalTilesetCount = 0;
58
+
55
59
  const contentCount = this._innerContentHeaders.length;
56
60
  this._arrayFetchPromises = new Array(contentCount);
57
61
  this._requests = new Array(contentCount);
@@ -505,6 +509,16 @@ async function createInnerContents(multipleContents) {
505
509
  const contents = await Promise.all(promises);
506
510
  multipleContents._contentsCreated = true;
507
511
  multipleContents._contents = contents.filter(defined);
512
+
513
+ // If each content is an external tileset, then the tile
514
+ // itself does not have any renderable content
515
+ if (
516
+ multipleContents._externalTilesetCount === multipleContents._contents.length
517
+ ) {
518
+ const tile = multipleContents._tile;
519
+ tile.hasRenderableContent = false;
520
+ }
521
+
508
522
  return contents;
509
523
  }
510
524
 
@@ -518,10 +532,13 @@ async function createInnerContent(multipleContents, arrayBuffer, index) {
518
532
  try {
519
533
  const preprocessed = preprocess3DTileContent(arrayBuffer);
520
534
 
535
+ const tileset = multipleContents._tileset;
536
+ const resource = multipleContents._innerContentResources[index];
537
+ const tile = multipleContents._tile;
538
+
521
539
  if (preprocessed.contentType === Cesium3DTileContentType.EXTERNAL_TILESET) {
522
- throw new RuntimeError(
523
- "External tilesets are disallowed inside multiple contents",
524
- );
540
+ multipleContents._externalTilesetCount++;
541
+ tile.hasTilesetContent = true;
525
542
  }
526
543
 
527
544
  multipleContents._disableSkipLevelOfDetail =
@@ -529,10 +546,6 @@ async function createInnerContent(multipleContents, arrayBuffer, index) {
529
546
  preprocessed.contentType === Cesium3DTileContentType.GEOMETRY ||
530
547
  preprocessed.contentType === Cesium3DTileContentType.VECTOR;
531
548
 
532
- const tileset = multipleContents._tileset;
533
- const resource = multipleContents._innerContentResources[index];
534
- const tile = multipleContents._tile;
535
-
536
549
  let content;
537
550
  const contentFactory = Cesium3DTileContentFactory[preprocessed.contentType];
538
551
  if (defined(preprocessed.binaryPayload)) {
@@ -665,7 +665,7 @@ PointPrimitive.getScreenSpaceBoundingBox = function (
665
665
  * Determines if this point equals another point. Points are equal if all their properties
666
666
  * are equal. Points in different collections can be equal.
667
667
  *
668
- * @param {PointPrimitive} other The point to compare for equality.
668
+ * @param {PointPrimitive} [other] The point to compare for equality.
669
669
  * @returns {boolean} <code>true</code> if the points are equal; otherwise, <code>false</code>.
670
670
  */
671
671
  PointPrimitive.prototype.equals = function (other) {
@@ -345,6 +345,7 @@ ResourceCache.getBufferViewLoader = function (options) {
345
345
  *
346
346
  * @param {object} options Object with the following properties:
347
347
  * @param {object} options.gltf The glTF JSON.
348
+ * @param {object} options.primitive The primitive containing the Draco extension.
348
349
  * @param {object} options.draco The Draco extension object.
349
350
  * @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
350
351
  * @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
@@ -354,10 +355,11 @@ ResourceCache.getBufferViewLoader = function (options) {
354
355
  */
355
356
  ResourceCache.getDracoLoader = function (options) {
356
357
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
357
- const { gltf, draco, gltfResource, baseResource } = options;
358
+ const { gltf, primitive, draco, gltfResource, baseResource } = options;
358
359
 
359
360
  //>>includeStart('debug', pragmas.debug);
360
361
  Check.typeOf.object("options.gltf", gltf);
362
+ Check.typeOf.object("options.primitive", primitive);
361
363
  Check.typeOf.object("options.draco", draco);
362
364
  Check.typeOf.object("options.gltfResource", gltfResource);
363
365
  Check.typeOf.object("options.baseResource", baseResource);
@@ -378,6 +380,7 @@ ResourceCache.getDracoLoader = function (options) {
378
380
  dracoLoader = new GltfDracoLoader({
379
381
  resourceCache: ResourceCache,
380
382
  gltf: gltf,
383
+ primitive: primitive,
381
384
  draco: draco,
382
385
  gltfResource: gltfResource,
383
386
  baseResource: baseResource,
@@ -396,6 +399,7 @@ ResourceCache.getDracoLoader = function (options) {
396
399
  * @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
397
400
  * @param {FrameState} options.frameState The frame state.
398
401
  * @param {number} [options.bufferViewId] The bufferView ID corresponding to the vertex buffer.
402
+ * @param {object} [options.primitive] The primitive containing the Draco extension.
399
403
  * @param {object} [options.draco] The Draco extension object.
400
404
  * @param {string} [options.attributeSemantic] The attribute semantic, e.g. POSITION or NORMAL.
401
405
  * @param {number} [options.accessorId] The accessor ID.
@@ -418,6 +422,7 @@ ResourceCache.getVertexBufferLoader = function (options) {
418
422
  baseResource,
419
423
  frameState,
420
424
  bufferViewId,
425
+ primitive,
421
426
  draco,
422
427
  attributeSemantic,
423
428
  accessorId,
@@ -439,6 +444,7 @@ ResourceCache.getVertexBufferLoader = function (options) {
439
444
  }
440
445
 
441
446
  const hasBufferViewId = defined(bufferViewId);
447
+ const hasPrimitive = defined(primitive);
442
448
  const hasDraco = hasDracoCompression(draco, attributeSemantic);
443
449
  const hasAttributeSemantic = defined(attributeSemantic);
444
450
  const hasAccessorId = defined(accessorId);
@@ -461,6 +467,12 @@ ResourceCache.getVertexBufferLoader = function (options) {
461
467
  );
462
468
  }
463
469
 
470
+ if (hasDraco && !hasPrimitive) {
471
+ throw new DeveloperError(
472
+ "When options.draco is defined options.primitive must also be defined.",
473
+ );
474
+ }
475
+
464
476
  if (hasDraco) {
465
477
  Check.typeOf.object("options.draco", draco);
466
478
  Check.typeOf.string("options.attributeSemantic", attributeSemantic);
@@ -492,6 +504,7 @@ ResourceCache.getVertexBufferLoader = function (options) {
492
504
  gltfResource: gltfResource,
493
505
  baseResource: baseResource,
494
506
  bufferViewId: bufferViewId,
507
+ primitive: primitive,
495
508
  draco: draco,
496
509
  attributeSemantic: attributeSemantic,
497
510
  accessorId: accessorId,
@@ -522,6 +535,7 @@ function hasDracoCompression(draco, semantic) {
522
535
  * @param {Resource} options.gltfResource The {@link Resource} containing the glTF.
523
536
  * @param {Resource} options.baseResource The {@link Resource} that paths in the glTF JSON are relative to.
524
537
  * @param {FrameState} options.frameState The frame state.
538
+ * @param {object} [options.primitive] The primitive containing the Draco extension.
525
539
  * @param {object} [options.draco] The Draco extension object.
526
540
  * @param {boolean} [options.asynchronous=true] Determines if WebGL resource creation will be spread out over several frames or block until all WebGL resources are created.
527
541
  * @param {boolean} [options.loadBuffer=false] Load index buffer as a GPU index buffer.
@@ -537,6 +551,7 @@ ResourceCache.getIndexBufferLoader = function (options) {
537
551
  gltfResource,
538
552
  baseResource,
539
553
  frameState,
554
+ primitive,
540
555
  draco,
541
556
  asynchronous = true,
542
557
  loadBuffer = false,
@@ -578,6 +593,7 @@ ResourceCache.getIndexBufferLoader = function (options) {
578
593
  accessorId: accessorId,
579
594
  gltfResource: gltfResource,
580
595
  baseResource: baseResource,
596
+ primitive: primitive,
581
597
  draco: draco,
582
598
  cacheKey: cacheKey,
583
599
  asynchronous: asynchronous,
@@ -25,6 +25,7 @@ import CustomShader from "./Model/CustomShader.js";
25
25
  import Cartographic from "../Core/Cartographic.js";
26
26
  import Ellipsoid from "../Core/Ellipsoid.js";
27
27
  import VerticalExaggeration from "../Core/VerticalExaggeration.js";
28
+ import Cesium3DTilesetStatistics from "./Cesium3DTilesetStatistics.js";
28
29
 
29
30
  /**
30
31
  * A primitive that renders voxel data from a {@link VoxelProvider}.
@@ -70,6 +71,12 @@ function VoxelPrimitive(options) {
70
71
  */
71
72
  this._traversal = undefined;
72
73
 
74
+ /**
75
+ * @type {Cesium3DTilesetStatistics}
76
+ * @private
77
+ */
78
+ this._statistics = new Cesium3DTilesetStatistics();
79
+
73
80
  /**
74
81
  * This member is not created until the provider is ready.
75
82
  *
@@ -450,6 +457,123 @@ function VoxelPrimitive(options) {
450
457
  }
451
458
  }
452
459
 
460
+ /**
461
+ * The event fired to indicate that a tile's content was loaded.
462
+ * <p>
463
+ * This event is fired during the tileset traversal while the frame is being rendered
464
+ * so that updates to the tile take effect in the same frame. Do not create or modify
465
+ * Cesium entities or primitives during the event listener.
466
+ * </p>
467
+ *
468
+ * @type {Event}
469
+ *
470
+ * @example
471
+ * voxelPrimitive.tileLoad.addEventListener(function() {
472
+ * console.log('A tile was loaded.');
473
+ * });
474
+ */
475
+ this.tileLoad = new Event();
476
+
477
+ /**
478
+ * This event fires once for each visible tile in a frame.
479
+ * <p>
480
+ * This event is fired during the traversal while the frame is being rendered.
481
+ *
482
+ * @type {Event}
483
+ *
484
+ * @example
485
+ * voxelPrimitive.tileVisible.addEventListener(function() {
486
+ * console.log('A tile is visible.');
487
+ * });
488
+ *
489
+ */
490
+ this.tileVisible = new Event();
491
+
492
+ /**
493
+ * The event fired to indicate that a tile's content failed to load.
494
+ *
495
+ * @type {Event}
496
+ *
497
+ * @example
498
+ * voxelPrimitive.tileFailed.addEventListener(function() {
499
+ * console.log('An error occurred loading tile.');
500
+ * });
501
+ */
502
+ this.tileFailed = new Event();
503
+
504
+ /**
505
+ * The event fired to indicate that a tile's content was unloaded.
506
+ *
507
+ * @type {Event}
508
+ *
509
+ * @example
510
+ * voxelPrimitive.tileUnload.addEventListener(function() {
511
+ * console.log('A tile was unloaded from the cache.');
512
+ * });
513
+ *
514
+ */
515
+ this.tileUnload = new Event();
516
+
517
+ /**
518
+ * The event fired to indicate progress of loading new tiles. This event is fired when a new tile
519
+ * is requested, when a requested tile is finished downloading, and when a downloaded tile has been
520
+ * processed and is ready to render.
521
+ * <p>
522
+ * The number of pending tile requests, <code>numberOfPendingRequests</code>, and number of tiles
523
+ * processing, <code>numberOfTilesProcessing</code> are passed to the event listener.
524
+ * </p>
525
+ * <p>
526
+ * This event is fired at the end of the frame after the scene is rendered.
527
+ * </p>
528
+ *
529
+ * @type {Event}
530
+ *
531
+ * @example
532
+ * voxelPrimitive.loadProgress.addEventListener(function(numberOfPendingRequests, numberOfTilesProcessing) {
533
+ * if ((numberOfPendingRequests === 0) && (numberOfTilesProcessing === 0)) {
534
+ * console.log('Finished loading');
535
+ * return;
536
+ * }
537
+ *
538
+ * console.log(`Loading: requests: ${numberOfPendingRequests}, processing: ${numberOfTilesProcessing}`);
539
+ * });
540
+ */
541
+ this.loadProgress = new Event();
542
+
543
+ /**
544
+ * The event fired to indicate that all tiles that meet the screen space error this frame are loaded. The voxel
545
+ * primitive is completely loaded for this view.
546
+ * <p>
547
+ * This event is fired at the end of the frame after the scene is rendered.
548
+ * </p>
549
+ *
550
+ * @type {Event}
551
+ *
552
+ * @example
553
+ * voxelPrimitive.allTilesLoaded.addEventListener(function() {
554
+ * console.log('All tiles are loaded');
555
+ * });
556
+ */
557
+ this.allTilesLoaded = new Event();
558
+
559
+ /**
560
+ * The event fired to indicate that all tiles that meet the screen space error this frame are loaded. This event
561
+ * is fired once when all tiles in the initial view are loaded.
562
+ * <p>
563
+ * This event is fired at the end of the frame after the scene is rendered.
564
+ * </p>
565
+ *
566
+ * @type {Event}
567
+ *
568
+ * @example
569
+ * voxelPrimitive.initialTilesLoaded.addEventListener(function() {
570
+ * console.log('Initial tiles are loaded');
571
+ * });
572
+ *
573
+ * @see Cesium3DTileset#allTilesLoaded
574
+ */
575
+ this.initialTilesLoaded = new Event();
576
+
453
577
  // If the provider fails to initialize the primitive will fail too.
454
578
  const provider = this._provider;
455
579
  initialize(this, provider);
@@ -186,6 +186,16 @@ Object.defineProperties(VoxelProvider.prototype, {
186
186
  get: DeveloperError.throwInstantiationError,
187
187
  },
188
188
 
189
+ /**
190
+ * The number of levels of detail containing available tiles in the tileset.
191
+ *
192
+ * @type {number|undefined}
193
+ * @readonly
194
+ */
195
+ availableLevels: {
196
+ get: DeveloperError.throwInstantiationError,
197
+ },
198
+
189
199
  /**
190
200
  * Gets the number of keyframes in the dataset.
191
201
  * This should not be called before {@link VoxelProvider#ready} returns true.