diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.cpp b/src/Mod/Fem/Gui/TaskFemConstraint.cpp index 4254d14ba5..0e85d3a5f1 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraint.cpp @@ -135,6 +135,24 @@ const std::string TaskFemConstraint::getScale() const //OvG: Return pre-calculat return result; } +void TaskFemConstraint::setSelection(QListWidgetItem* item) { + std::string s = item->text().toStdString(); + std::string docName = ConstraintView->getObject()->getDocument()->getName(); + + std::string delimiter = ":"; + + size_t pos = 0; + std::string objName; + std::string subName; + pos = s.find(delimiter); + objName = s.substr(0, pos); + s.erase(0, pos + delimiter.length()); + subName = s; + + Gui::Selection().clearSelection(); + Gui::Selection().addSelection(docName.c_str(), objName.c_str(), subName.c_str(), 0, 0, 0); +} + void TaskFemConstraint::onReferenceDeleted(const int row) { Fem::Constraint* pcConstraint = static_cast(ConstraintView->getObject()); std::vector Objects = pcConstraint->References.getValues(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.h b/src/Mod/Fem/Gui/TaskFemConstraint.h index f761e2e59b..c3b29ded24 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.h +++ b/src/Mod/Fem/Gui/TaskFemConstraint.h @@ -33,6 +33,7 @@ class QAction; class QListWidget; +class QListWidgetItem; namespace FemGui { @@ -51,6 +52,7 @@ public: protected Q_SLOTS: void onReferenceDeleted(const int row); void onButtonReference(const bool pressed = true); + void setSelection(QListWidgetItem* item); // Shaft Wizard integration void onButtonWizOk(); void onButtonWizCancel(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp index 9bfbac6908..09b365625a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp @@ -524,24 +524,6 @@ void TaskFemConstraintDisplacement::removeFromSelection() updateUI(); } -void TaskFemConstraintDisplacement::setSelection(QListWidgetItem* item){ - std::string s = item->text().toStdString(); - std::string docName=ConstraintView->getObject()->getDocument()->getName(); - - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName=s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0); -} - void TaskFemConstraintDisplacement::onReferenceDeleted() { TaskFemConstraintDisplacement::removeFromSelection(); //OvG: On right-click face is automatically selected, so just remove } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h index 6794ca9d88..6ced3f52c8 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h @@ -39,7 +39,6 @@ #include #include #include -#include class Ui_TaskFemConstraintDisplacement; @@ -94,7 +93,6 @@ private Q_SLOTS: void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp index 3953f5c7ff..eb9ea92bf3 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp @@ -230,24 +230,6 @@ void TaskFemConstraintFixed::removeFromSelection() updateUI(); } -void TaskFemConstraintFixed::setSelection(QListWidgetItem* item){ - std::string docName=ConstraintView->getObject()->getDocument()->getName(); - - std::string s = item->text().toStdString(); - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName=s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0); -} - void TaskFemConstraintFixed::onReferenceDeleted() { TaskFemConstraintFixed::removeFromSelection(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.h b/src/Mod/Fem/Gui/TaskFemConstraintFixed.h index 705e20cc6a..1660de7403 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.h @@ -36,7 +36,6 @@ #include #include #include -#include class Ui_TaskFemConstraintFixed; @@ -52,10 +51,8 @@ public: private Q_SLOTS: void onReferenceDeleted(void); - void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp index ed2ef47bbf..dbac0057ff 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp @@ -845,24 +845,6 @@ void TaskFemConstraintFluidBoundary::removeFromSelection() updateUI(); } -void TaskFemConstraintFluidBoundary::setSelection(QListWidgetItem* item) { - std::string s = item->text().toStdString(); - std::string docName = ConstraintView->getObject()->getDocument()->getName(); - - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName = s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(), objName.c_str(), subName.c_str(), 0, 0, 0); -} - void TaskFemConstraintFluidBoundary::updateUI() { if (ui->listReferences->model()->rowCount() == 0) { diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h index 7eb569decc..88928454b4 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.h @@ -34,7 +34,6 @@ #include "ViewProviderFemConstraintFluidBoundary.h" #include -#include class Ui_TaskFemConstraintFluidBoundary; @@ -89,7 +88,6 @@ private Q_SLOTS: void onCheckReverse(bool); // consider removing this slot as the UI is hidden void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp index 514a19e155..449ed8e202 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp @@ -257,25 +257,6 @@ void TaskFemConstraintForce::removeFromSelection() pcConstraint->References.setValues(Objects, SubElements); updateUI(); } - -void TaskFemConstraintForce::setSelection(QListWidgetItem* item) { - std::string s = item->text().toStdString(); - std::string docName = ConstraintView->getObject()->getDocument()->getName(); - - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName = s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(), objName.c_str(), subName.c_str(), 0, 0, 0); -} - void TaskFemConstraintForce::onForceChanged(double f) { Fem::ConstraintForce* pcConstraint = static_cast(ConstraintView->getObject()); @@ -324,10 +305,6 @@ void TaskFemConstraintForce::onButtonDirection(const bool pressed) Part::Feature* feat = static_cast(obj); TopoDS_Shape ref = feat->Shape.getShape().getSubShape(subNamesElement.c_str()); - if (TypeName.substr(0, 4).compare(std::string("Part")) != 0) { - QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!")); - return; - } if (subNamesElement.substr(0, 4) == "Face") { if (!Fem::Tools::isPlanar(TopoDS::Face(ref))) { QMessageBox::warning(this, tr("Selection error"), tr("Only planar faces can be picked for 3D")); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.h b/src/Mod/Fem/Gui/TaskFemConstraintForce.h index d255b0dd91..9ef4fa2d90 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.h @@ -33,7 +33,6 @@ #include "ViewProviderFemConstraintForce.h" #include -#include class Ui_TaskFemConstraintForce; @@ -67,7 +66,6 @@ private Q_SLOTS: void onCheckReverse(bool); void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp index 5ba853e8c8..de67cf104e 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp @@ -331,25 +331,6 @@ void TaskFemConstraintHeatflux::removeFromSelection() updateUI(); } - -void TaskFemConstraintHeatflux::setSelection(QListWidgetItem* item){ - std::string docName=ConstraintView->getObject()->getDocument()->getName(); - - std::string s = item->text().toStdString(); - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName=s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0); -} - void TaskFemConstraintHeatflux::onReferenceDeleted() { TaskFemConstraintHeatflux::removeFromSelection(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h index 2cf62cf802..272528b5a8 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.h @@ -39,7 +39,6 @@ #include #include #include -#include class Ui_TaskFemConstraintHeatflux; @@ -67,7 +66,6 @@ private Q_SLOTS: void Flux(); void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp index 0dd5eb8a1b..be99decf3a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp @@ -253,24 +253,6 @@ void TaskFemConstraintPlaneRotation::removeFromSelection() updateUI(); } -void TaskFemConstraintPlaneRotation::setSelection(QListWidgetItem* item){ - std::string docName=ConstraintView->getObject()->getDocument()->getName(); - - std::string s = item->text().toStdString(); - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName=s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0); -} - void TaskFemConstraintPlaneRotation::onReferenceDeleted() { TaskFemConstraintPlaneRotation::removeFromSelection(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h index 106df6a511..0c1eed4747 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.h @@ -39,7 +39,6 @@ #include #include #include -#include class Ui_TaskFemConstraintPlaneRotation; @@ -55,10 +54,8 @@ public: private Q_SLOTS: void onReferenceDeleted(void); - void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index 9232d47bef..08fba7f101 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -47,9 +47,6 @@ #include "ui_TaskFemConstraintPressure.h" #include #include - - - #include #include @@ -238,24 +235,6 @@ void TaskFemConstraintPressure::removeFromSelection() updateUI(); } -void TaskFemConstraintPressure::setSelection(QListWidgetItem* item){ - std::string docName=ConstraintView->getObject()->getDocument()->getName(); - - std::string s = item->text().toStdString(); - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName=s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0); -} - void TaskFemConstraintPressure::onReferenceDeleted() { TaskFemConstraintPressure::removeFromSelection(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.h b/src/Mod/Fem/Gui/TaskFemConstraintPressure.h index 0793ca74c4..0fb3efee63 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.h @@ -39,7 +39,6 @@ #include #include #include -#include class Ui_TaskFemConstraintPressure; @@ -57,11 +56,9 @@ public: private Q_SLOTS: void onReferenceDeleted(void); - void onCheckReverse(bool); void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp index 03bd21cbad..730689558a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp @@ -274,24 +274,6 @@ void TaskFemConstraintTemperature::removeFromSelection() updateUI(); } -void TaskFemConstraintTemperature::setSelection(QListWidgetItem* item){ - std::string docName=ConstraintView->getObject()->getDocument()->getName(); - - std::string s = item->text().toStdString(); - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName=s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0); -} - void TaskFemConstraintTemperature::onReferenceDeleted() { TaskFemConstraintTemperature::removeFromSelection(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h index 14cd10dc90..17b1d3b4fc 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h @@ -39,7 +39,6 @@ #include #include #include -#include class Ui_TaskFemConstraintTemperature; @@ -63,7 +62,6 @@ private Q_SLOTS: void Flux(); void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); protected: bool event(QEvent *e); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp index ad25e0ba83..e8afeabb27 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp @@ -49,13 +49,12 @@ #include "TaskFemConstraintTransform.h" #include "ui_TaskFemConstraintTransform.h" #include -#include #include -#include -#include - +#include #include #include +#include +#include #include #define PI (3.141592653589793238462643383279502884L) @@ -408,24 +407,6 @@ void TaskFemConstraintTransform::removeFromSelection() ui->sp_Z->setValue(0); } -void TaskFemConstraintTransform::setSelection(QListWidgetItem* item){ - std::string docName=ConstraintView->getObject()->getDocument()->getName(); - - std::string s = item->text().toStdString(); - std::string delimiter = ":"; - - size_t pos = 0; - std::string objName; - std::string subName; - pos = s.find(delimiter); - objName = s.substr(0, pos); - s.erase(0, pos + delimiter.length()); - subName=s; - - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(docName.c_str(),objName.c_str(),subName.c_str(),0,0,0); -} - const std::string TaskFemConstraintTransform::getReferences() const { std::vector items; diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.h b/src/Mod/Fem/Gui/TaskFemConstraintTransform.h index 31d0340e91..9cb395b087 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.h @@ -39,7 +39,6 @@ #include #include #include -#include class Ui_TaskFemConstraintTransform; @@ -64,7 +63,6 @@ private Q_SLOTS: void Cyl(); void addToSelection(); void removeFromSelection(); - void setSelection(QListWidgetItem* item); void x_Changed(int x); void y_Changed(int y); void z_Changed(int z);