From dbbdc9d2e655de8a11dfc5f61e9b87df7a7105c6 Mon Sep 17 00:00:00 2001 From: Jeff Young <jeff@rokeby.ie> Date: Tue, 28 Jun 2022 12:06:17 -0600 Subject: [PATCH] Don't rely on the penWidth already being set when setting the dash style. Fixes https://gitlab.com/kicad/code/kicad/issues/11908 --- common/plotters/DXF_plotter.cpp | 8 +++-- common/plotters/HPGL_plotter.cpp | 8 ++--- common/plotters/PDF_plotter.cpp | 23 ++++++++----- common/plotters/PS_plotter.cpp | 24 ++++++++------ common/plotters/SVG_plotter.cpp | 53 +++++++++++++++++------------- common/plotters/plotter.cpp | 12 +++---- eeschema/lib_shape.cpp | 4 +-- eeschema/lib_textbox.cpp | 4 +-- eeschema/sch_bus_entry.cpp | 4 +-- eeschema/sch_line.cpp | 4 +-- eeschema/sch_shape.cpp | 4 +-- eeschema/sch_textbox.cpp | 4 +-- include/plotters/plotter.h | 8 ++--- include/plotters/plotter_dxf.h | 4 +-- include/plotters/plotter_gerber.h | 6 ++-- include/plotters/plotter_hpgl.h | 21 ++++++------ include/plotters/plotters_pslike.h | 9 ++--- 17 files changed, 111 insertions(+), 89 deletions(-) diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index fd046886a1..db3f84857c 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/common/plotters/DXF_plotter.cpp @@ -587,10 +587,12 @@ void DXF_PLOTTER::PenTo( const VECTOR2I& pos, char plume ) } -void DXF_PLOTTER::SetDash( PLOT_DASH_TYPE aDashed ) +void DXF_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) { - wxASSERT( aDashed >= PLOT_DASH_TYPE::FIRST_TYPE && aDashed <= PLOT_DASH_TYPE::LAST_TYPE ); - m_currentLineType = aDashed; + wxASSERT( aLineStyle >= PLOT_DASH_TYPE::FIRST_TYPE + && aLineStyle <= PLOT_DASH_TYPE::LAST_TYPE ); + + m_currentLineType = aLineStyle; } diff --git a/common/plotters/HPGL_plotter.cpp b/common/plotters/HPGL_plotter.cpp index 3a414ad648..14a6d9dbd8 100644 --- a/common/plotters/HPGL_plotter.cpp +++ b/common/plotters/HPGL_plotter.cpp @@ -222,7 +222,7 @@ static const double PLUsPERDECIMIL = 0.1016; HPGL_PLOTTER::HPGL_PLOTTER() : arcTargetChordLength( 0 ), arcMinChordDegrees( 5.0, DEGREES_T ), - dashType( PLOT_DASH_TYPE::SOLID ), + m_lineStyle( PLOT_DASH_TYPE::SOLID ), useUserCoords( false ), fitUserCoords( false ), m_current_item( nullptr ) @@ -542,9 +542,9 @@ void HPGL_PLOTTER::PenTo( const VECTOR2I& pos, char plume ) } -void HPGL_PLOTTER::SetDash( PLOT_DASH_TYPE dashed ) +void HPGL_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) { - dashType = dashed; + m_lineStyle = aLineStyle; flushItem(); } @@ -854,7 +854,7 @@ bool HPGL_PLOTTER::startOrAppendItem( const VECTOR2D& location, wxString const& item.loc_end = location; item.bbox = BOX2D( location ); item.pen = penNumber; - item.dashType = dashType; + item.dashType = m_lineStyle; item.content = content; m_items.push_back( item ); m_current_item = &m_items.back(); diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index d687da7323..06e484a689 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -176,30 +176,35 @@ void PDF_PLOTTER::emitSetRGBColor( double r, double g, double b, double a ) } -void PDF_PLOTTER::SetDash( PLOT_DASH_TYPE dashed ) +void PDF_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) { wxASSERT( workFile ); - switch( dashed ) + + switch( aLineStyle ) { case PLOT_DASH_TYPE::DASH: fprintf( workFile, "[%d %d] 0 d\n", - (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DOT: fprintf( workFile, "[%d %d] 0 d\n", - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DASHDOT: fprintf( workFile, "[%d %d %d %d] 0 d\n", - (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(), - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ), + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DASHDOTDOT: fprintf( workFile, "[%d %d %d %d %d %d] 0 d\n", - (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(), - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU(), - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ), + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ), + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + default: fputs( "[] 0 d\n", workFile ); } diff --git a/common/plotters/PS_plotter.cpp b/common/plotters/PS_plotter.cpp index 1482e54478..f3961035ce 100644 --- a/common/plotters/PS_plotter.cpp +++ b/common/plotters/PS_plotter.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -510,29 +510,33 @@ void PS_PLOTTER::emitSetRGBColor( double r, double g, double b, double a ) } -void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed ) +void PS_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) { - switch( dashed ) + switch( aLineStyle ) { case PLOT_DASH_TYPE::DASH: fprintf( m_outputFile, "[%d %d] 0 setdash\n", - (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DOT: fprintf( m_outputFile, "[%d %d] 0 setdash\n", - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DASHDOT: fprintf( m_outputFile, "[%d %d %d %d] 0 setdash\n", - (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(), - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ), + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DASHDOTDOT: fprintf( m_outputFile, "[%d %d %d %d %d %d] 0 setdash\n", - (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(), - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU(), - (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() ); + (int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ), + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ), + (int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) ); break; + default: fputs( "solidline\n", m_outputFile ); } diff --git a/common/plotters/SVG_plotter.cpp b/common/plotters/SVG_plotter.cpp index c5cb4dbb21..900bd3f50b 100644 --- a/common/plotters/SVG_plotter.cpp +++ b/common/plotters/SVG_plotter.cpp @@ -210,7 +210,7 @@ void SVG_PLOTTER::SetColor( const COLOR4D& color ) PSLIKE_PLOTTER::SetColor( color ); if( m_graphics_changed ) - setSVGPlotStyle(); + setSVGPlotStyle( GetCurrentLineWidth() ); } @@ -224,7 +224,7 @@ void SVG_PLOTTER::setFillMode( FILL_T fill ) } -void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle ) +void SVG_PLOTTER::setSVGPlotStyle( int aLineWidth, bool aIsGroup, const std::string& aExtraStyle ) { if( aIsGroup ) fputs( "</g>\n<g ", m_outputFile ); @@ -237,6 +237,7 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle case FILL_T::NO_FILL: fputs( "fill-opacity:0.0; ", m_outputFile ); break; + case FILL_T::FILLED_SHAPE: case FILL_T::FILLED_WITH_BG_BODYCOLOR: case FILL_T::FILLED_WITH_COLOR: @@ -244,7 +245,7 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle break; } - double pen_w = userToDeviceSize( GetCurrentLineWidth() ); + double pen_w = userToDeviceSize( aLineWidth ); if( pen_w < 0.0 ) // Ensure pen width validity pen_w = 0.0; @@ -263,23 +264,28 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle { case PLOT_DASH_TYPE::DASH: fprintf( m_outputFile, "stroke-dasharray:%.*f,%.*f;", - m_precision, GetDashMarkLenIU(), m_precision, GetDashGapLenIU() ); + m_precision, GetDashMarkLenIU( aLineWidth ), + m_precision, GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DOT: fprintf( m_outputFile, "stroke-dasharray:%f,%f;", - GetDotMarkLenIU(), GetDashGapLenIU() ); + GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DASHDOT: fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f;", - GetDashMarkLenIU(), GetDashGapLenIU(), - GetDotMarkLenIU(), GetDashGapLenIU() ); + GetDashMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ), + GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DASHDOTDOT: fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f,%f,%f;", - GetDashMarkLenIU(), GetDashGapLenIU(), - GetDotMarkLenIU(), GetDashGapLenIU(), - GetDotMarkLenIU(), GetDashGapLenIU() ); + GetDashMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ), + GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ), + GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) ); break; + case PLOT_DASH_TYPE::DEFAULT: case PLOT_DASH_TYPE::SOLID: default: @@ -288,9 +294,7 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle } if( aExtraStyle.length() ) - { fputs( aExtraStyle.c_str(), m_outputFile ); - } fputs( "\"", m_outputFile ); @@ -322,7 +326,7 @@ void SVG_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData ) } if( m_graphics_changed ) - setSVGPlotStyle(); + setSVGPlotStyle( aWidth ); } @@ -366,16 +370,16 @@ void SVG_PLOTTER::emitSetRGBColor( double r, double g, double b, double a ) } -void SVG_PLOTTER::SetDash( PLOT_DASH_TYPE dashed ) +void SVG_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) { - if( m_dashed != dashed ) + if( m_dashed != aLineStyle ) { m_graphics_changed = true; - m_dashed = dashed; + m_dashed = aLineStyle; } if( m_graphics_changed ) - setSVGPlotStyle(); + setSVGPlotStyle( aLineWidth ); } @@ -584,13 +588,13 @@ void SVG_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi switch( aFill ) { case FILL_T::NO_FILL: - setSVGPlotStyle( false, "fill:none" ); + setSVGPlotStyle( aWidth, false, "fill:none" ); break; case FILL_T::FILLED_WITH_BG_BODYCOLOR: case FILL_T::FILLED_SHAPE: case FILL_T::FILLED_WITH_COLOR: - setSVGPlotStyle( false, "fill-rule:evenodd;" ); + setSVGPlotStyle( aWidth, false, "fill-rule:evenodd;" ); break; } @@ -686,15 +690,20 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume ) if( m_fillMode != FILL_T::NO_FILL ) { setFillMode( FILL_T::NO_FILL ); - setSVGPlotStyle(); + setSVGPlotStyle( GetCurrentLineWidth() ); } - fprintf( m_outputFile, "<path d=\"M%.*f %.*f\n", m_precision, pos_dev.x, m_precision, pos_dev.y ); + fprintf( m_outputFile, "<path d=\"M%.*f %.*f\n", + m_precision, pos_dev.x, + m_precision, pos_dev.y ); } else if( m_penState != plume || pos != m_penLastpos ) { VECTOR2D pos_dev = userToDeviceCoordinates( pos ); - fprintf( m_outputFile, "L%.*f %.*f\n", m_precision, pos_dev.x, m_precision, pos_dev.y ); + + fprintf( m_outputFile, "L%.*f %.*f\n", + m_precision, pos_dev.x, + m_precision, pos_dev.y ); } m_penState = plume; diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index b51236dbaa..d22db99f42 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -129,21 +129,21 @@ double PLOTTER::userToDeviceSize( double size ) const #define IU_PER_MILS ( m_IUsPerDecimil * 10 ) -double PLOTTER::GetDotMarkLenIU() const +double PLOTTER::GetDotMarkLenIU( int aLineWidth ) const { - return userToDeviceSize( m_renderSettings->GetDotLength( GetCurrentLineWidth() ) ); + return userToDeviceSize( m_renderSettings->GetDotLength( aLineWidth ) ); } -double PLOTTER::GetDashMarkLenIU() const +double PLOTTER::GetDashMarkLenIU( int aLineWidth ) const { - return userToDeviceSize( m_renderSettings->GetDashLength( GetCurrentLineWidth() ) ); + return userToDeviceSize( m_renderSettings->GetDashLength( aLineWidth ) ); } -double PLOTTER::GetDashGapLenIU() const +double PLOTTER::GetDashGapLenIU( int aLineWidth ) const { - return userToDeviceSize( m_renderSettings->GetGapLength( GetCurrentLineWidth() ) ); + return userToDeviceSize( m_renderSettings->GetGapLength( aLineWidth ) ); } diff --git a/eeschema/lib_shape.cpp b/eeschema/lib_shape.cpp index 1fd0e865f9..d21053f1cb 100644 --- a/eeschema/lib_shape.cpp +++ b/eeschema/lib_shape.cpp @@ -219,7 +219,7 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs } aPlotter->SetColor( color ); - aPlotter->SetDash( lineStyle ); + aPlotter->SetDash( penWidth, lineStyle ); switch( GetShape() ) { @@ -250,7 +250,7 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs UNIMPLEMENTED_FOR( SHAPE_T_asString() ); } - aPlotter->SetDash( PLOT_DASH_TYPE::SOLID ); + aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID ); } diff --git a/eeschema/lib_textbox.cpp b/eeschema/lib_textbox.cpp index 97ca097c36..9a98f1c394 100644 --- a/eeschema/lib_textbox.cpp +++ b/eeschema/lib_textbox.cpp @@ -347,9 +347,9 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf lineStyle = PLOT_DASH_TYPE::DASH; aPlotter->SetColor( color ); - aPlotter->SetDash( lineStyle ); + aPlotter->SetDash( penWidth, lineStyle ); aPlotter->Rect( start, end, FILL_T::NO_FILL, penWidth ); - aPlotter->SetDash( PLOT_DASH_TYPE::SOLID ); + aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID ); } LIB_TEXTBOX text( *this ); diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index ffdd2a94ae..af9f7d2f5a 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -506,11 +506,11 @@ void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const aPlotter->SetCurrentLineWidth( penWidth ); aPlotter->SetColor( color ); - aPlotter->SetDash( GetLineStyle() ); + aPlotter->SetDash( penWidth, GetLineStyle() ); aPlotter->MoveTo( m_pos ); aPlotter->FinishTo( GetEnd() ); - aPlotter->SetDash( PLOT_DASH_TYPE::SOLID ); + aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID ); } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 7a5f726675..8b558c1587 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -881,12 +881,12 @@ void SCH_LINE::Plot( PLOTTER* aPlotter, bool aBackground ) const aPlotter->SetColor( color ); aPlotter->SetCurrentLineWidth( penWidth ); - aPlotter->SetDash( GetEffectiveLineStyle() ); + aPlotter->SetDash( penWidth, GetEffectiveLineStyle() ); aPlotter->MoveTo( m_start ); aPlotter->FinishTo( m_end ); - aPlotter->SetDash( PLOT_DASH_TYPE::SOLID ); + aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID ); } diff --git a/eeschema/sch_shape.cpp b/eeschema/sch_shape.cpp index c818acffdd..8f817b8840 100644 --- a/eeschema/sch_shape.cpp +++ b/eeschema/sch_shape.cpp @@ -176,7 +176,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOTES ) ); aPlotter->SetCurrentLineWidth( pen_size ); - aPlotter->SetDash( GetEffectiveLineStyle() ); + aPlotter->SetDash( pen_size, GetEffectiveLineStyle() ); switch( GetShape() ) { @@ -226,7 +226,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const UNIMPLEMENTED_FOR( SHAPE_T_asString() ); } - aPlotter->SetDash( PLOT_DASH_TYPE::SOLID ); + aPlotter->SetDash( pen_size, PLOT_DASH_TYPE::SOLID ); } } diff --git a/eeschema/sch_textbox.cpp b/eeschema/sch_textbox.cpp index e70da6e1ea..26b688311b 100644 --- a/eeschema/sch_textbox.cpp +++ b/eeschema/sch_textbox.cpp @@ -355,9 +355,9 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const lineStyle = PLOT_DASH_TYPE::SOLID; aPlotter->SetColor( color ); - aPlotter->SetDash( lineStyle ); + aPlotter->SetDash( penWidth, lineStyle ); aPlotter->Rect( m_start, m_end, FILL_T::NO_FILL, penWidth ); - aPlotter->SetDash( PLOT_DASH_TYPE::SOLID ); + aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID ); } color = GetTextColor(); diff --git a/include/plotters/plotter.h b/include/plotters/plotter.h index a190786bf2..3fe5278876 100644 --- a/include/plotters/plotter.h +++ b/include/plotters/plotter.h @@ -153,7 +153,7 @@ public: virtual void SetColor( const COLOR4D& color ) = 0; - virtual void SetDash( PLOT_DASH_TYPE dashed ) = 0; + virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) = 0; virtual void SetCreator( const wxString& aCreator ) { m_creator = aCreator; } @@ -570,11 +570,11 @@ protected: */ virtual double userToDeviceSize( double size ) const; - double GetDotMarkLenIU() const; + double GetDotMarkLenIU( int aLineWidth ) const; - double GetDashMarkLenIU() const; + double GetDashMarkLenIU( int aLineWidth ) const; - double GetDashGapLenIU() const; + double GetDashGapLenIU( int aLineWidth ) const; protected: // variables used in most of plotters: /// Plot scale - chosen by the user (even implicitly with 'fit in a4') diff --git a/include/plotters/plotter_dxf.h b/include/plotters/plotter_dxf.h index 9829b65ff3..bb1f94993f 100644 --- a/include/plotters/plotter_dxf.h +++ b/include/plotters/plotter_dxf.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -70,7 +70,7 @@ public: m_currentPenWidth = 0; } - virtual void SetDash( PLOT_DASH_TYPE dashed ) override; + virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override; /** * The DXF exporter handles 'colors' as layers... diff --git a/include/plotters/plotter_gerber.h b/include/plotters/plotter_gerber.h index 0388edc661..7801a32fbd 100644 --- a/include/plotters/plotter_gerber.h +++ b/include/plotters/plotter_gerber.h @@ -51,14 +51,14 @@ public: */ virtual bool StartPlot() override; virtual bool EndPlot() override; - virtual void SetCurrentLineWidth( int width, void* aData = nullptr ) override; + virtual void SetCurrentLineWidth( int aLineWidth, void* aData = nullptr ) override; // RS274X has no dashing, nor colors - virtual void SetDash( PLOT_DASH_TYPE dashed ) override + virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override { } - virtual void SetColor( const COLOR4D& color ) override {} + virtual void SetColor( const COLOR4D& aColor ) override {} // Currently, aScale and aMirror are not used in gerber plotter virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil, diff --git a/include/plotters/plotter_hpgl.h b/include/plotters/plotter_hpgl.h index d3720bf503..c73d878b9d 100644 --- a/include/plotters/plotter_hpgl.h +++ b/include/plotters/plotter_hpgl.h @@ -78,7 +78,7 @@ public: /** * HPGL supports dashed lines. */ - virtual void SetDash( PLOT_DASH_TYPE dashed ) override; + virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override; virtual void SetColor( const COLOR4D& color ) override {} @@ -170,15 +170,6 @@ protected: */ bool startOrAppendItem( const VECTOR2D& location, const wxString& content ); - int penSpeed; - int penNumber; - double penDiameter; - double arcTargetChordLength; - EDA_ANGLE arcMinChordDegrees; - PLOT_DASH_TYPE dashType; - bool useUserCoords; - bool fitUserCoords; - struct HPGL_ITEM { HPGL_ITEM() : @@ -223,6 +214,16 @@ protected: /// Return the plot command corresponding to a line type static const char* lineTypeCommand( PLOT_DASH_TYPE linetype ); +protected: + int penSpeed; + int penNumber; + double penDiameter; + double arcTargetChordLength; + EDA_ANGLE arcMinChordDegrees; + PLOT_DASH_TYPE m_lineStyle; + bool useUserCoords; + bool fitUserCoords; + std::list<HPGL_ITEM> m_items; HPGL_ITEM* m_current_item; }; diff --git a/include/plotters/plotters_pslike.h b/include/plotters/plotters_pslike.h index 5424e48321..e521f5dc34 100644 --- a/include/plotters/plotters_pslike.h +++ b/include/plotters/plotters_pslike.h @@ -196,7 +196,7 @@ public: /** * PostScript supports dashed lines. */ - virtual void SetDash( PLOT_DASH_TYPE dashed ) override; + virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override; virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil, double aScale, bool aMirror ) override; @@ -299,7 +299,7 @@ public: /** * PDF supports dashed lines */ - virtual void SetDash( PLOT_DASH_TYPE dashed ) override; + virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override; /** * PDF can have multiple pages, so SetPageSettings can be called @@ -448,7 +448,7 @@ public: /** * SVG supports dashed lines. */ - virtual void SetDash( PLOT_DASH_TYPE dashed ) override; + virtual void SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle ) override; virtual void SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil, double aScale, bool aMirror ) override; @@ -529,7 +529,8 @@ protected: * @param aIsGroup If false, do not form a new group for the style. * @param aExtraStyle If given, the string will be added into the style string before closing */ - void setSVGPlotStyle( bool aIsGroup = true, const std::string& aExtraStyle = {} ); + void setSVGPlotStyle( int aLineWidth, bool aIsGroup = true, + const std::string& aExtraStyle = {} ); /** * Prepare parameters for setSVGPlotStyle()