Skip to content

Commit 8b5539f

Browse files
authored
Add tileset.extensions getter (#8829)
* Added tileset.extensions getter * Update CHANGES.md * Add tests * Update CHANGES.md
1 parent d5b4cc4 commit 8b5539f

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
### 1.70.0 - 2020-06-01
44

5+
##### Additions :tada:
6+
7+
- Added `Cesium3DTileset.extensions` to get the extensions property from the tileset JSON. [#8829](https://github.com/CesiumGS/cesium/pull/8829)
8+
59
##### Fixes :wrench:
610

711
- This fixes a bug where a removed billboard can prevent changing of the terrainProvider [#8766](https://github.com/CesiumGS/cesium/pull/8766)

Source/Scene/Cesium3DTileset.js

+27
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ function Cesium3DTileset(options) {
147147
this._properties = undefined; // Metadata for per-model/point/etc properties
148148
this._geometricError = undefined; // Geometric error when the tree is not rendered at all
149149
this._extensionsUsed = undefined;
150+
this._extensions = undefined;
150151
this._gltfUpAxis = undefined;
151152
this._cache = new Cesium3DTilesetCache();
152153
this._processingQueue = [];
@@ -916,6 +917,7 @@ function Cesium3DTileset(options) {
916917
that._properties = tilesetJson.properties;
917918
that._geometricError = tilesetJson.geometricError;
918919
that._extensionsUsed = tilesetJson.extensionsUsed;
920+
that._extensions = tilesetJson.extensions;
919921
that._gltfUpAxis = gltfUpAxis;
920922
that._extras = tilesetJson.extras;
921923

@@ -1010,6 +1012,31 @@ Object.defineProperties(Cesium3DTileset.prototype, {
10101012
return this._asset;
10111013
},
10121014
},
1015+
1016+
/**
1017+
* Gets the tileset's extensions object property.
1018+
*
1019+
* @memberof Cesium3DTileset.prototype
1020+
*
1021+
* @type {Object}
1022+
* @readonly
1023+
*
1024+
* @exception {DeveloperError} The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.
1025+
*/
1026+
extensions: {
1027+
get: function () {
1028+
//>>includeStart('debug', pragmas.debug);
1029+
if (!this.ready) {
1030+
throw new DeveloperError(
1031+
"The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
1032+
);
1033+
}
1034+
//>>includeEnd('debug');
1035+
1036+
return this._extensions;
1037+
},
1038+
},
1039+
10131040
/**
10141041
* The {@link ClippingPlaneCollection} used to selectively disable rendering the tileset.
10151042
*

Specs/Scene/Cesium3DTilesetSpec.js

+9
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,15 @@ describe(
496496
}).toThrowDeveloperError();
497497
});
498498

499+
it("throws when getting extensions and tileset is not ready", function () {
500+
var tileset = new Cesium3DTileset({
501+
url: tilesetUrl,
502+
});
503+
expect(function () {
504+
return tileset.extensions;
505+
}).toThrowDeveloperError();
506+
});
507+
499508
it("throws when getting properties and tileset is not ready", function () {
500509
var tileset = new Cesium3DTileset({
501510
url: tilesetUrl,

0 commit comments

Comments
 (0)