@xeokit/xeokit-sdk 2.4.0-alpha-43 → 2.4.0-alpha-45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103094,7 +103094,13 @@ class MetaObject {
103094
103094
  this.type = params.type;
103095
103095
 
103096
103096
  /**
103097
- * Optional {@link PropertySet}s used by this MetaObject.
103097
+ * IDs of PropertySets associated with this MetaObject.
103098
+ * @type {[]|*}
103099
+ */
103100
+ this.propertySetIds = params.propertySetIds;
103101
+
103102
+ /**
103103
+ * The {@link PropertySet}s associated with this MetaObject.
103098
103104
  *
103099
103105
  * @property propertySets
103100
103106
  * @type {PropertySet[]}
@@ -103282,7 +103288,7 @@ class PropertySet {
103282
103288
  /**
103283
103289
  * @private
103284
103290
  */
103285
- constructor(id, originalSystemId, name, type, properties) {
103291
+ constructor(params) {
103286
103292
 
103287
103293
  /**
103288
103294
  * Globally-unique ID for this PropertySet.
@@ -103292,7 +103298,7 @@ class PropertySet {
103292
103298
  * @property id
103293
103299
  * @type {String}
103294
103300
  */
103295
- this.id = id;
103301
+ this.id = params.id;
103296
103302
 
103297
103303
  /**
103298
103304
  * ID of the corresponding object within the originating system, if any.
@@ -103300,7 +103306,7 @@ class PropertySet {
103300
103306
  * @type {String}
103301
103307
  * @abstract
103302
103308
  */
103303
- this.originalSystemId = originalSystemId;
103309
+ this.originalSystemId = params.originalSystemId;
103304
103310
 
103305
103311
  /**
103306
103312
  * The MetaModels that share this PropertySet.
@@ -103314,7 +103320,7 @@ class PropertySet {
103314
103320
  * @property name
103315
103321
  * @type {String}
103316
103322
  */
103317
- this.name = name;
103323
+ this.name = params.name;
103318
103324
 
103319
103325
  /**
103320
103326
  * Type of this PropertySet.
@@ -103322,7 +103328,7 @@ class PropertySet {
103322
103328
  * @property type
103323
103329
  * @type {String}
103324
103330
  */
103325
- this.type = type;
103331
+ this.type = params.type;
103326
103332
 
103327
103333
  /**
103328
103334
  * Properties within this PropertySet.
@@ -103332,7 +103338,8 @@ class PropertySet {
103332
103338
  */
103333
103339
  this.properties = [];
103334
103340
 
103335
- if (properties) {
103341
+ if (params.properties) {
103342
+ const properties = params.properties;
103336
103343
  for (let i = 0, len = properties.length; i < len; i++) {
103337
103344
  const property = properties[i];
103338
103345
  this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
@@ -103520,6 +103527,7 @@ class MetaScene {
103520
103527
  const metaObjectData = metaModelData.metaObjects[i];
103521
103528
  const type = metaObjectData.type;
103522
103529
  const id = metaObjectData.id;
103530
+ const propertySetIds = metaObjectData.propertySets | metaObjectData.propertySetIds;
103523
103531
  let metaObject = this.metaObjects[id];
103524
103532
  if (!metaObject) {
103525
103533
  metaObject = new MetaObject({
@@ -103527,7 +103535,7 @@ class MetaScene {
103527
103535
  parentId: metaObjectData.parent,
103528
103536
  type,
103529
103537
  name: metaObjectData.name,
103530
- propertySetIds: metaObjectData.propertySetIds
103538
+ propertySetIds
103531
103539
  });
103532
103540
  this.metaObjects[id] = metaObject;
103533
103541
  }
@@ -103547,6 +103555,19 @@ class MetaScene {
103547
103555
  if (metaObject.children) {
103548
103556
  metaObject.children = [];
103549
103557
  }
103558
+
103559
+ // Re-link each MetaObject's property sets
103560
+
103561
+ if (metaObject.propertySets) {
103562
+ metaObject.propertySets = [];
103563
+ }
103564
+ if (metaObject.propertySetIds) {
103565
+ for (let i = 0, len = metaObject.propertySetIds.length; i < len; i++) {
103566
+ const propertySetId = metaObject.propertySetIds[i];
103567
+ const propertySet = this.propertySets[propertySetId];
103568
+ metaObject.propertySets.push(propertySet);
103569
+ }
103570
+ }
103550
103571
  }
103551
103572
 
103552
103573
  for (let objectId in this.metaObjects) {
@@ -103593,14 +103614,18 @@ class MetaScene {
103593
103614
 
103594
103615
  // Globalize MetaObject property set IDs
103595
103616
 
103596
- const propertySetIds = metaObjectData.propertySetIds;
103597
- if (propertySetIds) {
103598
- const propertySetGlobalIds = [];
103599
- for (let j = 0, lenj = propertySetIds.length; j < lenj; j++) {
103600
- propertySetGlobalIds.push(math.globalizeObjectId(modelId, propertySetIds[j]));
103617
+ if (globalize) {
103618
+ const propertySetIds = metaObjectData.propertySetIds;
103619
+ if (propertySetIds) {
103620
+ const propertySetGlobalIds = [];
103621
+ for (let j = 0, lenj = propertySetIds.length; j < lenj; j++) {
103622
+ propertySetGlobalIds.push(math.globalizeObjectId(modelId, propertySetIds[j]));
103623
+ }
103624
+ metaObjectData.propertySetIds = propertySetGlobalIds;
103625
+ metaObjectData.originalSystemPropertySetIds = propertySetIds;
103601
103626
  }
103602
- metaObjectData.propertySetIds = propertySetGlobalIds;
103603
- metaObjectData.originalSystemPropertySetIds = propertySetIds;
103627
+ } else {
103628
+ metaObjectData.originalSystemPropertySetIds = metaObjectData.propertySetIds;
103604
103629
  }
103605
103630
  }
103606
103631
  }
@@ -103683,6 +103708,19 @@ class MetaScene {
103683
103708
  if (metaObject.children) {
103684
103709
  metaObject.children = [];
103685
103710
  }
103711
+
103712
+ // Re-link each MetaObject's property sets
103713
+
103714
+ if (metaObject.propertySets) {
103715
+ metaObject.propertySets = [];
103716
+ }
103717
+ if (metaObject.propertySetIds) {
103718
+ for (let i = 0, len = metaObject.propertySetIds.length; i < len; i++) {
103719
+ const propertySetId = metaObject.propertySetIds[i];
103720
+ const propertySet = this.propertySets[propertySetId];
103721
+ metaObject.propertySets.push(propertySet);
103722
+ }
103723
+ }
103686
103724
  }
103687
103725
 
103688
103726
  this.metaObjectsByType = {};
@@ -103090,7 +103090,13 @@ class MetaObject {
103090
103090
  this.type = params.type;
103091
103091
 
103092
103092
  /**
103093
- * Optional {@link PropertySet}s used by this MetaObject.
103093
+ * IDs of PropertySets associated with this MetaObject.
103094
+ * @type {[]|*}
103095
+ */
103096
+ this.propertySetIds = params.propertySetIds;
103097
+
103098
+ /**
103099
+ * The {@link PropertySet}s associated with this MetaObject.
103094
103100
  *
103095
103101
  * @property propertySets
103096
103102
  * @type {PropertySet[]}
@@ -103278,7 +103284,7 @@ class PropertySet {
103278
103284
  /**
103279
103285
  * @private
103280
103286
  */
103281
- constructor(id, originalSystemId, name, type, properties) {
103287
+ constructor(params) {
103282
103288
 
103283
103289
  /**
103284
103290
  * Globally-unique ID for this PropertySet.
@@ -103288,7 +103294,7 @@ class PropertySet {
103288
103294
  * @property id
103289
103295
  * @type {String}
103290
103296
  */
103291
- this.id = id;
103297
+ this.id = params.id;
103292
103298
 
103293
103299
  /**
103294
103300
  * ID of the corresponding object within the originating system, if any.
@@ -103296,7 +103302,7 @@ class PropertySet {
103296
103302
  * @type {String}
103297
103303
  * @abstract
103298
103304
  */
103299
- this.originalSystemId = originalSystemId;
103305
+ this.originalSystemId = params.originalSystemId;
103300
103306
 
103301
103307
  /**
103302
103308
  * The MetaModels that share this PropertySet.
@@ -103310,7 +103316,7 @@ class PropertySet {
103310
103316
  * @property name
103311
103317
  * @type {String}
103312
103318
  */
103313
- this.name = name;
103319
+ this.name = params.name;
103314
103320
 
103315
103321
  /**
103316
103322
  * Type of this PropertySet.
@@ -103318,7 +103324,7 @@ class PropertySet {
103318
103324
  * @property type
103319
103325
  * @type {String}
103320
103326
  */
103321
- this.type = type;
103327
+ this.type = params.type;
103322
103328
 
103323
103329
  /**
103324
103330
  * Properties within this PropertySet.
@@ -103328,7 +103334,8 @@ class PropertySet {
103328
103334
  */
103329
103335
  this.properties = [];
103330
103336
 
103331
- if (properties) {
103337
+ if (params.properties) {
103338
+ const properties = params.properties;
103332
103339
  for (let i = 0, len = properties.length; i < len; i++) {
103333
103340
  const property = properties[i];
103334
103341
  this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
@@ -103516,6 +103523,7 @@ class MetaScene {
103516
103523
  const metaObjectData = metaModelData.metaObjects[i];
103517
103524
  const type = metaObjectData.type;
103518
103525
  const id = metaObjectData.id;
103526
+ const propertySetIds = metaObjectData.propertySets | metaObjectData.propertySetIds;
103519
103527
  let metaObject = this.metaObjects[id];
103520
103528
  if (!metaObject) {
103521
103529
  metaObject = new MetaObject({
@@ -103523,7 +103531,7 @@ class MetaScene {
103523
103531
  parentId: metaObjectData.parent,
103524
103532
  type,
103525
103533
  name: metaObjectData.name,
103526
- propertySetIds: metaObjectData.propertySetIds
103534
+ propertySetIds
103527
103535
  });
103528
103536
  this.metaObjects[id] = metaObject;
103529
103537
  }
@@ -103543,6 +103551,19 @@ class MetaScene {
103543
103551
  if (metaObject.children) {
103544
103552
  metaObject.children = [];
103545
103553
  }
103554
+
103555
+ // Re-link each MetaObject's property sets
103556
+
103557
+ if (metaObject.propertySets) {
103558
+ metaObject.propertySets = [];
103559
+ }
103560
+ if (metaObject.propertySetIds) {
103561
+ for (let i = 0, len = metaObject.propertySetIds.length; i < len; i++) {
103562
+ const propertySetId = metaObject.propertySetIds[i];
103563
+ const propertySet = this.propertySets[propertySetId];
103564
+ metaObject.propertySets.push(propertySet);
103565
+ }
103566
+ }
103546
103567
  }
103547
103568
 
103548
103569
  for (let objectId in this.metaObjects) {
@@ -103589,14 +103610,18 @@ class MetaScene {
103589
103610
 
103590
103611
  // Globalize MetaObject property set IDs
103591
103612
 
103592
- const propertySetIds = metaObjectData.propertySetIds;
103593
- if (propertySetIds) {
103594
- const propertySetGlobalIds = [];
103595
- for (let j = 0, lenj = propertySetIds.length; j < lenj; j++) {
103596
- propertySetGlobalIds.push(math.globalizeObjectId(modelId, propertySetIds[j]));
103613
+ if (globalize) {
103614
+ const propertySetIds = metaObjectData.propertySetIds;
103615
+ if (propertySetIds) {
103616
+ const propertySetGlobalIds = [];
103617
+ for (let j = 0, lenj = propertySetIds.length; j < lenj; j++) {
103618
+ propertySetGlobalIds.push(math.globalizeObjectId(modelId, propertySetIds[j]));
103619
+ }
103620
+ metaObjectData.propertySetIds = propertySetGlobalIds;
103621
+ metaObjectData.originalSystemPropertySetIds = propertySetIds;
103597
103622
  }
103598
- metaObjectData.propertySetIds = propertySetGlobalIds;
103599
- metaObjectData.originalSystemPropertySetIds = propertySetIds;
103623
+ } else {
103624
+ metaObjectData.originalSystemPropertySetIds = metaObjectData.propertySetIds;
103600
103625
  }
103601
103626
  }
103602
103627
  }
@@ -103679,6 +103704,19 @@ class MetaScene {
103679
103704
  if (metaObject.children) {
103680
103705
  metaObject.children = [];
103681
103706
  }
103707
+
103708
+ // Re-link each MetaObject's property sets
103709
+
103710
+ if (metaObject.propertySets) {
103711
+ metaObject.propertySets = [];
103712
+ }
103713
+ if (metaObject.propertySetIds) {
103714
+ for (let i = 0, len = metaObject.propertySetIds.length; i < len; i++) {
103715
+ const propertySetId = metaObject.propertySetIds[i];
103716
+ const propertySet = this.propertySets[propertySetId];
103717
+ metaObject.propertySets.push(propertySet);
103718
+ }
103719
+ }
103682
103720
  }
103683
103721
 
103684
103722
  this.metaObjectsByType = {};