Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Oct 24, 2024
1 parent 8cd06b8 commit d22c8db
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 100 deletions.
51 changes: 36 additions & 15 deletions dist/xeokit-sdk.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -123350,7 +123350,7 @@ class StoreyViewsPlugin extends Plugin {
this.fire("storeys", this.storeys);
});
this.storeys[storeyId] = storey;
this._storeysList= null;
this._storeysList = null;
if (!this.modelStoreys[modelId]) {
this.modelStoreys[modelId] = {};
}
Expand All @@ -123371,7 +123371,7 @@ class StoreyViewsPlugin extends Plugin {
model.off(storey._onModelDestroyed);
}
delete this.storeys[storyObjectId];
this._storeysList= null;
this._storeysList = null;
}
}
delete this.modelStoreys[modelId];
Expand Down Expand Up @@ -123590,7 +123590,11 @@ class StoreyViewsPlugin extends Plugin {
height = Math.round(width * aspect);
}

this._objectsMemento.saveObjects(scene);
const mask = {
visible: true,
};

this._objectsMemento.saveObjects(scene, mask);
this._cameraMemento.saveCamera(scene);

this.showStoreyObjects(storeyId, utils.apply(options, {
Expand All @@ -123605,7 +123609,7 @@ class StoreyViewsPlugin extends Plugin {
format: format,
});

this._objectsMemento.restoreObjects(scene);
this._objectsMemento.restoreObjects(scene, mask);
this._cameraMemento.restoreCamera(scene);

return new StoreyMap(storeyId, src, format, width, height, padding);
Expand Down Expand Up @@ -123742,9 +123746,9 @@ class StoreyViewsPlugin extends Plugin {
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
*/
getStoreyInVerticalRange(worldPos) {
for(let storeyId in this.storeys) {
for (let storeyId in this.storeys) {
const storey = this.storeys[storeyId];
const aabb = [0,0,0,0,0,0], pos = [0,0,0];
const 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];
Expand All @@ -123757,14 +123761,14 @@ class StoreyViewsPlugin extends Plugin {

/**
* Returns whether a position is above or below a building
*
*
* @param {Number[]} worldPos 3D World-space position.
* @returns {String} ID of the lowest/highest story or null.
*/
isPositionAboveOrBelowBuilding(worldPos) {
const keys = Object.keys(this.storeys);
const ids = [keys[0], keys[keys.length-1]];
if(worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
const ids = [keys[0], keys[keys.length - 1]];
if (worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
return ids[0];
else if (worldPos[1] > this.storeys[ids[1]].storeyAABB[4])
return ids[1];
Expand Down Expand Up @@ -123884,13 +123888,30 @@ class StoreyViewsPlugin extends Plugin {
} else {
idx = 2;
}
if (storey1.aabb[idx] > storey2.aabb[idx]) {
return -1;
}
if (storey1.aabb[idx] < storey2.aabb[idx]) {
return 1;
const metaScene = this.viewer.metaScene;
const storey1MetaObject = metaScene.metaObjects[storey1.storeyId];
const storey2MetaObject = metaScene.metaObjects[storey2.storeyId];

if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
const elevation1 = storey1MetaObject.attributes.elevation;
const elevation2 = storey2MetaObject.attributes.elevation;
if (elevation1 > elevation2) {
return -1;
}
if (elevation1 < elevation2) {
return 1;
}
return 0;
} else {
if (storey1.aabb[idx] > storey2.aabb[idx]) {
return -1;
}
if (storey1.aabb[idx] < storey2.aabb[idx]) {
return 1;
}
return 0;
}
return 0;
});
}
}
Expand Down
51 changes: 36 additions & 15 deletions dist/xeokit-sdk.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -123346,7 +123346,7 @@ class StoreyViewsPlugin extends Plugin {
this.fire("storeys", this.storeys);
});
this.storeys[storeyId] = storey;
this._storeysList= null;
this._storeysList = null;
if (!this.modelStoreys[modelId]) {
this.modelStoreys[modelId] = {};
}
Expand All @@ -123367,7 +123367,7 @@ class StoreyViewsPlugin extends Plugin {
model.off(storey._onModelDestroyed);
}
delete this.storeys[storyObjectId];
this._storeysList= null;
this._storeysList = null;
}
}
delete this.modelStoreys[modelId];
Expand Down Expand Up @@ -123586,7 +123586,11 @@ class StoreyViewsPlugin extends Plugin {
height = Math.round(width * aspect);
}

this._objectsMemento.saveObjects(scene);
const mask = {
visible: true,
};

this._objectsMemento.saveObjects(scene, mask);
this._cameraMemento.saveCamera(scene);

this.showStoreyObjects(storeyId, utils.apply(options, {
Expand All @@ -123601,7 +123605,7 @@ class StoreyViewsPlugin extends Plugin {
format: format,
});

this._objectsMemento.restoreObjects(scene);
this._objectsMemento.restoreObjects(scene, mask);
this._cameraMemento.restoreCamera(scene);

return new StoreyMap(storeyId, src, format, width, height, padding);
Expand Down Expand Up @@ -123738,9 +123742,9 @@ class StoreyViewsPlugin extends Plugin {
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
*/
getStoreyInVerticalRange(worldPos) {
for(let storeyId in this.storeys) {
for (let storeyId in this.storeys) {
const storey = this.storeys[storeyId];
const aabb = [0,0,0,0,0,0], pos = [0,0,0];
const 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];
Expand All @@ -123753,14 +123757,14 @@ class StoreyViewsPlugin extends Plugin {

/**
* Returns whether a position is above or below a building
*
*
* @param {Number[]} worldPos 3D World-space position.
* @returns {String} ID of the lowest/highest story or null.
*/
isPositionAboveOrBelowBuilding(worldPos) {
const keys = Object.keys(this.storeys);
const ids = [keys[0], keys[keys.length-1]];
if(worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
const ids = [keys[0], keys[keys.length - 1]];
if (worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
return ids[0];
else if (worldPos[1] > this.storeys[ids[1]].storeyAABB[4])
return ids[1];
Expand Down Expand Up @@ -123880,13 +123884,30 @@ class StoreyViewsPlugin extends Plugin {
} else {
idx = 2;
}
if (storey1.aabb[idx] > storey2.aabb[idx]) {
return -1;
}
if (storey1.aabb[idx] < storey2.aabb[idx]) {
return 1;
const metaScene = this.viewer.metaScene;
const storey1MetaObject = metaScene.metaObjects[storey1.storeyId];
const storey2MetaObject = metaScene.metaObjects[storey2.storeyId];

if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
const elevation1 = storey1MetaObject.attributes.elevation;
const elevation2 = storey2MetaObject.attributes.elevation;
if (elevation1 > elevation2) {
return -1;
}
if (elevation1 < elevation2) {
return 1;
}
return 0;
} else {
if (storey1.aabb[idx] > storey2.aabb[idx]) {
return -1;
}
if (storey1.aabb[idx] < storey2.aabb[idx]) {
return 1;
}
return 0;
}
return 0;
});
}
}
Expand Down
Loading

0 comments on commit d22c8db

Please sign in to comment.