Skip to content

Commit

Permalink
fixes #3164: Elements of an analysis including the mesh and constrain…
Browse files Browse the repository at this point in the history
…ts should be hidden when hiding the analysis (Space)
  • Loading branch information
wwmayer committed Oct 6, 2017
1 parent d898ecc commit c7886b3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
28 changes: 26 additions & 2 deletions src/Mod/Fem/Gui/ViewProviderAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#endif

#include "ViewProviderAnalysis.h"
#include <Gui/Application.h>
#include <Gui/Command.h>
#include <Gui/Document.h>
#include <Gui/Control.h>
Expand Down Expand Up @@ -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();
}

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);
}
}

return temp;
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* )
Expand Down
11 changes: 9 additions & 2 deletions src/Mod/Fem/Gui/ViewProviderAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ class FemGuiExport ViewProviderFemAnalysis : public Gui::ViewProviderDocumentObj
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 */
//@{
Expand Down
8 changes: 6 additions & 2 deletions src/Mod/Fem/Gui/ViewProviderSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ PROPERTY_SOURCE(FemGui::ViewProviderSolver, Gui::ViewProviderDocumentObject)

ViewProviderSolver::ViewProviderSolver()
{
sPixmap = "fem-solver";

sPixmap = "fem-solver";
}

ViewProviderSolver::~ViewProviderSolver()
{

}

std::vector<std::string> ViewProviderSolver::getDisplayModes(void) const
{
return { "Solver" };
}



// Python feature -----------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions src/Mod/Fem/Gui/ViewProviderSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ class FemGuiExport ViewProviderSolver : public Gui::ViewProviderDocumentObject
~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;
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Fem/ObjectsFem.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
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


Expand Down

0 comments on commit c7886b3

Please sign in to comment.