diff --git a/src/Mod/Fem/App/AppFem.cpp b/src/Mod/Fem/App/AppFem.cpp index 2598144908..e4d7accdd3 100644 --- a/src/Mod/Fem/App/AppFem.cpp +++ b/src/Mod/Fem/App/AppFem.cpp @@ -176,6 +176,7 @@ PyMOD_INIT_FUNC(Fem) Fem::FemPostFilter ::init(); Fem::FemPostClipFilter ::init(); Fem::FemPostDataAlongLineFilter ::init(); + Fem::FemPostDataAtPointFilter ::init(); Fem::FemPostScalarClipFilter ::init(); Fem::FemPostWarpVectorFilter ::init(); Fem::FemPostCutFilter ::init(); diff --git a/src/Mod/Fem/App/FemPostFilter.cpp b/src/Mod/Fem/App/FemPostFilter.cpp index 800cedddaf..233982f39a 100644 --- a/src/Mod/Fem/App/FemPostFilter.cpp +++ b/src/Mod/Fem/App/FemPostFilter.cpp @@ -69,9 +69,10 @@ DocumentObjectExecReturn* FemPostFilter::execute(void) { if(!m_pipelines.empty() && !m_activePipeline.empty()) { FemPostFilter::FilterPipeline& pipe = m_pipelines[m_activePipeline]; - if (m_activePipeline.length() >= 13) { + if ((m_activePipeline.length() >= 13) || (m_activePipeline.length() >= 11)) { std::string LineClip = m_activePipeline.substr(0,13); - if (LineClip == "DataAlongLine") { + std::string PointClip = m_activePipeline.substr(0,11); + if ((LineClip == "DataAlongLine") || (PointClip == "DataAtPoint")) { pipe.filterSource->SetSourceData(getInputData()); pipe.filterTarget->Update(); @@ -299,6 +300,101 @@ void FemPostDataAlongLineFilter::GetAxisData() { XAxisData.setValues(coords); } +PROPERTY_SOURCE(Fem::FemPostDataAtPointFilter, Fem::FemPostFilter) + +FemPostDataAtPointFilter::FemPostDataAtPointFilter(void) : FemPostFilter() { + + ADD_PROPERTY_TYPE(Center,(Base::Vector3d(0.0,0.0,1.0)), "DataAtPoint", App::Prop_None, "The center used to define the center of the point"); + ADD_PROPERTY_TYPE(Radius,(0), "DataAtPoint", App::Prop_None, "The point 2 used to define end point of line"); + ADD_PROPERTY_TYPE(PointData,(0), "DataAtPoint",App::Prop_None,"Point data values used for plotting"); + ADD_PROPERTY_TYPE(FieldName,(""),"DataAtPoint",App::Prop_None,"Field used for plotting"); + ADD_PROPERTY_TYPE(Unit,(""),"DataAtPoint",App::Prop_None,"Unit used for Field"); + + PointData.setStatus(App::Property::ReadOnly, true); + FieldName.setStatus(App::Property::ReadOnly, true); + Unit.setStatus(App::Property::ReadOnly, true); + + FilterPipeline clip; + + m_point = vtkSmartPointer::New(); + const Base::Vector3d& vec = Center.getValue(); + m_point->SetCenter(vec.x, vec.y, vec.z); + m_point->SetRadius(0); + + m_probe = vtkSmartPointer::New(); + m_probe->SetInputConnection(m_point->GetOutputPort()); + m_probe->SetValidPointMaskArrayName("ValidPointArray"); + m_probe->SetPassPointArrays(1); + m_probe->SetPassCellArrays(1); + // needs vtk > 6.1 +#if (VTK_MAJOR_VERSION > 6) || (VTK_MINOR_VERSION > 1) + m_probe->ComputeToleranceOff(); + m_probe->SetTolerance(0.01); +#endif + + clip.filterSource = m_probe; + clip.filterTarget = m_probe; + + addFilterPipeline(clip, "DataAtPoint"); + setActiveFilterPipeline("DataAtPoint"); +} + +FemPostDataAtPointFilter::~FemPostDataAtPointFilter() { + +} + +DocumentObjectExecReturn* FemPostDataAtPointFilter::execute(void) { + + //recalculate the filter + return Fem::FemPostFilter::execute(); +} + + +void FemPostDataAtPointFilter::onChanged(const Property* prop) { + if(prop == &Center) { + const Base::Vector3d& vec = Center.getValue(); + m_point->SetCenter(vec.x, vec.y, vec.z); + } + else if(prop == &FieldName) { + GetPointData(); + } + Fem::FemPostFilter::onChanged(prop); +} + +short int FemPostDataAtPointFilter::mustExecute(void) const { + + if(Center.isTouched()){ + + return 1; + } + else return App::DocumentObject::mustExecute(); +} + +void FemPostDataAtPointFilter::GetPointData() { + + std::vector values; + + vtkSmartPointer data = m_probe->GetOutputDataObject(0); + vtkDataSet* dset = vtkDataSet::SafeDownCast(data); + vtkDataArray* pdata = dset->GetPointData()->GetArray(FieldName.getValue()); + + int component = 0; + + for(int i=0; iGetNumberOfPoints(); ++i) { + + double value = 0; + if(pdata->GetNumberOfComponents() == 1) + value = pdata->GetComponent(i, component); + else { + for(int j=0; jGetNumberOfComponents(); ++j) + value += std::pow(pdata->GetComponent(i, j),2); + + value = std::sqrt(value); + } + values.push_back(value); + } + PointData.setValues(values); +} PROPERTY_SOURCE(Fem::FemPostScalarClipFilter, Fem::FemPostFilter) diff --git a/src/Mod/Fem/App/FemPostFilter.h b/src/Mod/Fem/App/FemPostFilter.h index b2e59377a4..c7be676711 100644 --- a/src/Mod/Fem/App/FemPostFilter.h +++ b/src/Mod/Fem/App/FemPostFilter.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -132,6 +133,37 @@ private: }; +class AppFemExport FemPostDataAtPointFilter : public FemPostFilter { + + PROPERTY_HEADER(Fem::FemPostDataAtPointFilter); + +public: + FemPostDataAtPointFilter(void); + virtual ~FemPostDataAtPointFilter(); + + App::PropertyVectorDistance Center; + App::PropertyDistance Radius; + App::PropertyString FieldName; + App::PropertyFloatList PointData; + App::PropertyString Unit; + + virtual const char* getViewProviderName(void) const { + return "FemGui::ViewProviderFemPostDataAtPoint"; + } + virtual short int mustExecute(void) const; + +protected: + virtual App::DocumentObjectExecReturn* execute(void); + virtual void onChanged(const App::Property* prop); + void GetPointData(); + +private: + + vtkSmartPointer m_point; + vtkSmartPointer m_probe; + +}; + class AppFemExport FemPostScalarClipFilter : public FemPostFilter { PROPERTY_HEADER(Fem::FemPostScalarClipFilter); diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index 6ba69b2e45..c9ecdb43c2 100644 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -150,6 +150,7 @@ PyMOD_INIT_FUNC(FemGui) FemGui::ViewProviderFemPostSphereFunction ::init(); FemGui::ViewProviderFemPostClip ::init(); FemGui::ViewProviderFemPostDataAlongLine ::init(); + FemGui::ViewProviderFemPostDataAtPoint ::init(); FemGui::ViewProviderFemPostScalarClip ::init(); FemGui::ViewProviderFemPostWarpVector ::init(); FemGui::ViewProviderFemPostCut ::init(); diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index f4b680a38e..098bd9daee 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -118,6 +118,7 @@ if(BUILD_FEM_VTK) TaskPostDisplay.ui TaskPostClip.ui TaskPostDataAlongLine.ui + TaskPostDataAtPoint.ui TaskPostScalarClip.ui TaskPostWarpVector.ui TaskPostCut.ui @@ -290,6 +291,7 @@ if(BUILD_FEM_VTK) SphereWidget.ui TaskPostClip.ui TaskPostDataAlongLine.ui + TaskPostDataAtPoint.ui TaskPostScalarClip.ui TaskPostDisplay.ui TaskPostWarpVector.ui diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index 4d01111cf7..d5319f5670 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -1204,6 +1204,32 @@ bool CmdFemPostCreateDataAlongLineFilter::isActive(void) return hasActiveDocument(); } +DEF_STD_CMD_A(CmdFemPostCreateDataAtPointFilter); + +CmdFemPostCreateDataAtPointFilter::CmdFemPostCreateDataAtPointFilter() + : Command("FEM_PostCreateDataAtPointFilter") +{ + sAppModule = "Fem"; + sGroup = QT_TR_NOOP("Fem"); + sMenuText = QT_TR_NOOP("Define/create a clip filter which clips a field data at point"); + sToolTipText = QT_TR_NOOP("Define/create a clip filter which clips a field data at point"); + sWhatsThis = "FEM_PostCreateDataAtPointFilter"; + sStatusTip = sToolTipText; + sPixmap = "fem-DataAtPoint"; +} + +void CmdFemPostCreateDataAtPointFilter::activated(int) +{ + + setupFilter(this, "DataAtPoint"); + +} + +bool CmdFemPostCreateDataAtPointFilter::isActive(void) +{ + return hasActiveDocument(); +} + DEF_STD_CMD_A(CmdFemPostCreateLinearizedStressesFilter); CmdFemPostCreateLinearizedStressesFilter::CmdFemPostCreateLinearizedStressesFilter() @@ -1600,6 +1626,7 @@ void CreateFemCommands(void) #ifdef FC_USE_VTK rcCmdMgr.addCommand(new CmdFemPostCreateClipFilter); rcCmdMgr.addCommand(new CmdFemPostCreateDataAlongLineFilter); + rcCmdMgr.addCommand(new CmdFemPostCreateDataAtPointFilter); rcCmdMgr.addCommand(new CmdFemPostCreateLinearizedStressesFilter); rcCmdMgr.addCommand(new CmdFemPostCreateScalarClipFilter); rcCmdMgr.addCommand(new CmdFemPostWarpVectorFilter); diff --git a/src/Mod/Fem/Gui/Resources/Fem.qrc b/src/Mod/Fem/Gui/Resources/Fem.qrc index c8412e7f66..a73d3967c4 100755 --- a/src/Mod/Fem/Gui/Resources/Fem.qrc +++ b/src/Mod/Fem/Gui/Resources/Fem.qrc @@ -34,6 +34,7 @@ icons/fem-cut.svg icons/fem-cylinder.svg icons/fem-DataAlongLine.svg + icons/fem-DataAtPoint.png icons/fem-data.svg icons/fem-elmer.svg icons/fem-equation-electrostatic.svg diff --git a/src/Mod/Fem/Gui/Resources/icons/fem-DataAtPoint.png b/src/Mod/Fem/Gui/Resources/icons/fem-DataAtPoint.png new file mode 100644 index 0000000000..a9de7e03a5 Binary files /dev/null and b/src/Mod/Fem/Gui/Resources/icons/fem-DataAtPoint.png differ diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.cpp b/src/Mod/Fem/Gui/TaskPostBoxes.cpp index 696c1cb69e..2dce5b0e1c 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.cpp +++ b/src/Mod/Fem/Gui/TaskPostBoxes.cpp @@ -29,6 +29,7 @@ #include "ui_TaskPostDisplay.h" #include "ui_TaskPostClip.h" #include "ui_TaskPostDataAlongLine.h" +#include "ui_TaskPostDataAtPoint.h" #include "ui_TaskPostScalarClip.h" #include "ui_TaskPostWarpVector.h" #include "ui_TaskPostCut.h" @@ -43,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -104,10 +106,12 @@ void PointMarker::customEvent(QEvent*) const SbVec3f& pt1 = vp->pCoords->point[0]; const SbVec3f& pt2 = vp->pCoords->point[1]; - Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point1 = App.Vector(%f, %f, %f)", m_name.c_str(), pt1[0],pt1[1], pt1[2]); - Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point2 = App.Vector(%f, %f, %f)", m_name.c_str(), pt2[0],pt2[1], pt2[2]); + if(m_name == "DataAlongLine"){ + PointsChanged(pt1[0],pt1[1], pt1[2], pt2[0],pt2[1], pt2[2]); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point1 = App.Vector(%f, %f, %f)", m_name.c_str(), pt1[0],pt1[1], pt1[2]); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Point2 = App.Vector(%f, %f, %f)", m_name.c_str(), pt2[0],pt2[1], pt2[2]); + } Gui::Command::doCommand(Gui::Command::Doc, ObjectInvisible().c_str()); - PointsChanged(pt1[0],pt1[1], pt1[2], pt2[0],pt2[1], pt2[2]); } std::string PointMarker::ObjectInvisible(){ @@ -138,6 +142,79 @@ ViewProviderPointMarker::~ViewProviderPointMarker() pCoords->unref(); } +// ---------------------------------------------------------------------------- + +DataMarker::DataMarker(Gui::View3DInventorViewer* iv, std::string ObjName) : view(iv), + vp(new ViewProviderDataMarker) +{ + view->addViewProvider(vp); + m_name = ObjName; +} + +DataMarker::~DataMarker() +{ + view->removeViewProvider(vp); + delete vp; +} + +void DataMarker::addPoint(const SbVec3f& pt) +{ + int ct = countPoints(); + vp->pCoords->point.set1Value(ct, pt); + vp->pMarker->numPoints=ct+1; + +} + +int DataMarker::countPoints() const +{ + return vp->pCoords->point.getNum(); +} + +void DataMarker::customEvent(QEvent*) +{ + const SbVec3f& pt1 = vp->pCoords->point[0]; + + if(m_name == "DataAtPoint"){ + PointsChanged(pt1[0],pt1[1], pt1[2]); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", m_name.c_str(), pt1[0],pt1[1], pt1[2]); + } + Gui::Command::doCommand(Gui::Command::Doc, ObjectInvisible().c_str()); +} + +std::string DataMarker::ObjectInvisible(){ +return "for amesh in App.activeDocument().Objects:\n\ + if \"Mesh\" in amesh.TypeId:\n\ + aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\ + for apart in App.activeDocument().Objects:\n\ + if aparttoshow == apart.Name:\n\ + apart.ViewObject.Visibility = False\n"; +} + +PROPERTY_SOURCE(FemGui::ViewProviderDataMarker, Gui::ViewProviderDocumentObject) + +ViewProviderDataMarker::ViewProviderDataMarker() +{ + pCoords = new SoCoordinate3(); + pCoords->ref(); + pCoords->point.setNum(0); + pMarker = new SoMarkerSet(); + pMarker->markerIndex = SoMarkerSet::CIRCLE_FILLED_9_9; + pMarker->numPoints=0; + pMarker->ref(); + + SoGroup* grp = new SoGroup(); + grp->addChild(pCoords); + grp->addChild(pMarker); + addDisplayMaskMode(grp, "Base"); + setDisplayMaskMode("Base"); +} + +ViewProviderDataMarker::~ViewProviderDataMarker() +{ + pCoords->unref(); + pMarker->unref(); +} + //************************************************************************** //************************************************************************** // TaskDialog @@ -669,6 +746,170 @@ plt.show()\n"; //############################################################################################ +TaskPostDataAtPoint::TaskPostDataAtPoint(ViewProviderDocumentObject* view, QWidget* parent) + : TaskPostBox(view,Gui::BitmapFactory().pixmap("fem-femmesh-create-node-by-poly"), tr("Data At Point"), parent) { + + assert(view->isDerivedFrom(ViewProviderFemPostDataAtPoint::getClassTypeId())); + + //we load the views widget + proxy = new QWidget(this); + ui = new Ui_TaskPostDataAtPoint(); + ui->setupUi(proxy); + + QMetaObject::connectSlotsByName(this); + this->groupLayout()->addWidget(proxy); + + const Base::Vector3d& vec = static_cast(getObject())->Center.getValue(); + ui->centerX->setValue(vec.x); + ui->centerY->setValue(vec.y); + ui->centerZ->setValue(vec.z); + + connect(ui->centerX, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); + connect(ui->centerY, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); + connect(ui->centerZ, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); + + //update all fields + updateEnumerationList(getTypedView()->Field, ui->Field); +} + +TaskPostDataAtPoint::~TaskPostDataAtPoint() { + +} + +void TaskPostDataAtPoint::applyPythonCode() { + +} + +static const char * cursor_star[] = { +"32 32 3 1", +" c None", +". c #FFFFFF", +"+ c #FF0000", +" . ", +" . ", +" . ", +" . ", +" . ", +" ", +"..... ..... ", +" ", +" . ", +" . ", +" . ++ ", +" . + + ", +" . + ++ + ", +" + ++++ + ", +" + ++ ++ + ", +" + ++++++++ + ", +" ++ ++ ++ ++ "}; + +void TaskPostDataAtPoint::on_SelectPoint_clicked() { + + Gui::Command::doCommand(Gui::Command::Doc, ObjectVisible().c_str()); + Gui::Document* doc = Gui::Application::Instance->activeDocument(); + Gui::View3DInventor* view = static_cast(doc->getActiveView()); + if (view) { + Gui::View3DInventorViewer* viewer = view->getViewer(); + viewer->setEditing(true); + viewer->setEditingCursor(QCursor(QPixmap(cursor_star), 7, 7)); + + // Derives from QObject and we have a parent object, so we don't + // require a delete. + std::string ObjName = static_cast(getObject())->Label.getValue(); + + FemGui::DataMarker* marker = new FemGui::DataMarker(viewer, ObjName); + viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), + FemGui::TaskPostDataAtPoint::pointCallback, marker); + connect(marker, SIGNAL(PointsChanged(double, double, double)), this, SLOT(onChange(double, double, double))); + } + getTypedView()->DisplayMode.setValue(1); + updateEnumerationList(getTypedView()->Field, ui->Field); + +} + +std::string TaskPostDataAtPoint::ObjectVisible(){ +return "for amesh in App.activeDocument().Objects:\n\ + if \"Mesh\" in amesh.TypeId:\n\ + aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\ + for apart in App.activeDocument().Objects:\n\ + if aparttoshow == apart.Name:\n\ + apart.ViewObject.Visibility = True\n"; +} + +void TaskPostDataAtPoint::onChange(double x, double y, double z) { + + ui->centerX->setValue(x); + ui->centerY->setValue(y); + ui->centerZ->setValue(z); + +} + +void TaskPostDataAtPoint::centerChanged(double) { + + Base::Vector3d vec(ui->centerX->value(), ui->centerY->value(), ui->centerZ->value()); + std::string ObjName = static_cast(getObject())->Label.getValue(); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)",ObjName.c_str(), ui->centerX->value(), ui->centerY->value(), ui->centerZ->value()); + +} + +void TaskPostDataAtPoint::pointCallback(void * ud, SoEventCallback * n) +{ + const SoMouseButtonEvent * mbe = static_cast(n->getEvent()); + Gui::View3DInventorViewer* view = reinterpret_cast(n->getUserData()); + DataMarker *pm = reinterpret_cast(ud); + + // Mark all incoming mouse button events as handled, especially, to deactivate the selection node + n->getAction()->setHandled(); + + if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { + const SoPickedPoint * point = n->getPickedPoint(); + if (point == NULL) { + Base::Console().Message("No point picked.\n"); + return; + } + + n->setHandled(); + pm->addPoint(point->getPoint()); + if (pm->countPoints() == 1) { + QEvent *e = new QEvent(QEvent::User); + QApplication::postEvent(pm, e); + // leave mode + view->setEditing(false); + view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pointCallback, ud); + } + } + else if (mbe->getButton() != SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) { + n->setHandled(); + view->setEditing(false); + view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pointCallback, ud); + pm->deleteLater(); + } +} + +void TaskPostDataAtPoint::on_Field_activated(int i) { + + getTypedView()->Field.setValue(i); + std::string FieldName = ui->Field->currentText().toStdString(); + static_cast(getObject())->FieldName.setValue(FieldName); + if ((FieldName == "Von Mises stress") || (FieldName == "Max shear stress (Tresca)") || (FieldName == "Maximum Principal stress") || (FieldName == "Minimum Principal stress") || (FieldName == "Median Principal stress") || (FieldName == "Stress vectors")){ + static_cast(getObject())->Unit.setValue("MPa"); + } + else if (FieldName == "Displacement"){ + static_cast(getObject())->Unit.setValue("mm"); + } + else if (FieldName == "Temperature"){ + static_cast(getObject())->Unit.setValue("K"); + } + + std::string PointData = " The value at that location is " + std::to_string(static_cast(getObject())->PointData[0]) + " " +static_cast(getObject())->Unit.getValue() + "\n"; + QMessageBox::information(Gui::getMainWindow(), + qApp->translate("CmdFemPostCreateDataAtPointFilter", "Data At Point"), + qApp->translate("CmdFemPostCreateDataAtPointFilter", PointData.c_str())); + Base::Console().Error(PointData.c_str()); +} + +//############################################################################################ + TaskPostScalarClip::TaskPostScalarClip(ViewProviderDocumentObject* view, QWidget* parent) : TaskPostBox(view, Gui::BitmapFactory().pixmap("fem-femmesh-create-node-by-poly"), tr("Clip options"), parent) { diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.h b/src/Mod/Fem/Gui/TaskPostBoxes.h index ba50c54958..3dc24a1800 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.h +++ b/src/Mod/Fem/Gui/TaskPostBoxes.h @@ -36,6 +36,7 @@ class QComboBox; class Ui_TaskPostDisplay; class Ui_TaskPostClip; class Ui_TaskPostDataAlongLine; +class Ui_TaskPostDataAtPoint; class Ui_TaskPostScalarClip; class Ui_TaskPostWarpVector; class Ui_TaskPostCut; @@ -90,6 +91,45 @@ protected: friend class PointMarker; }; +class ViewProviderDataMarker; +class DataMarker : public QObject +{ + Q_OBJECT + +public: + DataMarker(Gui::View3DInventorViewer* view, std::string ObjName); + ~DataMarker(); + + void addPoint(const SbVec3f&); + int countPoints() const; + +Q_SIGNALS: + void PointsChanged(double x, double y, double z); + +protected: + void customEvent(QEvent* e); + +private: + Gui::View3DInventorViewer *view; + ViewProviderDataMarker *vp; + std::string m_name; + std::string ObjectInvisible(); +}; + +class FemGuiExport ViewProviderDataMarker : public Gui::ViewProviderDocumentObject +{ + PROPERTY_HEADER(FemGui::ViewProviderDataMarker); + +public: + ViewProviderDataMarker(); + virtual ~ViewProviderDataMarker(); + +protected: + SoCoordinate3 * pCoords; + SoMarkerSet * pMarker; + friend class DataMarker; +}; + class TaskPostBox : public Gui::TaskView::TaskBox { Q_OBJECT @@ -242,6 +282,30 @@ private: Ui_TaskPostDataAlongLine* ui; }; +class TaskPostDataAtPoint: public TaskPostBox { + + Q_OBJECT + +public: + TaskPostDataAtPoint(Gui::ViewProviderDocumentObject* view, QWidget* parent = 0); + virtual ~TaskPostDataAtPoint(); + + virtual void applyPythonCode(); + static void pointCallback(void * ud, SoEventCallback * n); + +private Q_SLOTS: + void on_SelectPoint_clicked(); + void on_Field_activated(int i); + void centerChanged(double); + void onChange(double x, double y, double z); + + +private: + std::string ObjectVisible(); + QWidget* proxy; + Ui_TaskPostDataAtPoint* ui; +}; + class TaskPostScalarClip : public TaskPostBox { Q_OBJECT diff --git a/src/Mod/Fem/Gui/TaskPostDataAtPoint.ui b/src/Mod/Fem/Gui/TaskPostDataAtPoint.ui new file mode 100644 index 0000000000..a47a40c855 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskPostDataAtPoint.ui @@ -0,0 +1,151 @@ + + + TaskPostDataAtPoint + + + + 0 + 0 + 482 + 363 + + + + Form + + + + + + Qt::Horizontal + + + + + + + + + Center + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + + + + + + + Select Point + + + + + + + Qt::Horizontal + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Field + + + + + + + + + + + + Qt::Horizontal + + + + + SelectPoint + line + line_2 + line_3 + + + + + diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFilter.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFilter.cpp index a5832a8992..12c3cda0d8 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFilter.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFilter.cpp @@ -69,6 +69,24 @@ void ViewProviderFemPostDataAlongLine::setupTaskDialog(TaskDlgPost* dlg) { } +PROPERTY_SOURCE(FemGui::ViewProviderFemPostDataAtPoint, FemGui::ViewProviderFemPostObject) + +ViewProviderFemPostDataAtPoint::ViewProviderFemPostDataAtPoint() { + + sPixmap = "fem-DataAtPoint"; +} + +ViewProviderFemPostDataAtPoint::~ViewProviderFemPostDataAtPoint() { + +} + +void ViewProviderFemPostDataAtPoint::setupTaskDialog(TaskDlgPost* dlg) { + + //add the function box + dlg->appendBox(new TaskPostDataAtPoint(dlg->getView())); + +} + PROPERTY_SOURCE(FemGui::ViewProviderFemPostScalarClip, FemGui::ViewProviderFemPostObject) diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFilter.h b/src/Mod/Fem/Gui/ViewProviderFemPostFilter.h index 426b0afd9a..f97f1bcf2f 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFilter.h +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFilter.h @@ -51,6 +51,19 @@ public: ViewProviderFemPostDataAlongLine(); ~ViewProviderFemPostDataAlongLine(); +protected: + virtual void setupTaskDialog(TaskDlgPost* dlg); +}; + +class FemGuiExport ViewProviderFemPostDataAtPoint: public ViewProviderFemPostObject { + + PROPERTY_HEADER(FemGui::ViewProviderFemPostDataAtPoint); + +public: + /// constructor. + ViewProviderFemPostDataAtPoint(); + ~ViewProviderFemPostDataAtPoint(); + protected: virtual void setupTaskDialog(TaskDlgPost* dlg); }; diff --git a/src/Mod/Fem/Gui/Workbench.cpp b/src/Mod/Fem/Gui/Workbench.cpp index cf88546648..7d63dc0b0f 100755 --- a/src/Mod/Fem/Gui/Workbench.cpp +++ b/src/Mod/Fem/Gui/Workbench.cpp @@ -146,6 +146,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const << "FEM_PostCreateWarpVectorFilter" << "FEM_PostCreateDataAlongLineFilter" << "FEM_PostCreateLinearizedStressesFilter" + << "FEM_PostCreateDataAtPointFilter" << "Separator" << "FEM_PostCreateFunctions"; #endif @@ -254,6 +255,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const << "FEM_PostCreateWarpVectorFilter" << "FEM_PostCreateDataAlongLineFilter" << "FEM_PostCreateLinearizedStressesFilter" + << "FEM_PostCreateDataAtPointFilter" << "Separator" << "FEM_PostCreateFunctions"; #endif