Don't rely on the penWidth already being set when setting the dash style.

Fixes https://gitlab.com/kicad/code/kicad/issues/11908
This commit is contained in:
Jeff Young
2022-06-29 07:34:45 -06:00
parent 4a8aaefdc0
commit dbbdc9d2e6
17 changed files with 111 additions and 89 deletions
+4 -4
View File
@@ -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')
+2 -2
View File
@@ -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...
+3 -3
View File
@@ -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,
+11 -10
View File
@@ -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;
};
+5 -4
View File
@@ -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()