Fix plotting of 360 degree arcs and printing of mirrored arcs.

The second issue is OSX-only; the first is universal.
This commit is contained in:
Jeff Young 2018-02-04 16:22:14 +00:00 committed by jean-pierre charras
parent 6b12fef288
commit b0d1e49319
2 changed files with 16 additions and 2 deletions

View File

@ -314,8 +314,13 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
}
else // Mirrored mode: arc orientation is reversed
{
#ifdef __WXMAC__ // wxWidgets OSX print driver handles arc mirroring for us
if( StAngle > EndAngle )
std::swap( StAngle, EndAngle );
#else
if( StAngle < EndAngle )
std::swap( StAngle, EndAngle );
#endif
}
if( filled )

View File

@ -515,6 +515,10 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge )
double startAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
double endAngle = startAngle + aEdge->GetAngle();
// when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
if( std::abs( aEdge->GetAngle() ) == 3600.0 )
m_plotter->ThickCircle( pos, radius * 2, thickness, GetPlotMode(), &gbr_metadata );
else
m_plotter->ThickArc( pos, -endAngle, -startAngle, radius, thickness, GetPlotMode(), &gbr_metadata );
}
break;
@ -752,6 +756,11 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
radius = KiROUND( GetLineLength( end, start ) );
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
EndAngle = StAngle + aSeg->GetAngle();
// when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
if( std::abs( aSeg->GetAngle() ) == 3600.0 )
m_plotter->ThickCircle( start, radius * 2, thickness, GetPlotMode(), &gbr_metadata );
else
m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetPlotMode(), &gbr_metadata );
break;