Adding additional objects to FEM

This commit is contained in:
jriegel
2013-04-20 10:53:03 +02:00
parent a74b98e9ed
commit 6c8cb6f184
13 changed files with 344 additions and 177 deletions

View File

@@ -29,10 +29,13 @@
#endif
#include "ViewProviderAnalysis.h"
#include <Gui/Command.h>
#include <Gui/Document.h>
#include <Gui/Control.h>
#include <Mod/Fem/App/FemMeshObject.h>
#include <Mod/Fem/App/FemMesh.h>
#include <Mod/Fem/App/FemAnalysis.h>
#include "TaskDlgAnalysis.h"
using namespace FemGui;
@@ -42,7 +45,7 @@ using namespace FemGui;
PROPERTY_SOURCE(FemGui::ViewProviderAnalysis, Gui::ViewProviderGeometryObject)
PROPERTY_SOURCE(FemGui::ViewProviderAnalysis, Gui::ViewProviderDocumentObject)
ViewProviderAnalysis::ViewProviderAnalysis()
@@ -56,3 +59,95 @@ ViewProviderAnalysis::~ViewProviderAnalysis()
}
std::vector<App::DocumentObject*> ViewProviderAnalysis::claimChildren(void)const
{
std::vector<App::DocumentObject*> temp(static_cast<Fem::FemAnalysis*>(getObject())->Member.getValues());
return temp;
}
//std::vector<App::DocumentObject*> ViewProviderAnalysis::claimChildren3D(void)const
//{
//
// //return static_cast<Assembly::ConstraintGroup*>(getObject())->Constraints.getValues();
// return std::vector<App::DocumentObject*> ();
//}
void ViewProviderAnalysis::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
{
//QAction* act;
//act = menu->addAction(QObject::tr("Edit pad"), receiver, member);
//act->setData(QVariant((int)ViewProvider::Default));
//PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member);
}
bool ViewProviderAnalysis::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
//// When double-clicking on the item for this pad the
//// object unsets and sets its edit mode without closing
//// the task panel
//Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
//TaskDlgAnalysis *anaDlg = qobject_cast<TaskDlgAnalysis *>(dlg);
//if (padDlg && anaDlg->getPadView() != this)
// padDlg = 0; // another pad left open its task panel
//if (dlg && !padDlg) {
// QMessageBox msgBox;
// msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
// msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
// msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
// msgBox.setDefaultButton(QMessageBox::Yes);
// int ret = msgBox.exec();
// if (ret == QMessageBox::Yes)
// Gui::Control().closeDialog();
// else
// return false;
//}
// start the edit dialog
// if (padDlg)
// Gui::Control().showDialog(padDlg);
// else
Fem::FemAnalysis* pcAna = static_cast<Fem::FemAnalysis*>(this->getObject());
Gui::Control().showDialog(new TaskDlgAnalysis(pcAna));
return true;
}
else {
return Gui::ViewProviderDocumentObject::setEdit(ModNum);
}
}
void ViewProviderAnalysis::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// when pressing ESC make sure to close the dialog
Gui::Control().closeDialog();
}
else {
Gui::ViewProviderDocumentObject::unsetEdit(ModNum);
}
}
bool ViewProviderAnalysis::onDelete(const std::vector<std::string> &)
{
//// get the support and Sketch
//PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(getObject());
//Sketcher::SketchObject *pcSketch = 0;
//App::DocumentObject *pcSupport = 0;
//if (pcPad->Sketch.getValue()){
// pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
// pcSupport = pcSketch->Support.getValue();
//}
//// if abort command deleted the object the support is visible again
//if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
// Gui::Application::Instance->getViewProvider(pcSketch)->show();
//if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport))
// Gui::Application::Instance->getViewProvider(pcSupport)->show();
return true;
}