remove trailing spaces

This commit is contained in:
wmayer
2018-11-05 10:53:01 +01:00
parent 0e9334aec2
commit a67ee5648c
5 changed files with 35 additions and 42 deletions

View File

@@ -385,7 +385,7 @@ int SketchObject::toggleDriving(int ConstrId)
if (extorconstructionpoint1 && extorconstructionpoint2 && extorconstructionpoint3 && vals[ConstrId]->isDriving==false)
return -4;
// copy the list
std::vector<Constraint *> newVals(vals);
// clone the changed Constraint
@@ -409,14 +409,13 @@ int SketchObject::testDrivingChange(int ConstrId, bool isdriving)
if (ConstrId < 0 || ConstrId >= int(vals.size()))
return -1;
if (!vals[ConstrId]->isDimensional())
return -2;
if (!(vals[ConstrId]->First>=0 || vals[ConstrId]->Second>=0 || vals[ConstrId]->Third>=0) && isdriving==true)
return -3; // a constraint that does not have at least one element as not-external-geometry can never be driving.
return 0;
}
@@ -424,36 +423,31 @@ int SketchObject::testDrivingChange(int ConstrId, bool isdriving)
/// Make all dimensionals Driving/non-Driving
int SketchObject::setDatumsDriving(bool isdriving)
{
const std::vector<Constraint *> &vals = this->Constraints.getValues();
std::vector<Constraint *> newVals(vals);
std::vector< Constraint * > tbd; // list of dynamically allocated memory that need to be deleted;
for(size_t i=0; i<newVals.size(); i++) {
if(!testDrivingChange(i, isdriving)) {
const std::vector<Constraint *> &vals = this->Constraints.getValues();
std::vector<Constraint *> newVals(vals);
std::vector< Constraint * > tbd; // list of dynamically allocated memory that need to be deleted;
for (size_t i=0; i<newVals.size(); i++) {
if (!testDrivingChange(i, isdriving)) {
Constraint *constNew = newVals[i]->clone();
constNew->isDriving = isdriving;
newVals[i] = constNew;
tbd.push_back(constNew);
}
}
}
this->Constraints.setValues(newVals);
for(size_t i = 0; i < newVals.size(); i++) {
for (size_t i = 0; i < newVals.size(); i++) {
if (!isdriving && newVals[i]->isDimensional())
setExpression(Constraints.createPath(i), boost::shared_ptr<App::Expression>());
}
for(auto &t : tbd)
delete t;
if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
for (auto &t : tbd)
delete t;
if (noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();
return 0;
@@ -462,33 +456,31 @@ int SketchObject::setDatumsDriving(bool isdriving)
int SketchObject::moveDatumsToEnd(void)
{
const std::vector<Constraint *> &vals = this->Constraints.getValues();
std::vector<Constraint *> copy(vals);
std::vector<Constraint *> newVals(vals.size());
int addindex= copy.size()-1;
// add the dimensionals at the end
for(int i= copy.size()-1 ; i >= 0; i--) {
for (int i= copy.size()-1 ; i >= 0; i--) {
if(copy[i]->isDimensional()) {
newVals[addindex] = copy[i];
addindex--;
}
}
// add the non-dimensionals
for(int i = copy.size()-1; i >= 0; i--) {
for (int i = copy.size()-1; i >= 0; i--) {
if(!copy[i]->isDimensional()) {
newVals[addindex] = copy[i];
addindex--;
}
}
this->Constraints.setValues(newVals);
if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
if (noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
solve();
return 0;