From b863d1df75079fec31a9f9966f9660d06d10ebf4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 22 Jan 2018 20:06:12 +0100 Subject: [PATCH] improve whitespaces --- src/Mod/PartDesign/App/Body.cpp | 3 +- src/Mod/PartDesign/App/Body.h | 4 +- src/Mod/PartDesign/App/FeatureTransformed.cpp | 116 ++++++++---------- 3 files changed, 57 insertions(+), 66 deletions(-) diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index 9bde93a67a..f88110e78a 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -330,7 +330,6 @@ void Body::insertObject(App::DocumentObject* feature, App::DocumentObject* targe // Set the BaseFeature property setBaseProperty(feature); - } void Body::setBaseProperty(App::DocumentObject* feature) @@ -340,7 +339,7 @@ void Body::setBaseProperty(App::DocumentObject* feature) App::DocumentObject* prevSolidFeature = getPrevSolidFeature(feature); // NULL is ok here, it just means we made the current one fiature the base solid static_cast(feature)->BaseFeature.setValue(prevSolidFeature); - + // Reroute the next solid feature's BaseFeature property to this feature App::DocumentObject* nextSolidFeature = getNextSolidFeature(feature); if (nextSolidFeature) { diff --git a/src/Mod/PartDesign/App/Body.h b/src/Mod/PartDesign/App/Body.h index aec97be57f..b91148b453 100644 --- a/src/Mod/PartDesign/App/Body.h +++ b/src/Mod/PartDesign/App/Body.h @@ -85,7 +85,7 @@ public: void insertObject(App::DocumentObject* feature, App::DocumentObject* target, bool after=false); void setBaseProperty(App::DocumentObject* feature); - + /// Remove the feature from the body virtual std::vector removeObject(DocumentObject* obj) override; @@ -110,7 +110,7 @@ public: * all features derived from PartDesign::Feature and Part::Datum and sketches */ static bool isAllowed(const App::DocumentObject* f); - virtual bool allowObject(DocumentObject* f) override {return isAllowed(f);}; + virtual bool allowObject(DocumentObject* f) override {return isAllowed(f);} /** * Return the body which this feature belongs too, or NULL diff --git a/src/Mod/PartDesign/App/FeatureTransformed.cpp b/src/Mod/PartDesign/App/FeatureTransformed.cpp index c3ff4dcd04..b4ce20879c 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.cpp +++ b/src/Mod/PartDesign/App/FeatureTransformed.cpp @@ -201,16 +201,13 @@ App::DocumentObjectExecReturn *Transformed::execute(void) rejected.clear(); std::vector originals = Originals.getValues(); - if (originals.empty()) {// typically InsideMultiTransform + if (originals.empty()) // typically InsideMultiTransform return App::DocumentObject::StdReturn; - } - else { - if(!this->BaseFeature.getValue()) { - auto body = getFeatureBody(); - if(body) { - body->setBaseProperty(this); - } + if(!this->BaseFeature.getValue()) { + auto body = getFeatureBody(); + if(body) { + body->setBaseProperty(this); } } @@ -409,61 +406,56 @@ TopoDS_Shape Transformed::refineShapeIfActive(const TopoDS_Shape& oldShape) cons void Transformed::divideTools(const std::vector &toolsIn, std::vector &individualsOut, TopoDS_Compound &compoundOut) const { - typedef std::pair ShapeBoundPair; - typedef std::list PairList; - typedef std::vector PairVector; - - PairList pairList; - - std::vector::const_iterator it; - for (it = toolsIn.begin(); it != toolsIn.end(); ++it) - { - Bnd_Box bound; - BRepBndLib::Add(*it, bound); - bound.SetGap(0.0); - ShapeBoundPair temp = std::make_pair(*it, bound); - pairList.push_back(temp); - } - - BRep_Builder builder; - builder.MakeCompound(compoundOut); - - while(!pairList.empty()) - { - PairVector currentGroup; - currentGroup.push_back(pairList.front()); - pairList.pop_front(); - PairList::iterator it = pairList.begin(); - while(it != pairList.end()) - { - PairVector::const_iterator groupIt; - bool found(false); - for (groupIt = currentGroup.begin(); groupIt != currentGroup.end(); ++groupIt) - { - if (!(*it).second.IsOut((*groupIt).second))//touching means is out. - { - found = true; - break; - } - } - if (found) - { - currentGroup.push_back(*it); - pairList.erase(it); - it=pairList.begin(); - continue; - } - it++; + typedef std::pair ShapeBoundPair; + typedef std::list PairList; + typedef std::vector PairVector; + + PairList pairList; + + std::vector::const_iterator it; + for (it = toolsIn.begin(); it != toolsIn.end(); ++it) { + Bnd_Box bound; + BRepBndLib::Add(*it, bound); + bound.SetGap(0.0); + ShapeBoundPair temp = std::make_pair(*it, bound); + pairList.push_back(temp); } - if (currentGroup.size() == 1) - builder.Add(compoundOut, currentGroup.front().first); - else - { - PairVector::const_iterator groupIt; - for (groupIt = currentGroup.begin(); groupIt != currentGroup.end(); ++groupIt) - individualsOut.push_back((*groupIt).first); + + BRep_Builder builder; + builder.MakeCompound(compoundOut); + + while(!pairList.empty()) { + PairVector currentGroup; + currentGroup.push_back(pairList.front()); + pairList.pop_front(); + PairList::iterator it = pairList.begin(); + while(it != pairList.end()) { + PairVector::const_iterator groupIt; + bool found(false); + for (groupIt = currentGroup.begin(); groupIt != currentGroup.end(); ++groupIt) { + if (!(*it).second.IsOut((*groupIt).second)) {//touching means is out. + found = true; + break; + } + } + if (found) { + currentGroup.push_back(*it); + pairList.erase(it); + it=pairList.begin(); + continue; + } + ++it; + } + + if (currentGroup.size() == 1) { + builder.Add(compoundOut, currentGroup.front().first); + } + else { + PairVector::const_iterator groupIt; + for (groupIt = currentGroup.begin(); groupIt != currentGroup.end(); ++groupIt) + individualsOut.push_back((*groupIt).first); + } } - } } - + }