Fem: Apply clang-format

This commit is contained in:
wmayer
2023-09-25 12:54:22 +02:00
committed by wwmayer
parent 59c7653584
commit b8b94c249e
148 changed files with 6507 additions and 4651 deletions

View File

@@ -24,9 +24,9 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QAction>
# include <QMessageBox>
# include <sstream>
#include <QAction>
#include <QMessageBox>
#include <sstream>
#endif
#include <Base/Tools.h>
@@ -45,8 +45,8 @@ using namespace Gui;
TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring* ConstraintView,
QWidget* parent)
: TaskFemConstraintOnBoundary(ConstraintView, parent, "FEM_ConstraintSpring"),
ui(new Ui_TaskFemConstraintSpring)
: TaskFemConstraintOnBoundary(ConstraintView, parent, "FEM_ConstraintSpring")
, ui(new Ui_TaskFemConstraintSpring)
{
proxy = new QWidget(this);
ui->setupUi(proxy);
@@ -56,10 +56,14 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
createDeleteAction(ui->lw_references);
connect(deleteAction, &QAction::triggered, this, &TaskFemConstraintSpring::onReferenceDeleted);
connect(ui->lw_references, &QListWidget::currentItemChanged,
this, &TaskFemConstraintSpring::setSelection);
connect(ui->lw_references, &QListWidget::itemClicked,
this, &TaskFemConstraintSpring::setSelection);
connect(ui->lw_references,
&QListWidget::currentItemChanged,
this,
&TaskFemConstraintSpring::setSelection);
connect(ui->lw_references,
&QListWidget::itemClicked,
this,
&TaskFemConstraintSpring::setSelection);
this->groupLayout()->addWidget(proxy);
@@ -74,7 +78,7 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
// Fill data into dialog elements
ui->if_norm->setUnit(pcConstraint->NormalStiffness.getUnit());
ui->if_norm->setMinimum(
0);// TODO fix this -------------------------------------------------------------------
0); // TODO fix this -------------------------------------------------------------------
ui->if_norm->setMaximum(FLOAT_MAX);
Base::Quantity ns =
Base::Quantity((pcConstraint->NormalStiffness.getValue()), Base::Unit::Stiffness);
@@ -82,7 +86,7 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
ui->if_tan->setUnit(pcConstraint->TangentialStiffness.getUnit());
ui->if_tan->setMinimum(
0);// TODO fix this -------------------------------------------------------------------
0); // TODO fix this -------------------------------------------------------------------
ui->if_tan->setMaximum(FLOAT_MAX);
Base::Quantity ts =
Base::Quantity((pcConstraint->TangentialStiffness.getValue()), Base::Unit::Stiffness);
@@ -126,7 +130,7 @@ void TaskFemConstraintSpring::updateUI()
void TaskFemConstraintSpring::addToSelection()
{
std::vector<Gui::SelectionObject> selection =
Gui::Selection().getSelectionEx();// gets vector of selected objects of active document
Gui::Selection().getSelectionEx(); // gets vector of selected objects of active document
if (selection.empty()) {
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
return;
@@ -136,7 +140,7 @@ void TaskFemConstraintSpring::addToSelection()
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
for (auto & it : selection) {// for every selected object
for (auto& it : selection) { // for every selected object
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
return;
@@ -144,7 +148,7 @@ void TaskFemConstraintSpring::addToSelection()
const std::vector<std::string>& subNames = it.getSubNames();
App::DocumentObject* obj = it.getObject();
for (const auto & subName : subNames) {// for every selected sub element
for (const auto& subName : subNames) { // for every selected sub element
bool addMe = true;
if (subName.substr(0, 4) != "Face") {
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
@@ -155,13 +159,13 @@ void TaskFemConstraintSpring::addToSelection()
itr != SubElements.end();
itr = std::find(++itr,
SubElements.end(),
subName)) {// for every sub element in selection that
// matches one in old list
subName)) { // for every sub element in selection that
// matches one in old list
if (obj
== Objects[std::distance(
SubElements.begin(),
itr)]) {// if selected sub element's object equals the one in old list then
// it was added before so don't add
itr)]) { // if selected sub element's object equals the one in old list
// then it was added before so don't add
addMe = false;
}
}
@@ -181,7 +185,7 @@ void TaskFemConstraintSpring::addToSelection()
void TaskFemConstraintSpring::removeFromSelection()
{
std::vector<Gui::SelectionObject> selection =
Gui::Selection().getSelectionEx();// gets vector of selected objects of active document
Gui::Selection().getSelectionEx(); // gets vector of selected objects of active document
if (selection.empty()) {
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
return;
@@ -191,7 +195,7 @@ void TaskFemConstraintSpring::removeFromSelection()
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
std::vector<size_t> itemsToDel;
for (const auto & it : selection) {// for every selected object
for (const auto& it : selection) { // for every selected object
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
return;
@@ -199,19 +203,19 @@ void TaskFemConstraintSpring::removeFromSelection()
const std::vector<std::string>& subNames = it.getSubNames();
const App::DocumentObject* obj = it.getObject();
for (const auto & subName : subNames) {// for every selected sub element
for (const auto& subName : subNames) { // for every selected sub element
for (std::vector<std::string>::iterator itr =
std::find(SubElements.begin(), SubElements.end(), subName);
itr != SubElements.end();
itr = std::find(++itr,
SubElements.end(),
subName)) {// for every sub element in selection that
// matches one in old list
subName)) { // for every sub element in selection that
// matches one in old list
if (obj
== Objects[std::distance(
SubElements.begin(),
itr)]) {// if selected sub element's object equals the one in old list then
// it was added before so mark for deletion
itr)]) { // if selected sub element's object equals the one in old list
// then it was added before so mark for deletion
itemsToDel.push_back(std::distance(SubElements.begin(), itr));
}
}
@@ -235,7 +239,8 @@ void TaskFemConstraintSpring::removeFromSelection()
updateUI();
}
void TaskFemConstraintSpring::onReferenceDeleted() {
void TaskFemConstraintSpring::onReferenceDeleted()
{
TaskFemConstraintSpring::removeFromSelection();
}
@@ -270,15 +275,16 @@ bool TaskFemConstraintSpring::event(QEvent* e)
}
void TaskFemConstraintSpring::changeEvent(QEvent*)
{
}
{}
void TaskFemConstraintSpring::clearButtons(const SelectionChangeModes notThis)
{
if (notThis != SelectionChangeModes::refAdd)
if (notThis != SelectionChangeModes::refAdd) {
ui->btnAdd->setChecked(false);
if (notThis != SelectionChangeModes::refRemove)
}
if (notThis != SelectionChangeModes::refRemove) {
ui->btnRemove->setChecked(false);
}
}
//**************************************************************************
@@ -308,7 +314,7 @@ void TaskDlgFemConstraintSpring::open()
Gui::Command::Doc,
ViewProviderFemConstraint::gethideMeshShowPartStr(
(static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument())
.c_str());// OvG: Hide meshes and show parts
.c_str()); // OvG: Hide meshes and show parts
}
}
@@ -334,11 +340,11 @@ bool TaskDlgFemConstraintSpring::accept()
"App.ActiveDocument.%s.ElmerStiffness = '%s'",
name.c_str(),
parameterStiffness->getElmerStiffness().c_str());
std::string scale = parameterStiffness->getScale();// OvG: determine modified scale
std::string scale = parameterStiffness->getScale(); // OvG: determine modified scale
Gui::Command::doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Scale = %s",
name.c_str(),
scale.c_str());// OvG: implement modified scale
scale.c_str()); // OvG: implement modified scale
}
catch (const Base::Exception& e) {
QMessageBox::warning(parameter, tr("Input error"), QString::fromLatin1(e.what()));