[FEM] update ViewProvider selection code
as suggested in
67e836b7e9 (r79459854)
This commit is contained in:
@@ -22,6 +22,10 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <Inventor/nodes/SoDrawStyle.h>
|
||||
#endif
|
||||
|
||||
#include <Mod/Fem/App/FemPostFilter.h>
|
||||
|
||||
#include "ViewProviderFemPostFilter.h"
|
||||
@@ -77,6 +81,19 @@ ViewProviderFemPostDataAtPoint::ViewProviderFemPostDataAtPoint() {
|
||||
sPixmap = "FEM_PostFilterDataAtPoint";
|
||||
}
|
||||
|
||||
void ViewProviderFemPostDataAtPoint::show()
|
||||
{
|
||||
Gui::ViewProviderDocumentObject::show();
|
||||
m_colorStyle->style = SoDrawStyle::FILLED;
|
||||
}
|
||||
|
||||
void ViewProviderFemPostDataAtPoint::onSelectionChanged(const Gui::SelectionChanges &)
|
||||
{
|
||||
// do not do anything here
|
||||
// For DataAtPoint the color bar must not be refreshed when it is selected
|
||||
// because a single point does not make sense with a color range.
|
||||
}
|
||||
|
||||
ViewProviderFemPostDataAtPoint::~ViewProviderFemPostDataAtPoint() {
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ class FemGuiExport ViewProviderFemPostDataAtPoint: public ViewProviderFemPostObj
|
||||
public:
|
||||
/// constructor.
|
||||
ViewProviderFemPostDataAtPoint();
|
||||
void show() override;
|
||||
void onSelectionChanged(const Gui::SelectionChanges &) override;
|
||||
~ViewProviderFemPostDataAtPoint();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -699,9 +699,9 @@ void ViewProviderFemPostObject::show(void) {
|
||||
Gui::ViewProviderDocumentObject::show();
|
||||
m_colorStyle->style = SoDrawStyle::FILLED;
|
||||
// we must update the color bar except for data point filters
|
||||
auto nameVP = std::string(this->getObject()->getViewProviderName());
|
||||
if (nameVP.compare("FemGui::ViewProviderFemPostDataAtPoint") == 0)
|
||||
return;
|
||||
//auto nameVP = std::string(this->getObject()->getViewProviderName());
|
||||
//if (nameVP.compare("FemGui::ViewProviderFemPostDataAtPoint") == 0)
|
||||
// return;
|
||||
WriteColorData(true);
|
||||
}
|
||||
|
||||
@@ -750,21 +750,21 @@ bool ViewProviderFemPostObject::canDelete(App::DocumentObject* obj) const
|
||||
}
|
||||
|
||||
void ViewProviderFemPostObject::selectionChanged(const Gui::SelectionChanges &sel)
|
||||
{
|
||||
onSelectionChanged(sel);
|
||||
}
|
||||
|
||||
void ViewProviderFemPostObject::onSelectionChanged(const Gui::SelectionChanges &sel)
|
||||
{
|
||||
// If a FemPostObject is selected in the document tree we must refresh its
|
||||
// color bar.
|
||||
// But don't do this if the object is invisible because other objects with a
|
||||
// color bar might be visible and the color bar is then wrong.
|
||||
// Also don't do this for point filters because for them a color bar is not sensible.
|
||||
if (sel.Type == sel.AddSelection) {
|
||||
Gui::SelectionObject obj(sel);
|
||||
if (obj.getObject() == this->getObject()) {
|
||||
if (!this->getObject()->Visibility.getValue())
|
||||
return;
|
||||
auto nameVP = std::string(this->getObject()->getViewProviderName());
|
||||
if (nameVP.compare("FemGui::ViewProviderFemPostDataAtPoint") == 0)
|
||||
return;
|
||||
WriteColorData(true);
|
||||
if (this->getObject()->Visibility.getValue())
|
||||
WriteColorData(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ protected:
|
||||
vtkSmartPointer<vtkVertexGlyphFilter> m_points, m_pointsSurface;
|
||||
|
||||
void selectionChanged(const Gui::SelectionChanges &);
|
||||
virtual void onSelectionChanged(const Gui::SelectionChanges &sel);
|
||||
typedef boost::signals2::scoped_connection Connection;
|
||||
Connection connectSelection;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user