Select/isolate 在多模型方法中
Select/isolate in multimodel approach
在 API 中将描述的方法引用到 select/isolate 个对象(在查看器中仅加载一个模型的情况下):
- select(dbids,selectionType)
- isolate(node)/isolateById(dbids) // that is the difference?
我知道 select 模拟多模型:
viewer.impl.selector.setSelection([objectIds], model);
问题是:
- 是否存在用于多模型模式的隔离模拟?
- 如何 select/isolate 同时使用不同模型的两个对象?
对于isolate
,你可以这样做(借用Viewer3D.js
):
// Get selected elements from each loaded models
var selection = this.viewer.getAggregateSelection();
var allModels = this.viewer.impl.modelQueue().getModels().concat(); // shallow copy
// Isolate selected nodes.
selection.forEach(function(singleRes){
singleRes.model.visibilityManager.isolate(singleRes.selection);
var indx = allModels.indexOf(singleRes.model);
if (indx >= 0) {
allModels.splice(indx, 1);
}
});
// Hide nodes from all other models
while (allModels.length) {
allModels.pop().visibilityManager.setAllVisibility(false);
}
this.viewer.clearSelection();
对于select
,您需要将相应的模型和dbIds传递给viewer.impl.selector.setSelection([dbIds], model);
并为每个集合调用setSelection
,如下所示。不能一次性存档。
var selSet = [
{
selection: [1234, 5621],
model: model1
},
{
selection: [12, 758],
model: model2
},
];
selSet.forEach(funciton(sel) {
viewer.impl.selector.setSelection(sel.selection, sel.model);
});
在 API 的最新版本中,viewer.impl.visibilityManager
返回一个 MultiModelVisibilityManager
,因此您可以将模型作为第二个参数传递:
MultiModelVisibilityManager.prototype.isolate = function (node, model)
查看 viewer3D.js (L#17825) 以了解该对象的可用方法。
据我所知,无法在一次调用中 select 来自不同模型的两个对象,您只需为传递各自 ID 的每个模型发出一个 select 调用。我认为这没有问题。
希望对您有所帮助。
在 API 中将描述的方法引用到 select/isolate 个对象(在查看器中仅加载一个模型的情况下):
- select(dbids,selectionType)
- isolate(node)/isolateById(dbids) // that is the difference?
我知道 select 模拟多模型:
viewer.impl.selector.setSelection([objectIds], model);
问题是:
- 是否存在用于多模型模式的隔离模拟?
- 如何 select/isolate 同时使用不同模型的两个对象?
对于isolate
,你可以这样做(借用Viewer3D.js
):
// Get selected elements from each loaded models
var selection = this.viewer.getAggregateSelection();
var allModels = this.viewer.impl.modelQueue().getModels().concat(); // shallow copy
// Isolate selected nodes.
selection.forEach(function(singleRes){
singleRes.model.visibilityManager.isolate(singleRes.selection);
var indx = allModels.indexOf(singleRes.model);
if (indx >= 0) {
allModels.splice(indx, 1);
}
});
// Hide nodes from all other models
while (allModels.length) {
allModels.pop().visibilityManager.setAllVisibility(false);
}
this.viewer.clearSelection();
对于select
,您需要将相应的模型和dbIds传递给viewer.impl.selector.setSelection([dbIds], model);
并为每个集合调用setSelection
,如下所示。不能一次性存档。
var selSet = [
{
selection: [1234, 5621],
model: model1
},
{
selection: [12, 758],
model: model2
},
];
selSet.forEach(funciton(sel) {
viewer.impl.selector.setSelection(sel.selection, sel.model);
});
在 API 的最新版本中,viewer.impl.visibilityManager
返回一个 MultiModelVisibilityManager
,因此您可以将模型作为第二个参数传递:
MultiModelVisibilityManager.prototype.isolate = function (node, model)
查看 viewer3D.js (L#17825) 以了解该对象的可用方法。
据我所知,无法在一次调用中 select 来自不同模型的两个对象,您只需为传递各自 ID 的每个模型发出一个 select 调用。我认为这没有问题。
希望对您有所帮助。