From 8d3f1a9f247524b4c5e60ebdc5cef8dabb3d502f Mon Sep 17 00:00:00 2001 From: jriegel Date: Sun, 3 Mar 2013 22:19:04 +0100 Subject: [PATCH] Dialog for dealing with creation and edeting of node sets --- src/Mod/Fem/App/FemSetElementsObject.h | 8 +- src/Mod/Fem/App/FemSetFacesObject.h | 8 +- src/Mod/Fem/App/FemSetGeometryObject.h | 8 +- src/Mod/Fem/App/FemSetNodesObject.h | 8 +- src/Mod/Fem/App/FemSetObject.cpp | 1 + src/Mod/Fem/App/FemSetObject.h | 4 +- src/Mod/Fem/Gui/AppFemGui.cpp | 8 + src/Mod/Fem/Gui/CMakeLists.txt | 63 ++++++-- src/Mod/Fem/Gui/Command.cpp | 52 +++++- src/Mod/Fem/Gui/TaskCreateNodeSet.cpp | 170 ++++++++++++++++++++ src/Mod/Fem/Gui/TaskCreateNodeSet.h | 81 ++++++++++ src/Mod/Fem/Gui/TaskCreateNodeSet.ui | 146 +++++++++++++++++ src/Mod/Fem/Gui/TaskDlgCreateNodeSet.cpp | 104 ++++++++++++ src/Mod/Fem/Gui/TaskDlgCreateNodeSet.h | 74 +++++++++ src/Mod/Fem/Gui/TaskObjectName.cpp | 109 +++++++++++++ src/Mod/Fem/Gui/TaskObjectName.h | 72 +++++++++ src/Mod/Fem/Gui/TaskObjectName.ui | 32 ++++ src/Mod/Fem/Gui/ViewProviderFemMesh.cpp | 51 +++--- src/Mod/Fem/Gui/ViewProviderFemMesh.h | 7 +- src/Mod/Fem/Gui/ViewProviderSetElements.cpp | 56 +++++++ src/Mod/Fem/Gui/ViewProviderSetElements.h | 49 ++++++ src/Mod/Fem/Gui/ViewProviderSetFaces.cpp | 56 +++++++ src/Mod/Fem/Gui/ViewProviderSetFaces.h | 49 ++++++ src/Mod/Fem/Gui/ViewProviderSetGeometry.cpp | 56 +++++++ src/Mod/Fem/Gui/ViewProviderSetGeometry.h | 49 ++++++ src/Mod/Fem/Gui/ViewProviderSetNodes.cpp | 57 +++++++ src/Mod/Fem/Gui/ViewProviderSetNodes.h | 49 ++++++ src/Mod/Fem/Gui/Workbench.cpp | 2 + 28 files changed, 1376 insertions(+), 53 deletions(-) create mode 100644 src/Mod/Fem/Gui/TaskCreateNodeSet.cpp create mode 100644 src/Mod/Fem/Gui/TaskCreateNodeSet.h create mode 100644 src/Mod/Fem/Gui/TaskCreateNodeSet.ui create mode 100644 src/Mod/Fem/Gui/TaskDlgCreateNodeSet.cpp create mode 100644 src/Mod/Fem/Gui/TaskDlgCreateNodeSet.h create mode 100644 src/Mod/Fem/Gui/TaskObjectName.cpp create mode 100644 src/Mod/Fem/Gui/TaskObjectName.h create mode 100644 src/Mod/Fem/Gui/TaskObjectName.ui create mode 100644 src/Mod/Fem/Gui/ViewProviderSetElements.cpp create mode 100644 src/Mod/Fem/Gui/ViewProviderSetElements.h create mode 100644 src/Mod/Fem/Gui/ViewProviderSetFaces.cpp create mode 100644 src/Mod/Fem/Gui/ViewProviderSetFaces.h create mode 100644 src/Mod/Fem/Gui/ViewProviderSetGeometry.cpp create mode 100644 src/Mod/Fem/Gui/ViewProviderSetGeometry.h create mode 100644 src/Mod/Fem/Gui/ViewProviderSetNodes.cpp create mode 100644 src/Mod/Fem/Gui/ViewProviderSetNodes.h diff --git a/src/Mod/Fem/App/FemSetElementsObject.h b/src/Mod/Fem/App/FemSetElementsObject.h index c6e375acc..e5443fc3c 100644 --- a/src/Mod/Fem/App/FemSetElementsObject.h +++ b/src/Mod/Fem/App/FemSetElementsObject.h @@ -40,10 +40,10 @@ public: FemSetElementsObject(void); virtual ~FemSetElementsObject(); - /// returns the type name of the ViewProvider - //virtual const char* getViewProviderName(void) const { - // return "FemGui::ViewProviderFemSet"; - //} + // returns the type name of the ViewProvider + virtual const char* getViewProviderName(void) const { + return "FemGui::ViewProviderSetElements"; + } virtual App::DocumentObjectExecReturn *execute(void) { return App::DocumentObject::StdReturn; } diff --git a/src/Mod/Fem/App/FemSetFacesObject.h b/src/Mod/Fem/App/FemSetFacesObject.h index 49a0e6c3e..344c24ad2 100644 --- a/src/Mod/Fem/App/FemSetFacesObject.h +++ b/src/Mod/Fem/App/FemSetFacesObject.h @@ -40,10 +40,10 @@ public: FemSetFacesObject(void); virtual ~FemSetFacesObject(); - /// returns the type name of the ViewProvider - //virtual const char* getViewProviderName(void) const { - // return "FemGui::ViewProviderFemSet"; - //} + // returns the type name of the ViewProvider + virtual const char* getViewProviderName(void) const { + return "FemGui::ViewProviderSetFaces"; + } virtual App::DocumentObjectExecReturn *execute(void) { return App::DocumentObject::StdReturn; } diff --git a/src/Mod/Fem/App/FemSetGeometryObject.h b/src/Mod/Fem/App/FemSetGeometryObject.h index 69344c2d3..e89040e04 100644 --- a/src/Mod/Fem/App/FemSetGeometryObject.h +++ b/src/Mod/Fem/App/FemSetGeometryObject.h @@ -40,10 +40,10 @@ public: FemSetGeometryObject(void); virtual ~FemSetGeometryObject(); - /// returns the type name of the ViewProvider - //virtual const char* getViewProviderName(void) const { - // return "FemGui::ViewProviderFemSet"; - //} + // returns the type name of the ViewProvider + virtual const char* getViewProviderName(void) const { + return "FemGui::ViewProviderSetGeometry"; + } virtual App::DocumentObjectExecReturn *execute(void) { return App::DocumentObject::StdReturn; } diff --git a/src/Mod/Fem/App/FemSetNodesObject.h b/src/Mod/Fem/App/FemSetNodesObject.h index 512bf485a..7e51f4a32 100644 --- a/src/Mod/Fem/App/FemSetNodesObject.h +++ b/src/Mod/Fem/App/FemSetNodesObject.h @@ -42,10 +42,10 @@ public: App::PropertyIntegerSet Nodes; - /// returns the type name of the ViewProvider - //virtual const char* getViewProviderName(void) const { - // return "FemGui::ViewProviderFemSet"; - //} + // returns the type name of the ViewProvider + virtual const char* getViewProviderName(void) const { + return "FemGui::ViewProviderSetNodes"; + } virtual App::DocumentObjectExecReturn *execute(void) { return App::DocumentObject::StdReturn; } diff --git a/src/Mod/Fem/App/FemSetObject.cpp b/src/Mod/Fem/App/FemSetObject.cpp index e195e0f22..f5fbcf876 100644 --- a/src/Mod/Fem/App/FemSetObject.cpp +++ b/src/Mod/Fem/App/FemSetObject.cpp @@ -38,6 +38,7 @@ PROPERTY_SOURCE(Fem::FemSetObject, App::DocumentObject) FemSetObject::FemSetObject() { + ADD_PROPERTY_TYPE(FemMesh,(0), "MeshSet link",Prop_None,"MeshSet the set belongs to"); } FemSetObject::~FemSetObject() diff --git a/src/Mod/Fem/App/FemSetObject.h b/src/Mod/Fem/App/FemSetObject.h index 2290d61b8..3c957d388 100644 --- a/src/Mod/Fem/App/FemSetObject.h +++ b/src/Mod/Fem/App/FemSetObject.h @@ -25,7 +25,7 @@ #define Fem_FemSetObject_H #include -#include +#include #include "FemSetObject.h" namespace Fem @@ -40,6 +40,8 @@ public: FemSetObject(void); virtual ~FemSetObject(); + App::PropertyLink FemMesh; + /// returns the type name of the ViewProvider //virtual const char* getViewProviderName(void) const { // return "FemGui::ViewProviderFemSet"; diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index 219d59ad7..d36865d91 100755 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -30,6 +30,10 @@ #include #include #include "ViewProviderFemMesh.h" +#include "ViewProviderSetNodes.h" +#include "ViewProviderSetElements.h" +#include "ViewProviderSetFaces.h" +#include "ViewProviderSetGeometry.h" #include "Workbench.h" //#include "resources/qrc_Fem.cpp" @@ -65,6 +69,10 @@ void FemGuiExport initFemGui() // addition objects FemGui::Workbench ::init(); FemGui::ViewProviderFemMesh ::init(); + FemGui::ViewProviderSetNodes ::init(); + FemGui::ViewProviderSetElements ::init(); + FemGui::ViewProviderSetFaces ::init(); + FemGui::ViewProviderSetGeometry ::init(); // add resources and reloads the translators loadFemResource(); diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index 5343beb2b..1a1b7a501 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -31,30 +31,58 @@ endif(SMESH_FOUND) set(FemGui_MOC_HDRS Hypothesis.h + TaskObjectName.h + TaskCreateNodeSet.h + TaskDlgCreateNodeSet.h ) fc_wrap_cpp(FemGui_MOC_SRCS ${FemGui_MOC_HDRS}) SOURCE_GROUP("Moc" FILES ${FemGui_MOC_SRCS}) set(FemGui_UIC_SRCS Hypothesis.ui + TaskCreateNodeSet.ui + TaskObjectName.ui ) qt4_wrap_ui(FemGui_UIC_HDRS ${FemGui_UIC_SRCS}) -SET(FemGui_DLG_SRCS - ${FemGui_UIC_HDRS} - Hypothesis.ui - Hypothesis.cpp - Hypothesis.h -) -SOURCE_GROUP("Dialogs" FILES ${FemGui_DLG_SRCS}) qt4_add_resources(FemResource_SRCS Resources/Fem.qrc) SOURCE_GROUP("Resources" FILES ${FemResource_SRCS}) +SET(FemGui_SRCS_ViewProvider + ViewProviderFemMesh.cpp + ViewProviderFemMesh.h + ViewProviderSetNodes.cpp + ViewProviderSetNodes.h + ViewProviderSetElements.cpp + ViewProviderSetElements.h + ViewProviderSetFaces.cpp + ViewProviderSetFaces.h + ViewProviderSetGeometry.cpp + ViewProviderSetGeometry.h +) +SOURCE_GROUP("ViewProvider" FILES ${FemGui_SRCS_ViewProvider}) -SET(FemGui_SRCS - ${FemGui_DLG_SRCS} - ${FemResource_SRCS} +SET(FemGui_SRCS_TaskBoxes + TaskObjectName.ui + TaskObjectName.cpp + TaskObjectName.h + TaskCreateNodeSet.ui + TaskCreateNodeSet.cpp + TaskCreateNodeSet.h +) +SOURCE_GROUP("Task_Boxes" FILES ${FemGui_SRCS_TaskBoxes}) + +SET(FemGui_SRCS_TaskDlg + TaskDlgCreateNodeSet.h + TaskDlgCreateNodeSet.cpp + Hypothesis.ui + Hypothesis.cpp + Hypothesis.h +) +SOURCE_GROUP("Task_Dialogs" FILES ${FemGui_SRCS_TaskDlg}) + +SET(FemGui_SRCS_Module AppFemGui.cpp AppFemGuiPy.cpp Command.cpp @@ -63,10 +91,21 @@ SET(FemGui_SRCS PreCompiled.h Workbench.cpp Workbench.h - ViewProviderFemMesh.cpp - ViewProviderFemMesh.h +) +SOURCE_GROUP("Module" FILES ${FemGui_SRCS_Module}) + +SET(FemGui_SRCS + ${FemGui_UIC_HDRS} + ${FemGui_DLG_SRCS} + ${FemResource_SRCS} + ${FemGui_SRCS_ViewProvider} + ${FemGui_SRCS_TaskDlg} + ${FemGui_SRCS_TaskBoxes} + ${FemGui_SRCS_Module} ) + + add_library(FemGui SHARED ${FemGui_SRCS}) target_link_libraries(FemGui ${FemGui_LIBS}) diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index 6d7717dc1..eaa9acdc8 100755 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -50,6 +50,7 @@ #include #include +#include #include #include "Hypothesis.h" @@ -85,6 +86,7 @@ bool CmdFemCreateFromShape::isActive(void) } +// ##################################################################################################### @@ -180,7 +182,7 @@ CmdFemDefineNodesSet::CmdFemDefineNodesSet() sToolTipText = QT_TR_NOOP("Create node set by Poly"); sWhatsThis = "Create node set by Poly"; sStatusTip = QT_TR_NOOP("Create node set by Poly"); - sPixmap = "mesh_cut"; + sPixmap = "Fem_FemMesh"; } void CmdFemDefineNodesSet::activated(int iMsg) @@ -223,6 +225,53 @@ bool CmdFemDefineNodesSet::isActive(void) return false; } + +// ##################################################################################################### + +DEF_STD_CMD_A(CmdFemCreateNodesSet); + +CmdFemCreateNodesSet::CmdFemCreateNodesSet() + :Command("Fem_CreateNodesSet") +{ + sAppModule = "Fem"; + sGroup = QT_TR_NOOP("Fem"); + sMenuText = QT_TR_NOOP("Define/create a nodes set..."); + sToolTipText = QT_TR_NOOP("Define/create a nodes set..."); + sWhatsThis = sToolTipText; + sStatusTip = sToolTipText; + sPixmap = "Fem_FemMesh"; + +} + + +void CmdFemCreateNodesSet::activated(int iMsg) +{ + + Gui::SelectionFilter ObjectFilter("SELECT Fem::FemSetNodesObject COUNT 1"); + Gui::SelectionFilter FemMeshFilter ("SELECT Fem::FemMeshObject COUNT 1"); + + if (ObjectFilter.match()) { + Fem::FemSetNodesObject *NodesObj = static_cast(ObjectFilter.Result[0][0].getObject()); + openCommand("Edit nodes-set"); + doCommand(Gui,"Gui.activeDocument().setEdit('%s')",NodesObj->getNameInDocument()); + }else if (FemMeshFilter.match()) { + Fem::FemMeshObject *MeshObj = static_cast(FemMeshFilter.Result[0][0].getObject()); + + std::string FeatName = getUniqueObjectName("NodesSet"); + + openCommand("Create a new nodes-set"); + doCommand(Doc,"App.activeDocument().addObject('Fem::FemSetNodesObject','%s')",FeatName.c_str()); + doCommand(Gui,"App.activeDocument().%s.FemMesh = App.activeDocument().%s",FeatName.c_str(),MeshObj->getNameInDocument()); + doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); + + } +} + +bool CmdFemCreateNodesSet::isActive(void) +{ + return true; +} + //-------------------------------------------------------------------------------------- @@ -230,5 +279,6 @@ void CreateFemCommands(void) { Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); rcCmdMgr.addCommand(new CmdFemCreateFromShape()); + rcCmdMgr.addCommand(new CmdFemCreateNodesSet()); rcCmdMgr.addCommand(new CmdFemDefineNodesSet()); } diff --git a/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp b/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp new file mode 100644 index 000000000..02b6d767a --- /dev/null +++ b/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp @@ -0,0 +1,170 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + + +#include +#include +#include "ui_TaskCreateNodeSet.h" +#include "TaskCreateNodeSet.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include "ViewProviderFemMesh.h" + + +using namespace FemGui; +using namespace Gui; + +TaskCreateNodeSet::TaskCreateNodeSet(Fem::FemSetNodesObject *pcObject,QWidget *parent) + : TaskBox(Gui::BitmapFactory().pixmap("Fem_FemMesh"), + tr("Nodes set"), + true, + parent), + pcObject(pcObject) +{ + // we need a separate container widget to add all controls to + proxy = new QWidget(this); + ui = new Ui_TaskCreateNodeSet(); + ui->setupUi(proxy); + QMetaObject::connectSlotsByName(this); + + this->groupLayout()->addWidget(proxy); + + QObject::connect(ui->toolButton_Poly,SIGNAL(clicked()),this,SLOT(Poly())); + QObject::connect(ui->comboBox,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int))); + + MeshViewProvider = dynamic_cast(Gui::Application::Instance->getViewProvider( pcObject->FemMesh.getValue())); + assert(MeshViewProvider); + + tempSet = pcObject->Nodes.getValues(); + + MeshViewProvider->setHighlightNodes(tempSet); + + ui->groupBox_AngleSearch->setEnabled(false); + +} + +void TaskCreateNodeSet::Poly(void) +{ + Gui::Document* doc = Gui::Application::Instance->activeDocument(); + Gui::MDIView* view = doc->getActiveView(); + if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); + viewer->setEditing(true); + viewer->startSelection(Gui::View3DInventorViewer::Clip); + viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback,this); + } +} + +void TaskCreateNodeSet::SwitchMethod(int Value) +{ + if(Value == 1) + ui->groupBox_AngleSearch->setEnabled(true); + else + ui->groupBox_AngleSearch->setEnabled(false); +} + + + +void TaskCreateNodeSet::DefineNodesCallback(void * ud, SoEventCallback * n) +{ + // show the wait cursor because this could take quite some time + Gui::WaitCursor wc; + + TaskCreateNodeSet *taskBox = static_cast(ud); + + + // When this callback function is invoked we must in either case leave the edit mode + Gui::View3DInventorViewer* view = reinterpret_cast(n->getUserData()); + view->setEditing(false); + view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback,ud); + n->setHandled(); + + SbBool clip_inner; + std::vector clPoly = view->getGLPolygon(&clip_inner); + if (clPoly.size() < 3) + return; + if (clPoly.front() != clPoly.back()) + clPoly.push_back(clPoly.front()); + + SoCamera* cam = view->getCamera(); + SbViewVolume vv = cam->getViewVolume(); + Gui::ViewVolumeProjection proj(vv); + Base::Polygon2D polygon; + for (std::vector::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it) + polygon.Add(Base::Vector2D((*it)[0],(*it)[1])); + + taskBox->DefineNodes(polygon,proj); + +} + +void TaskCreateNodeSet::DefineNodes(const Base::Polygon2D &polygon,const Gui::ViewVolumeProjection &proj) +{ + const SMESHDS_Mesh* data = const_cast(pcObject->FemMesh.getValue()->FemMesh.getValue().getSMesh())->GetMeshDS(); + + SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator(); + Base::Vector3f pt2d; + + if(! ui->checkBox_Add->isChecked()) + tempSet.clear(); + + for (int i=0;aNodeIter->more();) { + const SMDS_MeshNode* aNode = aNodeIter->next(); + Base::Vector3f vec(aNode->X(),aNode->Y(),aNode->Z()); + pt2d = proj(vec); + if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y)) == true) + tempSet.insert(aNode->GetID()); + } + + MeshViewProvider->setHighlightNodes(tempSet); + +} + + + +TaskCreateNodeSet::~TaskCreateNodeSet() +{ + delete ui; +} + + +#include "moc_TaskCreateNodeSet.cpp" diff --git a/src/Mod/Fem/Gui/TaskCreateNodeSet.h b/src/Mod/Fem/Gui/TaskCreateNodeSet.h new file mode 100644 index 000000000..6c8f8c4db --- /dev/null +++ b/src/Mod/Fem/Gui/TaskCreateNodeSet.h @@ -0,0 +1,81 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_TASKVIEW_TaskCreateNodeSet_H +#define GUI_TASKVIEW_TaskCreateNodeSet_H + +#include +#include + +#include + + +class Ui_TaskCreateNodeSet; +class SoEventCallback; + +namespace Base { +class Polygon2D; +} +namespace App { +class Property; +} + +namespace Gui { +class ViewProvider; +class ViewVolumeProjection; +} + +namespace FemGui { + +class ViewProviderFemMesh; + + +class TaskCreateNodeSet : public Gui::TaskView::TaskBox +{ + Q_OBJECT + +public: + TaskCreateNodeSet(Fem::FemSetNodesObject *pcObject,QWidget *parent = 0); + ~TaskCreateNodeSet(); + + std::set tempSet; + ViewProviderFemMesh * MeshViewProvider; + +private Q_SLOTS: + void Poly(void); + void SwitchMethod(int Value); + +protected: + Fem::FemSetNodesObject *pcObject; + static void DefineNodesCallback(void * ud, SoEventCallback * n); + void DefineNodes(const Base::Polygon2D &polygon,const Gui::ViewVolumeProjection &proj); + + +private: + QWidget* proxy; + Ui_TaskCreateNodeSet* ui; +}; + +} //namespace PartDesignGui + +#endif // GUI_TASKVIEW_TaskCreateNodeSet_H diff --git a/src/Mod/Fem/Gui/TaskCreateNodeSet.ui b/src/Mod/Fem/Gui/TaskCreateNodeSet.ui new file mode 100644 index 000000000..412ad7ae1 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskCreateNodeSet.ui @@ -0,0 +1,146 @@ + + + TaskCreateNodeSet + + + + 0 + 0 + 177 + 180 + + + + + 0 + 0 + + + + Form + + + + + + + Volume + + + + + Surface + + + + + + + + + + + 10 + 75 + true + + + + Nodes: 0 + + + + + + + + + + + Poly + + + + + + + false + + + Box + + + + + + + false + + + Pick + + + + + + + Add + + + + + + + + + Angle-search + + + + + + Collect adjancent nodes + + + + + + + + + Stop angle: + + + + + + + + + + 0 + + + 0.000000000000000 + + + 1800.000000000000000 + + + 10.000000000000000 + + + 60.000000000000000 + + + + + + + + + + + + + diff --git a/src/Mod/Fem/Gui/TaskDlgCreateNodeSet.cpp b/src/Mod/Fem/Gui/TaskDlgCreateNodeSet.cpp new file mode 100644 index 000000000..f46e19a9b --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDlgCreateNodeSet.cpp @@ -0,0 +1,104 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include "TaskDlgCreateNodeSet.h" + +#include +#include +#include +#include +#include +#include "ViewProviderFemMesh.h" + + +using namespace FemGui; + + +//************************************************************************** +//************************************************************************** +// TaskDialog +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TaskDlgCreateNodeSet::TaskDlgCreateNodeSet(Fem::FemSetNodesObject *obj) + : TaskDialog(),FemSetNodesObject(obj) +{ + name = new TaskObjectName(obj); + param = new TaskCreateNodeSet(obj); + + Content.push_back(name); + Content.push_back(param); +} + +TaskDlgCreateNodeSet::~TaskDlgCreateNodeSet() +{ + +} + +//==== calls from the TaskView =============================================================== + + +void TaskDlgCreateNodeSet::open() +{ + //select->activate(); + //Edge2TaskObject->execute(); + //param->setEdgeAndClusterNbr(Edge2TaskObject->NbrOfEdges,Edge2TaskObject->NbrOfCluster); + +} + +bool TaskDlgCreateNodeSet::accept() +{ + try { + FemSetNodesObject->Nodes.setValues(param->tempSet); + FemSetNodesObject->recompute(); + Gui::Document* doc = Gui::Application::Instance->activeDocument(); + if(doc) + doc->resetEdit(); + param->MeshViewProvider->resetHighlightNodes(); + return true; + } + catch (const Base::Exception& e) { + Base::Console().Warning("TaskDlgCreateNodeSet::accept(): %s\n", e.what()); + } + + return false; +} + +bool TaskDlgCreateNodeSet::reject() +{ + FemSetNodesObject->execute(); + param->MeshViewProvider->resetHighlightNodes(); + return true; +} + +void TaskDlgCreateNodeSet::helpRequested() +{ + +} + + +#include "moc_TaskDlgCreateNodeSet.cpp" diff --git a/src/Mod/Fem/Gui/TaskDlgCreateNodeSet.h b/src/Mod/Fem/Gui/TaskDlgCreateNodeSet.h new file mode 100644 index 000000000..4b82cca69 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDlgCreateNodeSet.h @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef ROBOTGUI_TaskDlgCreateNodeSet_H +#define ROBOTGUI_TaskDlgCreateNodeSet_H + +#include + +#include +#include "TaskCreateNodeSet.h" +#include "TaskObjectName.h" + +// forward +namespace Gui { namespace TaskView { class TaskSelectLinkProperty;}} + + +namespace FemGui { + + +/// simulation dialog for the TaskView +class TaskDlgCreateNodeSet : public Gui::TaskView::TaskDialog +{ + Q_OBJECT + +public: + TaskDlgCreateNodeSet(Fem::FemSetNodesObject *); + ~TaskDlgCreateNodeSet(); + +public: + /// is called the TaskView when the dialog is opened + virtual void open(); + /// is called by the framework if the dialog is accepted (Ok) + virtual bool accept(); + /// is called by the framework if the dialog is rejected (Cancel) + virtual bool reject(); + /// is called by the framework if the user press the help button + virtual void helpRequested(); + + /// returns for Close and Help button + virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const + { return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; } + +protected: + TaskCreateNodeSet *param; + TaskObjectName *name; + + Fem::FemSetNodesObject *FemSetNodesObject; +}; + + + +} //namespace RobotGui + +#endif // ROBOTGUI_TASKDLGSIMULATE_H diff --git a/src/Mod/Fem/Gui/TaskObjectName.cpp b/src/Mod/Fem/Gui/TaskObjectName.cpp new file mode 100644 index 000000000..3341535c6 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskObjectName.cpp @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include +#include +#include "ui_TaskObjectName.h" +#include "TaskObjectName.h" +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace FemGui; +using namespace Gui; + +TaskObjectName::TaskObjectName(App::DocumentObject *pcObject,QWidget *parent) + : TaskBox(Gui::BitmapFactory().pixmap("Fem_FemMesh"), + tr("TaskObjectName"), + true, + parent), + pcObject(pcObject) +{ + // we need a separate container widget to add all controls to + proxy = new QWidget(this); + ui = new Ui_TaskObjectName(); + ui->setupUi(proxy); + QMetaObject::connectSlotsByName(this); + + this->groupLayout()->addWidget(proxy); + + //QObject::connect(ui->pushButton_HideShow,SIGNAL(clicked()),this,SLOT(hideShow())); + //QObject::connect(ui->doubleSpinBoxSizing,SIGNAL(valueChanged (double)),this,SLOT(sizingValueChanged(double))); + //QObject::connect(ui->checkBoxOrientation,SIGNAL(toggled (bool)),this,SLOT(orientationToggled(bool))); + +} +//void TaskObjectName::setHideShowObject(void) +//{ +// HideShowObj = pcObject->Source.getValue(); +// +// if(HideShowObj){ +// QString ObjectName = QString::fromUtf8(HideShowObj->Label.getValue()); +// ui->lineEdit_ObjectName->setText(ObjectName); +// }else{ +// ui->lineEdit_ObjectName->setText(QString()); +// } +//} +// +//void TaskObjectName::hideShow(void) +//{ +// setHideShowObject(); +// +// if(HideShowObj){ +// Gui::Document* doc = Gui::Application::Instance->activeDocument(); +// if(doc->getViewProvider(HideShowObj)->isVisible()) +// doc->getViewProvider(HideShowObj)->setVisible(false); +// else +// doc->getViewProvider(HideShowObj)->setVisible(true); +// } +//} +// +//void TaskObjectName::sizingValueChanged(double Value) +//{ +// pcObject->SegValue.setValue(Value); +//} +// +//void TaskObjectName::orientationToggled(bool Value) +//{ +// pcObject->UseRotation.setValue(Value); +//} +// + + +TaskObjectName::~TaskObjectName() +{ + delete ui; +} + + +#include "moc_TaskObjectName.cpp" diff --git a/src/Mod/Fem/Gui/TaskObjectName.h b/src/Mod/Fem/Gui/TaskObjectName.h new file mode 100644 index 000000000..cea4d8ff9 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskObjectName.h @@ -0,0 +1,72 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_TASKVIEW_TaskObjectName_H +#define GUI_TASKVIEW_TaskObjectName_H + +#include + + + +class Ui_TaskObjectName; + +namespace App { +class Property; +class DocumentObject; +} + +namespace Gui { +class ViewProvider; +} + +namespace FemGui { + + + +class TaskObjectName : public Gui::TaskView::TaskBox +{ + Q_OBJECT + +public: + TaskObjectName(App::DocumentObject *pcObject,QWidget *parent = 0); + ~TaskObjectName(); + + +private Q_SLOTS: + //void hideShow(void); + //void sizingValueChanged(double Value); + //void orientationToggled(bool Value); + +protected: + App::DocumentObject *pcObject; + +private: + +private: + QWidget* proxy; + Ui_TaskObjectName* ui; +}; + +} //namespace FemGui + +#endif // GUI_TASKVIEW_TaskObjectName_H diff --git a/src/Mod/Fem/Gui/TaskObjectName.ui b/src/Mod/Fem/Gui/TaskObjectName.ui new file mode 100644 index 000000000..bfc49aa2e --- /dev/null +++ b/src/Mod/Fem/Gui/TaskObjectName.ui @@ -0,0 +1,32 @@ + + + TaskObjectName + + + + 0 + 0 + 200 + 40 + + + + Form + + + + + + + + true + + + + + + + + + + diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index 416650892..0a43aeeb8 100755 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * * * * This file is part of the FreeCAD CAx development system. * * * @@ -176,7 +176,6 @@ ViewProviderFemMesh::ViewProviderFemMesh() ADD_PROPERTY(BackfaceCulling,(true)); ADD_PROPERTY(ShowInner, (false)); - ADD_PROPERTY(HighlightedNodes,()); pcDrawStyle = new SoDrawStyle(); pcDrawStyle->ref(); @@ -241,7 +240,8 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj) pcAnoStyle->pointSize = 5; SoMaterial * pcAnoMaterial = new SoMaterial; - + pcAnoMaterial->diffuseColor.setValue(0,1,0); + pcAnoMaterial->emissiveColor.setValue(0,1,0); pcAnotRoot->addChild(pcAnoMaterial); pcAnotRoot->addChild(pcAnoStyle); pcAnotRoot->addChild(pcAnoCoords); @@ -378,29 +378,38 @@ void ViewProviderFemMesh::onChanged(const App::Property* prop) else if (prop == &LineWidth) { pcDrawStyle->lineWidth = LineWidth.getValue(); } - else if (prop == &HighlightedNodes) { - if(HighlightedNodes.getValues().size()){ - const Fem::PropertyFemMesh* mesh = static_cast(prop); - SMESHDS_Mesh* data = const_cast((dynamic_cast(this->pcObject)->FemMesh).getValue().getSMesh())->GetMeshDS(); - - pcAnoCoords->point.setNum(HighlightedNodes.getValues().size()); - SbVec3f* verts = pcAnoCoords->point.startEditing(); - int i=0; - for(std::set::const_iterator it=HighlightedNodes.getValues().begin();it!=HighlightedNodes.getValues().end();++it,i++){ - const SMDS_MeshNode *Node = data->FindNode(*it); - verts[i].setValue((float)Node->X(),(float)Node->Y(),(float)Node->Z()); - } - pcAnoCoords->point.finishEditing(); - - }else{ - pcAnoCoords->point.setNum(0); - } - } else { ViewProviderGeometryObject::onChanged(prop); } } +void ViewProviderFemMesh::setHighlightNodes(const std::set& HighlightedNodes) +{ + + if(HighlightedNodes.size()){ + const Fem::PropertyFemMesh* mesh = &(dynamic_cast(this->pcObject)->FemMesh); + SMESHDS_Mesh* data = const_cast((dynamic_cast(this->pcObject)->FemMesh).getValue().getSMesh())->GetMeshDS(); + + pcAnoCoords->point.setNum(HighlightedNodes.size()); + SbVec3f* verts = pcAnoCoords->point.startEditing(); + int i=0; + for(std::set::const_iterator it=HighlightedNodes.begin();it!=HighlightedNodes.end();++it,i++){ + const SMDS_MeshNode *Node = data->FindNode(*it); + verts[i].setValue((float)Node->X(),(float)Node->Y(),(float)Node->Z()); + } + pcAnoCoords->point.finishEditing(); + + }else{ + pcAnoCoords->point.setNum(0); + } + +} +void ViewProviderFemMesh::resetHighlightNodes(void) +{ + pcAnoCoords->point.setNum(0); +} + + // ---------------------------------------------------------------------------- void ViewProviderFEMMeshBuilder::buildNodes(const App::Property* prop, std::vector& nodes) const diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.h b/src/Mod/Fem/Gui/ViewProviderFemMesh.h index ebe453277..1e477aeaf 100755 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.h +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) * + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * * * * This file is part of the FreeCAD CAx development system. * * * @@ -64,13 +64,16 @@ public: App::PropertyMaterial PointMaterial; App::PropertyBool BackfaceCulling; App::PropertyBool ShowInner; - App::PropertyIntegerSet HighlightedNodes; void attach(App::DocumentObject *pcObject); void setDisplayMode(const char* ModeName); std::vector getDisplayModes() const; void updateData(const App::Property*); + // interface methodes + void setHighlightNodes(const std::set&); + void resetHighlightNodes(void); + private: static App::PropertyFloatConstraint::Constraints floatRange; diff --git a/src/Mod/Fem/Gui/ViewProviderSetElements.cpp b/src/Mod/Fem/Gui/ViewProviderSetElements.cpp new file mode 100644 index 000000000..46efbc089 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetElements.cpp @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include "ViewProviderSetElements.h" +#include + +using namespace Gui; +using namespace FemGui; + +PROPERTY_SOURCE(FemGui::ViewProviderSetElements, Gui::ViewProviderGeometryObject) + +bool ViewProviderSetElements::doubleClicked(void) +{ + //Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + //Gui::Control().showDialog(dlg); + return true; +} + + +bool ViewProviderSetElements::setEdit(int ModNum) +{ + //Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + //Gui::Control().showDialog(dlg); + return true; +} + +void ViewProviderSetElements::unsetEdit(int ModNum) +{ + + +} diff --git a/src/Mod/Fem/Gui/ViewProviderSetElements.h b/src/Mod/Fem/Gui/ViewProviderSetElements.h new file mode 100644 index 000000000..2d4495664 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetElements.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef FEM_ViewProviderSetElements_H +#define FEM_ViewProviderSetElements_H + +#include "ViewProviderSetElements.h" +#include +#include + +namespace FemGui +{ + +class ViewProviderSetElements : public Gui::ViewProviderGeometryObject +{ + PROPERTY_HEADER(RobotGui::ViewProviderSetElements); + +public: + virtual bool doubleClicked(void); +protected: + virtual bool setEdit(int ModNum); + virtual void unsetEdit(int ModNum); + +}; + +} //namespace FemGui + + +#endif // FEM_ViewProviderSetElements_H diff --git a/src/Mod/Fem/Gui/ViewProviderSetFaces.cpp b/src/Mod/Fem/Gui/ViewProviderSetFaces.cpp new file mode 100644 index 000000000..a814c7024 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetFaces.cpp @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include "ViewProviderSetFaces.h" +#include + +using namespace Gui; +using namespace FemGui; + +PROPERTY_SOURCE(FemGui::ViewProviderSetFaces, Gui::ViewProviderGeometryObject) + +bool ViewProviderSetFaces::doubleClicked(void) +{ + //Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + //Gui::Control().showDialog(dlg); + return true; +} + + +bool ViewProviderSetFaces::setEdit(int ModNum) +{ + //Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + //Gui::Control().showDialog(dlg); + return true; +} + +void ViewProviderSetFaces::unsetEdit(int ModNum) +{ + + +} diff --git a/src/Mod/Fem/Gui/ViewProviderSetFaces.h b/src/Mod/Fem/Gui/ViewProviderSetFaces.h new file mode 100644 index 000000000..a47b2e840 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetFaces.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef FEM_ViewProviderSetFaces_H +#define FEM_ViewProviderSetFaces_H + +#include "ViewProviderSetFaces.h" +#include +#include + +namespace FemGui +{ + +class ViewProviderSetFaces : public Gui::ViewProviderGeometryObject +{ + PROPERTY_HEADER(RobotGui::ViewProviderSetFaces); + +public: + virtual bool doubleClicked(void); +protected: + virtual bool setEdit(int ModNum); + virtual void unsetEdit(int ModNum); + +}; + +} //namespace FemGui + + +#endif // FEM_ViewProviderSetFaces_H diff --git a/src/Mod/Fem/Gui/ViewProviderSetGeometry.cpp b/src/Mod/Fem/Gui/ViewProviderSetGeometry.cpp new file mode 100644 index 000000000..0460fb71e --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetGeometry.cpp @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include "ViewProviderSetGeometry.h" +#include + +using namespace Gui; +using namespace FemGui; + +PROPERTY_SOURCE(FemGui::ViewProviderSetGeometry, Gui::ViewProviderGeometryObject) + +bool ViewProviderSetGeometry::doubleClicked(void) +{ + //Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + //Gui::Control().showDialog(dlg); + return true; +} + + +bool ViewProviderSetGeometry::setEdit(int ModNum) +{ + //Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + //Gui::Control().showDialog(dlg); + return true; +} + +void ViewProviderSetGeometry::unsetEdit(int ModNum) +{ + + +} diff --git a/src/Mod/Fem/Gui/ViewProviderSetGeometry.h b/src/Mod/Fem/Gui/ViewProviderSetGeometry.h new file mode 100644 index 000000000..a049cd9e4 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetGeometry.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef FEM_ViewProviderSetGeometry_H +#define FEM_ViewProviderSetGeometry_H + +#include "ViewProviderSetGeometry.h" +#include +#include + +namespace FemGui +{ + +class ViewProviderSetGeometry : public Gui::ViewProviderGeometryObject +{ + PROPERTY_HEADER(RobotGui::ViewProviderSetGeometry); + +public: + virtual bool doubleClicked(void); +protected: + virtual bool setEdit(int ModNum); + virtual void unsetEdit(int ModNum); + +}; + +} //namespace FemGui + + +#endif // FEM_ViewProviderSetGeometry_H diff --git a/src/Mod/Fem/Gui/ViewProviderSetNodes.cpp b/src/Mod/Fem/Gui/ViewProviderSetNodes.cpp new file mode 100644 index 000000000..c1d4e7534 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetNodes.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#ifndef _PreComp_ +#endif + +#include "ViewProviderSetNodes.h" +#include +#include + +using namespace Gui; +using namespace FemGui; + +PROPERTY_SOURCE(FemGui::ViewProviderSetNodes, Gui::ViewProviderGeometryObject) + +bool ViewProviderSetNodes::doubleClicked(void) +{ + Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + Gui::Control().showDialog(dlg); + return true; +} + + +bool ViewProviderSetNodes::setEdit(int ModNum) +{ + Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast(getObject())); + Gui::Control().showDialog(dlg); + return true; +} + +void ViewProviderSetNodes::unsetEdit(int ModNum) +{ + + +} diff --git a/src/Mod/Fem/Gui/ViewProviderSetNodes.h b/src/Mod/Fem/Gui/ViewProviderSetNodes.h new file mode 100644 index 000000000..9df4ef24f --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderSetNodes.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef FEM_ViewProviderSetNodes_H +#define FEM_ViewProviderSetNodes_H + +#include "ViewProviderSetNodes.h" +#include +#include + +namespace FemGui +{ + +class ViewProviderSetNodes : public Gui::ViewProviderGeometryObject +{ + PROPERTY_HEADER(RobotGui::ViewProviderSetNodes); + +public: + virtual bool doubleClicked(void); +protected: + virtual bool setEdit(int ModNum); + virtual void unsetEdit(int ModNum); + +}; + +} //namespace FemGui + + +#endif // FEM_ViewProviderSetNodes_H diff --git a/src/Mod/Fem/Gui/Workbench.cpp b/src/Mod/Fem/Gui/Workbench.cpp index 8e34c3d96..c1214e9cd 100755 --- a/src/Mod/Fem/Gui/Workbench.cpp +++ b/src/Mod/Fem/Gui/Workbench.cpp @@ -56,6 +56,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const Gui::ToolBarItem* fem = new Gui::ToolBarItem(root); fem->setCommand("FEM"); *fem << "Fem_CreateFromShape" + << "Fem_CreateNodesSet" << "Fem_DefineNodesSet"; return root; } @@ -68,6 +69,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const root->insertItem(item, fem); fem->setCommand("&FEM"); *fem << "Fem_CreateFromShape" + << "Fem_CreateNodesSet" << "Fem_DefineNodesSet"; return root;