@xeokit/xeokit-sdk 2.4.0-alpha-39 → 2.4.0-alpha-41
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.
- package/dist/xeokit-sdk.cjs.js +280 -186
- package/dist/xeokit-sdk.es.js +280 -186
- package/dist/xeokit-sdk.es.zip +0 -0
- package/dist/xeokit-sdk.es5.js +248 -236
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -33266,6 +33266,12 @@ class DataTextureSceneModel extends Component {
|
|
|
33266
33266
|
|
|
33267
33267
|
this._edgeThreshold = cfg.edgeThreshold || 10;
|
|
33268
33268
|
|
|
33269
|
+
/**
|
|
33270
|
+
* True when this model has been finalized after a successful call to finalize().
|
|
33271
|
+
* @type {boolean}
|
|
33272
|
+
*/
|
|
33273
|
+
this.finalized = false;
|
|
33274
|
+
|
|
33269
33275
|
this.visible = cfg.visible;
|
|
33270
33276
|
this.culled = cfg.culled;
|
|
33271
33277
|
this.pickable = cfg.pickable;
|
|
@@ -34572,6 +34578,8 @@ class DataTextureSceneModel extends Component {
|
|
|
34572
34578
|
const layer = this._layerList[i];
|
|
34573
34579
|
layer.attachToRenderingEvent();
|
|
34574
34580
|
}
|
|
34581
|
+
|
|
34582
|
+
this.finalized = true;
|
|
34575
34583
|
}
|
|
34576
34584
|
|
|
34577
34585
|
_rebuildAABB() {
|
|
@@ -96344,6 +96352,12 @@ class VBOSceneModel extends Component {
|
|
|
96344
96352
|
/** @private **/
|
|
96345
96353
|
this.renderFlags = new RenderFlags();
|
|
96346
96354
|
|
|
96355
|
+
/**
|
|
96356
|
+
* True when this model has been finalized after a successful call to finalize().
|
|
96357
|
+
* @type {boolean}
|
|
96358
|
+
*/
|
|
96359
|
+
this.finalized = false;
|
|
96360
|
+
|
|
96347
96361
|
/**
|
|
96348
96362
|
* @private
|
|
96349
96363
|
*/
|
|
@@ -98161,6 +98175,8 @@ ${cfg.uv && cfg.uv.length > 0 ? 1 : 0}-${cfg.uvCompressed && cfg.uvCompressed.le
|
|
|
98161
98175
|
this.glRedraw();
|
|
98162
98176
|
|
|
98163
98177
|
this.scene._aabbDirty = true;
|
|
98178
|
+
|
|
98179
|
+
this.finalized = true;
|
|
98164
98180
|
}
|
|
98165
98181
|
|
|
98166
98182
|
_rebuildAABB() {
|
|
@@ -99339,13 +99355,17 @@ const getCanvasPosFromEvent$4 = function (event, canvasPos) {
|
|
|
99339
99355
|
let element = event.target;
|
|
99340
99356
|
let totalOffsetLeft = 0;
|
|
99341
99357
|
let totalOffsetTop = 0;
|
|
99358
|
+
let totalScrollX = 0;
|
|
99359
|
+
let totalScrollY = 0;
|
|
99342
99360
|
while (element.offsetParent) {
|
|
99343
|
-
|
|
99344
|
-
|
|
99345
|
-
|
|
99361
|
+
totalOffsetLeft += element.offsetLeft;
|
|
99362
|
+
totalOffsetTop += element.offsetTop;
|
|
99363
|
+
totalScrollX += element.scrollLeft;
|
|
99364
|
+
totalScrollY += element.scrollTop;
|
|
99365
|
+
element = element.offsetParent;
|
|
99346
99366
|
}
|
|
99347
|
-
canvasPos[0] = event.pageX - totalOffsetLeft;
|
|
99348
|
-
canvasPos[1] = event.pageY - totalOffsetTop;
|
|
99367
|
+
canvasPos[0] = event.pageX + totalScrollX - totalOffsetLeft;
|
|
99368
|
+
canvasPos[1] = event.pageY + totalScrollY - totalOffsetTop;
|
|
99349
99369
|
}
|
|
99350
99370
|
return canvasPos;
|
|
99351
99371
|
};
|
|
@@ -102826,7 +102846,7 @@ class MetaModel {
|
|
|
102826
102846
|
/**
|
|
102827
102847
|
* @private
|
|
102828
102848
|
*/
|
|
102829
|
-
constructor(
|
|
102849
|
+
constructor(params) {
|
|
102830
102850
|
|
|
102831
102851
|
/**
|
|
102832
102852
|
* Globally-unique ID.
|
|
@@ -102838,14 +102858,14 @@ class MetaModel {
|
|
|
102838
102858
|
* @property id
|
|
102839
102859
|
* @type {String|Number}
|
|
102840
102860
|
*/
|
|
102841
|
-
this.id = id;
|
|
102861
|
+
this.id = params.id;
|
|
102842
102862
|
|
|
102843
102863
|
/**
|
|
102844
102864
|
* The project ID
|
|
102845
102865
|
* @property projectId
|
|
102846
102866
|
* @type {String|Number}
|
|
102847
102867
|
*/
|
|
102848
|
-
this.projectId = projectId;
|
|
102868
|
+
this.projectId = params.projectId;
|
|
102849
102869
|
|
|
102850
102870
|
/**
|
|
102851
102871
|
* The revision ID, if available.
|
|
@@ -102855,7 +102875,7 @@ class MetaModel {
|
|
|
102855
102875
|
* @property revisionId
|
|
102856
102876
|
* @type {String|Number}
|
|
102857
102877
|
*/
|
|
102858
|
-
this.revisionId = revisionId;
|
|
102878
|
+
this.revisionId = params.revisionId;
|
|
102859
102879
|
|
|
102860
102880
|
/**
|
|
102861
102881
|
* The model author, if available.
|
|
@@ -102865,7 +102885,7 @@ class MetaModel {
|
|
|
102865
102885
|
* @property author
|
|
102866
102886
|
* @type {String}
|
|
102867
102887
|
*/
|
|
102868
|
-
this.author = author;
|
|
102888
|
+
this.author = params.author;
|
|
102869
102889
|
|
|
102870
102890
|
/**
|
|
102871
102891
|
* The date the model was created, if available.
|
|
@@ -102875,7 +102895,7 @@ class MetaModel {
|
|
|
102875
102895
|
* @property createdAt
|
|
102876
102896
|
* @type {String}
|
|
102877
102897
|
*/
|
|
102878
|
-
this.createdAt = createdAt;
|
|
102898
|
+
this.createdAt = params.createdAt;
|
|
102879
102899
|
|
|
102880
102900
|
/**
|
|
102881
102901
|
* The application that created the model, if available.
|
|
@@ -102885,7 +102905,7 @@ class MetaModel {
|
|
|
102885
102905
|
* @property creatingApplication
|
|
102886
102906
|
* @type {String}
|
|
102887
102907
|
*/
|
|
102888
|
-
this.creatingApplication = creatingApplication;
|
|
102908
|
+
this.creatingApplication = params.creatingApplication;
|
|
102889
102909
|
|
|
102890
102910
|
/**
|
|
102891
102911
|
* The model schema version, if available.
|
|
@@ -102895,7 +102915,7 @@ class MetaModel {
|
|
|
102895
102915
|
* @property schema
|
|
102896
102916
|
* @type {String}
|
|
102897
102917
|
*/
|
|
102898
|
-
this.schema = schema;
|
|
102918
|
+
this.schema = params.schema;
|
|
102899
102919
|
|
|
102900
102920
|
/**
|
|
102901
102921
|
* Metadata on the {@link Scene}.
|
|
@@ -102903,15 +102923,15 @@ class MetaModel {
|
|
|
102903
102923
|
* @property metaScene
|
|
102904
102924
|
* @type {MetaScene}
|
|
102905
102925
|
*/
|
|
102906
|
-
this.metaScene = metaScene;
|
|
102926
|
+
this.metaScene = params.metaScene;
|
|
102907
102927
|
|
|
102908
102928
|
/**
|
|
102909
102929
|
* The {@link PropertySet}s in this MetaModel.
|
|
102910
102930
|
*
|
|
102911
102931
|
* @property propertySets
|
|
102912
|
-
* @type
|
|
102932
|
+
* @type {PropertySet[]}
|
|
102913
102933
|
*/
|
|
102914
|
-
this.propertySets =
|
|
102934
|
+
this.propertySets = [];
|
|
102915
102935
|
|
|
102916
102936
|
/**
|
|
102917
102937
|
* The root {@link MetaObject} in this MetaModel's composition structure hierarchy.
|
|
@@ -102929,6 +102949,20 @@ class MetaModel {
|
|
|
102929
102949
|
* @type {MetaObject[]}
|
|
102930
102950
|
*/
|
|
102931
102951
|
this.rootMetaObjects = [];
|
|
102952
|
+
|
|
102953
|
+
/**
|
|
102954
|
+
* The {@link MetaObject}s in this MetaModel, each mapped to its ID.
|
|
102955
|
+
*
|
|
102956
|
+
* @property metaObjects
|
|
102957
|
+
* @type {MetaObject[]}
|
|
102958
|
+
*/
|
|
102959
|
+
this.metaObjects=[];
|
|
102960
|
+
|
|
102961
|
+
/**
|
|
102962
|
+
* Connectivity graph.
|
|
102963
|
+
* @type {{}}
|
|
102964
|
+
*/
|
|
102965
|
+
this.graph = params.graph || {};
|
|
102932
102966
|
}
|
|
102933
102967
|
|
|
102934
102968
|
getJSON() {
|
|
@@ -102987,7 +103021,7 @@ class MetaObject {
|
|
|
102987
103021
|
/**
|
|
102988
103022
|
* @private
|
|
102989
103023
|
*/
|
|
102990
|
-
constructor(
|
|
103024
|
+
constructor(params) {
|
|
102991
103025
|
|
|
102992
103026
|
/**
|
|
102993
103027
|
* Model metadata.
|
|
@@ -102996,13 +103030,13 @@ class MetaObject {
|
|
|
102996
103030
|
* @type {MetaModel}
|
|
102997
103031
|
* @deprecated
|
|
102998
103032
|
*/
|
|
102999
|
-
this.metaModel =
|
|
103033
|
+
this.metaModel = null;
|
|
103000
103034
|
|
|
103001
103035
|
/**
|
|
103002
103036
|
* The MetaModels that share this MetaObject.
|
|
103003
103037
|
* @type {MetaModel[]}
|
|
103004
103038
|
*/
|
|
103005
|
-
this.metaModels = [
|
|
103039
|
+
this.metaModels = [];
|
|
103006
103040
|
|
|
103007
103041
|
/**
|
|
103008
103042
|
* Globally-unique ID.
|
|
@@ -103012,7 +103046,19 @@ class MetaObject {
|
|
|
103012
103046
|
* @property id
|
|
103013
103047
|
* @type {String|Number}
|
|
103014
103048
|
*/
|
|
103015
|
-
this.id = id;
|
|
103049
|
+
this.id = params.id;
|
|
103050
|
+
|
|
103051
|
+
/**
|
|
103052
|
+
* ID of the parent MetaObject.
|
|
103053
|
+
* @type {String|Number}
|
|
103054
|
+
*/
|
|
103055
|
+
this.parentId = params.parentId;
|
|
103056
|
+
|
|
103057
|
+
/**
|
|
103058
|
+
* The parent MetaObject.
|
|
103059
|
+
* @type {MetaObject | null}
|
|
103060
|
+
*/
|
|
103061
|
+
this.parent = null;
|
|
103016
103062
|
|
|
103017
103063
|
/**
|
|
103018
103064
|
* ID of the corresponding object within the originating system, if any.
|
|
@@ -103020,7 +103066,7 @@ class MetaObject {
|
|
|
103020
103066
|
* @type {String}
|
|
103021
103067
|
* @abstract
|
|
103022
103068
|
*/
|
|
103023
|
-
this.originalSystemId = originalSystemId;
|
|
103069
|
+
this.originalSystemId = params.originalSystemId;
|
|
103024
103070
|
|
|
103025
103071
|
/**
|
|
103026
103072
|
* Human-readable name.
|
|
@@ -103028,7 +103074,7 @@ class MetaObject {
|
|
|
103028
103074
|
* @property name
|
|
103029
103075
|
* @type {String}
|
|
103030
103076
|
*/
|
|
103031
|
-
this.name = name;
|
|
103077
|
+
this.name = params.name;
|
|
103032
103078
|
|
|
103033
103079
|
/**
|
|
103034
103080
|
* Type - often an IFC product type.
|
|
@@ -103036,7 +103082,7 @@ class MetaObject {
|
|
|
103036
103082
|
* @property type
|
|
103037
103083
|
* @type {String}
|
|
103038
103084
|
*/
|
|
103039
|
-
this.type = type;
|
|
103085
|
+
this.type = params.type;
|
|
103040
103086
|
|
|
103041
103087
|
/**
|
|
103042
103088
|
* Optional {@link PropertySet}s used by this MetaObject.
|
|
@@ -103044,46 +103090,20 @@ class MetaObject {
|
|
|
103044
103090
|
* @property propertySets
|
|
103045
103091
|
* @type {PropertySet[]}
|
|
103046
103092
|
*/
|
|
103047
|
-
this.propertySets =
|
|
103048
|
-
|
|
103049
|
-
if (parent !== undefined && parent !== null) {
|
|
103050
|
-
|
|
103051
|
-
/**
|
|
103052
|
-
* The parent MetaObject within the structure hierarchy.
|
|
103053
|
-
*
|
|
103054
|
-
* Undefined when this is the root of its structure.
|
|
103055
|
-
*
|
|
103056
|
-
* @property parent
|
|
103057
|
-
* @type {MetaObject}
|
|
103058
|
-
*/
|
|
103059
|
-
this.parent = parent;
|
|
103060
|
-
}
|
|
103061
|
-
|
|
103062
|
-
if (children !== undefined && children !== null) {
|
|
103093
|
+
this.propertySets = [];
|
|
103063
103094
|
|
|
103064
|
-
|
|
103065
|
-
|
|
103066
|
-
|
|
103067
|
-
|
|
103068
|
-
|
|
103069
|
-
|
|
103070
|
-
|
|
103071
|
-
|
|
103072
|
-
|
|
103073
|
-
|
|
103074
|
-
|
|
103075
|
-
|
|
103076
|
-
|
|
103077
|
-
/**
|
|
103078
|
-
* External application-specific metadata
|
|
103079
|
-
*
|
|
103080
|
-
* Undefined when there are is no external application-specific metadata.
|
|
103081
|
-
*
|
|
103082
|
-
* @property external
|
|
103083
|
-
* @type {*}
|
|
103084
|
-
*/
|
|
103085
|
-
this.external = external;
|
|
103086
|
-
}
|
|
103095
|
+
// if (external !== undefined && external !== null) {
|
|
103096
|
+
//
|
|
103097
|
+
// /**
|
|
103098
|
+
// * External application-specific metadata
|
|
103099
|
+
// *
|
|
103100
|
+
// * Undefined when there are is no external application-specific metadata.
|
|
103101
|
+
// *
|
|
103102
|
+
// * @property external
|
|
103103
|
+
// * @type {*}
|
|
103104
|
+
// */
|
|
103105
|
+
// this.external = external;
|
|
103106
|
+
// }
|
|
103087
103107
|
}
|
|
103088
103108
|
|
|
103089
103109
|
/**
|
|
@@ -103273,6 +103293,12 @@ class PropertySet {
|
|
|
103273
103293
|
*/
|
|
103274
103294
|
this.originalSystemId = originalSystemId;
|
|
103275
103295
|
|
|
103296
|
+
/**
|
|
103297
|
+
* The MetaModels that share this PropertySet.
|
|
103298
|
+
* @type {MetaModel[]}
|
|
103299
|
+
*/
|
|
103300
|
+
this.metaModels = [];
|
|
103301
|
+
|
|
103276
103302
|
/**
|
|
103277
103303
|
* Human-readable name of this PropertySet.
|
|
103278
103304
|
*
|
|
@@ -103369,12 +103395,6 @@ class MetaScene {
|
|
|
103369
103395
|
*/
|
|
103370
103396
|
this.rootMetaObjects = {};
|
|
103371
103397
|
|
|
103372
|
-
/**
|
|
103373
|
-
* Tracks number of MetaObjects of each type.
|
|
103374
|
-
* @private
|
|
103375
|
-
*/
|
|
103376
|
-
this._typeCounts = {};
|
|
103377
|
-
|
|
103378
103398
|
/**
|
|
103379
103399
|
* Subscriptions to events sent with {@link fire}.
|
|
103380
103400
|
* @private
|
|
@@ -103442,117 +103462,147 @@ class MetaScene {
|
|
|
103442
103462
|
*/
|
|
103443
103463
|
createMetaModel(modelId, metaModelData, options = {}) {
|
|
103444
103464
|
|
|
103445
|
-
|
|
103446
|
-
|
|
103447
|
-
|
|
103448
|
-
const newObjects = metaModelData.metaObjects || [];
|
|
103449
|
-
const author = metaModelData.author;
|
|
103450
|
-
const createdAt = metaModelData.createdAt;
|
|
103451
|
-
const creatingApplication = metaModelData.creatingApplication;
|
|
103452
|
-
const schema = metaModelData.schema;
|
|
103453
|
-
// if (options.excludeTypes) {
|
|
103454
|
-
// excludeTypes = {};
|
|
103455
|
-
// for (let i = 0, len = options.excludeTypes.length; i < len; i++) {
|
|
103456
|
-
// includeTypes[options.excludeTypes[i]] = true;
|
|
103457
|
-
// }
|
|
103458
|
-
// }
|
|
103465
|
+
this._globalizeIDs(modelId, metaModelData, options);
|
|
103466
|
+
|
|
103467
|
+
// Create MetaModel
|
|
103459
103468
|
|
|
103460
|
-
const metaModel = new MetaModel(
|
|
103469
|
+
const metaModel = new MetaModel({
|
|
103470
|
+
metaScene: this,
|
|
103471
|
+
id: modelId,
|
|
103472
|
+
projectId: metaModelData.projectId || "none",
|
|
103473
|
+
revisionId: metaModelData.revisionId || "none",
|
|
103474
|
+
author: metaModelData.author || "none",
|
|
103475
|
+
createdAt: metaModelData.createdAt || "none",
|
|
103476
|
+
creatingApplication: metaModelData.creatingApplication || "none",
|
|
103477
|
+
schema: metaModelData.schema || "none",
|
|
103478
|
+
propertySets: []
|
|
103479
|
+
});
|
|
103461
103480
|
|
|
103462
103481
|
this.metaModels[modelId] = metaModel;
|
|
103463
103482
|
|
|
103464
|
-
|
|
103465
|
-
|
|
103466
|
-
|
|
103467
|
-
const
|
|
103468
|
-
|
|
103469
|
-
|
|
103483
|
+
// Create global Property Sets
|
|
103484
|
+
|
|
103485
|
+
for (let i = 0, len = metaModelData.propertySets.length; i < len; i++) {
|
|
103486
|
+
const propertySetData = metaModelData.propertySets[i];
|
|
103487
|
+
let propertySet = this.propertySets[propertySetData.id];
|
|
103488
|
+
if (!propertySet) {
|
|
103489
|
+
propertySet = new PropertySet({
|
|
103490
|
+
id: propertySetData.id,
|
|
103491
|
+
originalSystemId: propertySetData.originalSystemId,
|
|
103492
|
+
type: propertySetData.type,
|
|
103493
|
+
name: propertySetData.name,
|
|
103494
|
+
properties: propertySetData.properties
|
|
103495
|
+
});
|
|
103496
|
+
this.propertySets[propertySet.id] = propertySet;
|
|
103497
|
+
}
|
|
103498
|
+
propertySet.metaModels.push(metaModel);
|
|
103499
|
+
metaModel.propertySets.push(propertySet);
|
|
103470
103500
|
}
|
|
103471
103501
|
|
|
103472
|
-
|
|
103473
|
-
|
|
103474
|
-
|
|
103502
|
+
// Create MetaObjects
|
|
103503
|
+
// Don't re-create reused MetaObjects
|
|
103504
|
+
// Save root MetaObjects on MetaModel
|
|
103505
|
+
// Save root MetaObjects on MetaScene
|
|
103475
103506
|
|
|
103507
|
+
for (let i = 0, len = metaModelData.metaObjects.length; i < len; i++) {
|
|
103508
|
+
const metaObjectData = metaModelData.metaObjects[i];
|
|
103509
|
+
const type = metaObjectData.type;
|
|
103510
|
+
const id = metaObjectData.id;
|
|
103511
|
+
let metaObject = this.metaObjects[id];
|
|
103512
|
+
if (!metaObject) {
|
|
103513
|
+
metaObject = new MetaObject({
|
|
103514
|
+
id,
|
|
103515
|
+
parentId: metaObjectData.parent,
|
|
103516
|
+
type,
|
|
103517
|
+
name: metaObjectData.name,
|
|
103518
|
+
propertySetIds: metaObjectData.propertySetIds
|
|
103519
|
+
});
|
|
103520
|
+
this.metaObjects[id] = metaObject;
|
|
103521
|
+
}
|
|
103522
|
+
metaObject.metaModels.push(metaModel);
|
|
103523
|
+
if (!metaObjectData.parent) {
|
|
103524
|
+
metaModel.rootMetaObjects.push(metaObject);
|
|
103525
|
+
this.rootMetaObjects[id] = metaObject;
|
|
103526
|
+
}
|
|
103527
|
+
metaModel.metaObjects.push(metaObject);
|
|
103528
|
+
}
|
|
103476
103529
|
|
|
103477
|
-
//
|
|
103530
|
+
// Re-link entire MetaObject parent/child hierarchy
|
|
103478
103531
|
|
|
103479
|
-
for (let
|
|
103480
|
-
const
|
|
103481
|
-
|
|
103482
|
-
|
|
103532
|
+
for (let objectId in this.metaObjects) {
|
|
103533
|
+
const metaObject = this.metaObjects[objectId];
|
|
103534
|
+
if (metaObject.children) {
|
|
103535
|
+
metaObject.children = [];
|
|
103536
|
+
}
|
|
103483
103537
|
}
|
|
103484
103538
|
|
|
103485
|
-
|
|
103486
|
-
|
|
103487
|
-
|
|
103488
|
-
|
|
103489
|
-
|
|
103490
|
-
|
|
103491
|
-
|
|
103492
|
-
|
|
103493
|
-
continue;
|
|
103539
|
+
for (let objectId in this.metaObjects) {
|
|
103540
|
+
const metaObject = this.metaObjects[objectId];
|
|
103541
|
+
if (metaObject.parentId) {
|
|
103542
|
+
const parentMetaObject = this.metaObjects[metaObject.parentId];
|
|
103543
|
+
if (parentMetaObject) {
|
|
103544
|
+
metaObject.parent = parentMetaObject;
|
|
103545
|
+
(parentMetaObject.children || (parentMetaObject.children = [])).push(metaObject);
|
|
103546
|
+
}
|
|
103494
103547
|
}
|
|
103495
|
-
createObjectsParams.push(filteredObject);
|
|
103496
103548
|
}
|
|
103497
103549
|
|
|
103498
|
-
// Create
|
|
103550
|
+
// Create MetaObjects-by-type lookup
|
|
103499
103551
|
|
|
103500
|
-
|
|
103501
|
-
|
|
103502
|
-
const
|
|
103503
|
-
const
|
|
103504
|
-
|
|
103505
|
-
|
|
103506
|
-
|
|
103507
|
-
|
|
103508
|
-
|
|
103509
|
-
|
|
103510
|
-
|
|
103511
|
-
|
|
103512
|
-
|
|
103552
|
+
this.metaObjectsByType = {};
|
|
103553
|
+
for (let objectId in this.metaObjects) {
|
|
103554
|
+
const metaObject = this.metaObjects[objectId];
|
|
103555
|
+
const type = metaObject.type;
|
|
103556
|
+
(this.metaObjectsByType[type] || (this.metaObjectsByType[type] = {}))[objectId] = metaObject;
|
|
103557
|
+
}
|
|
103558
|
+
|
|
103559
|
+
this.fire("metaModelCreated", modelId);
|
|
103560
|
+
|
|
103561
|
+
return metaModel;
|
|
103562
|
+
}
|
|
103563
|
+
|
|
103564
|
+
_globalizeIDs(modelId, metaModelData, options) {
|
|
103565
|
+
|
|
103566
|
+
const globalize = !!options.globalizeObjectIds;
|
|
103567
|
+
|
|
103568
|
+
if (metaModelData.metaObjects) {
|
|
103569
|
+
for (let i = 0, len = metaModelData.metaObjects.length; i < len; i++) {
|
|
103570
|
+
const metaObjectData = metaModelData.metaObjects[i];
|
|
103571
|
+
|
|
103572
|
+
// Globalize MetaObject IDs and parent IDs
|
|
103573
|
+
|
|
103574
|
+
metaObjectData.originalSystemId = metaObjectData.id;
|
|
103575
|
+
metaObjectData.originalParentSystemId = metaObjectData.parent;
|
|
103576
|
+
if (globalize) {
|
|
103577
|
+
metaObjectData.id = math.globalizeObjectId(modelId, metaObject.id);
|
|
103578
|
+
metaObjectData.parent = math.globalizeObjectId(modelId, metaObject.parent);
|
|
103579
|
+
}
|
|
103580
|
+
|
|
103581
|
+
// Globalize MetaObject property set IDs
|
|
103582
|
+
|
|
103583
|
+
const propertySetIds = metaObjectData.propertySetIds;
|
|
103584
|
+
if (propertySetIds) {
|
|
103585
|
+
const propertySetGlobalIds = [];
|
|
103586
|
+
for (let j = 0, lenj = propertySetIds.length; j < lenj; j++) {
|
|
103587
|
+
propertySetGlobalIds.push(math.globalizeObjectId(modelId, propertySetIds[j]));
|
|
103513
103588
|
}
|
|
103589
|
+
metaObjectData.propertySetIds = propertySetGlobalIds;
|
|
103590
|
+
metaObjectData.originalSystemPropertySetIds = propertySetIds;
|
|
103514
103591
|
}
|
|
103515
103592
|
}
|
|
103516
|
-
|
|
103517
|
-
|
|
103518
|
-
|
|
103519
|
-
|
|
103520
|
-
|
|
103521
|
-
|
|
103522
|
-
|
|
103523
|
-
|
|
103524
|
-
|
|
103525
|
-
|
|
103526
|
-
this._typeCounts[type]++;
|
|
103527
|
-
}
|
|
103528
|
-
existingObjects.push(metaObject);
|
|
103529
|
-
if (createObject.parent === undefined || createObject.parent === null) ;
|
|
103530
|
-
}
|
|
103531
|
-
|
|
103532
|
-
// Ensure that metaobjects in the existing metaobject list are all attached to their parents,
|
|
103533
|
-
// or registered as root metaobjects
|
|
103534
|
-
|
|
103535
|
-
for (let i = 0, len = existingObjects.length; i < len; i++) {
|
|
103536
|
-
const existingObject = existingObjects[i];
|
|
103537
|
-
const objectId = options.globalizeObjectIds ? math.globalizeObjectId(modelId, existingObject.id) : existingObject.id;
|
|
103538
|
-
if ((existingObject._parentId === undefined || existingObject._parentId === null) && !existingObject.parent) {
|
|
103539
|
-
metaModel.rootMetaObject = existingObject; // Deprecated, and won't work for federated models
|
|
103540
|
-
metaModel.rootMetaObjects[objectId] = existingObject;
|
|
103541
|
-
this.rootMetaObjects[objectId] = existingObject;
|
|
103542
|
-
} else if (existingObject._parentId) {
|
|
103543
|
-
const parentId = options.globalizeObjectIds ? math.globalizeObjectId(modelId, existingObject._parentId) : existingObject._parentId;
|
|
103544
|
-
existingObject._parentId = null;
|
|
103545
|
-
let parentMetaObject = this.metaObjects[parentId];
|
|
103546
|
-
if (parentMetaObject) {
|
|
103547
|
-
existingObject.parent = parentMetaObject;
|
|
103548
|
-
parentMetaObject.children = parentMetaObject.children || [];
|
|
103549
|
-
parentMetaObject.children.push(existingObject);
|
|
103593
|
+
}
|
|
103594
|
+
|
|
103595
|
+
// Globalize global PropertySet IDs
|
|
103596
|
+
|
|
103597
|
+
if (metaModelData.propertySets) {
|
|
103598
|
+
for (let i = 0, len = metaModelData.propertySets.length; i < len; i++) {
|
|
103599
|
+
const propertySet = metaModelData.propertySets[i];
|
|
103600
|
+
propertySet.originalSystemId = propertySet.id;
|
|
103601
|
+
if (globalize) {
|
|
103602
|
+
propertySet.id = math.globalizeObjectId(modelId, propertySet.id);
|
|
103550
103603
|
}
|
|
103551
103604
|
}
|
|
103552
103605
|
}
|
|
103553
|
-
|
|
103554
|
-
this.fire("metaModelCreated", modelId);
|
|
103555
|
-
return metaModel;
|
|
103556
103606
|
}
|
|
103557
103607
|
|
|
103558
103608
|
/**
|
|
@@ -103563,43 +103613,86 @@ class MetaScene {
|
|
|
103563
103613
|
* @param {String} id ID of the target {@link MetaModel}.
|
|
103564
103614
|
*/
|
|
103565
103615
|
destroyMetaModel(id) {
|
|
103616
|
+
|
|
103566
103617
|
const metaModel = this.metaModels[id];
|
|
103567
103618
|
if (!metaModel) {
|
|
103568
103619
|
return;
|
|
103569
103620
|
}
|
|
103570
|
-
this._removeMetaModel(metaModel);
|
|
103571
|
-
this.fire("metaModelDestroyed", id);
|
|
103572
|
-
}
|
|
103573
103621
|
|
|
103574
|
-
|
|
103575
|
-
|
|
103576
|
-
|
|
103577
|
-
|
|
103578
|
-
|
|
103579
|
-
|
|
103580
|
-
|
|
103581
|
-
|
|
103582
|
-
|
|
103583
|
-
|
|
103584
|
-
|
|
103622
|
+
// Remove global PropertySets
|
|
103623
|
+
|
|
103624
|
+
for (let i = 0, len = metaModel.propertySets.length; i < len; i++) {
|
|
103625
|
+
const propertySet = metaModel.propertySets[i];
|
|
103626
|
+
if (propertySet.metaModels.length === 1) { // Property set owned by one model, delete
|
|
103627
|
+
delete this.propertySets[propertySet.id];
|
|
103628
|
+
} else {
|
|
103629
|
+
const newMetaModels = [];
|
|
103630
|
+
for (let j = 0, lenj = propertySet.metaModels.length; j < lenj; j++) {
|
|
103631
|
+
if (propertySet.metaModels[i].id !== id) {
|
|
103632
|
+
newMetaModels.push(propertySet.metaModels[i]);
|
|
103633
|
+
}
|
|
103585
103634
|
}
|
|
103635
|
+
propertySet.metaModels = newMetaModels;
|
|
103586
103636
|
}
|
|
103587
|
-
|
|
103588
|
-
|
|
103589
|
-
|
|
103590
|
-
|
|
103591
|
-
|
|
103637
|
+
}
|
|
103638
|
+
|
|
103639
|
+
// Remove MetaObjects
|
|
103640
|
+
|
|
103641
|
+
for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {
|
|
103642
|
+
const metaObject = metaModel.metaObjects[i];
|
|
103643
|
+
metaObject.type;
|
|
103644
|
+
const id = metaObject.id;
|
|
103645
|
+
if (metaObject.metaModels.length === 1) { // MetaObject owned by one model, delete
|
|
103646
|
+
delete this.metaObjects[id];
|
|
103647
|
+
if (!metaObject.parent) {
|
|
103648
|
+
delete this.rootMetaObjects[id];
|
|
103649
|
+
}
|
|
103650
|
+
} else {
|
|
103651
|
+
const newMetaModels = [];
|
|
103652
|
+
const metaModelId = metaModel.id;
|
|
103653
|
+
for (let i = 0, len = metaObject.metaModels.length; i < len; i++) {
|
|
103654
|
+
if (metaObject.metaModels[i].id !== metaModelId) {
|
|
103655
|
+
newMetaModels.push(metaObject.metaModels[i]);
|
|
103656
|
+
}
|
|
103592
103657
|
}
|
|
103658
|
+
metaObject.metaModels = newMetaModels;
|
|
103593
103659
|
}
|
|
103594
|
-
}
|
|
103595
|
-
|
|
103596
|
-
|
|
103597
|
-
|
|
103598
|
-
|
|
103660
|
+
}
|
|
103661
|
+
|
|
103662
|
+
// Re-link entire MetaObject parent/child hierarchy
|
|
103663
|
+
|
|
103664
|
+
for (let objectId in this.metaObjects) {
|
|
103665
|
+
const metaObject = this.metaObjects[objectId];
|
|
103666
|
+
if (metaObject.children) {
|
|
103667
|
+
metaObject.children = [];
|
|
103599
103668
|
}
|
|
103600
103669
|
}
|
|
103601
|
-
|
|
103602
|
-
|
|
103670
|
+
|
|
103671
|
+
this.metaObjectsByType = {};
|
|
103672
|
+
|
|
103673
|
+
for (let objectId in this.metaObjects) {
|
|
103674
|
+
const metaObject = this.metaObjects[objectId];
|
|
103675
|
+
const type = metaObject.type;
|
|
103676
|
+
if (metaObject.children) {
|
|
103677
|
+
metaObject.children = null;
|
|
103678
|
+
}
|
|
103679
|
+
(this.metaObjectsByType[type] || (this.metaObjectsByType[type] = {}))[objectId] = metaObject;
|
|
103680
|
+
}
|
|
103681
|
+
|
|
103682
|
+
for (let objectId in this.metaObjects) {
|
|
103683
|
+
const metaObject = this.metaObjects[objectId];
|
|
103684
|
+
if (metaObject.parentId) {
|
|
103685
|
+
const parentMetaObject = this.metaObjects[metaObject.parentId];
|
|
103686
|
+
if (parentMetaObject) {
|
|
103687
|
+
metaObject.parent = parentMetaObject;
|
|
103688
|
+
(parentMetaObject.children || (parentMetaObject.children = [])).push(metaObject);
|
|
103689
|
+
}
|
|
103690
|
+
}
|
|
103691
|
+
}
|
|
103692
|
+
|
|
103693
|
+
delete this.metaModels[id];
|
|
103694
|
+
|
|
103695
|
+
this.fire("metaModelDestroyed", id);
|
|
103603
103696
|
}
|
|
103604
103697
|
|
|
103605
103698
|
/**
|
|
@@ -103622,12 +103715,13 @@ class MetaScene {
|
|
|
103622
103715
|
* @returns {String[]} Array of {@link MetaObject#id}s.
|
|
103623
103716
|
*/
|
|
103624
103717
|
getObjectIDsInSubtree(id, includeTypes, excludeTypes) {
|
|
103718
|
+
|
|
103625
103719
|
const list = [];
|
|
103626
103720
|
const metaObject = this.metaObjects[id];
|
|
103627
103721
|
const includeMask = (includeTypes && includeTypes.length > 0) ? arrayToMap(includeTypes) : null;
|
|
103628
103722
|
const excludeMask = (excludeTypes && excludeTypes.length > 0) ? arrayToMap(excludeTypes) : null;
|
|
103629
103723
|
|
|
103630
|
-
|
|
103724
|
+
const visit = (metaObject) => {
|
|
103631
103725
|
if (!metaObject) {
|
|
103632
103726
|
return;
|
|
103633
103727
|
}
|
|
@@ -103646,7 +103740,7 @@ class MetaScene {
|
|
|
103646
103740
|
visit(children[i]);
|
|
103647
103741
|
}
|
|
103648
103742
|
}
|
|
103649
|
-
}
|
|
103743
|
+
};
|
|
103650
103744
|
|
|
103651
103745
|
visit(metaObject);
|
|
103652
103746
|
return list;
|