Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Oct 15, 2024
1 parent 645fe45 commit 5440a2d
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 33 deletions.
58 changes: 50 additions & 8 deletions dist/xeokit-sdk.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -84320,6 +84320,8 @@ class SceneModel extends Component {
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;
Expand Down Expand Up @@ -122965,7 +122967,7 @@ class Storey {
/**
* Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
*
* The boundary is a six-element Float32Array containing the min/max extents of the
* The boundary is a six-element Float64Array containing the min/max extents of the
* axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
*
* @property storeyAABB
Expand All @@ -122976,7 +122978,7 @@ class Storey {
/**
* Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
*
* The boundary is a six-element Float32Array containing the min/max extents of the
* The boundary is a six-element Float64Array containing the min/max extents of the
* axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
*
* @deprecated
Expand All @@ -122988,7 +122990,7 @@ class Storey {
/**
* Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
*
* The boundary is a six-element Float32Array containing the min/max extents of the
* The boundary is a six-element Float64Array containing the min/max extents of the
* axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
*
* @property modelAABB
Expand Down Expand Up @@ -123313,6 +123315,8 @@ class StoreyViewsPlugin extends Plugin {
*/
this.storeys = {};

this._storeysList = null;

/**
* A set of {@link Storey}s for each {@link MetaModel}.
*
Expand Down Expand Up @@ -123354,6 +123358,7 @@ class StoreyViewsPlugin extends Plugin {
this.fire("storeys", this.storeys);
});
this.storeys[storeyId] = storey;
this._storeysList= null;
if (!this.modelStoreys[modelId]) {
this.modelStoreys[modelId] = {};
}
Expand All @@ -123374,6 +123379,7 @@ class StoreyViewsPlugin extends Plugin {
model.off(storey._onModelDestroyed);
}
delete this.storeys[storyObjectId];
this._storeysList= null;
}
}
delete this.modelStoreys[modelId];
Expand Down Expand Up @@ -123478,7 +123484,7 @@ class StoreyViewsPlugin extends Plugin {
* @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
* @param {*} [options] Options for showing the Entitys within the storey.
* @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
*/
*/
showStoreyObjects(storeyId, options = {}) {

const storey = this.storeys[storeyId];
Expand All @@ -123503,7 +123509,7 @@ class StoreyViewsPlugin extends Plugin {

this.withStoreyObjects(storeyId, (entity, metaObject) => {
if (entity) {
entity.visible = true;
entity.visible = true;
}
});
}
Expand Down Expand Up @@ -123739,7 +123745,7 @@ class StoreyViewsPlugin extends Plugin {

/**
* Gets the ID of the storey which's bounding box contains the y point of the world position
*
*
* @param {Number[]} worldPos 3D World-space position.
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
*/
Expand Down Expand Up @@ -123859,6 +123865,42 @@ class StoreyViewsPlugin extends Plugin {
this.viewer.scene.off(this._onModelLoaded);
super.destroy();
}

/**
* Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
*
* @returns {null}
*/
get storeysList() {
if (!this._storeysList) {
this._storeysList = Object.values(this.storeys);
this._storeysList.sort(this._getSpatialSortFunc());
}
return this._storeysList;
}

_getSpatialSortFunc() {
const viewer = this.viewer;
const scene = viewer.scene;
const camera = scene.camera;
return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
let 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;
});
}
}

const zeroVec = new Float64Array([0, 0, 1]);
Expand Down Expand Up @@ -127421,8 +127463,8 @@ class TreeViewPlugin extends Plugin {
if (!children || children.length === 0) {
return;
}
if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
// Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
const firstChild = children[0];
if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
children.sort(this._getSpatialSortFunc());
} else {
children.sort(this._alphaSortFunc);
Expand Down
58 changes: 50 additions & 8 deletions dist/xeokit-sdk.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -84316,6 +84316,8 @@ class SceneModel extends Component {
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;
Expand Down Expand Up @@ -122961,7 +122963,7 @@ class Storey {
/**
* Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
*
* The boundary is a six-element Float32Array containing the min/max extents of the
* The boundary is a six-element Float64Array containing the min/max extents of the
* axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
*
* @property storeyAABB
Expand All @@ -122972,7 +122974,7 @@ class Storey {
/**
* Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
*
* The boundary is a six-element Float32Array containing the min/max extents of the
* The boundary is a six-element Float64Array containing the min/max extents of the
* axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
*
* @deprecated
Expand All @@ -122984,7 +122986,7 @@ class Storey {
/**
* Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
*
* The boundary is a six-element Float32Array containing the min/max extents of the
* The boundary is a six-element Float64Array containing the min/max extents of the
* axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
*
* @property modelAABB
Expand Down Expand Up @@ -123309,6 +123311,8 @@ class StoreyViewsPlugin extends Plugin {
*/
this.storeys = {};

this._storeysList = null;

/**
* A set of {@link Storey}s for each {@link MetaModel}.
*
Expand Down Expand Up @@ -123350,6 +123354,7 @@ class StoreyViewsPlugin extends Plugin {
this.fire("storeys", this.storeys);
});
this.storeys[storeyId] = storey;
this._storeysList= null;
if (!this.modelStoreys[modelId]) {
this.modelStoreys[modelId] = {};
}
Expand All @@ -123370,6 +123375,7 @@ class StoreyViewsPlugin extends Plugin {
model.off(storey._onModelDestroyed);
}
delete this.storeys[storyObjectId];
this._storeysList= null;
}
}
delete this.modelStoreys[modelId];
Expand Down Expand Up @@ -123474,7 +123480,7 @@ class StoreyViewsPlugin extends Plugin {
* @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
* @param {*} [options] Options for showing the Entitys within the storey.
* @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
*/
*/
showStoreyObjects(storeyId, options = {}) {

const storey = this.storeys[storeyId];
Expand All @@ -123499,7 +123505,7 @@ class StoreyViewsPlugin extends Plugin {

this.withStoreyObjects(storeyId, (entity, metaObject) => {
if (entity) {
entity.visible = true;
entity.visible = true;
}
});
}
Expand Down Expand Up @@ -123735,7 +123741,7 @@ class StoreyViewsPlugin extends Plugin {

/**
* Gets the ID of the storey which's bounding box contains the y point of the world position
*
*
* @param {Number[]} worldPos 3D World-space position.
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
*/
Expand Down Expand Up @@ -123855,6 +123861,42 @@ class StoreyViewsPlugin extends Plugin {
this.viewer.scene.off(this._onModelLoaded);
super.destroy();
}

/**
* Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
*
* @returns {null}
*/
get storeysList() {
if (!this._storeysList) {
this._storeysList = Object.values(this.storeys);
this._storeysList.sort(this._getSpatialSortFunc());
}
return this._storeysList;
}

_getSpatialSortFunc() {
const viewer = this.viewer;
const scene = viewer.scene;
const camera = scene.camera;
return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
let 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;
});
}
}

const zeroVec = new Float64Array([0, 0, 1]);
Expand Down Expand Up @@ -127417,8 +127459,8 @@ class TreeViewPlugin extends Plugin {
if (!children || children.length === 0) {
return;
}
if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
// Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
const firstChild = children[0];
if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
children.sort(this._getSpatialSortFunc());
} else {
children.sort(this._alphaSortFunc);
Expand Down
Loading

0 comments on commit 5440a2d

Please sign in to comment.