@xeokit/xeokit-sdk 2.6.51 → 2.6.53
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 +56 -41
- package/dist/xeokit-sdk.es.js +56 -41
- package/dist/xeokit-sdk.es5.js +68 -70
- 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 +1 -1
- package/package.json +1 -1
- package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +36 -15
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +20 -19
package/package.json
CHANGED
|
@@ -301,7 +301,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
301
301
|
this.fire("storeys", this.storeys);
|
|
302
302
|
});
|
|
303
303
|
this.storeys[storeyId] = storey;
|
|
304
|
-
this._storeysList= null;
|
|
304
|
+
this._storeysList = null;
|
|
305
305
|
if (!this.modelStoreys[modelId]) {
|
|
306
306
|
this.modelStoreys[modelId] = {};
|
|
307
307
|
}
|
|
@@ -322,7 +322,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
322
322
|
model.off(storey._onModelDestroyed);
|
|
323
323
|
}
|
|
324
324
|
delete this.storeys[storyObjectId];
|
|
325
|
-
this._storeysList= null;
|
|
325
|
+
this._storeysList = null;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
delete this.modelStoreys[modelId];
|
|
@@ -541,7 +541,11 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
541
541
|
height = Math.round(width * aspect);
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
|
|
544
|
+
const mask = {
|
|
545
|
+
visible: true,
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
this._objectsMemento.saveObjects(scene, mask);
|
|
545
549
|
this._cameraMemento.saveCamera(scene);
|
|
546
550
|
|
|
547
551
|
this.showStoreyObjects(storeyId, utils.apply(options, {
|
|
@@ -556,7 +560,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
556
560
|
format: format,
|
|
557
561
|
});
|
|
558
562
|
|
|
559
|
-
this._objectsMemento.restoreObjects(scene);
|
|
563
|
+
this._objectsMemento.restoreObjects(scene, mask);
|
|
560
564
|
this._cameraMemento.restoreCamera(scene);
|
|
561
565
|
|
|
562
566
|
return new StoreyMap(storeyId, src, format, width, height, padding);
|
|
@@ -693,9 +697,9 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
693
697
|
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
|
|
694
698
|
*/
|
|
695
699
|
getStoreyInVerticalRange(worldPos) {
|
|
696
|
-
for(let storeyId in this.storeys) {
|
|
700
|
+
for (let storeyId in this.storeys) {
|
|
697
701
|
const storey = this.storeys[storeyId];
|
|
698
|
-
const aabb = [0,0,0,0,0,0], pos = [0,0,0];
|
|
702
|
+
const aabb = [0, 0, 0, 0, 0, 0], pos = [0, 0, 0];
|
|
699
703
|
aabb[1] = storey.storeyAABB[1];
|
|
700
704
|
aabb[4] = storey.storeyAABB[4];
|
|
701
705
|
pos[1] = worldPos[1];
|
|
@@ -708,14 +712,14 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
708
712
|
|
|
709
713
|
/**
|
|
710
714
|
* Returns whether a position is above or below a building
|
|
711
|
-
*
|
|
715
|
+
*
|
|
712
716
|
* @param {Number[]} worldPos 3D World-space position.
|
|
713
717
|
* @returns {String} ID of the lowest/highest story or null.
|
|
714
718
|
*/
|
|
715
719
|
isPositionAboveOrBelowBuilding(worldPos) {
|
|
716
720
|
const keys = Object.keys(this.storeys);
|
|
717
|
-
const ids = [keys[0], keys[keys.length-1]];
|
|
718
|
-
if(worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
721
|
+
const ids = [keys[0], keys[keys.length - 1]];
|
|
722
|
+
if (worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
719
723
|
return ids[0];
|
|
720
724
|
else if (worldPos[1] > this.storeys[ids[1]].storeyAABB[4])
|
|
721
725
|
return ids[1];
|
|
@@ -835,13 +839,30 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
835
839
|
} else {
|
|
836
840
|
idx = 2;
|
|
837
841
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
842
|
+
const metaScene = this.viewer.metaScene;
|
|
843
|
+
const storey1MetaObject = metaScene.metaObjects[storey1.storeyId];
|
|
844
|
+
const storey2MetaObject = metaScene.metaObjects[storey2.storeyId];
|
|
845
|
+
|
|
846
|
+
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
847
|
+
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
848
|
+
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
849
|
+
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
850
|
+
if (elevation1 > elevation2) {
|
|
851
|
+
return -1;
|
|
852
|
+
}
|
|
853
|
+
if (elevation1 < elevation2) {
|
|
854
|
+
return 1;
|
|
855
|
+
}
|
|
856
|
+
return 0;
|
|
857
|
+
} else {
|
|
858
|
+
if (storey1.aabb[idx] > storey2.aabb[idx]) {
|
|
859
|
+
return -1;
|
|
860
|
+
}
|
|
861
|
+
if (storey1.aabb[idx] < storey2.aabb[idx]) {
|
|
862
|
+
return 1;
|
|
863
|
+
}
|
|
864
|
+
return 0;
|
|
843
865
|
}
|
|
844
|
-
return 0;
|
|
845
866
|
});
|
|
846
867
|
}
|
|
847
868
|
}
|
|
@@ -1205,7 +1205,7 @@ export class TreeViewPlugin extends Plugin {
|
|
|
1205
1205
|
return;
|
|
1206
1206
|
}
|
|
1207
1207
|
const firstChild = children[0];
|
|
1208
|
-
if (this._hierarchy === "storeys" &&
|
|
1208
|
+
if ((this._hierarchy === "storeys" || this._hierarchy === "containment") && firstChild.type === "IfcBuildingStorey") {
|
|
1209
1209
|
children.sort(this._getSpatialSortFunc());
|
|
1210
1210
|
} else {
|
|
1211
1211
|
children.sort(this._alphaSortFunc);
|
|
@@ -1216,21 +1216,11 @@ export class TreeViewPlugin extends Plugin {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
|
-
_getSpatialSortFunc() {
|
|
1219
|
+
_getSpatialSortFunc() {
|
|
1220
1220
|
const viewer = this.viewer;
|
|
1221
1221
|
const scene = viewer.scene;
|
|
1222
1222
|
const camera = scene.camera;
|
|
1223
|
-
|
|
1224
|
-
return this._spatialSortFunc || (this._spatialSortFunc = (node1, node2) => {
|
|
1225
|
-
if (!node1.aabb || !node2.aabb) {
|
|
1226
|
-
// Sorting on lowest point of the AABB is likely more more robust when objects could overlap storeys
|
|
1227
|
-
if (!node1.aabb) {
|
|
1228
|
-
node1.aabb = scene.getAABB(metaScene.getObjectIDsInSubtree(node1.objectId));
|
|
1229
|
-
}
|
|
1230
|
-
if (!node2.aabb) {
|
|
1231
|
-
node2.aabb = scene.getAABB(metaScene.getObjectIDsInSubtree(node2.objectId));
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1223
|
+
return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
|
|
1234
1224
|
let idx = 0;
|
|
1235
1225
|
if (camera.xUp) {
|
|
1236
1226
|
idx = 0;
|
|
@@ -1239,13 +1229,24 @@ export class TreeViewPlugin extends Plugin {
|
|
|
1239
1229
|
} else {
|
|
1240
1230
|
idx = 2;
|
|
1241
1231
|
}
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1232
|
+
const metaScene = this.viewer.metaScene;
|
|
1233
|
+
const storey1MetaObject = metaScene.metaObjects[storey1.objectId];
|
|
1234
|
+
const storey2MetaObject = metaScene.metaObjects[storey2.objectId];
|
|
1235
|
+
|
|
1236
|
+
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
1237
|
+
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
1238
|
+
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
1239
|
+
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
1240
|
+
if (elevation1 > elevation2) {
|
|
1241
|
+
return -1;
|
|
1242
|
+
}
|
|
1243
|
+
if (elevation1 < elevation2) {
|
|
1244
|
+
return 1;
|
|
1245
|
+
}
|
|
1246
|
+
return 0;
|
|
1247
|
+
} else {
|
|
1248
|
+
return 0;
|
|
1247
1249
|
}
|
|
1248
|
-
return 0;
|
|
1249
1250
|
});
|
|
1250
1251
|
}
|
|
1251
1252
|
|