FEM: Add post pipeline branch

This commit is contained in:
Stefan Tröger
2024-12-21 23:13:10 +01:00
committed by Benjamin Nauck
parent a65a7feb87
commit 4bc2a1d6f3
21 changed files with 595 additions and 211 deletions

View File

@@ -65,6 +65,7 @@
#include "FemPostFilter.h"
#include "FemPostFunction.h"
#include "FemPostPipeline.h"
#include "FemPostBranchFilter.h"
#include "PropertyPostDataObject.h"
#endif
@@ -187,6 +188,7 @@ PyMOD_INIT_FUNC(Fem)
Fem::FemPostGroupExtension ::init();
Fem::FemPostPipeline ::init();
Fem::FemPostFilter ::init();
Fem::FemPostBranchFilter ::init();
Fem::FemPostClipFilter ::init();
Fem::FemPostContoursFilter ::init();
Fem::FemPostCutFilter ::init();

View File

@@ -67,12 +67,12 @@ if(BUILD_FEM_VTK)
FemPostObjectPyImp.cpp
FemPostPipelinePy.xml
FemPostPipelinePyImp.cpp
FemPostBranchPy.xml
FemPostBranchPyImp.cpp
FemPostBranchFilterPy.xml
FemPostBranchFilterPyImp.cpp
)
generate_from_xml(FemPostObjectPy)
generate_from_xml(FemPostPipelinePy)
generate_from_xml(FemPostBranchPy)
generate_from_xml(FemPostBranchFilterPy)
endif(BUILD_FEM_VTK)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
@@ -87,8 +87,8 @@ if(BUILD_FEM_VTK)
FemPostGroupExtension.cpp
FemPostPipeline.h
FemPostPipeline.cpp
FemPostBranch.h
FemPostBranch.cpp
FemPostBranchFilter.h
FemPostBranchFilter.cpp
FemPostFilter.h
FemPostFilter.cpp
FemPostFunction.h

View File

@@ -41,19 +41,19 @@
#include "FemMesh.h"
#include "FemMeshObject.h"
#include "FemPostBranch.h"
#include "FemPostBranchPy.h"
#include "FemPostBranchFilter.h"
#include "FemPostBranchFilterPy.h"
#include "FemVTKTools.h"
using namespace Fem;
using namespace App;
PROPERTY_SOURCE_WITH_EXTENSIONS(Fem::FemPostBranch, Fem::FemPostFilter);
PROPERTY_SOURCE_WITH_EXTENSIONS(Fem::FemPostBranchFilter, Fem::FemPostFilter);
const char* FemPostBranch::OutputEnums[] = {"Passthrough", "Append", nullptr};
const char* FemPostBranchFilter::OutputEnums[] = {"Passthrough", "Append", nullptr};
FemPostBranch::FemPostBranch() : Fem::FemPostFilter(), Fem::FemPostGroupExtension()
FemPostBranchFilter::FemPostBranchFilter() : Fem::FemPostFilter(), Fem::FemPostGroupExtension()
{
FemPostGroupExtension::initExtension(this);
@@ -93,9 +93,9 @@ FemPostBranch::FemPostBranch() : Fem::FemPostFilter(), Fem::FemPostGroupExtensio
setActiveFilterPipeline("passthrough");
}
FemPostBranch::~FemPostBranch() = default;
FemPostBranchFilter::~FemPostBranchFilter() = default;
short FemPostBranch::mustExecute() const
short FemPostBranchFilter::mustExecute() const
{
if (Mode.isTouched()) {
return 1;
@@ -105,7 +105,7 @@ short FemPostBranch::mustExecute() const
}
void FemPostBranch::onChanged(const Property* prop)
void FemPostBranchFilter::onChanged(const Property* prop)
{
/* onChanged handles the Pipeline setup: we connect the inputs and outputs
* of our child filters correctly according to the new settings
@@ -170,13 +170,23 @@ void FemPostBranch::onChanged(const Property* prop)
else {
setActiveFilterPipeline("append");
}
// inform toplevel pipeline we changed
App::DocumentObject* group = FemPostGroupExtension::getGroupOfObject(this);
if (!group) {
return;
}
if (group->hasExtension(FemPostGroupExtension::getExtensionClassTypeId())) {
auto postgroup = group->getExtensionByType<FemPostGroupExtension>();
postgroup->filterChanged(this);
}
}
FemPostFilter::onChanged(prop);
}
void FemPostBranch::filterChanged(FemPostFilter* filter)
void FemPostBranchFilter::filterChanged(FemPostFilter* filter)
{
//we only need to update the following children if we are in serial mode
if (Mode.getValue() == 0) {
@@ -213,7 +223,7 @@ void FemPostBranch::filterChanged(FemPostFilter* filter)
}
}
void FemPostBranch::filterPipelineChanged(FemPostFilter*) {
void FemPostBranchFilter::filterPipelineChanged(FemPostFilter*) {
// one of our filters has changed its active pipeline. We need to reconnect it properly.
// As we are cheap we just reconnect everything
// TODO: Do more efficiently
@@ -221,11 +231,11 @@ void FemPostBranch::filterPipelineChanged(FemPostFilter*) {
}
PyObject* FemPostBranch::getPyObject()
PyObject* FemPostBranchFilter::getPyObject()
{
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new FemPostBranchPy(this), true);
PythonObject = Py::Object(new FemPostBranchFilterPy(this), true);
}
return Py::new_reference_to(PythonObject);
}

View File

@@ -20,8 +20,8 @@
* *
***************************************************************************/
#ifndef Fem_FemPostBranch_H
#define Fem_FemPostBranch_H
#ifndef Fem_FemPostBranchFilter_H
#define Fem_FemPostBranchFilter_H
#include "FemPostFilter.h"
@@ -35,16 +35,15 @@
namespace Fem
{
class FemExport FemPostBranch: public Fem::FemPostFilter, public FemPostGroupExtension
class FemExport FemPostBranchFilter: public Fem::FemPostFilter, public FemPostGroupExtension
{
PROPERTY_HEADER_WITH_EXTENSIONS(Fem::FemPostBranch);
PROPERTY_HEADER_WITH_EXTENSIONS(Fem::FemPostBranchFilter);
public:
/// Constructor
FemPostBranch();
~FemPostBranch() override;
FemPostBranchFilter();
~FemPostBranchFilter() override;
App::PropertyEnumeration Mode;
App::PropertyEnumeration Output;
@@ -53,7 +52,7 @@ public:
const char* getViewProviderName() const override
{
return "FemGui::ViewProviderFemPostBranch";
return "FemGui::ViewProviderFemPostBranchFilter";
}
// Branch handling
@@ -73,4 +72,4 @@ private:
} // namespace Fem
#endif // Fem_FemPostBranch_H
#endif // Fem_FemPostBranchFilter_H

View File

@@ -2,10 +2,10 @@
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="FemPostObjectPy"
Name="FemPostBranchPy"
Twin="FemPostBranch"
TwinPointer="FemPostBranch"
Include="Mod/Fem/App/FemPostBranch.h"
Name="FemPostBranchFilterPy"
Twin="FemPostBranchFilter"
TwinPointer="FemPostBranchFilter"
Include="Mod/Fem/App/FemPostBranchFilter.h"
Namespace="Fem"
FatherInclude="Mod/Fem/App/FemPostObjectPy.h"
FatherNamespace="Fem">

View File

@@ -28,45 +28,45 @@
#include <Base/FileInfo.h>
// clang-format off
#include "FemPostBranch.h"
#include "FemPostBranchPy.h"
#include "FemPostBranchPy.cpp"
#include "FemPostBranchFilter.h"
#include "FemPostBranchFilterPy.h"
#include "FemPostBranchFilterPy.cpp"
// clang-format on
using namespace Fem;
// returns a string which represents the object e.g. when printed in python
std::string FemPostBranchPy::representation() const
std::string FemPostBranchFilterPy::representation() const
{
return {"<FemPostBranch object>"};
return {"<FemPostBranchFilter object>"};
}
PyObject* FemPostBranchPy::recomputeChildren(PyObject* args)
PyObject* FemPostBranchFilterPy::recomputeChildren(PyObject* args)
{
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
getFemPostBranchPtr()->recomputeChildren();
getFemPostBranchFilterPtr()->recomputeChildren();
Py_Return;
}
PyObject* FemPostBranchPy::getLastPostObject(PyObject* args)
PyObject* FemPostBranchFilterPy::getLastPostObject(PyObject* args)
{
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
App::DocumentObject* obj = getFemPostBranchPtr()->getLastPostObject();
App::DocumentObject* obj = getFemPostBranchFilterPtr()->getLastPostObject();
if (obj) {
return obj->getPyObject();
}
Py_Return;
}
PyObject* FemPostBranchPy::holdsPostObject(PyObject* args)
PyObject* FemPostBranchFilterPy::holdsPostObject(PyObject* args)
{
PyObject* py;
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &py)) {
@@ -79,16 +79,16 @@ PyObject* FemPostBranchPy::holdsPostObject(PyObject* args)
return nullptr;
}
bool ok = getFemPostBranchPtr()->holdsPostObject(static_cast<FemPostObject*>(obj));
bool ok = getFemPostBranchFilterPtr()->holdsPostObject(static_cast<FemPostObject*>(obj));
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
PyObject* FemPostBranchPy::getCustomAttributes(const char* /*attr*/) const
PyObject* FemPostBranchFilterPy::getCustomAttributes(const char* /*attr*/) const
{
return nullptr;
}
int FemPostBranchPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
int FemPostBranchFilterPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@@ -35,7 +35,7 @@
#include "FemPostFilter.h"
#include "FemPostPipeline.h"
#include "FemPostBranch.h"
#include "FemPostBranchFilter.h"
using namespace Fem;

View File

@@ -123,6 +123,17 @@ void FemPostGroupExtension::extensionOnChanged(const App::Property* p)
GroupExtension::extensionOnChanged(p);
}
App::DocumentObject* FemPostGroupExtension::getGroupOfObject(const App::DocumentObject* obj)
{
for (auto o : obj->getInList()) {
if (o->hasExtension(FemPostGroupExtension::getExtensionClassTypeId(), false)) {
return o;
}
}
return nullptr;
}
void FemPostGroupExtension::onExtendedUnsetupObject()
{
// remove all children!

View File

@@ -53,6 +53,9 @@ public:
virtual FemPostObject* getLastPostObject();
virtual bool holdsPostObject(FemPostObject* obj);
// general
static App::DocumentObject* getGroupOfObject(const App::DocumentObject* obj);
protected:
void extensionOnChanged(const App::Property* p) override;
void onExtendedUnsetupObject() override;

View File

@@ -74,6 +74,7 @@
#include "ViewProviderFemPostFunction.h"
#include "ViewProviderFemPostObject.h"
#include "ViewProviderFemPostPipeline.h"
#include "ViewProviderFemPostBranchFilter.h"
#endif
@@ -160,6 +161,7 @@ PyMOD_INIT_FUNC(FemGui)
#ifdef FC_USE_VTK
FemGui::ViewProviderFemPostObject ::init();
FemGui::ViewProviderFemPostPipeline ::init();
FemGui::ViewProviderFemPostBranchFilter ::init();
FemGui::ViewProviderFemPostClip ::init();
FemGui::ViewProviderFemPostContours ::init();
FemGui::ViewProviderFemPostCut ::init();

View File

@@ -96,6 +96,7 @@ if(BUILD_FEM_VTK)
TaskPostScalarClip.ui
TaskPostWarpVector.ui
TaskPostFrames.ui
TaskPostBranch.ui
)
endif(BUILD_FEM_VTK)
@@ -334,6 +335,8 @@ if(BUILD_FEM_VTK)
ViewProviderFemPostObject.cpp
ViewProviderFemPostPipeline.h
ViewProviderFemPostPipeline.cpp
ViewProviderFemPostBranchFilter.h
ViewProviderFemPostBranchFilter.cpp
ViewProviderFemPostFunction.h
ViewProviderFemPostFunction.cpp
ViewProviderFemPostFilter.h

View File

@@ -1838,31 +1838,20 @@ void setupFilter(Gui::Command* cmd, std::string Name)
// at first we must determine the pipeline of the selection object
// (which can be a pipeline itself)
bool selectionIsPipeline = false;
Fem::FemPostPipeline* pipeline = nullptr;
if (selObject->isDerivedFrom<Fem::FemPostPipeline>()) {
pipeline = static_cast<Fem::FemPostPipeline*>(selObject);
selectionIsPipeline = true;
}
else {
auto parents = selObject->getInList();
if (!parents.empty()) {
for (auto parentObject : parents) {
if (parentObject->isDerivedFrom<Fem::FemPostPipeline>()) {
pipeline = static_cast<Fem::FemPostPipeline*>(parentObject);
}
}
App::DocumentObject* pipeline = nullptr;
if(selObject->hasExtension(Fem::FemPostGroupExtension::getExtensionClassTypeId())) {
pipeline = selObject;
} else {
pipeline = Fem::FemPostGroupExtension::getGroupOfObject(selObject);
if (!pipeline || !pipeline->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
QMessageBox::warning(
Gui::getMainWindow(),
qApp->translate("setupFilter", "Error: Object not in a post processing group"),
qApp->translate("setupFilter", "The filter could not be set up: Object not in a post processing group."));
return;
}
}
if (!pipeline) {
QMessageBox::warning(
Gui::getMainWindow(),
qApp->translate("setupFilter", "Error: no post processing object selected."),
qApp->translate("setupFilter", "The filter could not be set up."));
return;
}
// create the object and add it to the pipeline
cmd->openCommand(QT_TRANSLATE_NOOP("Command", "Create filter"));
cmd->doCommand(Gui::Command::Doc,
@@ -2032,30 +2021,15 @@ void CmdFemPostClipFilter::activated(int)
bool CmdFemPostClipFilter::isActive()
{
// only allow one object
if (getSelection().getSelection().size() > 1) {
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a result is either a post pipeline or a possible filter
if (getSelection().countObjectsOfType<Fem::FemPostPipeline>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostDataAlongLineFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostScalarClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostContoursFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostCutFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostWarpVectorFilter>() == 1) {
return true;
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
@@ -2084,30 +2058,15 @@ void CmdFemPostCutFilter::activated(int)
bool CmdFemPostCutFilter::isActive()
{
// only allow one object
if (getSelection().getSelection().size() > 1) {
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a result is either a post pipeline or a possible filter
if (getSelection().countObjectsOfType<Fem::FemPostPipeline>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostContoursFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostCutFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostScalarClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostDataAlongLineFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostWarpVectorFilter>() == 1) {
return true;
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
@@ -2136,27 +2095,15 @@ void CmdFemPostDataAlongLineFilter::activated(int)
bool CmdFemPostDataAlongLineFilter::isActive()
{
// only allow one object
if (getSelection().getSelection().size() > 1) {
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a result is either a post pipeline or a possible filter
if (getSelection().countObjectsOfType<Fem::FemPostPipeline>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostContoursFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostCutFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostScalarClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostWarpVectorFilter>() == 1) {
return true;
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
@@ -2186,27 +2133,15 @@ void CmdFemPostDataAtPointFilter::activated(int)
bool CmdFemPostDataAtPointFilter::isActive()
{
// only allow one object
if (getSelection().getSelection().size() > 1) {
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a result is either a post pipeline or a possible filter
if (getSelection().countObjectsOfType<Fem::FemPostPipeline>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostCutFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostDataAlongLineFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostScalarClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostWarpVectorFilter>() == 1) {
return true;
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
@@ -2311,27 +2246,15 @@ void CmdFemPostScalarClipFilter::activated(int)
bool CmdFemPostScalarClipFilter::isActive()
{
// only allow one object
if (getSelection().getSelection().size() > 1) {
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a result is either a post pipeline or a possible other filter
if (getSelection().countObjectsOfType<Fem::FemPostPipeline>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostContoursFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostCutFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostDataAlongLineFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostWarpVectorFilter>() == 1) {
return true;
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
@@ -2360,27 +2283,15 @@ void CmdFemPostWarpVectorFilter::activated(int)
bool CmdFemPostWarpVectorFilter::isActive()
{
// only allow one object
if (getSelection().getSelection().size() > 1) {
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a result is either a post pipeline or a possible other filter
if (getSelection().countObjectsOfType<Fem::FemPostPipeline>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostCutFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostContoursFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostDataAlongLineFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostScalarClipFilter>() == 1) {
return true;
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
@@ -2409,27 +2320,15 @@ void CmdFemPostContoursFilter::activated(int)
bool CmdFemPostContoursFilter::isActive()
{
// only allow one object
if (getSelection().getSelection().size() > 1) {
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a result is either a post pipeline or a possible other filter
if (getSelection().countObjectsOfType<Fem::FemPostPipeline>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostCutFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostDataAlongLineFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostScalarClipFilter>() == 1) {
return true;
}
else if (getSelection().countObjectsOfType<Fem::FemPostWarpVectorFilter>() == 1) {
return true;
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
@@ -2796,6 +2695,42 @@ bool CmdFemPostPipelineFromResult::isActive()
return (results.size() == 1) ? true : false;
}
//================================================================================================
DEF_STD_CMD_A(CmdFemPostBranchFilter)
CmdFemPostBranchFilter::CmdFemPostBranchFilter()
: Command("FEM_PostBranchFilter")
{
sAppModule = "Fem";
sGroup = QT_TR_NOOP("Fem");
sMenuText = QT_TR_NOOP("Pipeline branch");
sToolTipText = QT_TR_NOOP("Branches the pipeline into a new path");
sWhatsThis = "FEM_PostBranchFilter";
sStatusTip = sToolTipText;
sPixmap = "FEM_PostBranchFilter";
}
void CmdFemPostBranchFilter::activated(int)
{
setupFilter(this, "Branch");
}
bool CmdFemPostBranchFilter::isActive()
{
// only allow one object
auto selection = getSelection().getSelection();
if (selection.size() > 1) {
return false;
}
// only activate if a post object is selected
for (auto obj : selection ) {
if (obj.pObject->isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
return true;
}
}
return false;
}
#endif
@@ -2851,6 +2786,7 @@ void CreateFemCommands()
rcCmdMgr.addCommand(new CmdFemPostLinearizedStressesFilter);
rcCmdMgr.addCommand(new CmdFemPostFunctions);
rcCmdMgr.addCommand(new CmdFemPostPipelineFromResult);
rcCmdMgr.addCommand(new CmdFemPostBranchFilter);
rcCmdMgr.addCommand(new CmdFemPostScalarClipFilter);
rcCmdMgr.addCommand(new CmdFemPostWarpVectorFilter);
#endif

View File

@@ -81,6 +81,7 @@
<file>icons/FEM_PostFilterLinearizedStresses.svg</file>
<file>icons/FEM_PostFilterWarp.svg</file>
<file>icons/FEM_PostFrames.svg</file>
<file>icons/FEM_PostBranchFilter.svg</file>
<file>icons/FEM_PostPipelineFromResult.svg</file>
<file>icons/FEM_ResultShow.svg</file>
<file>icons/FEM_ResultsPurge.svg</file>

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="64"
height="64"
id="svg2"
version="1.1"
sodipodi:docname="FEM_PostBranch.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="22.627417"
inkscape:cx="36.018252"
inkscape:cy="29.676388"
inkscape:window-width="3772"
inkscape:window-height="2132"
inkscape:window-x="68"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs4">
<linearGradient
id="linearGradient3802">
<stop
style="stop-color:#4e9a06;stop-opacity:1"
offset="0"
id="stop3804" />
<stop
style="stop-color:#73d216;stop-opacity:1"
offset="1"
id="stop3806" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient3802"
id="linearGradient3808"
x1="49"
y1="58"
x2="47"
y2="42"
gradientUnits="userSpaceOnUse" />
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:creator>
<cc:Agent>
<dc:title>[Alexander Gryson]</dc:title>
</cc:Agent>
</dc:creator>
<dc:date>2017-03-11</dc:date>
<dc:relation>https://www.freecad.org/wiki/index.php?title=Artwork</dc:relation>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>FreeCAD/src/Mod/</dc:identifier>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
<dc:contributor>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
transform="translate(0,-988.36218)">
<path
style="fill:none;stroke:#172a04;stroke-width:14.3583;stroke-linejoin:bevel;stroke-dasharray:none"
d="m 7.3446662,1052.2913 c -0.191309,-28.689 5.4919548,-27.8281 16.3618638,-30.5412 8.792494,-2.559 8.364413,-18.0247 8.364413,-18.0247 l -0.0367,-15.1045"
id="path2"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;stroke:#172a04;stroke-width:14.3583;stroke-linejoin:bevel;stroke-dasharray:none"
d="m 56.732958,1052.2676 c 0.19131,-28.6891 -5.491978,-27.8281 -16.361932,-30.5413 -8.79253,-2.559 -8.364448,-18.0247 -8.364448,-18.0247 l 0.0367,-15.10452"
id="path2-5"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;stroke:#8ae234;stroke-width:7.511;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 56.806638,1052.2731 c 0.191309,-28.6892 -5.491977,-27.8281 -16.361932,-30.5414 -8.79253,-2.559 -8.364446,-18.0247 -8.364446,-18.0247 l 0.0367,-15.10445"
id="path2-6-3"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;stroke:#8ae234;stroke-width:7.511;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 7.435987,1052.2558 c -0.1913091,-28.689 5.491954,-27.8281 16.361864,-30.5412 8.792494,-2.559 8.364413,-18.0247 8.364413,-18.0247 l -0.0367,-15.10449"
id="path2-6"
sodipodi:nodetypes="cccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -49,6 +49,7 @@
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include <Mod/Fem/App/FemPostFilter.h>
#include <Mod/Fem/App/FemPostBranchFilter.h>
#include <Mod/Fem/App/FemPostPipeline.h>
#include "ui_TaskPostClip.h"
@@ -60,6 +61,7 @@
#include "ui_TaskPostScalarClip.h"
#include "ui_TaskPostWarpVector.h"
#include "ui_TaskPostFrames.h"
#include "ui_TaskPostBranch.h"
#include "FemSettings.h"
@@ -67,6 +69,7 @@
#include "ViewProviderFemPostFilter.h"
#include "ViewProviderFemPostFunction.h"
#include "ViewProviderFemPostObject.h"
#include "ViewProviderFemPostBranchFilter.h"
using namespace FemGui;
@@ -540,6 +543,61 @@ void TaskPostFrames::applyPythonCode()
// ***************************************************************************
// ***************************************************************************
// Branch
TaskPostBranch::TaskPostBranch(ViewProviderFemPostBranchFilter* view, QWidget* parent)
: TaskPostBox(view,
Gui::BitmapFactory().pixmap("FEM_PostBranchFilter"),
tr("Branch behaviour"),
parent), ui(new Ui_TaskPostBranch)
{
// we load the views widget
proxy = new QWidget(this);
ui->setupUi(proxy);
this->groupLayout()->addWidget(proxy);
setupConnections();
// populate the data
auto branch = static_cast<Fem::FemPostBranchFilter*>(getObject());
ui->ModeBox->setCurrentIndex(branch->Mode.getValue());
ui->OutputBox->setCurrentIndex(branch->Output.getValue());
}
TaskPostBranch::~TaskPostBranch() = default;
void TaskPostBranch::setupConnections()
{
connect(ui->ModeBox,
qOverload<int>(&QComboBox::currentIndexChanged),
this,
&TaskPostBranch::onModeIndexChanged);
connect(ui->OutputBox,
qOverload<int>(&QComboBox::currentIndexChanged),
this,
&TaskPostBranch::onOutputIndexChanged);
}
void TaskPostBranch::onModeIndexChanged(int idx)
{
static_cast<Fem::FemPostBranchFilter*>(getObject())->Mode.setValue(idx);
}
void TaskPostBranch::onOutputIndexChanged(int idx)
{
static_cast<Fem::FemPostBranchFilter*>(getObject())->Output.setValue(idx);
}
void TaskPostBranch::applyPythonCode()
{
// we apply the views widgets python code
}
// ***************************************************************************
// data along line filter
TaskPostDataAlongLine::TaskPostDataAlongLine(ViewProviderFemPostDataAlongLine* view,

View File

@@ -30,7 +30,6 @@
#include "ViewProviderFemPostFunction.h"
class QComboBox;
class Ui_TaskPostDisplay;
class Ui_TaskPostClip;
@@ -41,6 +40,7 @@ class Ui_TaskPostScalarClip;
class Ui_TaskPostWarpVector;
class Ui_TaskPostCut;
class Ui_TaskPostFrames;
class Ui_TaskPostBranch;
class SoFontStyle;
class SoText2;
@@ -278,7 +278,7 @@ public:
};
// ***************************************************************************
// steps
// frames
class TaskPostFrames: public TaskPostBox
{
Q_OBJECT
@@ -303,6 +303,29 @@ private:
// ***************************************************************************
// ***************************************************************************
// branch
class ViewProviderFemPostBranchFilter;
class TaskPostBranch: public TaskPostBox
{
Q_OBJECT
public:
explicit TaskPostBranch(ViewProviderFemPostBranchFilter* view, QWidget* parent = nullptr);
~TaskPostBranch() override;
void applyPythonCode() override;
private:
void setupConnections();
void onModeIndexChanged(int);
void onOutputIndexChanged(int);
QWidget* proxy;
std::unique_ptr<Ui_TaskPostBranch> ui;
};
// ***************************************************************************
// data along line filter
class ViewProviderFemPostDataAlongLine;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,53 @@
/***************************************************************************
* Copyright (c) 2015 Stefan Tröger <stefantroeger@gmx.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 "TaskPostBoxes.h"
#include "ViewProviderFemPostBranchFilter.h"
using namespace FemGui;
PROPERTY_SOURCE_WITH_EXTENSIONS(FemGui::ViewProviderFemPostBranchFilter, FemGui::ViewProviderFemPostObject)
ViewProviderFemPostBranchFilter::ViewProviderFemPostBranchFilter() : Gui::ViewProviderGroupExtension()
{
Gui::ViewProviderGroupExtension::initExtension(this);
sPixmap = "FEM_PostBranchFilter";
}
ViewProviderFemPostBranchFilter::~ViewProviderFemPostBranchFilter()
{
}
void ViewProviderFemPostBranchFilter::setupTaskDialog(TaskDlgPost* dlg)
{
// add the branch ui
dlg->appendBox(new TaskPostBranch(this));
// add the display options
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
}

View File

@@ -0,0 +1,61 @@
/***************************************************************************
* Copyright (c) 2015 Stefan Tröger <stefantroeger@gmx.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_VIEWPROVIDERFEMPOSTBRANCHFILTER_H
#define FEM_VIEWPROVIDERFEMPOSTBRANCHFILTER_H
#include "ViewProviderFemPostObject.h"
#include <Gui/ViewProviderGroupExtension.h>
namespace Gui
{
class SelectionChanges;
class SoFCColorBar;
} // namespace Gui
namespace FemGui
{
class TaskDlgPost;
class FemGuiExport ViewProviderFemPostBranchFilter: public ViewProviderFemPostObject, public Gui::ViewProviderGroupExtension
{
PROPERTY_HEADER_WITH_EXTENSIONS(FemGui::ViewProviderFemPostBranchFilter);
public:
ViewProviderFemPostBranchFilter();
~ViewProviderFemPostBranchFilter() override;
protected:
virtual void setupTaskDialog(TaskDlgPost* dlg) override;
// override, to not show/hide children as the parent is shown/hidden like normal groups
void extensionHide() override {};
void extensionShow() override {};
};
}
#endif // FEM_VIEWPROVIDERFEMPOSTBRANCHFILTER_H

View File

@@ -51,13 +51,13 @@ public:
void scaleField(vtkDataSet* dset, vtkDataArray* pdata, double FieldFactor);
PyObject* getPyObject() override;
// override, to not show/hide children as the parent is shown/hidden like normal groups
void extensionHide() override {};
void extensionShow() override {};
protected:
void updateFunctionSize();
virtual void setupTaskDialog(TaskDlgPost* dlg) override;
// override, to not show/hide children as the parent is shown/hidden like normal groups
void extensionHide() override {};
void extensionShow() override {};
};
} // namespace FemGui

View File

@@ -199,6 +199,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
*results << "Separator"
<< "FEM_PostApplyChanges"
<< "FEM_PostPipelineFromResult"
<< "FEM_PostBranchFilter"
<< "Separator"
<< "FEM_PostFilterWarp"
<< "FEM_PostFilterClipScalar"