From a67ee5648c1c954ccf94aac2e60f94cff22cb6e5 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 5 Nov 2018 10:53:01 +0100 Subject: [PATCH] remove trailing spaces --- src/Mod/Sketcher/App/Constraint.h | 8 +-- src/Mod/Sketcher/App/SketchObject.cpp | 54 ++++++++----------- src/Mod/Sketcher/App/SketchObject.h | 8 +-- src/Mod/Sketcher/App/SketchObjectPyImp.cpp | 3 +- .../Sketcher/Gui/TaskSketcherConstrains.cpp | 4 +- 5 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/Mod/Sketcher/App/Constraint.h b/src/Mod/Sketcher/App/Constraint.h index b74ba35811..d241ee1d0c 100644 --- a/src/Mod/Sketcher/App/Constraint.h +++ b/src/Mod/Sketcher/App/Constraint.h @@ -104,9 +104,11 @@ public: inline double getValue() const { return Value; } - - inline bool isDimensional() const { return Type == Distance || Type == DistanceX || Type == DistanceY || - Type == Radius || Type == Diameter || Type == Angle || Type == SnellsLaw;} + + inline bool isDimensional() const { + return Type == Distance || Type == DistanceX || Type == DistanceY || + Type == Radius || Type == Diameter || Type == Angle || Type == SnellsLaw; + } friend class PropertyConstraintList; diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 7fa8fdcfa5..d9f08f4408 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -385,7 +385,7 @@ int SketchObject::toggleDriving(int ConstrId) if (extorconstructionpoint1 && extorconstructionpoint2 && extorconstructionpoint3 && vals[ConstrId]->isDriving==false) return -4; - + // copy the list std::vector 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 &vals = this->Constraints.getValues(); - std::vector newVals(vals); - - std::vector< Constraint * > tbd; // list of dynamically allocated memory that need to be deleted; - - for(size_t i=0; i &vals = this->Constraints.getValues(); + std::vector newVals(vals); + + std::vector< Constraint * > tbd; // list of dynamically allocated memory that need to be deleted; + + for (size_t i=0; iclone(); 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()); } - - 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 &vals = this->Constraints.getValues(); - + std::vector copy(vals); std::vector 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; diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index 895b4c3d93..14788eb3b7 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -112,7 +112,7 @@ public: /// Copy the constraints instead of cloning them and copying the expressions if any int addCopyOfConstraints(const SketchObject &orig); /// add constraint - int addConstraint(const Constraint *constraint); + int addConstraint(const Constraint *constraint); /// delete constraint int delConstraint(int ConstrId); int delConstraints(std::vector ConstrIds, bool updategeometry=true); @@ -178,7 +178,7 @@ public: int getDriving(int ConstrId, bool &isdriving); /// toggle the driving status of this constraint int toggleDriving(int ConstrId); - + /// Make all dimensionals Driving/non-Driving int setDatumsDriving(bool isdriving); /// Move Dimensional constraints at the end of the properties array @@ -413,8 +413,8 @@ protected: \retval list - the supported geometry list */ std::vector supportedGeometry(const std::vector &geoList) const; - - + + // refactoring functions // check whether constraint may be changed driving status int testDrivingChange(int ConstrId, bool isdriving); diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 8fe06a8d4c..71a055c03c 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -730,7 +730,7 @@ PyObject* SketchObjectPy::setDriving(PyObject *args) PyObject* SketchObjectPy::setDatumsDriving(PyObject *args) { PyObject* driving; - + if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &driving)) return 0; @@ -746,7 +746,6 @@ PyObject* SketchObjectPy::setDatumsDriving(PyObject *args) PyObject* SketchObjectPy::moveDatumsToEnd(PyObject *args) { - if (!PyArg_ParseTuple(args, "")) return 0; diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp index 603ba57afc..c0d4183244 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp @@ -317,10 +317,10 @@ public: } return false; } - + bool isDimensional() const { assert(ConstraintNbr >= 0 && ConstraintNbr < sketch->Constraints.getSize()); - + return (sketch->Constraints[ConstraintNbr])->isDimensional(); }