Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tileset.extensions getter #8829

Merged
merged 4 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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