FEM Post: Add cut filter
This commit is contained in:
parent
d0e371b3e1
commit
cd9e827d24
|
@ -158,6 +158,7 @@ PyMODINIT_FUNC initFem()
|
||||||
Fem::FemPostClipFilter ::init();
|
Fem::FemPostClipFilter ::init();
|
||||||
Fem::FemPostScalarClipFilter ::init();
|
Fem::FemPostScalarClipFilter ::init();
|
||||||
Fem::FemPostWarpVectorFilter ::init();
|
Fem::FemPostWarpVectorFilter ::init();
|
||||||
|
Fem::FemPostCutFilter ::init();
|
||||||
Fem::FemPostFunction ::init();
|
Fem::FemPostFunction ::init();
|
||||||
Fem::FemPostFunctionProvider ::init();
|
Fem::FemPostFunctionProvider ::init();
|
||||||
Fem::FemPostPlaneFunction ::init();
|
Fem::FemPostPlaneFunction ::init();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<<<<<<< c8cde18ac8aa317da00f6668e9a156fcbe0b2975
|
<<<<<<< 559b38429c3ec5bcad9eced553e5d7ca544cb55e
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
|
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
|
||||||
* *
|
* *
|
||||||
|
@ -158,6 +158,7 @@ PyMODINIT_FUNC initFem()
|
||||||
Fem::FemPostFilter ::init();
|
Fem::FemPostFilter ::init();
|
||||||
Fem::FemPostClipFilter ::init();
|
Fem::FemPostClipFilter ::init();
|
||||||
Fem::FemPostScalarClipFilter ::init();
|
Fem::FemPostScalarClipFilter ::init();
|
||||||
|
Fem::FemPostWarpVectorFilter ::init();
|
||||||
Fem::FemPostFunction ::init();
|
Fem::FemPostFunction ::init();
|
||||||
Fem::FemPostFunctionProvider ::init();
|
Fem::FemPostFunctionProvider ::init();
|
||||||
Fem::FemPostPlaneFunction ::init();
|
Fem::FemPostPlaneFunction ::init();
|
||||||
|
@ -325,10 +326,11 @@ PyMODINIT_FUNC initFem()
|
||||||
Fem::FemPostClipFilter ::init();
|
Fem::FemPostClipFilter ::init();
|
||||||
Fem::FemPostScalarClipFilter ::init();
|
Fem::FemPostScalarClipFilter ::init();
|
||||||
Fem::FemPostWarpVectorFilter ::init();
|
Fem::FemPostWarpVectorFilter ::init();
|
||||||
|
Fem::FemPostCutFilter ::init();
|
||||||
Fem::FemPostFunction ::init();
|
Fem::FemPostFunction ::init();
|
||||||
Fem::FemPostFunctionProvider ::init();
|
Fem::FemPostFunctionProvider ::init();
|
||||||
Fem::FemPostPlaneFunction ::init();
|
Fem::FemPostPlaneFunction ::init();
|
||||||
Fem::FemPostSphereFunction ::init();
|
Fem::FemPostSphereFunction ::init();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
>>>>>>> Add warp vector filter
|
>>>>>>> Add cut filter
|
||||||
|
|
|
@ -345,8 +345,8 @@ PROPERTY_SOURCE(Fem::FemPostWarpVectorFilter, Fem::FemPostFilter)
|
||||||
|
|
||||||
FemPostWarpVectorFilter::FemPostWarpVectorFilter(void): FemPostFilter() {
|
FemPostWarpVectorFilter::FemPostWarpVectorFilter(void): FemPostFilter() {
|
||||||
|
|
||||||
ADD_PROPERTY_TYPE(Factor, (0), "Warp", App::Prop_None, "The scalar value used to clip the selected field");
|
ADD_PROPERTY_TYPE(Factor, (0), "Warp", App::Prop_None, "The factor by which the vector is added to the node positions");
|
||||||
ADD_PROPERTY_TYPE(Vector, (long(0)), "Warp", App::Prop_None, "The field used to clip");
|
ADD_PROPERTY_TYPE(Vector, (long(0)), "Warp", App::Prop_None, "The field added to the node position");
|
||||||
|
|
||||||
polyDataSource = vtkGeometryFilter::New();
|
polyDataSource = vtkGeometryFilter::New();
|
||||||
|
|
||||||
|
@ -421,3 +421,37 @@ void FemPostWarpVectorFilter::onChanged(const Property* prop) {
|
||||||
|
|
||||||
Fem::FemPostFilter::onChanged(prop);
|
Fem::FemPostFilter::onChanged(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PROPERTY_SOURCE(Fem::FemPostCutFilter, Fem::FemPostFilter)
|
||||||
|
|
||||||
|
FemPostCutFilter::FemPostCutFilter(void) : FemPostFilter() {
|
||||||
|
|
||||||
|
ADD_PROPERTY_TYPE(Function, (0), "Cut", App::Prop_None, "The function object which defines the clip cut function");
|
||||||
|
|
||||||
|
polyDataSource = vtkGeometryFilter::New();
|
||||||
|
|
||||||
|
FilterPipeline clip;
|
||||||
|
m_cutter = vtkCutter::New();
|
||||||
|
clip.source = m_cutter;
|
||||||
|
clip.target = m_cutter;
|
||||||
|
clip.visualisation = m_cutter;
|
||||||
|
addFilterPipeline(clip, "cut");
|
||||||
|
setActiveFilterPipeline("cut");
|
||||||
|
}
|
||||||
|
|
||||||
|
FemPostCutFilter::~FemPostCutFilter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FemPostCutFilter::onChanged(const Property* prop) {
|
||||||
|
|
||||||
|
if(prop == &Function) {
|
||||||
|
|
||||||
|
if(Function.getValue() && Function.getValue()->isDerivedFrom(FemPostFunction::getClassTypeId())) {
|
||||||
|
m_cutter->SetCutFunction(static_cast<FemPostFunction*>(Function.getValue())->getImplicitFunction());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Fem::FemPostFilter::onChanged(prop);
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <vtkPassThrough.h>
|
#include <vtkPassThrough.h>
|
||||||
#include <vtkPlane.h>
|
#include <vtkPlane.h>
|
||||||
#include <vtkWarpVector.h>
|
#include <vtkWarpVector.h>
|
||||||
|
#include <vtkCutter.h>
|
||||||
|
|
||||||
namespace Fem
|
namespace Fem
|
||||||
{
|
{
|
||||||
|
@ -162,6 +163,27 @@ private:
|
||||||
App::Enumeration m_vectorFields;
|
App::Enumeration m_vectorFields;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AppFemExport FemPostCutFilter : public FemPostFilter {
|
||||||
|
|
||||||
|
PROPERTY_HEADER(Fem::FemPostCutFilter);
|
||||||
|
|
||||||
|
public:
|
||||||
|
FemPostCutFilter(void);
|
||||||
|
virtual ~FemPostCutFilter();
|
||||||
|
|
||||||
|
App::PropertyLink Function;
|
||||||
|
|
||||||
|
virtual const char* getViewProviderName(void) const {
|
||||||
|
return "FemGui::ViewProviderFemPostCut";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void onChanged(const App::Property* prop);
|
||||||
|
|
||||||
|
private:
|
||||||
|
vtkSmartPointer<vtkCutter> m_cutter;
|
||||||
|
};
|
||||||
|
|
||||||
} //namespace Fem
|
} //namespace Fem
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ PyMODINIT_FUNC initFemGui()
|
||||||
FemGui::ViewProviderFemPostClip ::init();
|
FemGui::ViewProviderFemPostClip ::init();
|
||||||
FemGui::ViewProviderFemPostScalarClip ::init();
|
FemGui::ViewProviderFemPostScalarClip ::init();
|
||||||
FemGui::ViewProviderFemPostWarpVector ::init();
|
FemGui::ViewProviderFemPostWarpVector ::init();
|
||||||
|
FemGui::ViewProviderFemPostCut ::init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ if(BUILD_FEM_VTK)
|
||||||
TaskPostClip.ui
|
TaskPostClip.ui
|
||||||
TaskPostScalarClip.ui
|
TaskPostScalarClip.ui
|
||||||
TaskPostWarpVector.ui
|
TaskPostWarpVector.ui
|
||||||
|
TaskPostCut.ui
|
||||||
PlaneWidget.ui
|
PlaneWidget.ui
|
||||||
SphereWidget.ui
|
SphereWidget.ui
|
||||||
)
|
)
|
||||||
|
@ -206,6 +207,7 @@ if(BUILD_FEM_VTK)
|
||||||
TaskPostScalarClip.ui
|
TaskPostScalarClip.ui
|
||||||
TaskPostDisplay.ui
|
TaskPostDisplay.ui
|
||||||
TaskPostWarpVector.ui
|
TaskPostWarpVector.ui
|
||||||
|
TaskPostCut.ui
|
||||||
TaskPostBoxes.h
|
TaskPostBoxes.h
|
||||||
TaskPostBoxes.cpp
|
TaskPostBoxes.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -767,6 +767,32 @@ bool CmdFemCreateNodesSet::isActive(void)
|
||||||
|
|
||||||
#ifdef FC_USE_VTK
|
#ifdef FC_USE_VTK
|
||||||
|
|
||||||
|
void setupFilter(Gui::Command* cmd, std::string Name) {
|
||||||
|
|
||||||
|
std::vector<Fem::FemPostPipeline*> pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||||
|
if (!pipelines.empty()) {
|
||||||
|
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||||
|
|
||||||
|
std::string FeatName = cmd->getUniqueObjectName(Name.c_str());
|
||||||
|
|
||||||
|
cmd->openCommand("Create filter");
|
||||||
|
cmd->doCommand(Gui::Command::Doc,"App.activeDocument().addObject('Fem::FemPost%sFilter','%s')", Name.c_str(), FeatName.c_str());
|
||||||
|
cmd->doCommand(Gui::Command::Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument());
|
||||||
|
cmd->doCommand(Gui::Command::Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
|
||||||
|
cmd->doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument());
|
||||||
|
cmd->doCommand(Gui::Command::Doc,"del __list__");
|
||||||
|
|
||||||
|
cmd->updateActive();
|
||||||
|
cmd->doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QMessageBox::warning(Gui::getMainWindow(),
|
||||||
|
qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"),
|
||||||
|
qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please."));
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
DEF_STD_CMD_A(CmdFemPostCreateClipFilter);
|
DEF_STD_CMD_A(CmdFemPostCreateClipFilter);
|
||||||
|
|
||||||
|
@ -784,28 +810,7 @@ CmdFemPostCreateClipFilter::CmdFemPostCreateClipFilter()
|
||||||
|
|
||||||
void CmdFemPostCreateClipFilter::activated(int iMsg)
|
void CmdFemPostCreateClipFilter::activated(int iMsg)
|
||||||
{
|
{
|
||||||
std::vector<Fem::FemPostPipeline*> pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
setupFilter(this, "Clip");
|
||||||
if (!pipelines.empty()) {
|
|
||||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
|
||||||
|
|
||||||
std::string FeatName = getUniqueObjectName("Clip");
|
|
||||||
|
|
||||||
openCommand("Create clip filter");
|
|
||||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostClipFilter','%s')",FeatName.c_str());
|
|
||||||
doCommand(Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument());
|
|
||||||
doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
|
|
||||||
doCommand(Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument());
|
|
||||||
doCommand(Doc,"del __list__");
|
|
||||||
|
|
||||||
this->updateActive();
|
|
||||||
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QMessageBox::warning(Gui::getMainWindow(),
|
|
||||||
qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"),
|
|
||||||
qApp->translate("CmdFemPostCreateClipFilter", "Select a pipeline, please."));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CmdFemPostCreateClipFilter::isActive(void)
|
bool CmdFemPostCreateClipFilter::isActive(void)
|
||||||
|
@ -829,27 +834,7 @@ CmdFemPostCreateScalarClipFilter::CmdFemPostCreateScalarClipFilter()
|
||||||
|
|
||||||
void CmdFemPostCreateScalarClipFilter::activated(int iMsg)
|
void CmdFemPostCreateScalarClipFilter::activated(int iMsg)
|
||||||
{
|
{
|
||||||
std::vector<Fem::FemPostPipeline*> pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
setupFilter(this, "ScalarClip");
|
||||||
if (!pipelines.empty()) {
|
|
||||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
|
||||||
|
|
||||||
std::string FeatName = getUniqueObjectName("ScalarClip");
|
|
||||||
|
|
||||||
openCommand("Create scalar clip filter");
|
|
||||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostScalarClipFilter','%s')",FeatName.c_str());
|
|
||||||
doCommand(Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument());
|
|
||||||
doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
|
|
||||||
doCommand(Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument());
|
|
||||||
doCommand(Doc,"del __list__");
|
|
||||||
|
|
||||||
this->updateActive();
|
|
||||||
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QMessageBox::warning(Gui::getMainWindow(),
|
|
||||||
qApp->translate("CmdFemPostCreateScalarClipFilter", "Wrong selection"),
|
|
||||||
qApp->translate("CmdFemPostCreateScalarClipFilter", "Select a pipeline, please."));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CmdFemPostCreateScalarClipFilter::isActive(void)
|
bool CmdFemPostCreateScalarClipFilter::isActive(void)
|
||||||
|
@ -875,27 +860,7 @@ CmdFemPostWarpVectorFilter::CmdFemPostWarpVectorFilter()
|
||||||
|
|
||||||
void CmdFemPostWarpVectorFilter::activated(int iMsg)
|
void CmdFemPostWarpVectorFilter::activated(int iMsg)
|
||||||
{
|
{
|
||||||
std::vector<Fem::FemPostPipeline*> pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
setupFilter(this, "WarpVector");
|
||||||
if (!pipelines.empty()) {
|
|
||||||
Fem::FemPostPipeline *pipeline = pipelines.front();
|
|
||||||
|
|
||||||
std::string FeatName = getUniqueObjectName("WarpVector");
|
|
||||||
|
|
||||||
openCommand("Create warp vector filter");
|
|
||||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostWarpVectorFilter','%s')",FeatName.c_str());
|
|
||||||
doCommand(Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument());
|
|
||||||
doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
|
|
||||||
doCommand(Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument());
|
|
||||||
doCommand(Doc,"del __list__");
|
|
||||||
|
|
||||||
this->updateActive();
|
|
||||||
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QMessageBox::warning(Gui::getMainWindow(),
|
|
||||||
qApp->translate("CmdFemPostCreateWarpVectorFilter", "Wrong selection"),
|
|
||||||
qApp->translate("CmdFemPostCreateWarpVectorFilter", "Select a pipeline, please."));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CmdFemPostWarpVectorFilter::isActive(void)
|
bool CmdFemPostWarpVectorFilter::isActive(void)
|
||||||
|
@ -903,6 +868,30 @@ bool CmdFemPostWarpVectorFilter::isActive(void)
|
||||||
return hasActiveDocument();
|
return hasActiveDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEF_STD_CMD_A(CmdFemPostCutFilter);
|
||||||
|
|
||||||
|
CmdFemPostCutFilter::CmdFemPostCutFilter()
|
||||||
|
: Command("Fem_PostCreateCutFilter")
|
||||||
|
{
|
||||||
|
sAppModule = "Fem";
|
||||||
|
sGroup = QT_TR_NOOP("Fem");
|
||||||
|
sMenuText = QT_TR_NOOP("Cut the data along an implicit function");
|
||||||
|
sToolTipText = QT_TR_NOOP("Cut the data along an implicit function");
|
||||||
|
sWhatsThis = "Fem_PostCreateCutFilter";
|
||||||
|
sStatusTip = sToolTipText;
|
||||||
|
sPixmap = "fem-fem-mesh-create-node-by-poly";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CmdFemPostCutFilter::activated(int iMsg)
|
||||||
|
{
|
||||||
|
setupFilter(this, "Cut");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CmdFemPostCutFilter::isActive(void)
|
||||||
|
{
|
||||||
|
return hasActiveDocument();
|
||||||
|
}
|
||||||
|
|
||||||
// #####################################################################################################
|
// #####################################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -958,7 +947,9 @@ void CmdFemPostFunctions::activated(int iMsg)
|
||||||
doCommand(Doc,"del __list__");
|
doCommand(Doc,"del __list__");
|
||||||
|
|
||||||
this->updateActive();
|
this->updateActive();
|
||||||
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
|
//most of the times functions are added inside of a filter, make sure this still works
|
||||||
|
if(Gui::Application::Instance->activeDocument()->getInEdit() == NULL)
|
||||||
|
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QMessageBox::warning(Gui::getMainWindow(),
|
QMessageBox::warning(Gui::getMainWindow(),
|
||||||
|
@ -1142,5 +1133,6 @@ void CreateFemCommands(void)
|
||||||
rcCmdMgr.addCommand(new CmdFemPostFunctions);
|
rcCmdMgr.addCommand(new CmdFemPostFunctions);
|
||||||
rcCmdMgr.addCommand(new CmdFemPostApllyChanges);
|
rcCmdMgr.addCommand(new CmdFemPostApllyChanges);
|
||||||
rcCmdMgr.addCommand(new CmdFemPostPipelineFromResult);
|
rcCmdMgr.addCommand(new CmdFemPostPipelineFromResult);
|
||||||
|
rcCmdMgr.addCommand(new CmdFemPostCutFilter);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,6 +30,7 @@
|
||||||
#include "ui_TaskPostClip.h"
|
#include "ui_TaskPostClip.h"
|
||||||
#include "ui_TaskPostScalarClip.h"
|
#include "ui_TaskPostScalarClip.h"
|
||||||
#include "ui_TaskPostWarpVector.h"
|
#include "ui_TaskPostWarpVector.h"
|
||||||
|
#include "ui_TaskPostCut.h"
|
||||||
#include "TaskPostBoxes.h"
|
#include "TaskPostBoxes.h"
|
||||||
#include "ViewProviderFemPostObject.h"
|
#include "ViewProviderFemPostObject.h"
|
||||||
#include "ViewProviderFemPostFunction.h"
|
#include "ViewProviderFemPostFunction.h"
|
||||||
|
@ -535,6 +536,107 @@ void TaskPostWarpVector::on_Min_valueChanged(double v) {
|
||||||
ui->Slider->blockSignals(false);
|
ui->Slider->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//############################################################################################
|
||||||
|
|
||||||
|
TaskPostCut::TaskPostCut(ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent)
|
||||||
|
: TaskPostBox(view,Gui::BitmapFactory().pixmap("fem-fem-mesh-create-node-by-poly"), tr("Choose implicit function"), parent) {
|
||||||
|
|
||||||
|
assert(view->isDerivedFrom(ViewProviderFemPostCut::getClassTypeId()));
|
||||||
|
assert(function);
|
||||||
|
|
||||||
|
fwidget = NULL;
|
||||||
|
|
||||||
|
//we load the views widget
|
||||||
|
proxy = new QWidget(this);
|
||||||
|
ui = new Ui_TaskPostCut();
|
||||||
|
ui->setupUi(proxy);
|
||||||
|
QMetaObject::connectSlotsByName(this);
|
||||||
|
this->groupLayout()->addWidget(proxy);
|
||||||
|
|
||||||
|
//the layout for the container widget
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
|
ui->Container->setLayout(layout);
|
||||||
|
|
||||||
|
//fill up the combo box with possible functions
|
||||||
|
collectImplicitFunctions();
|
||||||
|
|
||||||
|
//add the function creation command
|
||||||
|
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||||
|
rcCmdMgr.getCommandByName("Fem_PostCreateFunctions")->getAction()->addTo(ui->CreateButton);
|
||||||
|
ui->CreateButton->setPopupMode(QToolButton::InstantPopup);
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskPostCut::~TaskPostCut() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPostCut::applyPythonCode() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPostCut::collectImplicitFunctions() {
|
||||||
|
|
||||||
|
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||||
|
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||||
|
if (!pipelines.empty()) {
|
||||||
|
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||||
|
if(pipeline->Function.getValue() &&
|
||||||
|
pipeline->Function.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||||
|
|
||||||
|
ui->FunctionBox->clear();
|
||||||
|
QStringList items;
|
||||||
|
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||||
|
pipeline->Function.getValue())->Functions.getValues();
|
||||||
|
for(std::size_t i=0; i<funcs.size(); ++i)
|
||||||
|
items.push_back(QString::fromAscii(funcs[i]->getNameInDocument()));
|
||||||
|
|
||||||
|
ui->FunctionBox->addItems(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPostCut::on_CreateButton_triggered(QAction* a) {
|
||||||
|
|
||||||
|
collectImplicitFunctions();
|
||||||
|
recompute();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPostCut::on_FunctionBox_currentIndexChanged(int idx) {
|
||||||
|
|
||||||
|
//set the correct property
|
||||||
|
std::vector<Fem::FemPostPipeline*> pipelines;
|
||||||
|
pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
|
||||||
|
if (!pipelines.empty()) {
|
||||||
|
Fem::FemPostPipeline *pipeline = pipelines.front();
|
||||||
|
if(pipeline->Function.getValue() &&
|
||||||
|
pipeline->Function.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
|
||||||
|
|
||||||
|
const std::vector<App::DocumentObject*>& funcs = static_cast<Fem::FemPostFunctionProvider*>(
|
||||||
|
pipeline->Function.getValue())->Functions.getValues();
|
||||||
|
if(idx>=0)
|
||||||
|
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.setValue(funcs[idx]);
|
||||||
|
else
|
||||||
|
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.setValue(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//load the correct view
|
||||||
|
Fem::FemPostFunction* fobj = static_cast<Fem::FemPostFunction*>(
|
||||||
|
static_cast<Fem::FemPostCutFilter*>(getObject())->Function.getValue());
|
||||||
|
Gui::ViewProvider* view = NULL;
|
||||||
|
if(fobj)
|
||||||
|
view = Gui::Application::Instance->activeDocument()->getViewProvider(fobj);
|
||||||
|
|
||||||
|
if(fwidget)
|
||||||
|
fwidget->deleteLater();
|
||||||
|
|
||||||
|
if(view) {
|
||||||
|
fwidget = static_cast<FemGui::ViewProviderFemPostFunction*>(view)->createControlWidget();
|
||||||
|
fwidget->setParent(ui->Container);
|
||||||
|
fwidget->setViewProvider(static_cast<FemGui::ViewProviderFemPostFunction*>(view));
|
||||||
|
ui->Container->layout()->addWidget(fwidget);
|
||||||
|
}
|
||||||
|
recompute();
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_TaskPostBoxes.cpp"
|
#include "moc_TaskPostBoxes.cpp"
|
||||||
|
|
|
@ -36,6 +36,7 @@ class Ui_TaskPostDisplay;
|
||||||
class Ui_TaskPostClip;
|
class Ui_TaskPostClip;
|
||||||
class Ui_TaskPostScalarClip;
|
class Ui_TaskPostScalarClip;
|
||||||
class Ui_TaskPostWarpVector;
|
class Ui_TaskPostWarpVector;
|
||||||
|
class Ui_TaskPostCut;
|
||||||
|
|
||||||
|
|
||||||
namespace FemGui {
|
namespace FemGui {
|
||||||
|
@ -206,6 +207,31 @@ private:
|
||||||
Ui_TaskPostWarpVector* ui;
|
Ui_TaskPostWarpVector* ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TaskPostCut : public TaskPostBox {
|
||||||
|
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TaskPostCut(Gui::ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent = 0);
|
||||||
|
virtual ~TaskPostCut();
|
||||||
|
|
||||||
|
virtual void applyPythonCode();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void on_CreateButton_triggered(QAction* a);
|
||||||
|
void on_FunctionBox_currentIndexChanged(int idx);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void collectImplicitFunctions();
|
||||||
|
|
||||||
|
App::PropertyLink* m_functionProperty;
|
||||||
|
QWidget* proxy;
|
||||||
|
Ui_TaskPostCut* ui;
|
||||||
|
FunctionWidget* fwidget;
|
||||||
|
};
|
||||||
|
|
||||||
} //namespace FemGui
|
} //namespace FemGui
|
||||||
|
|
||||||
#endif // GUI_TASKVIEW_TaskPostDisplay_H
|
#endif // GUI_TASKVIEW_TaskPostDisplay_H
|
||||||
|
|
67
src/Mod/Fem/Gui/TaskPostCut.ui
Normal file
67
src/Mod/Fem/Gui/TaskPostCut.ui
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TaskPostCut</class>
|
||||||
|
<widget class="QWidget" name="TaskPostCut">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>404</width>
|
||||||
|
<height>98</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="FunctionBox"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="CreateButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../Gui/Icons/resource.qrc">
|
||||||
|
<normaloff>:/icons/list-add.svg</normaloff>:/icons/list-add.svg</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="Container" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Ignored" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../../Gui/Icons/resource.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
183
src/Mod/Fem/Gui/TaskPostWarpVector.ui
Normal file
183
src/Mod/Fem/Gui/TaskPostWarpVector.ui
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TaskPostWarpVector</class>
|
||||||
|
<widget class="QWidget" name="TaskPostWarpVector">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>295</width>
|
||||||
|
<height>156</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Vector</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="Vector">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Outline</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Surface</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Surface with Edges</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wireframe</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="Min">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="Slider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="invertedControls">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="tickPosition">
|
||||||
|
<enum>QSlider::NoTicks</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="Max">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="Value">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
<zorder>line</zorder>
|
||||||
|
<zorder></zorder>
|
||||||
|
<zorder></zorder>
|
||||||
|
<zorder>line_2</zorder>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -88,3 +88,24 @@ void ViewProviderFemPostWarpVector::setupTaskDialog(TaskDlgPost* dlg) {
|
||||||
//add the display options
|
//add the display options
|
||||||
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PROPERTY_SOURCE(FemGui::ViewProviderFemPostCut, FemGui::ViewProviderFemPostObject)
|
||||||
|
|
||||||
|
ViewProviderFemPostCut::ViewProviderFemPostCut() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewProviderFemPostCut::~ViewProviderFemPostCut() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewProviderFemPostCut::setupTaskDialog(TaskDlgPost* dlg) {
|
||||||
|
|
||||||
|
//add the function box
|
||||||
|
dlg->appendBox(new TaskPostCut(dlg->getView(),
|
||||||
|
&static_cast<Fem::FemPostCutFilter*>(dlg->getView()->getObject())->Function));
|
||||||
|
|
||||||
|
//add the display options
|
||||||
|
FemGui::ViewProviderFemPostObject::setupTaskDialog(dlg);
|
||||||
|
}
|
|
@ -68,6 +68,19 @@ protected:
|
||||||
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FemGuiExport ViewProviderFemPostCut : public ViewProviderFemPostObject {
|
||||||
|
|
||||||
|
PROPERTY_HEADER(FemGui::ViewProviderFemPostCut);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// constructor.
|
||||||
|
ViewProviderFemPostCut();
|
||||||
|
~ViewProviderFemPostCut();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void setupTaskDialog(TaskDlgPost* dlg);
|
||||||
|
};
|
||||||
|
|
||||||
} //namespace FemGui
|
} //namespace FemGui
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||||
<< "Separator"
|
<< "Separator"
|
||||||
<< "Fem_PostCreateClipFilter"
|
<< "Fem_PostCreateClipFilter"
|
||||||
<< "Fem_PostCreateScalarClipFilter"
|
<< "Fem_PostCreateScalarClipFilter"
|
||||||
|
<< "Fem_PostCreateCutFilter"
|
||||||
<< "Fem_PostCreateWarpVectorFilter"
|
<< "Fem_PostCreateWarpVectorFilter"
|
||||||
<< "Separator"
|
<< "Separator"
|
||||||
<< "Fem_PostCreateFunctions";
|
<< "Fem_PostCreateFunctions";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user