fixes #0003164: Elements of an analysis including the mesh and constraints should be hidden when hiding the analysis (Space)
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include "ViewProviderAnalysis.h"
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Control.h>
|
||||
@@ -74,9 +75,32 @@ bool ViewProviderFemAnalysis::doubleClicked(void)
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderFemAnalysis::claimChildren(void)const
|
||||
{
|
||||
std::vector<App::DocumentObject*> temp(static_cast<Fem::FemAnalysis*>(getObject())->Member.getValues());
|
||||
return static_cast<Fem::FemAnalysis*>(getObject())->Member.getValues();
|
||||
}
|
||||
|
||||
return temp;
|
||||
std::vector<std::string> ViewProviderFemAnalysis::getDisplayModes(void) const
|
||||
{
|
||||
return { "Analysis" };
|
||||
}
|
||||
|
||||
void ViewProviderFemAnalysis::hide(void)
|
||||
{
|
||||
Gui::ViewProviderDocumentObject::hide();
|
||||
std::vector<App::DocumentObject*> temp(static_cast<Fem::FemAnalysis*>
|
||||
(getObject())->Member.getValues());
|
||||
for (auto it : temp) {
|
||||
Gui::Application::Instance->hideViewProvider(it);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderFemAnalysis::show(void)
|
||||
{
|
||||
Gui::ViewProviderDocumentObject::show();
|
||||
std::vector<App::DocumentObject*> temp(static_cast<Fem::FemAnalysis*>
|
||||
(getObject())->Member.getValues());
|
||||
for (auto it : temp) {
|
||||
Gui::Application::Instance->showViewProvider(it);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderFemAnalysis::setupContextMenu(QMenu* menu, QObject* , const char* )
|
||||
|
||||
@@ -51,9 +51,16 @@ public:
|
||||
void setupContextMenu(QMenu*, QObject*, const char*);
|
||||
|
||||
virtual bool onDelete(const std::vector<std::string> &);
|
||||
|
||||
/// A list of all possible display modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
// shows solid in the tree
|
||||
virtual bool isShow(void) const{return true;}
|
||||
virtual bool isShow(void) const {
|
||||
return Visibility.getValue();
|
||||
}
|
||||
/// Hide the object in the view
|
||||
virtual void hide(void);
|
||||
/// Show the object in the view
|
||||
virtual void show(void);
|
||||
|
||||
/** @name Drag and drop */
|
||||
//@{
|
||||
|
||||
@@ -46,8 +46,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderSolver, Gui::ViewProviderDocumentObject)
|
||||
|
||||
ViewProviderSolver::ViewProviderSolver()
|
||||
{
|
||||
sPixmap = "fem-solver";
|
||||
|
||||
sPixmap = "fem-solver";
|
||||
}
|
||||
|
||||
ViewProviderSolver::~ViewProviderSolver()
|
||||
@@ -55,6 +54,11 @@ ViewProviderSolver::~ViewProviderSolver()
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderSolver::getDisplayModes(void) const
|
||||
{
|
||||
return { "Solver" };
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Python feature -----------------------------------------------------------------------
|
||||
|
||||
@@ -52,9 +52,11 @@ public:
|
||||
~ViewProviderSolver();
|
||||
|
||||
// shows solid in the tree
|
||||
virtual bool isShow(void) const{return true;}
|
||||
protected:
|
||||
|
||||
virtual bool isShow(void) const {
|
||||
return Visibility.getValue();
|
||||
}
|
||||
/// A list of all possible display modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
};
|
||||
|
||||
typedef Gui::ViewProviderPythonFeatureT<ViewProviderSolver> ViewProviderSolverPython;
|
||||
|
||||
@@ -34,6 +34,8 @@ import FreeCAD
|
||||
def makeAnalysis(doc, name="Analysis"):
|
||||
'''makeAnalysis(name): makes a Fem Analysis object'''
|
||||
obj = doc.addObject("Fem::FemAnalysisPython", name)
|
||||
if FreeCAD.GuiUp:
|
||||
obj.ViewObject.Proxy=0
|
||||
return obj
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user