diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index b100fb2c6d..4f9ac1fd3e 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -594,8 +594,7 @@ void PLOTTER::ThickArc( const VECTOR2D& centre, const EDA_ANGLE& aStartAngle, } -void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, - OUTLINE_MODE aTraceMode, void* aData ) +void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, void* aData ) { VECTOR2D center = aArcShape.getCenter(); VECTOR2D mid = aArcShape.GetArcMid(); diff --git a/include/eda_shape.h b/include/eda_shape.h index a63a3172b7..5ff4187140 100644 --- a/include/eda_shape.h +++ b/include/eda_shape.h @@ -107,7 +107,7 @@ public: void SetFillColor( const COLOR4D& aColor ) { m_fillColor = aColor; } void SetWidth( int aWidth ) { m_stroke.SetWidth( aWidth ); } - int GetWidth() const { return m_stroke.GetWidth(); } + virtual int GetWidth() const { return m_stroke.GetWidth(); } virtual int GetEffectiveWidth() const { return GetWidth(); } void SetLineStyle( const PLOT_DASH_TYPE aStyle ); diff --git a/pcbnew/convert_shape_list_to_polygon.cpp b/pcbnew/convert_shape_list_to_polygon.cpp index 1e399351d7..b21914b55f 100644 --- a/pcbnew/convert_shape_list_to_polygon.cpp +++ b/pcbnew/convert_shape_list_to_polygon.cpp @@ -382,8 +382,8 @@ bool ConvertOutlineToPolygon( std::vector& aShapeList, SHAPE_POLY_SE // Ensure the approximated Bezier shape is built // a good value is between (Bezier curve width / 2) and (Bezier curve width) // ( and at least 0.05 mm to avoid very small segments) - int min_segm_lenght = std::max( pcbIUScale.mmToIU( 0.05 ), graphic->GetWidth() ); - graphic->RebuildBezierToSegmentsPointsList( min_segm_lenght ); + int min_segm_length = std::max( pcbIUScale.mmToIU( 0.05 ), graphic->GetWidth() ); + graphic->RebuildBezierToSegmentsPointsList( min_segm_length ); if( reverse ) { diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index 078fed4e96..5615d4e52a 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -146,6 +146,16 @@ std::vector PCB_SHAPE::GetConnectionPoints() const } +int PCB_SHAPE::GetWidth() const +{ + // A stroke width of 0 in PCBNew means no-border, but negative stroke-widths are only used + // in EEschema (see SCH_SHAPE::GetPenWidth()). + // Since negative stroke widths can trip up down-stream code (such as the Gerber plotter), we + // weed them out here. + return std::max( EDA_SHAPE::GetWidth(), 0 ); +} + + void PCB_SHAPE::StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings ) { m_stroke.SetWidth( settings.GetLineThickness( GetLayer() ) ); diff --git a/pcbnew/pcb_shape.h b/pcbnew/pcb_shape.h index 851c23ccd2..1a5a224831 100644 --- a/pcbnew/pcb_shape.h +++ b/pcbnew/pcb_shape.h @@ -82,6 +82,8 @@ public: STROKE_PARAMS GetStroke() const override { return m_stroke; } void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; } + int GetWidth() const override; + void StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings ) override; /**