Fem: use SoAnnotation to highlight result pipeline objects

This commit is contained in:
wmayer
2022-07-31 17:51:31 +02:00
parent 47c2e77ebf
commit 8bb85d2b7c
6 changed files with 111 additions and 4 deletions

View File

@@ -28,6 +28,7 @@
# include <QMenu>
# include <QMessageBox>
# include <QTextStream>
# include <Inventor/nodes/SoAnnotation.h>
#endif
#include <App/MaterialObject.h>
@@ -55,6 +56,33 @@
using namespace FemGui;
ViewProviderFemHighlighter::ViewProviderFemHighlighter()
{
annotate = new SoAnnotation();
annotate->ref();
}
ViewProviderFemHighlighter::~ViewProviderFemHighlighter()
{
annotate->unref();
}
void ViewProviderFemHighlighter::attach(ViewProviderFemAnalysis* view)
{
SoGroup* root = view->getRoot();
root->addChild(annotate);
}
void ViewProviderFemHighlighter::highlightView(Gui::ViewProviderDocumentObject* view)
{
annotate->removeAllChildren();
if (view) {
annotate->addChild(view->getRoot());
}
}
// ----------------------------------------------------------------------------
/* TRANSLATOR FemGui::ViewProviderFemAnalysis */
@@ -71,6 +99,17 @@ ViewProviderFemAnalysis::~ViewProviderFemAnalysis()
}
void ViewProviderFemAnalysis::attach(App::DocumentObject* obj)
{
Gui::ViewProviderDocumentObjectGroup::attach(obj);
extension.attach(this);
}
void ViewProviderFemAnalysis::highlightView(Gui::ViewProviderDocumentObject* view)
{
extension.highlightView(view);
}
bool ViewProviderFemAnalysis::doubleClicked(void)
{
Gui::Command::assureWorkbench("FemWorkbench");
@@ -244,7 +283,7 @@ bool ViewProviderFemAnalysis::canDelete(App::DocumentObject* obj) const
// thus we can pass this action
// we can warn the user if necessary in the object's ViewProvider in the onDelete() function
Q_UNUSED(obj)
return true;
return true;
}
// Python feature -----------------------------------------------------------------------