import Check from "../Core/Check.js"; import defaultValue from "../Core/defaultValue.js"; import defined from "../Core/defined.js"; /** * An object containing structural metadata. *
* See the {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadatas|EXT_structural_metadata Extension} as well as the * previous {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata|EXT_feature_metadata Extension} for glTF. *
* * @param {Object} options Object with the following properties: * @param {MetadataSchema} options.schema The parsed schema. * @param {PropertyTable[]} [options.propertyTables] An array of property table objects. For the legacyEXT_feature_metadata
extension, this is sorted by the key in the propertyTables dictionary
* @param {PropertyTexture[]} [options.propertyTextures] An array of property texture objects. For the legacy EXT_feature_metadata
extension, this is sorted by the key in the propertyTextures dictionary
* @param {PropertyAttribute[]} [options.propertyAttributes] An array of property attribute objects. This is new in EXT_structural_metadata
* @param {Object} [options.statistics] Statistics about metadata
* @param {Object} [options.extras] Extra user-defined properties
* @param {Object} [options.extensions] An object containing extensions
*
* @alias StructuralMetadata
* @constructor
*
* @private
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
*/
function StructuralMetadata(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
//>>includeStart('debug', pragmas.debug);
Check.typeOf.object("options.schema", options.schema);
//>>includeEnd('debug');
this._schema = options.schema;
const propertyTables = options.propertyTables;
this._propertyTableCount = defined(propertyTables)
? propertyTables.length
: 0;
this._propertyTables = propertyTables;
this._propertyTextures = options.propertyTextures;
this._propertyAttributes = options.propertyAttributes;
this._statistics = options.statistics;
this._extras = options.extras;
this._extensions = options.extensions;
}
Object.defineProperties(StructuralMetadata.prototype, {
/**
* Schema containing classes and enums.
*
* @memberof StructuralMetadata.prototype
* @type {MetadataSchema}
* @readonly
* @private
*/
schema: {
get: function () {
return this._schema;
},
},
/**
* Statistics about the metadata.
* * See the {@link https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata/schema/statistics.schema.json|statistics schema reference} for the full set of properties. *
* * @memberof StructuralMetadata.prototype * @type {Object} * @readonly * @private */ statistics: { get: function () { return this._statistics; }, }, /** * Extras in the JSON object. * * @memberof StructuralMetadata.prototype * @type {*} * @readonly * @private */ extras: { get: function () { return this._extras; }, }, /** * Extensions in the JSON object. * * @memberof StructuralMetadata.prototype * @type {Object} * @readonly * @private */ extensions: { get: function () { return this._extensions; }, }, /** * Number of property tables in the metadata. * * @memberof StructuralMetadata.prototype * @type {Number} * @readonly * @private */ propertyTableCount: { get: function () { return this._propertyTableCount; }, }, /** * The property tables in the metadata. * * @memberof StructuralMetadata.prototype * @type {PropertyTable[]} * @readonly * @private */ propertyTables: { get: function () { return this._propertyTables; }, }, /** * The property textures in the metadata. * * @memberof StructuralMetadata.prototype * @type {PropertyTexture[]} * @readonly * @private */ propertyTextures: { get: function () { return this._propertyTextures; }, }, /** * The property attributes from the structural metadata extension * * @memberof StructuralMetadata.prototype * @type {PropertyAttribute[]} * @readonly * @private */ propertyAttributes: { get: function () { return this._propertyAttributes; }, }, }); /** * Gets the property table with the given ID. *
* For the legacy EXT_feature_metadata
, textures are stored in an array sorted
* by the key in the propertyTables dictionary.
*
* For the legacy EXT_feature_metadata
, textures are stored in an array sorted
* by the key in the propertyTextures dictionary.
*