Fix issue: HPGL (plot mode sketch) : polygons are not closed.

Fixes: lp:1771531
https://bugs.launchpad.net/kicad/+bug/1771531
This commit is contained in:
jean-pierre charras 2018-05-18 10:13:46 +02:00
parent 689db4f038
commit ec98bbba11
1 changed files with 13 additions and 3 deletions

View File

@ -606,7 +606,8 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
corners.push_back( wxPoint( - dx, + dy ) ); corners.push_back( wxPoint( - dx, + dy ) );
corners.push_back( wxPoint( + dx, + dy ) ); corners.push_back( wxPoint( + dx, + dy ) );
corners.push_back( wxPoint( + dx, - dy ) ); corners.push_back( wxPoint( + dx, - dy ) );
// Close polygon
corners.push_back( wxPoint( - dx, - dy ) );
for( unsigned ii = 0; ii < corners.size(); ii++ ) for( unsigned ii = 0; ii < corners.size(); ii++ )
{ {
@ -645,12 +646,15 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
// TransformRoundRectToPolygon creates only one convex polygon // TransformRoundRectToPolygon creates only one convex polygon
std::vector< wxPoint > cornerList; std::vector< wxPoint > cornerList;
cornerList.reserve( segmentToCircleCount + 4 ); cornerList.reserve( segmentToCircleCount + 5 );
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 ); SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
for( int ii = 0; ii < poly.PointCount(); ++ii ) for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
if( cornerList.back() != cornerList.front() )
cornerList.push_back( cornerList.front() );
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL );
} }
@ -670,6 +674,9 @@ void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
for( int ii = 1; ii < poly.PointCount(); ++ii ) for( int ii = 1; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) ); cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
if( cornerList.back() != cornerList.front() )
cornerList.push_back( cornerList.front() );
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL );
} }
} }
@ -679,7 +686,7 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorne
double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData )
{ {
std::vector< wxPoint > cornerList; std::vector< wxPoint > cornerList;
cornerList.reserve( 4 ); cornerList.reserve( 5 );
for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ )
{ {
@ -689,5 +696,8 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorne
cornerList.push_back( coord ); cornerList.push_back( coord );
} }
// Close polygon
cornerList.push_back( cornerList.front() );
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL );
} }