Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | 47x 47x 47x 47x 46x 45x 45x 45x 110x 110x 45x 45x 45x 45x 45x 45x 1x 4x 4x 55x 69x 1x 1x 1x 21x 20x | import Check from "../Core/Check.js";
import Frozen from "../Core/Frozen.js";
import defined from "../Core/defined.js";
import PropertyAttributeProperty from "./PropertyAttributeProperty.js";
/**
* A property attribute; a collection of per-point properties stored as custom
* vertex attributes.
* <p>
* See the {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata|EXT_structural_metadata Extension}
* </p>
*
* @param {object} options Object with the following properties:
* @param {string} [options.name] Optional human-readable name to describe the attribute
* @param {number} [options.id] A unique id to identify the property attribute, useful for debugging. This is the array index in the property attributes array
* @param {object} options.propertyAttribute The property attribute JSON, following the EXT_structural_metadata schema.
* @param {MetadataClass} options.class The class that properties conform to.
*
* @alias PropertyAttribute
* @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 PropertyAttribute(options) {
options = options ?? Frozen.EMPTY_OBJECT;
const propertyAttribute = options.propertyAttribute;
const classDefinition = options.class;
//>>includeStart('debug', pragmas.debug);
Check.typeOf.object("options.propertyAttribute", propertyAttribute);
Check.typeOf.object("options.class", classDefinition);
//>>includeEnd('debug');
const properties = {};
Eif (defined(propertyAttribute.properties)) {
for (const propertyId in propertyAttribute.properties) {
Eif (propertyAttribute.properties.hasOwnProperty(propertyId)) {
properties[propertyId] = new PropertyAttributeProperty({
property: propertyAttribute.properties[propertyId],
classProperty: classDefinition.properties[propertyId],
});
}
}
}
this._name = options.name;
this._id = options.id;
this._class = classDefinition;
this._properties = properties;
this._extras = propertyAttribute.extras;
this._extensions = propertyAttribute.extensions;
}
Object.defineProperties(PropertyAttribute.prototype, {
/**
* A human-readable name for this attribute
*
* @memberof PropertyAttribute.prototype
*
* @type {string}
* @readonly
* @private
*/
name: {
get: function () {
return this._name;
},
},
/**
* An identifier for this attribute. Useful for debugging.
*
* @memberof PropertyAttribute.prototype
*
* @type {string|number}
* @readonly
* @private
*/
id: {
get: function () {
return this._id;
},
},
/**
* The class that properties conform to.
*
* @memberof PropertyAttribute.prototype
*
* @type {MetadataClass}
* @readonly
* @private
*/
class: {
get: function () {
return this._class;
},
},
/**
* The properties in this property attribute.
*
* @memberof PropertyAttribute.prototype
*
* @type {Object<string, PropertyAttributeProperty>}
* @readonly
* @private
*/
properties: {
get: function () {
return this._properties;
},
},
/**
* Extra user-defined properties.
*
* @memberof PropertyAttribute.prototype
*
* @type {*}
* @readonly
* @private
*/
extras: {
get: function () {
return this._extras;
},
},
/**
* An object containing extensions.
*
* @memberof PropertyAttribute.prototype
*
* @type {object}
* @readonly
* @private
*/
extensions: {
get: function () {
return this._extensions;
},
},
});
/**
* Gets the property with the given property ID.
*
* @param {string} propertyId The case-sensitive ID of the property.
* @returns {PropertyAttributeProperty|undefined} The property, or <code>undefined</code> if the property does not exist.
* @private
*/
PropertyAttribute.prototype.getProperty = function (propertyId) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.string("propertyId", propertyId);
//>>includeEnd('debug');
return this._properties[propertyId];
};
export default PropertyAttribute;
|