code cleaning.

This commit is contained in:
jean-pierre charras 2022-12-01 15:55:51 +01:00
parent 6befa1c57e
commit c378d01068
1 changed files with 14 additions and 14 deletions

View File

@ -185,7 +185,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
contours.emplace_back(); contours.emplace_back();
int ii = contours.size() - 1; SHAPE_LINE_CHAIN& currContour = contours.back();
bool firstPt = true; bool firstPt = true;
// Circles, rects and polygons are closed shapes unto themselves (and do not combine // Circles, rects and polygons are closed shapes unto themselves (and do not combine
@ -207,7 +207,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
RotatePoint( pt, orientation ); RotatePoint( pt, orientation );
pt += offset; pt += offset;
contours[ ii ].Append( pt ); currContour.Append( pt );
if( firstPt ) if( firstPt )
firstPt = false; firstPt = false;
@ -217,7 +217,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
prevPt = pt; prevPt = pt;
} }
contours[ ii ].SetClosed( true ); currContour.SetClosed( true );
} }
else if( graphic->GetShape() == SHAPE_T::CIRCLE ) else if( graphic->GetShape() == SHAPE_T::CIRCLE )
{ {
@ -234,7 +234,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
{ {
nextPt = start; nextPt = start;
RotatePoint( nextPt, center, ANGLE_360 * step / steps ); RotatePoint( nextPt, center, ANGLE_360 * step / steps );
contours[ ii ].Append( nextPt ); currContour.Append( nextPt );
if( firstPt ) if( firstPt )
firstPt = false; firstPt = false;
@ -244,7 +244,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
prevPt = nextPt; prevPt = nextPt;
} }
contours[ ii ].SetClosed( true ); currContour.SetClosed( true );
} }
else if( graphic->GetShape() == SHAPE_T::RECT ) else if( graphic->GetShape() == SHAPE_T::RECT )
{ {
@ -252,7 +252,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
for( const VECTOR2I& pt : pts ) for( const VECTOR2I& pt : pts )
{ {
contours[ ii ].Append( pt ); currContour.Append( pt );
if( firstPt ) if( firstPt )
firstPt = false; firstPt = false;
@ -262,7 +262,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
prevPt = pt; prevPt = pt;
} }
contours[ ii ].SetClosed( true ); currContour.SetClosed( true );
} }
else else
{ {
@ -271,7 +271,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
VECTOR2I startPt = graphic->GetEnd(); VECTOR2I startPt = graphic->GetEnd();
prevPt = startPt; prevPt = startPt;
contours[ ii ].Append( prevPt ); currContour.Append( prevPt );
// do not append the other end point yet, this first 'graphic' might be an arc // do not append the other end point yet, this first 'graphic' might be an arc
for(;;) for(;;)
@ -307,7 +307,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
else else
nextPt = graphic->GetStart(); nextPt = graphic->GetStart();
contours[ ii ].Append( nextPt ); currContour.Append( nextPt );
shapeOwners[ std::make_pair( prevPt, nextPt ) ] = graphic; shapeOwners[ std::make_pair( prevPt, nextPt ) ] = graphic;
prevPt = nextPt; prevPt = nextPt;
} }
@ -340,13 +340,13 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
RotatePoint( pt, pcenter, rotation ); RotatePoint( pt, pcenter, rotation );
contours[ ii ].Append( pt ); currContour.Append( pt );
shapeOwners[ std::make_pair( prevPt, pt ) ] = graphic; shapeOwners[ std::make_pair( prevPt, pt ) ] = graphic;
prevPt = pt; prevPt = pt;
} }
// Append the last arc end point // Append the last arc end point
contours[ ii ].Append( pend ); currContour.Append( pend );
shapeOwners[ std::make_pair( prevPt, pend ) ] = graphic; shapeOwners[ std::make_pair( prevPt, pend ) ] = graphic;
prevPt = pend; prevPt = pend;
} }
@ -377,7 +377,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
for( int jj = graphic->GetBezierPoints().size()-1; jj >= 0; jj-- ) for( int jj = graphic->GetBezierPoints().size()-1; jj >= 0; jj-- )
{ {
const VECTOR2I& pt = graphic->GetBezierPoints()[jj]; const VECTOR2I& pt = graphic->GetBezierPoints()[jj];
contours[ ii ].Append( pt ); currContour.Append( pt );
shapeOwners[ std::make_pair( prevPt, pt ) ] = graphic; shapeOwners[ std::make_pair( prevPt, pt ) ] = graphic;
prevPt = pt; prevPt = pt;
} }
@ -386,7 +386,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
{ {
for( const VECTOR2I& pt : graphic->GetBezierPoints() ) for( const VECTOR2I& pt : graphic->GetBezierPoints() )
{ {
contours[ ii ].Append( pt ); currContour.Append( pt );
shapeOwners[ std::make_pair( prevPt, pt ) ] = graphic; shapeOwners[ std::make_pair( prevPt, pt ) ] = graphic;
prevPt = pt; prevPt = pt;
} }
@ -418,7 +418,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
if( close_enough( startPt, prevPt, aChainingEpsilon ) ) if( close_enough( startPt, prevPt, aChainingEpsilon ) )
{ {
contours[ ii ].SetClosed( true ); currContour.SetClosed( true );
break; break;
} }
else if( nextGraphic ) // encountered already-used segment, but not at the start else if( nextGraphic ) // encountered already-used segment, but not at the start