Skip to content

Commit

Permalink
Add tileset.extensions getter (#8829)
Browse files Browse the repository at this point in the history
* Added tileset.extensions getter

* Update CHANGES.md

* Add tests

* Update CHANGES.md
  • Loading branch information
lilleyse authored May 7, 2020
1 parent d5b4cc4 commit 8b5539f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### 1.70.0 - 2020-06-01

##### Additions :tada:

- Added `Cesium3DTileset.extensions` to get the extensions property from the tileset JSON. [#8829](https://github.com/CesiumGS/cesium/pull/8829)

##### Fixes :wrench:

- This fixes a bug where a removed billboard can prevent changing of the terrainProvider [#8766](https://github.com/CesiumGS/cesium/pull/8766)
Expand Down
27 changes: 27 additions & 0 deletions Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function Cesium3DTileset(options) {
this._properties = undefined; // Metadata for per-model/point/etc properties
this._geometricError = undefined; // Geometric error when the tree is not rendered at all
this._extensionsUsed = undefined;
this._extensions = undefined;
this._gltfUpAxis = undefined;
this._cache = new Cesium3DTilesetCache();
this._processingQueue = [];
Expand Down Expand Up @@ -916,6 +917,7 @@ function Cesium3DTileset(options) {
that._properties = tilesetJson.properties;
that._geometricError = tilesetJson.geometricError;
that._extensionsUsed = tilesetJson.extensionsUsed;
that._extensions = tilesetJson.extensions;
that._gltfUpAxis = gltfUpAxis;
that._extras = tilesetJson.extras;

Expand Down Expand Up @@ -1010,6 +1012,31 @@ Object.defineProperties(Cesium3DTileset.prototype, {
return this._asset;
},
},

/**
* Gets the tileset's extensions object property.
*
* @memberof Cesium3DTileset.prototype
*
* @type {Object}
* @readonly
*
* @exception {DeveloperError} The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.
*/
extensions: {
get: function () {
//>>includeStart('debug', pragmas.debug);
if (!this.ready) {
throw new DeveloperError(
"The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
);
}
//>>includeEnd('debug');

return this._extensions;
},
},

/**
* The {@link ClippingPlaneCollection} used to selectively disable rendering the tileset.
*
Expand Down
9 changes: 9 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,15 @@ describe(
}).toThrowDeveloperError();
});

it("throws when getting extensions and tileset is not ready", function () {
var tileset = new Cesium3DTileset({
url: tilesetUrl,
});
expect(function () {
return tileset.extensions;
}).toThrowDeveloperError();
});

it("throws when getting properties and tileset is not ready", function () {
var tileset = new Cesium3DTileset({
url: tilesetUrl,
Expand Down

0 comments on commit 8b5539f

Please sign in to comment.