@xeokit/xeokit-sdk 2.6.51 → 2.6.52
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 +36 -15
- package/dist/xeokit-sdk.es.js +36 -15
- package/dist/xeokit-sdk.es5.js +67 -67
- 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/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
|
}
|
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
|
}
|