15832144755
2022-01-06 7b4c8991dca9cf2a809a95e239d144697d3afb56
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
import Check from "../Core/Check.js";
import defined from "../Core/defined.js";
import MetadataClass from "./MetadataClass.js";
import MetadataEnum from "./MetadataEnum.js";
 
/**
 * A schema containing classes and enums.
 * <p>
 * See the {@link https://github.com/CesiumGS/3d-tiles/tree/3d-tiles-next/extensions/3DTILES_metadata|3DTILES_metadata Extension} for 3D Tiles
 * </p>
 *
 * @param {Object} schema The schema JSON object.
 *
 * @alias MetadataSchema
 * @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 MetadataSchema(schema) {
  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.object("schema", schema);
  //>>includeEnd('debug');
 
  var enums = {};
  if (defined(schema.enums)) {
    for (var enumId in schema.enums) {
      if (schema.enums.hasOwnProperty(enumId)) {
        enums[enumId] = new MetadataEnum({
          id: enumId,
          enum: schema.enums[enumId],
        });
      }
    }
  }
 
  var classes = {};
  if (defined(schema.classes)) {
    for (var classId in schema.classes) {
      if (schema.classes.hasOwnProperty(classId)) {
        classes[classId] = new MetadataClass({
          id: classId,
          class: schema.classes[classId],
          enums: enums,
        });
      }
    }
  }
 
  this._classes = classes;
  this._enums = enums;
  this._name = schema.name;
  this._description = schema.description;
  this._version = schema.version;
  this._extras = schema.extras;
  this._extensions = schema.extensions;
}
 
Object.defineProperties(MetadataSchema.prototype, {
  /**
   * Classes defined in the schema.
   *
   * @memberof MetadataSchema.prototype
   * @type {Object.<String, MetadataClass>}
   * @readonly
   * @private
   */
  classes: {
    get: function () {
      return this._classes;
    },
  },
 
  /**
   * Enums defined in the schema.
   *
   * @memberof MetadataSchema.prototype
   * @type {Object.<String, MetadataEnum>}
   * @readonly
   * @private
   */
  enums: {
    get: function () {
      return this._enums;
    },
  },
 
  /**
   * The name of the schema.
   *
   * @memberof MetadataSchema.prototype
   * @type {String}
   * @readonly
   * @private
   */
  name: {
    get: function () {
      return this._name;
    },
  },
 
  /**
   * The description of the schema.
   *
   * @memberof MetadataSchema.prototype
   * @type {String}
   * @readonly
   * @private
   */
  description: {
    get: function () {
      return this._description;
    },
  },
 
  /**
   * The application-specific version of the schema.
   *
   * @memberof MetadataSchema.prototype
   * @type {String}
   * @readonly
   * @private
   */
  version: {
    get: function () {
      return this._version;
    },
  },
 
  /**
   * Extras in the JSON object.
   *
   * @memberof MetadataSchema.prototype
   * @type {*}
   * @readonly
   * @private
   */
  extras: {
    get: function () {
      return this._extras;
    },
  },
 
  /**
   * Extensions in the JSON object.
   *
   * @memberof MetadataSchema.prototype
   * @type {Object}
   * @readonly
   * @private
   */
  extensions: {
    get: function () {
      return this._extensions;
    },
  },
});
 
export default MetadataSchema;