Skip to content

Commit

Permalink
Path: PR6497 move return statement to new line
Browse files Browse the repository at this point in the history
  • Loading branch information
chennes committed Mar 29, 2022
1 parent 6f230d7 commit 5f31fb7
Show file tree
Hide file tree
Showing 18 changed files with 411 additions and 204 deletions.
45 changes: 31 additions & 14 deletions src/Mod/Path/App/Area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,10 @@ static bool getShapePlane(const TopoDS_Shape &shape, gp_Pln &pln) {
}

bool Area::isCoplanar(const TopoDS_Shape &s1, const TopoDS_Shape &s2) {
if(s1.IsNull() || s2.IsNull()) return false;
if(s1.IsSame(s2)) return true;
if(s1.IsNull() || s2.IsNull())
return false;
if(s1.IsSame(s2))
return true;
gp_Pln pln1,pln2;
if(!getShapePlane(s1,pln1) || !getShapePlane(s2,pln2))
return false;
Expand All @@ -290,7 +292,8 @@ int Area::addShape(CArea &area, const TopoDS_Shape &shape, const gp_Trsf *trsf,
addWire(area,TopoDS::Wire(it.Current()),trsf,deflection);
}

if(haveShape) return skipped;
if(haveShape)
return skipped;

CArea _area;
CArea _areaOpen;
Expand Down Expand Up @@ -1052,7 +1055,8 @@ void Area::explode(const TopoDS_Shape &shape) {
TopoDS::Edge(xp.Current())).Wire(),&myTrsf,myParams.Deflection,true);
}
}
if(haveShape) return;
if(haveShape)
return;
for(TopExp_Explorer it(shape, TopAbs_EDGE); it.More(); it.Next()) {
if(myParams.Coplanar!=CoplanarNone && !isCoplanar(it.Current(),plane)){
++mySkippedShapes;
Expand Down Expand Up @@ -1616,7 +1620,8 @@ std::list<Area::Shape> Area::getProjectedShapes(const gp_Trsf &trsf, bool invers
}

void Area::build() {
if(isBuilt()) return;
if(isBuilt())
return;

if(myShapes.empty())
throw Base::ValueError("no shape added");
Expand Down Expand Up @@ -1773,9 +1778,11 @@ TopoDS_Shape Area::getShape(int index) {
build();
AREA_SECTION(getShape,index);

if(myShapeDone) return myShape;
if(myShapeDone)
return myShape;

if(!myArea) return TopoDS_Shape();
if(!myArea)
return TopoDS_Shape();

CAreaConfig conf(myParams);

Expand Down Expand Up @@ -2270,7 +2277,8 @@ TopoDS_Shape Area::toShape(const CArea &area, bool fill, const gp_Trsf *trsf, in
builder.Add(compound,wire);
}
TopExp_Explorer xp(compound,TopAbs_EDGE);
if(!xp.More()) return TopoDS_Shape();
if(!xp.More())
return TopoDS_Shape();
if(fill) {
try{
FC_TIME_INIT(t);
Expand Down Expand Up @@ -2750,7 +2758,8 @@ struct ShapeInfoBuilder {

if(type == TopAbs_EDGE) {
BRepAdaptor_Curve curve(TopoDS::Edge(shape));
if(curve.GetType()!=GeomAbs_Circle) return;
if(curve.GetType()!=GeomAbs_Circle)
return;
}else{
bool found = false;
for(TopExp_Explorer it(shape,TopAbs_EDGE);it.More();it.Next()) {
Expand All @@ -2760,7 +2769,8 @@ struct ShapeInfoBuilder {
break;
}
}
if(!found) return;
if(!found)
return;
}
gp_Ax3 pos = myList.back().myPln.Position();
if(!pos.Direct()) pos = gp_Ax3(pos.Ax2());
Expand Down Expand Up @@ -2788,15 +2798,21 @@ struct ShapeInfoBuilder {
myArcPlaneFound = true;
return;
}case Area::ArcPlaneXY:
if(x0&&y0) {myArcPlaneFound=true;return;}
if(x0&&y0) {myArcPlaneFound=true;
return;
}
dstPos = gp_Ax3(pos.Location(),gp_Dir(0,0,1));
break;
case Area::ArcPlaneZX:
if(x0&&z0) {myArcPlaneFound=true;return;}
if(x0&&z0) {myArcPlaneFound=true;
return;
}
dstPos = gp_Ax3(pos.Location(),gp_Dir(0,1,0));
break;
case Area::ArcPlaneYZ:
if(z0&&y0) {myArcPlaneFound=true;return;}
if(z0&&y0) {myArcPlaneFound=true;
return;
}
dstPos = gp_Ax3(pos.Location(),gp_Dir(1,0,0));
break;
default:
Expand Down Expand Up @@ -2873,7 +2889,8 @@ std::list<TopoDS_Shape> Area::sortWires(const std::list<TopoDS_Shape> &shapes,
{
std::list<TopoDS_Shape> wires;

if(shapes.empty()) return wires;
if(shapes.empty())
return wires;

AxisGetter getter;
AxisSetter setter;
Expand Down
6 changes: 4 additions & 2 deletions src/Mod/Path/App/FeatureArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ FeatureAreaView::FeatureAreaView()
std::list<TopoDS_Shape> FeatureAreaView::getShapes() {
std::list<TopoDS_Shape> shapes;
App::DocumentObject* pObj = Source.getValue();
if (!pObj) return shapes;
if (!pObj)
return shapes;
if(!pObj->isDerivedFrom(FeatureArea::getClassTypeId()))
return shapes;

Expand All @@ -186,7 +187,8 @@ std::list<TopoDS_Shape> FeatureAreaView::getShapes() {
int index=SectionIndex.getValue(),count=SectionCount.getValue();
if(index<0) {
index += ((int)all_shapes.size());
if(index<0) return shapes;
if(index<0)
return shapes;
if(count<=0 || index+1-count<0) {
count = index+1;
index = 0;
Expand Down
6 changes: 4 additions & 2 deletions src/Mod/Path/Gui/ViewProviderPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ SoDetail* ViewProviderPath::getDetail(const char* subelement) const

void ViewProviderPath::onChanged(const App::Property* prop)
{
if(blockPropertyChange) return;
if(blockPropertyChange)
return;

if (prop == &LineWidth) {
pcDrawStyle->lineWidth = LineWidth.getValue();
Expand Down Expand Up @@ -648,7 +649,8 @@ void ViewProviderPath::updateVisual(bool rebuild) {
for(i=StartIndex.getValue();i<(int)command2Edge.size();++i)
if((edgeStart=command2Edge[i])>=0) break;

if(edgeStart<0) return;
if(edgeStart<0)
return;

if(i!=StartIndex.getValue() && StartIndex.getValue()!=0) {
blockPropertyChange = true;
Expand Down
6 changes: 4 additions & 2 deletions src/Mod/Path/libarea/Arc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ bool CArc::AlmostALine()const

Point CArc::MidParam(double param)const {
/// returns a point which is 0-1 along arc
if(fabs(param) < 0.00000000000001)return m_s;
if(fabs(param - 1.0) < 0.00000000000001)return m_e;
if(fabs(param) < 0.00000000000001)
return m_s;
if(fabs(param - 1.0) < 0.00000000000001)
return m_e;

Point p;
Point v = m_s - m_c;
Expand Down
21 changes: 14 additions & 7 deletions src/Mod/Path/libarea/Area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ void CArea::ChangeStartToNearest(const Point *point, double min_dist)
m_curves.erase(It);
}

if(m_curves.empty()) return;
if(m_curves.empty())
return;

std::list<CCurve> curves;
Point p;
Expand Down Expand Up @@ -521,7 +522,8 @@ static void zigzag(const CArea &input_a)
Point null_point(0, 0);
rightward_for_zigs = true;

if(CArea::m_please_abort)return;
if(CArea::m_please_abort)
return;

double step_percent_increment = 0.8 * CArea::m_single_area_processing_length / num_steps;

Expand All @@ -544,7 +546,8 @@ static void zigzag(const CArea &input_a)
a2.Intersect(a);
make_zig(a2, y0, y);
rightward_for_zigs = !rightward_for_zigs;
if(CArea::m_please_abort)return;
if(CArea::m_please_abort)
return;
CArea::m_processing_done += step_percent_increment;
}

Expand All @@ -566,7 +569,8 @@ void CArea::SplitAndMakePocketToolpath(std::list<CCurve> &curve_list, const CAre
CArea::m_processing_done = m_split_processing_length;
CArea::m_units = save_units;

if(areas.size() == 0)return;
if(areas.size() == 0)
return;

double single_area_length = 50.0 / areas.size();

Expand Down Expand Up @@ -601,7 +605,8 @@ void CArea::MakePocketToolpath(std::list<CCurve> &curve_list, const CAreaPocketP
{
std::list<CArea> m_areas;
a_offset.Split(m_areas);
if(CArea::m_please_abort)return;
if(CArea::m_please_abort)
return;
if(m_areas.size() == 0)
{
CArea::m_processing_done += CArea::m_single_area_processing_length;
Expand Down Expand Up @@ -644,7 +649,8 @@ void CArea::Split(std::list<CArea> &m_areas)const
CArea a = *this;
a.Reorder();

if(CArea::m_please_abort)return;
if(CArea::m_please_abort)
return;

for(std::list<CCurve>::const_iterator It = a.m_curves.begin(); It != a.m_curves.end(); It++)
{
Expand Down Expand Up @@ -732,7 +738,8 @@ bool IsInside(const Point& p, const CArea& a)
c.m_vertices.emplace_back(Point(p.x - 0.01, p.y - 0.01));
a2.m_curves.push_back(c);
a2.Intersect(a);
if(fabs(a2.GetArea()) < 0.0004)return false;
if(fabs(a2.GetArea()) < 0.0004)
return false;
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion src/Mod/Path/libarea/AreaClipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ static void MakePoly(const CCurve& curve, TPolygon &p, bool reverse = false)
pts_for_AddVertex.clear();
const CVertex* prev_vertex = NULL;

if(!curve.m_vertices.size()) return;
if(!curve.m_vertices.size())
return;
if(!curve.IsClosed()) AddVertex(curve.m_vertices.front(),NULL);

for (std::list<CVertex>::const_iterator It2 = curve.m_vertices.begin(); It2 != curve.m_vertices.end(); It2++)
Expand Down

0 comments on commit 5f31fb7

Please sign in to comment.