@xeokit/xeokit-sdk 2.4.0-alpha-39 → 2.4.0-alpha-40
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 +275 -187
- package/dist/xeokit-sdk.es.js +275 -187
- 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
|
-
}
|
|
103093
|
+
this.propertySets = [];
|
|
103061
103094
|
|
|
103062
|
-
if (
|
|
103063
|
-
|
|
103064
|
-
|
|
103065
|
-
|
|
103066
|
-
|
|
103067
|
-
|
|
103068
|
-
|
|
103069
|
-
|
|
103070
|
-
|
|
103071
|
-
|
|
103072
|
-
|
|
103073
|
-
}
|
|
103074
|
-
|
|
103075
|
-
if (external !== undefined && external !== null) {
|
|
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,119 +103462,143 @@ class MetaScene {
|
|
|
103442
103462
|
*/
|
|
103443
103463
|
createMetaModel(modelId, metaModelData, options = {}) {
|
|
103444
103464
|
|
|
103445
|
-
|
|
103446
|
-
const revisionId = metaModelData.revisionId || "none";
|
|
103447
|
-
const newPropertySets = metaModelData.propertySets || [];
|
|
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);
|
|
103459
103466
|
|
|
103460
|
-
|
|
103467
|
+
// Create MetaModel
|
|
103468
|
+
|
|
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
|
-
|
|
103475
|
-
|
|
103476
|
-
|
|
103477
|
-
// Filter out the parameters we'll create
|
|
103502
|
+
// Create MetaObjects
|
|
103503
|
+
// Don't re-create reused MetaObjects
|
|
103504
|
+
// Save root MetaObjects on MetaModel
|
|
103505
|
+
// Save root MetaObjects on MetaScene
|
|
103478
103506
|
|
|
103479
|
-
for (let i = 0, len =
|
|
103480
|
-
const
|
|
103481
|
-
|
|
103482
|
-
|
|
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);
|
|
103483
103528
|
}
|
|
103484
103529
|
|
|
103485
|
-
//
|
|
103530
|
+
// Re-link entire MetaObject parent/child hierarchy
|
|
103486
103531
|
|
|
103487
|
-
for (let
|
|
103488
|
-
|
|
103489
|
-
|
|
103490
|
-
|
|
103491
|
-
existingObject.metaModels.push(metaModel);
|
|
103492
|
-
existingObjects.push(existingObject);
|
|
103493
|
-
continue;
|
|
103532
|
+
for (let objectId in this.metaObjects) {
|
|
103533
|
+
const metaObject = this.metaObjects[objectId];
|
|
103534
|
+
if (metaObject.children) {
|
|
103535
|
+
metaObject.children = [];
|
|
103494
103536
|
}
|
|
103495
|
-
createObjectsParams.push(filteredObject);
|
|
103496
103537
|
}
|
|
103497
103538
|
|
|
103498
|
-
|
|
103499
|
-
|
|
103500
|
-
|
|
103501
|
-
|
|
103502
|
-
const type = createObject.type;
|
|
103503
|
-
const objectId = options.globalizeObjectIds ? math.globalizeObjectId(modelId, createObject.id) : createObject.id;
|
|
103504
|
-
const originalSystemId = createObject.id;
|
|
103505
|
-
const name = createObject.name;
|
|
103506
|
-
const propertySets = [];
|
|
103507
|
-
if (createObject.propertySetIds && createObject.propertySetIds.length > 0) {
|
|
103508
|
-
for (let j = 0, lenj = createObject.propertySetIds.length; j < lenj; j++) {
|
|
103509
|
-
const propertySetId = createObject.propertySetIds[j];
|
|
103510
|
-
const propertySet = metaModel.propertySets[propertySetId];
|
|
103511
|
-
if (propertySet) {
|
|
103512
|
-
propertySets.push(propertySet);
|
|
103513
|
-
}
|
|
103514
|
-
}
|
|
103515
|
-
}
|
|
103516
|
-
const parent = null;
|
|
103517
|
-
const children = null;
|
|
103518
|
-
const external = createObject.external;
|
|
103519
|
-
const metaObject = new MetaObject(metaModel, objectId, originalSystemId, name, type, propertySets, parent, children, external);
|
|
103520
|
-
metaObject._parentId = createObject.parent;
|
|
103521
|
-
this.metaObjects[objectId] = metaObject;
|
|
103522
|
-
(this.metaObjectsByType[type] || (this.metaObjectsByType[type] = {}))[objectId] = metaObject;
|
|
103523
|
-
if (this._typeCounts[type] === undefined) {
|
|
103524
|
-
this._typeCounts[type] = 1;
|
|
103525
|
-
} else {
|
|
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];
|
|
103539
|
+
for (let objectId in this.metaObjects) {
|
|
103540
|
+
const metaObject = this.metaObjects[objectId];
|
|
103541
|
+
if (metaObject.parentId) {
|
|
103542
|
+
const parentMetaObject = this.metaObjects[metaObject.parentId];
|
|
103546
103543
|
if (parentMetaObject) {
|
|
103547
|
-
|
|
103548
|
-
parentMetaObject.children
|
|
103549
|
-
parentMetaObject.children.push(existingObject);
|
|
103544
|
+
metaObject.parent = parentMetaObject;
|
|
103545
|
+
(parentMetaObject.children || (parentMetaObject.children = [])).push(metaObject);
|
|
103550
103546
|
}
|
|
103551
103547
|
}
|
|
103552
103548
|
}
|
|
103553
103549
|
|
|
103550
|
+
// Create MetaObjects-by-type lookup
|
|
103551
|
+
|
|
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
|
+
|
|
103554
103559
|
this.fire("metaModelCreated", modelId);
|
|
103560
|
+
|
|
103555
103561
|
return metaModel;
|
|
103556
103562
|
}
|
|
103557
103563
|
|
|
103564
|
+
_globalizeIDs(modelId, metaModelData, options) {
|
|
103565
|
+
const globalize = !!options.globalizeObjectIds;
|
|
103566
|
+
for (let i = 0, len = metaModelData.metaObjects.length; i < len; i++) {
|
|
103567
|
+
const metaObjectData = metaModelData.metaObjects[i];
|
|
103568
|
+
|
|
103569
|
+
// Globalize MetaObject IDs and parent IDs
|
|
103570
|
+
|
|
103571
|
+
metaObjectData.originalSystemId = metaObjectData.id;
|
|
103572
|
+
metaObjectData.originalParentSystemId = metaObjectData.parent;
|
|
103573
|
+
if (globalize) {
|
|
103574
|
+
metaObjectData.id = math.globalizeObjectId(modelId, metaObject.id);
|
|
103575
|
+
metaObjectData.parent = math.globalizeObjectId(modelId, metaObject.parent);
|
|
103576
|
+
}
|
|
103577
|
+
|
|
103578
|
+
// Globalize MetaObject property set IDs
|
|
103579
|
+
|
|
103580
|
+
const propertySetIds = metaObjectData.propertySetIds;
|
|
103581
|
+
if (propertySetIds) {
|
|
103582
|
+
const propertySetGlobalIds = [];
|
|
103583
|
+
for (let j = 0, lenj = propertySetIds.length; j < lenj; j++) {
|
|
103584
|
+
propertySetGlobalIds.push(math.globalizeObjectId(modelId, propertySetIds[j]));
|
|
103585
|
+
}
|
|
103586
|
+
metaObjectData.propertySetIds = propertySetGlobalIds;
|
|
103587
|
+
metaObjectData.originalSystemPropertySetIds = propertySetIds;
|
|
103588
|
+
}
|
|
103589
|
+
}
|
|
103590
|
+
|
|
103591
|
+
// Globalize global PropertySet IDs
|
|
103592
|
+
|
|
103593
|
+
for (let i = 0, len = metaModelData.propertySets.length; i < len; i++) {
|
|
103594
|
+
const propertySet = metaModelData.propertySets[i];
|
|
103595
|
+
propertySet.originalSystemId = propertySet.id;
|
|
103596
|
+
if (globalize) {
|
|
103597
|
+
propertySet.id = math.globalizeObjectId(modelId, propertySet.id);
|
|
103598
|
+
}
|
|
103599
|
+
}
|
|
103600
|
+
}
|
|
103601
|
+
|
|
103558
103602
|
/**
|
|
103559
103603
|
* Removes a {@link MetaModel} from this MetaScene.
|
|
103560
103604
|
*
|
|
@@ -103563,43 +103607,86 @@ class MetaScene {
|
|
|
103563
103607
|
* @param {String} id ID of the target {@link MetaModel}.
|
|
103564
103608
|
*/
|
|
103565
103609
|
destroyMetaModel(id) {
|
|
103610
|
+
|
|
103566
103611
|
const metaModel = this.metaModels[id];
|
|
103567
103612
|
if (!metaModel) {
|
|
103568
103613
|
return;
|
|
103569
103614
|
}
|
|
103570
|
-
this._removeMetaModel(metaModel);
|
|
103571
|
-
this.fire("metaModelDestroyed", id);
|
|
103572
|
-
}
|
|
103573
103615
|
|
|
103574
|
-
|
|
103575
|
-
|
|
103576
|
-
|
|
103577
|
-
|
|
103578
|
-
|
|
103579
|
-
|
|
103580
|
-
|
|
103581
|
-
|
|
103582
|
-
|
|
103583
|
-
|
|
103584
|
-
|
|
103616
|
+
// Remove global PropertySets
|
|
103617
|
+
|
|
103618
|
+
for (let i = 0, len = metaModel.propertySets.length; i < len; i++) {
|
|
103619
|
+
const propertySet = metaModel.propertySets[i];
|
|
103620
|
+
if (propertySet.metaModels.length === 1) { // Property set owned by one model, delete
|
|
103621
|
+
delete this.propertySets[propertySet.id];
|
|
103622
|
+
} else {
|
|
103623
|
+
const newMetaModels = [];
|
|
103624
|
+
for (let j = 0, lenj = propertySet.metaModels.length; j < lenj; j++) {
|
|
103625
|
+
if (propertySet.metaModels[i].id !== id) {
|
|
103626
|
+
newMetaModels.push(propertySet.metaModels[i]);
|
|
103627
|
+
}
|
|
103585
103628
|
}
|
|
103629
|
+
propertySet.metaModels = newMetaModels;
|
|
103586
103630
|
}
|
|
103587
|
-
|
|
103588
|
-
|
|
103589
|
-
|
|
103590
|
-
|
|
103591
|
-
|
|
103631
|
+
}
|
|
103632
|
+
|
|
103633
|
+
// Remove MetaObjects
|
|
103634
|
+
|
|
103635
|
+
for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {
|
|
103636
|
+
const metaObject = metaModel.metaObjects[i];
|
|
103637
|
+
metaObject.type;
|
|
103638
|
+
const id = metaObject.id;
|
|
103639
|
+
if (metaObject.metaModels.length === 1) { // MetaObject owned by one model, delete
|
|
103640
|
+
delete this.metaObjects[id];
|
|
103641
|
+
if (!metaObject.parent) {
|
|
103642
|
+
delete this.rootMetaObjects[id];
|
|
103643
|
+
}
|
|
103644
|
+
} else {
|
|
103645
|
+
const newMetaModels = [];
|
|
103646
|
+
const metaModelId = metaModel.id;
|
|
103647
|
+
for (let i = 0, len = metaObject.metaModels.length; i < len; i++) {
|
|
103648
|
+
if (metaObject.metaModels[i].id !== metaModelId) {
|
|
103649
|
+
newMetaModels.push(metaObject.metaModels[i]);
|
|
103650
|
+
}
|
|
103592
103651
|
}
|
|
103652
|
+
metaObject.metaModels = newMetaModels;
|
|
103593
103653
|
}
|
|
103594
|
-
}
|
|
103595
|
-
|
|
103596
|
-
|
|
103597
|
-
|
|
103598
|
-
|
|
103654
|
+
}
|
|
103655
|
+
|
|
103656
|
+
// Re-link entire MetaObject parent/child hierarchy
|
|
103657
|
+
|
|
103658
|
+
for (let objectId in this.metaObjects) {
|
|
103659
|
+
const metaObject = this.metaObjects[objectId];
|
|
103660
|
+
if (metaObject.children) {
|
|
103661
|
+
metaObject.children = [];
|
|
103599
103662
|
}
|
|
103600
103663
|
}
|
|
103601
|
-
|
|
103602
|
-
|
|
103664
|
+
|
|
103665
|
+
this.metaObjectsByType = {};
|
|
103666
|
+
|
|
103667
|
+
for (let objectId in this.metaObjects) {
|
|
103668
|
+
const metaObject = this.metaObjects[objectId];
|
|
103669
|
+
const type = metaObject.type;
|
|
103670
|
+
if (metaObject.children) {
|
|
103671
|
+
metaObject.children = null;
|
|
103672
|
+
}
|
|
103673
|
+
(this.metaObjectsByType[type] || (this.metaObjectsByType[type] = {}))[objectId] = metaObject;
|
|
103674
|
+
}
|
|
103675
|
+
|
|
103676
|
+
for (let objectId in this.metaObjects) {
|
|
103677
|
+
const metaObject = this.metaObjects[objectId];
|
|
103678
|
+
if (metaObject.parentId) {
|
|
103679
|
+
const parentMetaObject = this.metaObjects[metaObject.parentId];
|
|
103680
|
+
if (parentMetaObject) {
|
|
103681
|
+
metaObject.parent = parentMetaObject;
|
|
103682
|
+
(parentMetaObject.children || (parentMetaObject.children = [])).push(metaObject);
|
|
103683
|
+
}
|
|
103684
|
+
}
|
|
103685
|
+
}
|
|
103686
|
+
|
|
103687
|
+
delete this.metaModels[id];
|
|
103688
|
+
|
|
103689
|
+
this.fire("metaModelDestroyed", id);
|
|
103603
103690
|
}
|
|
103604
103691
|
|
|
103605
103692
|
/**
|
|
@@ -103622,12 +103709,13 @@ class MetaScene {
|
|
|
103622
103709
|
* @returns {String[]} Array of {@link MetaObject#id}s.
|
|
103623
103710
|
*/
|
|
103624
103711
|
getObjectIDsInSubtree(id, includeTypes, excludeTypes) {
|
|
103712
|
+
|
|
103625
103713
|
const list = [];
|
|
103626
103714
|
const metaObject = this.metaObjects[id];
|
|
103627
103715
|
const includeMask = (includeTypes && includeTypes.length > 0) ? arrayToMap(includeTypes) : null;
|
|
103628
103716
|
const excludeMask = (excludeTypes && excludeTypes.length > 0) ? arrayToMap(excludeTypes) : null;
|
|
103629
103717
|
|
|
103630
|
-
|
|
103718
|
+
const visit = (metaObject) => {
|
|
103631
103719
|
if (!metaObject) {
|
|
103632
103720
|
return;
|
|
103633
103721
|
}
|
|
@@ -103646,7 +103734,7 @@ class MetaScene {
|
|
|
103646
103734
|
visit(children[i]);
|
|
103647
103735
|
}
|
|
103648
103736
|
}
|
|
103649
|
-
}
|
|
103737
|
+
};
|
|
103650
103738
|
|
|
103651
103739
|
visit(metaObject);
|
|
103652
103740
|
return list;
|