From b0d1e49319a27d2655e2a9a6c5481fc1fd0b3fe4 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 4 Feb 2018 16:22:14 +0000 Subject: [PATCH] Fix plotting of 360 degree arcs and printing of mirrored arcs. The second issue is OSX-only; the first is universal. --- pcbnew/class_drawsegment.cpp | 5 +++++ pcbnew/plot_brditems_plotter.cpp | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index d38c29ca9c..e42d6b9218 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -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 ) diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 5b634e4c27..30aae84381 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -515,7 +515,11 @@ 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(); - m_plotter->ThickArc( pos, -endAngle, -startAngle, radius, thickness, GetPlotMode(), &gbr_metadata ); + // 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,7 +756,12 @@ 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(); - m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetPlotMode(), &gbr_metadata ); + + // 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; case S_CURVE: