From cccdaddd50753bc21c4aa23756b92a18432e91c5 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 3 Jun 2021 15:03:00 -0700 Subject: [PATCH] Adding SHAPE_ARC direct plotting --- common/plotters/GERBER_plotter.cpp | 9 +++++++++ common/plotters/plotter.cpp | 7 +++++++ common/plotters/plotter_gerber.h | 2 ++ include/plotter.h | 2 ++ 4 files changed, 20 insertions(+) diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index ecb96cd484..7ba2f88ae3 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -816,6 +816,7 @@ void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_TYPE aF } + void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_TYPE aFill, int aWidth ) { @@ -825,6 +826,14 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn plotArc( aCenter, aStAngle, aEndAngle, aRadius, false ); } +void GERBER_PLOTTER::Arc( const SHAPE_ARC& aArc ) +{ + SetCurrentLineWidth( aArc.GetWidth() ); + + // aFill is not used here. + plotArc( aArc, false ); +} + void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion ) { diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index c5611e0081..277c1ea5bc 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -154,6 +154,13 @@ double PLOTTER::GetDashGapLenIU() const } +void PLOTTER::Arc( const SHAPE_ARC& aArc ) +{ + Arc( wxPoint( aArc.GetCenter() ), aArc.GetStartAngle(), aArc.GetEndAngle(), aArc.GetRadius(), + FILL_TYPE::NO_FILL, aArc.GetWidth() ); +} + + void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_TYPE fill, int width ) { diff --git a/common/plotters/plotter_gerber.h b/common/plotters/plotter_gerber.h index e65162a568..5f219d71d0 100644 --- a/common/plotters/plotter_gerber.h +++ b/common/plotters/plotter_gerber.h @@ -77,6 +77,8 @@ public: virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override; + virtual void Arc( const SHAPE_ARC& aArc ) override; + // These functions plot an item and manage X2 gerber attributes virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, OUTLINE_MODE tracemode, void* aData ) override; diff --git a/include/plotter.h b/include/plotter.h index 205f50240e..7d623fe003 100644 --- a/include/plotter.h +++ b/include/plotter.h @@ -42,6 +42,7 @@ #include class COLOR_SETTINGS; +class SHAPE_ARC; class SHAPE_POLY_SET; class SHAPE_LINE_CHAIN; class GBR_NETLIST_METADATA; @@ -233,6 +234,7 @@ public: */ virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, int rayon, FILL_TYPE fill, int width = USE_DEFAULT_LINE_WIDTH ); + virtual void Arc( const SHAPE_ARC& aArc ); /** * Generic fallback: Cubic Bezier curve rendered as a polyline