pcbnew: Clean up warnings with unit handling in the DXF export

(cherry picked from commit ff9d899ae0)
This commit is contained in:
Ian McInerney 2019-07-10 16:47:12 +02:00 committed by Wayne Stambaugh
parent 09d7d0f1bc
commit 40ba502853
6 changed files with 18 additions and 24 deletions

View File

@ -122,18 +122,18 @@ static wxString getDXFColorName( COLOR4D aColor )
} }
void DXF_PLOTTER::SetUnits( Units aUnit ) void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
{ {
m_plotUnits = aUnit; m_plotUnits = aUnit;
switch( aUnit ) switch( aUnit )
{ {
case MILIMETERS: case DXF_UNIT_MILLIMETERS:
m_unitScalingFactor = 0.00254; m_unitScalingFactor = 0.00254;
m_measurementDirective = 1; m_measurementDirective = 1;
break; break;
case INCHES: case DXF_UNIT_INCHES:
default: default:
m_unitScalingFactor = 0.0001; m_unitScalingFactor = 0.0001;
m_measurementDirective = 0; m_measurementDirective = 0;

View File

@ -1256,7 +1256,7 @@ public:
textAsLines = true; textAsLines = true;
m_currentColor = COLOR4D::BLACK; m_currentColor = COLOR4D::BLACK;
m_currentLineType = 0; m_currentLineType = 0;
SetUnits( DXF_PLOTTER::INCHES ); SetUnits( DXF_PLOTTER::DXF_UNIT_INCHES );
} }
virtual PlotFormat GetPlotterType() const override virtual PlotFormat GetPlotterType() const override
@ -1340,11 +1340,11 @@ public:
void* aData = NULL ) override; void* aData = NULL ) override;
// Should be the same order as in the PCB_PLOT_PARAMS class // Must be in the same order as the drop-down list in the plot dialog inside pcbnew
enum Units enum DXF_UNITS
{ {
INCHES = 0, DXF_UNIT_INCHES = 0,
MILIMETERS = 1 DXF_UNIT_MILLIMETERS = 1
}; };
/** /**
@ -1352,14 +1352,14 @@ public:
* *
* @param aUnit - The units to use * @param aUnit - The units to use
*/ */
void SetUnits( Units aUnit ); void SetUnits( DXF_UNITS aUnit );
/** /**
* The units currently enabled for plotting * The units currently enabled for plotting
* *
* @return The currently configured units * @return The currently configured units
*/ */
Units GetUnits() const DXF_UNITS GetUnits() const
{ {
return m_plotUnits; return m_plotUnits;
} }
@ -1390,7 +1390,7 @@ protected:
COLOR4D m_currentColor; COLOR4D m_currentColor;
int m_currentLineType; int m_currentLineType;
Units m_plotUnits; DXF_UNITS m_plotUnits;
double m_unitScalingFactor; double m_unitScalingFactor;
unsigned int m_measurementDirective; unsigned int m_measurementDirective;
}; };

View File

@ -573,7 +573,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED ); tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() ); tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() );
tempOptions.SetDXFPlotUnits( tempOptions.SetDXFPlotUnits(
static_cast<PCB_PLOT_PARAMS::Units>( m_DXF_plotUnits->GetSelection() ) ); static_cast<DXF_PLOTTER::DXF_UNITS>( m_DXF_plotUnits->GetSelection() ) );
tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() ); tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option

View File

@ -103,7 +103,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_plotViaOnMaskLayer = false; m_plotViaOnMaskLayer = false;
m_plotMode = FILLED; m_plotMode = FILLED;
m_DXFplotPolygonMode = true; m_DXFplotPolygonMode = true;
m_DXFplotUnits = INCHES; m_DXFplotUnits = DXF_PLOTTER::DXF_UNIT_INCHES;
m_useAuxOrigin = false; m_useAuxOrigin = false;
m_HPGLPenNum = 1; m_HPGLPenNum = 1;
m_HPGLPenSpeed = 20; // this param is always in cm/s m_HPGLPenSpeed = 20; // this param is always in cm/s

View File

@ -44,13 +44,6 @@ public:
FULL_DRILL_SHAPE = 2 FULL_DRILL_SHAPE = 2
}; };
// Must be in the same order as the drop-down list in the plot dialog
enum Units
{
INCHES = 0,
MILIMETERS = 1,
};
private: private:
// If true, do not plot NPTH pads // If true, do not plot NPTH pads
// (mainly used to disable NPTH pads plotting on copper layers) // (mainly used to disable NPTH pads plotting on copper layers)
@ -70,7 +63,7 @@ private:
/** /**
* DXF format: Units to use when plotting the DXF * DXF format: Units to use when plotting the DXF
*/ */
Units m_DXFplotUnits; DXF_PLOTTER::DXF_UNITS m_DXFplotUnits;
/// Plot format type (chooses the driver to be used) /// Plot format type (chooses the driver to be used)
PlotFormat m_format; PlotFormat m_format;
@ -208,12 +201,12 @@ public:
void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; } void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
bool GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; } bool GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; }
void SetDXFPlotUnits( Units aUnit ) void SetDXFPlotUnits( DXF_PLOTTER::DXF_UNITS aUnit )
{ {
m_DXFplotUnits = aUnit; m_DXFplotUnits = aUnit;
} }
Units GetDXFPlotUnits() const DXF_PLOTTER::DXF_UNITS GetDXFPlotUnits() const
{ {
return m_DXFplotUnits; return m_DXFplotUnits;
} }

View File

@ -1060,7 +1060,8 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
case PLOT_FORMAT_DXF: case PLOT_FORMAT_DXF:
DXF_PLOTTER* DXF_plotter; DXF_PLOTTER* DXF_plotter;
DXF_plotter = new DXF_PLOTTER(); DXF_plotter = new DXF_PLOTTER();
DXF_plotter->SetUnits( static_cast<DXF_PLOTTER::Units>( aPlotOpts->GetDXFPlotUnits() ) ); DXF_plotter->SetUnits(
static_cast<DXF_PLOTTER::DXF_UNITS>( aPlotOpts->GetDXFPlotUnits() ) );
plotter = DXF_plotter; plotter = DXF_plotter;
break; break;