FEM: code formating: remove trailing white spaces

This commit is contained in:
Bernd Hahnebach
2016-08-01 21:58:37 +01:00
committed by wmayer
parent 175649a3bf
commit 55d2884658
55 changed files with 782 additions and 782 deletions

View File

@@ -77,21 +77,21 @@ TaskFemConstraintPlaneRotation::TaskFemConstraintPlaneRotation(ViewProviderFemCo
action->connect(action, SIGNAL(triggered()), this, SLOT(onReferenceDeleted()));
ui->lw_references->addAction(action);
ui->lw_references->setContextMenuPolicy(Qt::ActionsContextMenu);
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(setSelection(QListWidgetItem*)));
this->groupLayout()->addWidget(proxy);
/* Note: */
// Get the feature data
Fem::ConstraintPlaneRotation* pcConstraint = static_cast<Fem::ConstraintPlaneRotation*>(ConstraintView->getObject());
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
// Fill data into dialog elements
ui->lw_references->clear();
for (std::size_t i = 0; i < Objects.size(); i++) {
ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i]));
@@ -99,7 +99,7 @@ TaskFemConstraintPlaneRotation::TaskFemConstraintPlaneRotation(ViewProviderFemCo
if (Objects.size() > 0) {
ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect);
}
//Selection buttons
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
@@ -123,33 +123,33 @@ void TaskFemConstraintPlaneRotation::updateUI()
void TaskFemConstraintPlaneRotation::addToSelection()
{
int rows = ui->lw_references->model()->rowCount();
int rows = ui->lw_references->model()->rowCount();
if (rows==1){
QMessageBox::warning(this, tr("Selection error"), tr("Only one face can be selected for a plane rotation constraint!"));
Gui::Selection().clearSelection();
return;
}
else {
return;
}
else {
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document
if (selection.size()==0){
QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!"));
return;
}
}
Fem::ConstraintPlaneRotation* pcConstraint = static_cast<Fem::ConstraintPlaneRotation*>(ConstraintView->getObject());
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object
if (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
return;
}
std::vector<std::string> subNames=it->getSubNames();
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
if (subNames.size()==1){
if (subNames.size()==1){
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
bool addMe=true;
if ((subNames[subIt].substr(0,4) != "Face")) {
@@ -187,7 +187,7 @@ void TaskFemConstraintPlaneRotation::addToSelection()
QMessageBox::warning(this, tr("Selection error"), tr("Only one face can be selected for a plane rotation constraint!"));
Gui::Selection().clearSelection();
return;
}
}
//Update UI
pcConstraint->References.setValues(Objects,SubElements);
updateUI();
@@ -212,10 +212,10 @@ void TaskFemConstraintPlaneRotation::removeFromSelection()
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
return;
}
std::vector<std::string> subNames=it->getSubNames();
App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element
for (std::vector<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
itr!= SubElements.end();
@@ -227,7 +227,7 @@ void TaskFemConstraintPlaneRotation::removeFromSelection()
}
}
}
std::sort(itemsToDel.begin(),itemsToDel.end());
while (itemsToDel.size()>0){
Objects.erase(Objects.begin()+itemsToDel.back());
@@ -237,21 +237,21 @@ void TaskFemConstraintPlaneRotation::removeFromSelection()
//Update UI
disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(setSelection(QListWidgetItem*)));
ui->lw_references->clear();
for (unsigned int j=0;j<Objects.size();j++){
ui->lw_references->addItem(makeRefText(Objects[j], SubElements[j]));
}
connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(setSelection(QListWidgetItem*)));
pcConstraint->References.setValues(Objects,SubElements);
updateUI();
}
void TaskFemConstraintPlaneRotation::setSelection(QListWidgetItem* item){
std::string docName=ConstraintView->getObject()->getDocument()->getName();
std::string s = item->text().toStdString();
std::string delimiter = ":";
@@ -262,7 +262,7 @@ void TaskFemConstraintPlaneRotation::setSelection(QListWidgetItem* item){
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);
}
@@ -314,7 +314,7 @@ void TaskDlgFemConstraintPlaneRotation::open()
bool TaskDlgFemConstraintPlaneRotation::accept()
{
std::string name = ConstraintView->getObject()->getNameInDocument();
const TaskFemConstraintPlaneRotation* parameters = static_cast<const TaskFemConstraintPlaneRotation*>(parameter);
const TaskFemConstraintPlaneRotation* parameters = static_cast<const TaskFemConstraintPlaneRotation*>(parameter);
std::string scale = parameters->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
return TaskDlgFemConstraint::accept();