@xeokit/xeokit-sdk 2.6.49 → 2.6.50

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.
@@ -84320,6 +84320,8 @@ class SceneModel extends Component {
84320
84320
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84321
84321
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84322
84322
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
84323
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
84324
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
84323
84325
  this._matrix.set(this._worldRotationMatrix);
84324
84326
  math.translateMat4v(this._position, this._matrix);
84325
84327
  this._matrixDirty = false;
@@ -122965,7 +122967,7 @@ class Storey {
122965
122967
  /**
122966
122968
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122967
122969
  *
122968
- * The boundary is a six-element Float32Array containing the min/max extents of the
122970
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122969
122971
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122970
122972
  *
122971
122973
  * @property storeyAABB
@@ -122976,7 +122978,7 @@ class Storey {
122976
122978
  /**
122977
122979
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122978
122980
  *
122979
- * The boundary is a six-element Float32Array containing the min/max extents of the
122981
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122980
122982
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122981
122983
  *
122982
122984
  * @deprecated
@@ -122988,7 +122990,7 @@ class Storey {
122988
122990
  /**
122989
122991
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
122990
122992
  *
122991
- * The boundary is a six-element Float32Array containing the min/max extents of the
122993
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122992
122994
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122993
122995
  *
122994
122996
  * @property modelAABB
@@ -123313,6 +123315,8 @@ class StoreyViewsPlugin extends Plugin {
123313
123315
  */
123314
123316
  this.storeys = {};
123315
123317
 
123318
+ this._storeysList = null;
123319
+
123316
123320
  /**
123317
123321
  * A set of {@link Storey}s for each {@link MetaModel}.
123318
123322
  *
@@ -123354,6 +123358,7 @@ class StoreyViewsPlugin extends Plugin {
123354
123358
  this.fire("storeys", this.storeys);
123355
123359
  });
123356
123360
  this.storeys[storeyId] = storey;
123361
+ this._storeysList= null;
123357
123362
  if (!this.modelStoreys[modelId]) {
123358
123363
  this.modelStoreys[modelId] = {};
123359
123364
  }
@@ -123374,6 +123379,7 @@ class StoreyViewsPlugin extends Plugin {
123374
123379
  model.off(storey._onModelDestroyed);
123375
123380
  }
123376
123381
  delete this.storeys[storyObjectId];
123382
+ this._storeysList= null;
123377
123383
  }
123378
123384
  }
123379
123385
  delete this.modelStoreys[modelId];
@@ -123478,7 +123484,7 @@ class StoreyViewsPlugin extends Plugin {
123478
123484
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
123479
123485
  * @param {*} [options] Options for showing the Entitys within the storey.
123480
123486
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
123481
- */
123487
+ */
123482
123488
  showStoreyObjects(storeyId, options = {}) {
123483
123489
 
123484
123490
  const storey = this.storeys[storeyId];
@@ -123503,7 +123509,7 @@ class StoreyViewsPlugin extends Plugin {
123503
123509
 
123504
123510
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
123505
123511
  if (entity) {
123506
- entity.visible = true;
123512
+ entity.visible = true;
123507
123513
  }
123508
123514
  });
123509
123515
  }
@@ -123739,7 +123745,7 @@ class StoreyViewsPlugin extends Plugin {
123739
123745
 
123740
123746
  /**
123741
123747
  * Gets the ID of the storey which's bounding box contains the y point of the world position
123742
- *
123748
+ *
123743
123749
  * @param {Number[]} worldPos 3D World-space position.
123744
123750
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
123745
123751
  */
@@ -123859,6 +123865,42 @@ class StoreyViewsPlugin extends Plugin {
123859
123865
  this.viewer.scene.off(this._onModelLoaded);
123860
123866
  super.destroy();
123861
123867
  }
123868
+
123869
+ /**
123870
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
123871
+ *
123872
+ * @returns {null}
123873
+ */
123874
+ get storeysList() {
123875
+ if (!this._storeysList) {
123876
+ this._storeysList = Object.values(this.storeys);
123877
+ this._storeysList.sort(this._getSpatialSortFunc());
123878
+ }
123879
+ return this._storeysList;
123880
+ }
123881
+
123882
+ _getSpatialSortFunc() {
123883
+ const viewer = this.viewer;
123884
+ const scene = viewer.scene;
123885
+ const camera = scene.camera;
123886
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
123887
+ let idx = 0;
123888
+ if (camera.xUp) {
123889
+ idx = 0;
123890
+ } else if (camera.yUp) {
123891
+ idx = 1;
123892
+ } else {
123893
+ idx = 2;
123894
+ }
123895
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
123896
+ return -1;
123897
+ }
123898
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
123899
+ return 1;
123900
+ }
123901
+ return 0;
123902
+ });
123903
+ }
123862
123904
  }
123863
123905
 
123864
123906
  const zeroVec = new Float64Array([0, 0, 1]);
@@ -127421,8 +127463,8 @@ class TreeViewPlugin extends Plugin {
127421
127463
  if (!children || children.length === 0) {
127422
127464
  return;
127423
127465
  }
127424
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
127425
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
127466
+ const firstChild = children[0];
127467
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
127426
127468
  children.sort(this._getSpatialSortFunc());
127427
127469
  } else {
127428
127470
  children.sort(this._alphaSortFunc);
@@ -84316,6 +84316,8 @@ class SceneModel extends Component {
84316
84316
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84317
84317
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84318
84318
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
84319
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
84320
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
84319
84321
  this._matrix.set(this._worldRotationMatrix);
84320
84322
  math.translateMat4v(this._position, this._matrix);
84321
84323
  this._matrixDirty = false;
@@ -122961,7 +122963,7 @@ class Storey {
122961
122963
  /**
122962
122964
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122963
122965
  *
122964
- * The boundary is a six-element Float32Array containing the min/max extents of the
122966
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122965
122967
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122966
122968
  *
122967
122969
  * @property storeyAABB
@@ -122972,7 +122974,7 @@ class Storey {
122972
122974
  /**
122973
122975
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122974
122976
  *
122975
- * The boundary is a six-element Float32Array containing the min/max extents of the
122977
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122976
122978
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122977
122979
  *
122978
122980
  * @deprecated
@@ -122984,7 +122986,7 @@ class Storey {
122984
122986
  /**
122985
122987
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
122986
122988
  *
122987
- * The boundary is a six-element Float32Array containing the min/max extents of the
122989
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122988
122990
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122989
122991
  *
122990
122992
  * @property modelAABB
@@ -123309,6 +123311,8 @@ class StoreyViewsPlugin extends Plugin {
123309
123311
  */
123310
123312
  this.storeys = {};
123311
123313
 
123314
+ this._storeysList = null;
123315
+
123312
123316
  /**
123313
123317
  * A set of {@link Storey}s for each {@link MetaModel}.
123314
123318
  *
@@ -123350,6 +123354,7 @@ class StoreyViewsPlugin extends Plugin {
123350
123354
  this.fire("storeys", this.storeys);
123351
123355
  });
123352
123356
  this.storeys[storeyId] = storey;
123357
+ this._storeysList= null;
123353
123358
  if (!this.modelStoreys[modelId]) {
123354
123359
  this.modelStoreys[modelId] = {};
123355
123360
  }
@@ -123370,6 +123375,7 @@ class StoreyViewsPlugin extends Plugin {
123370
123375
  model.off(storey._onModelDestroyed);
123371
123376
  }
123372
123377
  delete this.storeys[storyObjectId];
123378
+ this._storeysList= null;
123373
123379
  }
123374
123380
  }
123375
123381
  delete this.modelStoreys[modelId];
@@ -123474,7 +123480,7 @@ class StoreyViewsPlugin extends Plugin {
123474
123480
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
123475
123481
  * @param {*} [options] Options for showing the Entitys within the storey.
123476
123482
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
123477
- */
123483
+ */
123478
123484
  showStoreyObjects(storeyId, options = {}) {
123479
123485
 
123480
123486
  const storey = this.storeys[storeyId];
@@ -123499,7 +123505,7 @@ class StoreyViewsPlugin extends Plugin {
123499
123505
 
123500
123506
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
123501
123507
  if (entity) {
123502
- entity.visible = true;
123508
+ entity.visible = true;
123503
123509
  }
123504
123510
  });
123505
123511
  }
@@ -123735,7 +123741,7 @@ class StoreyViewsPlugin extends Plugin {
123735
123741
 
123736
123742
  /**
123737
123743
  * Gets the ID of the storey which's bounding box contains the y point of the world position
123738
- *
123744
+ *
123739
123745
  * @param {Number[]} worldPos 3D World-space position.
123740
123746
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
123741
123747
  */
@@ -123855,6 +123861,42 @@ class StoreyViewsPlugin extends Plugin {
123855
123861
  this.viewer.scene.off(this._onModelLoaded);
123856
123862
  super.destroy();
123857
123863
  }
123864
+
123865
+ /**
123866
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
123867
+ *
123868
+ * @returns {null}
123869
+ */
123870
+ get storeysList() {
123871
+ if (!this._storeysList) {
123872
+ this._storeysList = Object.values(this.storeys);
123873
+ this._storeysList.sort(this._getSpatialSortFunc());
123874
+ }
123875
+ return this._storeysList;
123876
+ }
123877
+
123878
+ _getSpatialSortFunc() {
123879
+ const viewer = this.viewer;
123880
+ const scene = viewer.scene;
123881
+ const camera = scene.camera;
123882
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
123883
+ let idx = 0;
123884
+ if (camera.xUp) {
123885
+ idx = 0;
123886
+ } else if (camera.yUp) {
123887
+ idx = 1;
123888
+ } else {
123889
+ idx = 2;
123890
+ }
123891
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
123892
+ return -1;
123893
+ }
123894
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
123895
+ return 1;
123896
+ }
123897
+ return 0;
123898
+ });
123899
+ }
123858
123900
  }
123859
123901
 
123860
123902
  const zeroVec = new Float64Array([0, 0, 1]);
@@ -127417,8 +127459,8 @@ class TreeViewPlugin extends Plugin {
127417
127459
  if (!children || children.length === 0) {
127418
127460
  return;
127419
127461
  }
127420
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
127421
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
127462
+ const firstChild = children[0];
127463
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
127422
127464
  children.sort(this._getSpatialSortFunc());
127423
127465
  } else {
127424
127466
  children.sort(this._alphaSortFunc);
@@ -18604,7 +18604,7 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
18604
18604
  * Gets the SceneModel's local modeling rotation transform matrix.
18605
18605
  *
18606
18606
  * @type {Number[]}
18607
- */,set:function set(value){this._matrix.set(value||DEFAULT_MATRIX);math.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix);math.conjugateQuaternion(this._quaternion,this._conjugateQuaternion);math.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate);this._matrix.set(this._worldRotationMatrix);math.translateMat4v(this._position,this._matrix);this._matrixDirty=false;this._setWorldMatrixDirty();this._sceneModelDirty();this.glRedraw();}},{key:"rotationMatrix",get:function get(){this._rebuildMatrices();return this._worldRotationMatrix;}},{key:"_rebuildMatrices",value:function _rebuildMatrices(){if(this._matrixDirty){math.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix);math.conjugateQuaternion(this._quaternion,this._conjugateQuaternion);math.quaternionToRotationMat4(this._conjugateQuaternion,this._worldRotationMatrixConjugate);this._matrix.set(this._worldRotationMatrix);math.translateMat4v(this._position,this._matrix);this._matrixDirty=false;this._viewMatrixDirty=true;}}/**
18607
+ */,set:function set(value){this._matrix.set(value||DEFAULT_MATRIX);math.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix);math.conjugateQuaternion(this._quaternion,this._conjugateQuaternion);math.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrixConjugate);this._matrix.set(this._worldRotationMatrix);math.translateMat4v(this._position,this._matrix);this._matrixDirty=false;this._setWorldMatrixDirty();this._sceneModelDirty();this.glRedraw();}},{key:"rotationMatrix",get:function get(){this._rebuildMatrices();return this._worldRotationMatrix;}},{key:"_rebuildMatrices",value:function _rebuildMatrices(){if(this._matrixDirty){math.quaternionToRotationMat4(this._quaternion,this._worldRotationMatrix);math.conjugateQuaternion(this._quaternion,this._conjugateQuaternion);math.quaternionToRotationMat4(this._conjugateQuaternion,this._worldRotationMatrixConjugate);math.scaleMat4v(this._scale,this._worldRotationMatrix);math.scaleMat4v(this._scale,this._worldRotationMatrixConjugate);this._matrix.set(this._worldRotationMatrix);math.translateMat4v(this._position,this._matrix);this._matrixDirty=false;this._viewMatrixDirty=true;}}/**
18608
18608
  * Gets the conjugate of the SceneModel's local modeling rotation transform matrix.
18609
18609
  *
18610
18610
  * This is used for RTC view matrix management in renderers.
@@ -26142,7 +26142,7 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26142
26142
  */this.modelId=modelId;/**
26143
26143
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
26144
26144
  *
26145
- * The boundary is a six-element Float32Array containing the min/max extents of the
26145
+ * The boundary is a six-element Float64Array containing the min/max extents of the
26146
26146
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
26147
26147
  *
26148
26148
  * @property storeyAABB
@@ -26150,7 +26150,7 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26150
26150
  */this.storeyAABB=storeyAABB.slice();/**
26151
26151
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
26152
26152
  *
26153
- * The boundary is a six-element Float32Array containing the min/max extents of the
26153
+ * The boundary is a six-element Float64Array containing the min/max extents of the
26154
26154
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
26155
26155
  *
26156
26156
  * @deprecated
@@ -26159,7 +26159,7 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26159
26159
  */this.aabb=this.storeyAABB;/**
26160
26160
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
26161
26161
  *
26162
- * The boundary is a six-element Float32Array containing the min/max extents of the
26162
+ * The boundary is a six-element Float64Array containing the min/max extents of the
26163
26163
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
26164
26164
  *
26165
26165
  * @property modelAABB
@@ -26433,13 +26433,13 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26433
26433
  * These are created and destroyed automatically as models are loaded and destroyed.
26434
26434
  *
26435
26435
  * @type {{String:Storey}}
26436
- */_this142.storeys={};/**
26436
+ */_this142.storeys={};_this142._storeysList=null;/**
26437
26437
  * A set of {@link Storey}s for each {@link MetaModel}.
26438
26438
  *
26439
26439
  * These are created and destroyed automatically as models are loaded and destroyed.
26440
26440
  *
26441
26441
  * @type {{String: {String:Storey}}}
26442
- */_this142.modelStoreys={};_this142._fitStoreyMaps=!!cfg.fitStoreyMaps;_this142._onModelLoaded=_this142.viewer.scene.on("modelLoaded",function(modelId){_this142._registerModelStoreys(modelId);_this142.fire("storeys",_this142.storeys);});return _this142;}_createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this143=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i533=0,len=storeyIds.length;_i533<len;_i533++){var storeyId=storeyIds[_i533];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this143._deregisterModelStoreys(modelId);_this143.fire("storeys",_this143.storeys);});this.storeys[storeyId]=storey;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];}}delete this.modelStoreys[modelId];}}/**
26442
+ */_this142.modelStoreys={};_this142._fitStoreyMaps=!!cfg.fitStoreyMaps;_this142._onModelLoaded=_this142.viewer.scene.on("modelLoaded",function(modelId){_this142._registerModelStoreys(modelId);_this142.fire("storeys",_this142.storeys);});return _this142;}_createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this143=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i533=0,len=storeyIds.length;_i533<len;_i533++){var storeyId=storeyIds[_i533];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this143._deregisterModelStoreys(modelId);_this143.fire("storeys",_this143.storeys);});this.storeys[storeyId]=storey;this._storeysList=null;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];this._storeysList=null;}}delete this.modelStoreys[modelId];}}/**
26443
26443
  * When true, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different
26444
26444
  * floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
26445
26445
  * @returns {*|boolean}
@@ -26466,7 +26466,7 @@ var sca=Math.abs(diag/Math.tan(fitFOV*math.DEGTORAD));var orthoScale2=diag*1.3;v
26466
26466
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
26467
26467
  * @param {*} [options] Options for showing the Entitys within the storey.
26468
26468
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
26469
- */},{key:"showStoreyObjects",value:function showStoreyObjects(storeyId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var storey=this.storeys[storeyId];if(!storey){this.error("IfcBuildingStorey not found with this ID: "+storeyId);return;}var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var storeyMetaObject=metaScene.metaObjects[storeyId];if(!storeyMetaObject){return;}if(options.hideOthers){scene.setObjectsVisible(viewer.scene.visibleObjectIds,false);}this.withStoreyObjects(storeyId,function(entity,metaObject){if(entity){entity.visible=true;}});}/**
26469
+ */},{key:"showStoreyObjects",value:function showStoreyObjects(storeyId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var storey=this.storeys[storeyId];if(!storey){this.error("IfcBuildingStorey not found with this ID: "+storeyId);return;}var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var storeyMetaObject=metaScene.metaObjects[storeyId];if(!storeyMetaObject){return;}if(options.hideOthers){scene.setObjectsVisible(viewer.scene.visibleObjectIds,false);}this.withStoreyObjects(storeyId,function(entity,metaObject){if(entity){entity.visible=true;}});}/**
26470
26470
  * Executes a callback on each of the objects within the given storey.
26471
26471
  *
26472
26472
  * ## Usage
@@ -26510,7 +26510,7 @@ pickSurface:options.pickSurface,pickInvisible:true,matrix:matrix});return pickRe
26510
26510
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
26511
26511
  */},{key:"getStoreyContainingWorldPos",value:function getStoreyContainingWorldPos(worldPos){for(var storeyId in this.storeys){var storey=this.storeys[storeyId];if(math.point3AABB3AbsoluteIntersect(storey.storeyAABB,worldPos)){return storeyId;}}return null;}/**
26512
26512
  * Gets the ID of the storey which's bounding box contains the y point of the world position
26513
- *
26513
+ *
26514
26514
  * @param {Number[]} worldPos 3D World-space position.
26515
26515
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
26516
26516
  */},{key:"getStoreyInVerticalRange",value:function getStoreyInVerticalRange(worldPos){for(var storeyId in this.storeys){var storey=this.storeys[storeyId];var aabb=[0,0,0,0,0,0],pos=[0,0,0];aabb[1]=storey.storeyAABB[1];aabb[4]=storey.storeyAABB[4];pos[1]=worldPos[1];if(math.point3AABB3AbsoluteIntersect(aabb,pos)){return storeyId;}}return null;}/**
@@ -26536,7 +26536,11 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
26536
26536
  * @param {Number[]} imageDir Normalized 2D direction vector.
26537
26537
  */},{key:"worldDirToStoreyMap",value:function worldDirToStoreyMap(storeyMap,worldDir,imageDir){var camera=this.viewer.camera;var eye=camera.eye;var look=camera.look;var eyeLookDir=math.subVec3(look,eye,tempVec3a$2);var worldUp=camera.worldUp;var xUp=worldUp[0]>worldUp[1]&&worldUp[0]>worldUp[2];var yUp=!xUp&&worldUp[1]>worldUp[0]&&worldUp[1]>worldUp[2];!xUp&&!yUp&&worldUp[2]>worldUp[0]&&worldUp[2]>worldUp[1];if(xUp){imageDir[0]=eyeLookDir[1];imageDir[1]=eyeLookDir[2];}else if(yUp){imageDir[0]=eyeLookDir[0];imageDir[1]=eyeLookDir[2];}else{imageDir[0]=eyeLookDir[0];imageDir[1]=eyeLookDir[1];}math.normalizeVec2(imageDir);}/**
26538
26538
  * Destroys this StoreyViewsPlugin.
26539
- */},{key:"destroy",value:function destroy(){this.viewer.scene.off(this._onModelLoaded);_get(_getPrototypeOf(StoreyViewsPlugin.prototype),"destroy",this).call(this);}}]);return StoreyViewsPlugin;}(Plugin);var zeroVec=new Float64Array([0,0,1]);var quat=new Float64Array(4);/**
26539
+ */},{key:"destroy",value:function destroy(){this.viewer.scene.off(this._onModelLoaded);_get(_getPrototypeOf(StoreyViewsPlugin.prototype),"destroy",this).call(this);}/**
26540
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
26541
+ *
26542
+ * @returns {null}
26543
+ */},{key:"storeysList",get:function get(){if(!this._storeysList){this._storeysList=Object.values(this.storeys);this._storeysList.sort(this._getSpatialSortFunc());}return this._storeysList;}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;return this._spatialSortFunc||(this._spatialSortFunc=function(storey1,storey2){var idx=0;if(camera.xUp){idx=0;}else if(camera.yUp){idx=1;}else{idx=2;}if(storey1.aabb[idx]>storey2.aabb[idx]){return-1;}if(storey1.aabb[idx]<storey2.aabb[idx]){return 1;}return 0;});}}]);return StoreyViewsPlugin;}(Plugin);var zeroVec=new Float64Array([0,0,1]);var quat=new Float64Array(4);/**
26540
26544
  * Controls a {@link SectionPlane} with mouse and touch input.
26541
26545
  */var FaceAlignedSectionPlanesControl=/*#__PURE__*/function(){/** @private */function FaceAlignedSectionPlanesControl(plugin){_classCallCheck(this,FaceAlignedSectionPlanesControl);/**
26542
26546
  * ID of this FaceAlignedSectionPlanesControl.
@@ -27621,8 +27625,7 @@ _this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;
27621
27625
  // // errors.push("Can't build storeys hierarchy: no IfcBuildingStoreys found");
27622
27626
  // }
27623
27627
  // }
27624
- return true;}},{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();this._createTrees();this.expandToDepth(this._autoExpandDepth);}},{key:"_createDisabledNodes",value:function _createDisabledNodes(){var rootNode=this._renderService.createRootNode();this._rootElement=rootNode;this._containerElement.appendChild(rootNode);var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){var rootMetaObject=rootMetaObjects[objectId];var metaObjectType=rootMetaObject.type;var metaObjectName=rootMetaObject.name;var rootName=metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType;var childNode=this._renderService.createDisabledNodeElement(rootName);rootNode.appendChild(childNode);}}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i544=0,len=children.length;_i544<len;_i544++){var childMetaObject=children[_i544];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_createStoreysNodes",value:function _createStoreysNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createStoreysNodes2(rootMetaObjects[id],null,null,null);}}},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(buildingNode);this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node6={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node6);this._objectNodes[_node6.objectId]=_node6;this._nodeNodes[_node6.nodeId]=_node6;}}}if(children){for(var _i545=0,len=children.length;_i545<len;_i545++){var childMetaObject=children[_i545];this._createStoreysNodes2(childMetaObject,buildingNode,storeyNode,typeNodes);}}}},{key:"_createTypesNodes",value:function _createTypesNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createTypesNodes2(rootMetaObjects[id],null,null);}}},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node7={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node7);this._objectNodes[_node7.objectId]=_node7;this._nodeNodes[_node7.nodeId]=_node7;}}}if(children){for(var _i546=0,len=children.length;_i546<len;_i546++){var childMetaObject=children[_i546];this._createTypesNodes2(childMetaObject,rootNode,typeNodes);}}}},{key:"_createContainmentNodes",value:function _createContainmentNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createContainmentNodes2(rootMetaObjects[id],null);}}},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var _i547=0,len=children.length;_i547<len;_i547++){var childMetaObject=children[_i547];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}if(this._hierarchy==="storeys"&&node.type==="IfcBuilding"){// Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
27625
- children.sort(this._getSpatialSortFunc());}else{children.sort(this._alphaSortFunc);}for(var _i549=0,len=children.length;_i549<len;_i549++){var _node8=children[_i549];this._sortChildren(_node8);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){// Creates cached sort func with Viewer in scope
27628
+ return true;}},{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();this._createTrees();this.expandToDepth(this._autoExpandDepth);}},{key:"_createDisabledNodes",value:function _createDisabledNodes(){var rootNode=this._renderService.createRootNode();this._rootElement=rootNode;this._containerElement.appendChild(rootNode);var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){var rootMetaObject=rootMetaObjects[objectId];var metaObjectType=rootMetaObject.type;var metaObjectName=rootMetaObject.name;var rootName=metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType;var childNode=this._renderService.createDisabledNodeElement(rootName);rootNode.appendChild(childNode);}}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i544=0,len=children.length;_i544<len;_i544++){var childMetaObject=children[_i544];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_createStoreysNodes",value:function _createStoreysNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createStoreysNodes2(rootMetaObjects[id],null,null,null);}}},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(buildingNode);this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node6={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node6);this._objectNodes[_node6.objectId]=_node6;this._nodeNodes[_node6.nodeId]=_node6;}}}if(children){for(var _i545=0,len=children.length;_i545<len;_i545++){var childMetaObject=children[_i545];this._createStoreysNodes2(childMetaObject,buildingNode,storeyNode,typeNodes);}}}},{key:"_createTypesNodes",value:function _createTypesNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createTypesNodes2(rootMetaObjects[id],null,null);}}},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node7={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node7);this._objectNodes[_node7.objectId]=_node7;this._nodeNodes[_node7.nodeId]=_node7;}}}if(children){for(var _i546=0,len=children.length;_i546<len;_i546++){var childMetaObject=children[_i546];this._createTypesNodes2(childMetaObject,rootNode,typeNodes);}}}},{key:"_createContainmentNodes",value:function _createContainmentNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createContainmentNodes2(rootMetaObjects[id],null);}}},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?"na":this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var _i547=0,len=children.length;_i547<len;_i547++){var childMetaObject=children[_i547];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}var firstChild=children[0];if(this._hierarchy==="storeys"&&firstChild.type==="IfcBuildingStorey"){children.sort(this._getSpatialSortFunc());}else{children.sort(this._alphaSortFunc);}for(var _i549=0,len=children.length;_i549<len;_i549++){var _node8=children[_i549];this._sortChildren(_node8);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){// Creates cached sort func with Viewer in scope
27626
27629
  var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var metaScene=viewer.metaScene;return this._spatialSortFunc||(this._spatialSortFunc=function(node1,node2){if(!node1.aabb||!node2.aabb){// Sorting on lowest point of the AABB is likely more more robust when objects could overlap storeys
27627
27630
  if(!node1.aabb){node1.aabb=scene.getAABB(metaScene.getObjectIDsInSubtree(node1.objectId));}if(!node2.aabb){node2.aabb=scene.getAABB(metaScene.getObjectIDsInSubtree(node2.objectId));}}var idx=0;if(camera.xUp){idx=0;}else if(camera.yUp){idx=1;}else{idx=2;}if(node1.aabb[idx]>node2.aabb[idx]){return-1;}if(node1.aabb[idx]<node2.aabb[idx]){return 1;}return 0;});}},{key:"_alphaSortFunc",value:function _alphaSortFunc(node1,node2){var title1=node1.title.toUpperCase();// FIXME: Should be case sensitive?
27628
27631
  var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title2){return 1;}return 0;}},{key:"_synchNodesToEntities",value:function _synchNodesToEntities(){var objectIds=Object.keys(this.viewer.metaScene.metaObjects);var metaObjects=this._viewer.metaScene.metaObjects;var objects=this._viewer.scene.objects;for(var _i550=0,len=objectIds.length;_i550<len;_i550++){var objectId=objectIds[_i550];var metaObject=metaObjects[objectId];if(metaObject){var _node9=this._objectNodes[objectId];if(_node9){var entity=objects[objectId];if(entity){var visible=entity.visible;_node9.numEntities=1;_node9.xrayed=entity.xrayed;if(visible){_node9.numVisibleEntities=1;_node9.checked=true;}else{_node9.numVisibleEntities=0;_node9.checked=false;}var parent=_node9.parent;// Synch parents