add method to get view that contains a given node

This commit is contained in:
wmayer
2016-08-14 18:01:10 +02:00
parent 279531e89d
commit 554875b930
6 changed files with 31 additions and 7 deletions

View File

@@ -1321,23 +1321,23 @@ MDIView* Document::getActiveView(void) const
return active;
}
Gui::MDIView* Document::getViewOfViewProvider(Gui::ViewProvider* vp) const
Gui::MDIView* Document::getViewOfNode(SoNode* node) const
{
std::list<MDIView*> mdis = getMDIViewsOfType(View3DInventor::getClassTypeId());
for (std::list<MDIView*>::const_iterator it = mdis.begin(); it != mdis.end(); ++it) {
View3DInventor* view = static_cast<View3DInventor*>(*it);
SoSearchAction searchAction;
searchAction.setNode(vp->getRoot());
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.apply(view->getViewer()->getSceneGraph());
SoPath* selectionPath = searchAction.getPath();
if (selectionPath)
if (view->getViewer()->searchNode(node))
return *it;
}
return 0;
}
Gui::MDIView* Document::getViewOfViewProvider(Gui::ViewProvider* vp) const
{
return getViewOfNode(vp->getRoot());
}
Gui::MDIView* Document::getEditingViewOfViewProvider(Gui::ViewProvider* vp) const
{
std::list<MDIView*> mdis = getMDIViewsOfType(View3DInventor::getClassTypeId());