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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | 102x 102x 102x 102x 101x 100x 100x 10x 100x 100x 100x 100x 6x 6x 12x 12x 94x 6x 6x 6x 12x 12x 12x 12x 100x 100x 100x 100x 100x 100x 100x 1x 233x 310x 276x 63x 225x 3x 3x | import Check from "../Core/Check.js";
import Frozen from "../Core/Frozen.js";
import defined from "../Core/defined.js";
import GroupMetadata from "./GroupMetadata.js";
import TilesetMetadata from "./TilesetMetadata.js";
/**
* An object containing metadata about a 3D Tileset.
* <p>
* See the {@link https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_metadata|3DTILES_metadata Extension} for 3D Tiles.
* </p>
* <p>
* This object represents the tileset JSON (3D Tiles 1.1) or the <code>3DTILES_metadata</code> object that contains
* the schema ({@link MetadataSchema}), tileset metadata ({@link TilesetMetadata}), group metadata (dictionary of {@link GroupMetadata}), and metadata statistics (dictionary)
* </p>
*
* @param {object} options Object with the following properties:
* @param {object} options.metadataJson Either the tileset JSON (3D Tiles 1.1) or the <code>3DTILES_metadata</code> extension object that contains the tileset metadata.
* @param {MetadataSchema} options.schema The parsed schema.
*
* @alias Cesium3DTilesetMetadata
* @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 Cesium3DTilesetMetadata(options) {
options = options ?? Frozen.EMPTY_OBJECT;
const metadataJson = options.metadataJson;
// The calling code is responsible for loading the schema.
// This keeps metadata parsing synchronous.
const schema = options.schema;
//>>includeStart('debug', pragmas.debug);
Check.typeOf.object("options.metadataJson", metadataJson);
Check.typeOf.object("options.schema", schema);
//>>includeEnd('debug');
// An older schema stored the tileset metadata in the "tileset" property.
const metadata = metadataJson.metadata ?? metadataJson.tileset;
let tileset;
if (defined(metadata)) {
tileset = new TilesetMetadata({
tileset: metadata,
class: schema.classes[metadata.class],
});
}
let groupIds = [];
const groups = [];
const groupsJson = metadataJson.groups;
if (Array.isArray(groupsJson)) {
const length = groupsJson.length;
for (let i = 0; i < length; i++) {
const group = groupsJson[i];
groups.push(
new GroupMetadata({
group: group,
class: schema.classes[group.class],
}),
);
}
} else if (defined(groupsJson)) {
// An older version of group metadata stored groups in a dictionary
// instead of an array.
groupIds = Object.keys(groupsJson).sort();
const length = groupIds.length;
for (let i = 0; i < length; i++) {
const groupId = groupIds[i];
Eif (groupsJson.hasOwnProperty(groupId)) {
const group = groupsJson[groupId];
groups.push(
new GroupMetadata({
id: groupId,
group: groupsJson[groupId],
class: schema.classes[group.class],
}),
);
}
}
}
this._schema = schema;
this._groups = groups;
this._groupIds = groupIds;
this._tileset = tileset;
this._statistics = metadataJson.statistics;
this._extras = metadataJson.extras;
this._extensions = metadataJson.extensions;
}
Object.defineProperties(Cesium3DTilesetMetadata.prototype, {
/**
* Schema containing classes and enums.
*
* @memberof Cesium3DTilesetMetadata.prototype
* @type {MetadataSchema}
* @readonly
* @private
*/
schema: {
get: function () {
return this._schema;
},
},
/**
* Metadata about groups of content.
*
* @memberof Cesium3DTilesetMetadata.prototype
* @type {GroupMetadata[]}
* @readonly
* @private
*/
groups: {
get: function () {
return this._groups;
},
},
/**
* The IDs of the group metadata in the corresponding groups dictionary.
* Only populated if using the legacy schema.
*
* @memberof Cesium3DTilesetMetadata.prototype
* @type {}
* @readonly
* @private
*/
groupIds: {
get: function () {
return this._groupIds;
},
},
/**
* Metadata about the tileset as a whole.
*
* @memberof Cesium3DTilesetMetadata.prototype
* @type {TilesetMetadata}
* @readonly
* @private
*/
tileset: {
get: function () {
return this._tileset;
},
},
/**
* Statistics about the metadata.
* <p>
* See the {@link https://github.com/CesiumGS/3d-tiles/blob/main/extensions/3DTILES_metadata/schema/statistics.schema.json|statistics schema reference}
* in the 3D Tiles spec for the full set of properties.
* </p>
*
* @memberof Cesium3DTilesetMetadata.prototype
* @type {object}
* @readonly
* @private
*/
statistics: {
get: function () {
return this._statistics;
},
},
/**
* Extra user-defined properties.
*
* @memberof Cesium3DTilesetMetadata.prototype
* @type {*}
* @readonly
* @private
*/
extras: {
get: function () {
return this._extras;
},
},
/**
* An object containing extensions.
*
* @memberof Cesium3DTilesetMetadata.prototype
* @type {object}
* @readonly
* @private
*/
extensions: {
get: function () {
return this._extensions;
},
},
});
export default Cesium3DTilesetMetadata;
|