@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/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -123350,7 +123350,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123350
123350
|
this.fire("storeys", this.storeys);
|
|
123351
123351
|
});
|
|
123352
123352
|
this.storeys[storeyId] = storey;
|
|
123353
|
-
this._storeysList= null;
|
|
123353
|
+
this._storeysList = null;
|
|
123354
123354
|
if (!this.modelStoreys[modelId]) {
|
|
123355
123355
|
this.modelStoreys[modelId] = {};
|
|
123356
123356
|
}
|
|
@@ -123371,7 +123371,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123371
123371
|
model.off(storey._onModelDestroyed);
|
|
123372
123372
|
}
|
|
123373
123373
|
delete this.storeys[storyObjectId];
|
|
123374
|
-
this._storeysList= null;
|
|
123374
|
+
this._storeysList = null;
|
|
123375
123375
|
}
|
|
123376
123376
|
}
|
|
123377
123377
|
delete this.modelStoreys[modelId];
|
|
@@ -123590,7 +123590,11 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123590
123590
|
height = Math.round(width * aspect);
|
|
123591
123591
|
}
|
|
123592
123592
|
|
|
123593
|
-
|
|
123593
|
+
const mask = {
|
|
123594
|
+
visible: true,
|
|
123595
|
+
};
|
|
123596
|
+
|
|
123597
|
+
this._objectsMemento.saveObjects(scene, mask);
|
|
123594
123598
|
this._cameraMemento.saveCamera(scene);
|
|
123595
123599
|
|
|
123596
123600
|
this.showStoreyObjects(storeyId, utils.apply(options, {
|
|
@@ -123605,7 +123609,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123605
123609
|
format: format,
|
|
123606
123610
|
});
|
|
123607
123611
|
|
|
123608
|
-
this._objectsMemento.restoreObjects(scene);
|
|
123612
|
+
this._objectsMemento.restoreObjects(scene, mask);
|
|
123609
123613
|
this._cameraMemento.restoreCamera(scene);
|
|
123610
123614
|
|
|
123611
123615
|
return new StoreyMap(storeyId, src, format, width, height, padding);
|
|
@@ -123742,9 +123746,9 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123742
123746
|
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
|
|
123743
123747
|
*/
|
|
123744
123748
|
getStoreyInVerticalRange(worldPos) {
|
|
123745
|
-
for(let storeyId in this.storeys) {
|
|
123749
|
+
for (let storeyId in this.storeys) {
|
|
123746
123750
|
const storey = this.storeys[storeyId];
|
|
123747
|
-
const aabb = [0,0,0,0,0,0], pos = [0,0,0];
|
|
123751
|
+
const aabb = [0, 0, 0, 0, 0, 0], pos = [0, 0, 0];
|
|
123748
123752
|
aabb[1] = storey.storeyAABB[1];
|
|
123749
123753
|
aabb[4] = storey.storeyAABB[4];
|
|
123750
123754
|
pos[1] = worldPos[1];
|
|
@@ -123757,14 +123761,14 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123757
123761
|
|
|
123758
123762
|
/**
|
|
123759
123763
|
* Returns whether a position is above or below a building
|
|
123760
|
-
*
|
|
123764
|
+
*
|
|
123761
123765
|
* @param {Number[]} worldPos 3D World-space position.
|
|
123762
123766
|
* @returns {String} ID of the lowest/highest story or null.
|
|
123763
123767
|
*/
|
|
123764
123768
|
isPositionAboveOrBelowBuilding(worldPos) {
|
|
123765
123769
|
const keys = Object.keys(this.storeys);
|
|
123766
|
-
const ids = [keys[0], keys[keys.length-1]];
|
|
123767
|
-
if(worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
123770
|
+
const ids = [keys[0], keys[keys.length - 1]];
|
|
123771
|
+
if (worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
123768
123772
|
return ids[0];
|
|
123769
123773
|
else if (worldPos[1] > this.storeys[ids[1]].storeyAABB[4])
|
|
123770
123774
|
return ids[1];
|
|
@@ -123884,13 +123888,30 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123884
123888
|
} else {
|
|
123885
123889
|
idx = 2;
|
|
123886
123890
|
}
|
|
123887
|
-
|
|
123888
|
-
|
|
123889
|
-
|
|
123890
|
-
|
|
123891
|
-
|
|
123891
|
+
const metaScene = this.viewer.metaScene;
|
|
123892
|
+
const storey1MetaObject = metaScene.metaObjects[storey1.storeyId];
|
|
123893
|
+
const storey2MetaObject = metaScene.metaObjects[storey2.storeyId];
|
|
123894
|
+
|
|
123895
|
+
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
123896
|
+
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
123897
|
+
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
123898
|
+
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
123899
|
+
if (elevation1 > elevation2) {
|
|
123900
|
+
return -1;
|
|
123901
|
+
}
|
|
123902
|
+
if (elevation1 < elevation2) {
|
|
123903
|
+
return 1;
|
|
123904
|
+
}
|
|
123905
|
+
return 0;
|
|
123906
|
+
} else {
|
|
123907
|
+
if (storey1.aabb[idx] > storey2.aabb[idx]) {
|
|
123908
|
+
return -1;
|
|
123909
|
+
}
|
|
123910
|
+
if (storey1.aabb[idx] < storey2.aabb[idx]) {
|
|
123911
|
+
return 1;
|
|
123912
|
+
}
|
|
123913
|
+
return 0;
|
|
123892
123914
|
}
|
|
123893
|
-
return 0;
|
|
123894
123915
|
});
|
|
123895
123916
|
}
|
|
123896
123917
|
}
|
|
@@ -127456,7 +127477,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
127456
127477
|
return;
|
|
127457
127478
|
}
|
|
127458
127479
|
const firstChild = children[0];
|
|
127459
|
-
if (this._hierarchy === "storeys" &&
|
|
127480
|
+
if ((this._hierarchy === "storeys" || this._hierarchy === "containment") && firstChild.type === "IfcBuildingStorey") {
|
|
127460
127481
|
children.sort(this._getSpatialSortFunc());
|
|
127461
127482
|
} else {
|
|
127462
127483
|
children.sort(this._alphaSortFunc);
|
|
@@ -127467,36 +127488,30 @@ class TreeViewPlugin extends Plugin {
|
|
|
127467
127488
|
}
|
|
127468
127489
|
}
|
|
127469
127490
|
|
|
127470
|
-
_getSpatialSortFunc() {
|
|
127491
|
+
_getSpatialSortFunc() {
|
|
127471
127492
|
const viewer = this.viewer;
|
|
127472
127493
|
const scene = viewer.scene;
|
|
127473
127494
|
const camera = scene.camera;
|
|
127474
|
-
|
|
127475
|
-
|
|
127476
|
-
|
|
127477
|
-
|
|
127478
|
-
|
|
127479
|
-
|
|
127480
|
-
|
|
127481
|
-
|
|
127482
|
-
|
|
127483
|
-
|
|
127484
|
-
|
|
127485
|
-
|
|
127486
|
-
|
|
127487
|
-
|
|
127488
|
-
|
|
127489
|
-
|
|
127495
|
+
return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
|
|
127496
|
+
if (camera.xUp) ; else if (camera.yUp) ; else ;
|
|
127497
|
+
const metaScene = this.viewer.metaScene;
|
|
127498
|
+
const storey1MetaObject = metaScene.metaObjects[storey1.objectId];
|
|
127499
|
+
const storey2MetaObject = metaScene.metaObjects[storey2.objectId];
|
|
127500
|
+
|
|
127501
|
+
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
127502
|
+
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
127503
|
+
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
127504
|
+
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
127505
|
+
if (elevation1 > elevation2) {
|
|
127506
|
+
return -1;
|
|
127507
|
+
}
|
|
127508
|
+
if (elevation1 < elevation2) {
|
|
127509
|
+
return 1;
|
|
127510
|
+
}
|
|
127511
|
+
return 0;
|
|
127490
127512
|
} else {
|
|
127491
|
-
|
|
127492
|
-
}
|
|
127493
|
-
if (node1.aabb[idx] > node2.aabb[idx]) {
|
|
127494
|
-
return -1;
|
|
127495
|
-
}
|
|
127496
|
-
if (node1.aabb[idx] < node2.aabb[idx]) {
|
|
127497
|
-
return 1;
|
|
127513
|
+
return 0;
|
|
127498
127514
|
}
|
|
127499
|
-
return 0;
|
|
127500
127515
|
});
|
|
127501
127516
|
}
|
|
127502
127517
|
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -123346,7 +123346,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123346
123346
|
this.fire("storeys", this.storeys);
|
|
123347
123347
|
});
|
|
123348
123348
|
this.storeys[storeyId] = storey;
|
|
123349
|
-
this._storeysList= null;
|
|
123349
|
+
this._storeysList = null;
|
|
123350
123350
|
if (!this.modelStoreys[modelId]) {
|
|
123351
123351
|
this.modelStoreys[modelId] = {};
|
|
123352
123352
|
}
|
|
@@ -123367,7 +123367,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123367
123367
|
model.off(storey._onModelDestroyed);
|
|
123368
123368
|
}
|
|
123369
123369
|
delete this.storeys[storyObjectId];
|
|
123370
|
-
this._storeysList= null;
|
|
123370
|
+
this._storeysList = null;
|
|
123371
123371
|
}
|
|
123372
123372
|
}
|
|
123373
123373
|
delete this.modelStoreys[modelId];
|
|
@@ -123586,7 +123586,11 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123586
123586
|
height = Math.round(width * aspect);
|
|
123587
123587
|
}
|
|
123588
123588
|
|
|
123589
|
-
|
|
123589
|
+
const mask = {
|
|
123590
|
+
visible: true,
|
|
123591
|
+
};
|
|
123592
|
+
|
|
123593
|
+
this._objectsMemento.saveObjects(scene, mask);
|
|
123590
123594
|
this._cameraMemento.saveCamera(scene);
|
|
123591
123595
|
|
|
123592
123596
|
this.showStoreyObjects(storeyId, utils.apply(options, {
|
|
@@ -123601,7 +123605,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123601
123605
|
format: format,
|
|
123602
123606
|
});
|
|
123603
123607
|
|
|
123604
|
-
this._objectsMemento.restoreObjects(scene);
|
|
123608
|
+
this._objectsMemento.restoreObjects(scene, mask);
|
|
123605
123609
|
this._cameraMemento.restoreCamera(scene);
|
|
123606
123610
|
|
|
123607
123611
|
return new StoreyMap(storeyId, src, format, width, height, padding);
|
|
@@ -123738,9 +123742,9 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123738
123742
|
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
|
|
123739
123743
|
*/
|
|
123740
123744
|
getStoreyInVerticalRange(worldPos) {
|
|
123741
|
-
for(let storeyId in this.storeys) {
|
|
123745
|
+
for (let storeyId in this.storeys) {
|
|
123742
123746
|
const storey = this.storeys[storeyId];
|
|
123743
|
-
const aabb = [0,0,0,0,0,0], pos = [0,0,0];
|
|
123747
|
+
const aabb = [0, 0, 0, 0, 0, 0], pos = [0, 0, 0];
|
|
123744
123748
|
aabb[1] = storey.storeyAABB[1];
|
|
123745
123749
|
aabb[4] = storey.storeyAABB[4];
|
|
123746
123750
|
pos[1] = worldPos[1];
|
|
@@ -123753,14 +123757,14 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123753
123757
|
|
|
123754
123758
|
/**
|
|
123755
123759
|
* Returns whether a position is above or below a building
|
|
123756
|
-
*
|
|
123760
|
+
*
|
|
123757
123761
|
* @param {Number[]} worldPos 3D World-space position.
|
|
123758
123762
|
* @returns {String} ID of the lowest/highest story or null.
|
|
123759
123763
|
*/
|
|
123760
123764
|
isPositionAboveOrBelowBuilding(worldPos) {
|
|
123761
123765
|
const keys = Object.keys(this.storeys);
|
|
123762
|
-
const ids = [keys[0], keys[keys.length-1]];
|
|
123763
|
-
if(worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
123766
|
+
const ids = [keys[0], keys[keys.length - 1]];
|
|
123767
|
+
if (worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
123764
123768
|
return ids[0];
|
|
123765
123769
|
else if (worldPos[1] > this.storeys[ids[1]].storeyAABB[4])
|
|
123766
123770
|
return ids[1];
|
|
@@ -123880,13 +123884,30 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
123880
123884
|
} else {
|
|
123881
123885
|
idx = 2;
|
|
123882
123886
|
}
|
|
123883
|
-
|
|
123884
|
-
|
|
123885
|
-
|
|
123886
|
-
|
|
123887
|
-
|
|
123887
|
+
const metaScene = this.viewer.metaScene;
|
|
123888
|
+
const storey1MetaObject = metaScene.metaObjects[storey1.storeyId];
|
|
123889
|
+
const storey2MetaObject = metaScene.metaObjects[storey2.storeyId];
|
|
123890
|
+
|
|
123891
|
+
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
123892
|
+
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
123893
|
+
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
123894
|
+
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
123895
|
+
if (elevation1 > elevation2) {
|
|
123896
|
+
return -1;
|
|
123897
|
+
}
|
|
123898
|
+
if (elevation1 < elevation2) {
|
|
123899
|
+
return 1;
|
|
123900
|
+
}
|
|
123901
|
+
return 0;
|
|
123902
|
+
} else {
|
|
123903
|
+
if (storey1.aabb[idx] > storey2.aabb[idx]) {
|
|
123904
|
+
return -1;
|
|
123905
|
+
}
|
|
123906
|
+
if (storey1.aabb[idx] < storey2.aabb[idx]) {
|
|
123907
|
+
return 1;
|
|
123908
|
+
}
|
|
123909
|
+
return 0;
|
|
123888
123910
|
}
|
|
123889
|
-
return 0;
|
|
123890
123911
|
});
|
|
123891
123912
|
}
|
|
123892
123913
|
}
|
|
@@ -127452,7 +127473,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
127452
127473
|
return;
|
|
127453
127474
|
}
|
|
127454
127475
|
const firstChild = children[0];
|
|
127455
|
-
if (this._hierarchy === "storeys" &&
|
|
127476
|
+
if ((this._hierarchy === "storeys" || this._hierarchy === "containment") && firstChild.type === "IfcBuildingStorey") {
|
|
127456
127477
|
children.sort(this._getSpatialSortFunc());
|
|
127457
127478
|
} else {
|
|
127458
127479
|
children.sort(this._alphaSortFunc);
|
|
@@ -127463,36 +127484,30 @@ class TreeViewPlugin extends Plugin {
|
|
|
127463
127484
|
}
|
|
127464
127485
|
}
|
|
127465
127486
|
|
|
127466
|
-
_getSpatialSortFunc() {
|
|
127487
|
+
_getSpatialSortFunc() {
|
|
127467
127488
|
const viewer = this.viewer;
|
|
127468
127489
|
const scene = viewer.scene;
|
|
127469
127490
|
const camera = scene.camera;
|
|
127470
|
-
|
|
127471
|
-
|
|
127472
|
-
|
|
127473
|
-
|
|
127474
|
-
|
|
127475
|
-
|
|
127476
|
-
|
|
127477
|
-
|
|
127478
|
-
|
|
127479
|
-
|
|
127480
|
-
|
|
127481
|
-
|
|
127482
|
-
|
|
127483
|
-
|
|
127484
|
-
|
|
127485
|
-
|
|
127491
|
+
return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
|
|
127492
|
+
if (camera.xUp) ; else if (camera.yUp) ; else ;
|
|
127493
|
+
const metaScene = this.viewer.metaScene;
|
|
127494
|
+
const storey1MetaObject = metaScene.metaObjects[storey1.objectId];
|
|
127495
|
+
const storey2MetaObject = metaScene.metaObjects[storey2.objectId];
|
|
127496
|
+
|
|
127497
|
+
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
127498
|
+
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
127499
|
+
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
127500
|
+
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
127501
|
+
if (elevation1 > elevation2) {
|
|
127502
|
+
return -1;
|
|
127503
|
+
}
|
|
127504
|
+
if (elevation1 < elevation2) {
|
|
127505
|
+
return 1;
|
|
127506
|
+
}
|
|
127507
|
+
return 0;
|
|
127486
127508
|
} else {
|
|
127487
|
-
|
|
127488
|
-
}
|
|
127489
|
-
if (node1.aabb[idx] > node2.aabb[idx]) {
|
|
127490
|
-
return -1;
|
|
127491
|
-
}
|
|
127492
|
-
if (node1.aabb[idx] < node2.aabb[idx]) {
|
|
127493
|
-
return 1;
|
|
127509
|
+
return 0;
|
|
127494
127510
|
}
|
|
127495
|
-
return 0;
|
|
127496
127511
|
});
|
|
127497
127512
|
}
|
|
127498
127513
|
|