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

This commit is contained in:
Ian McInerney 2019-07-10 16:47:12 +02:00 committed by Wayne Stambaugh
parent 6186dd5c51
commit ff9d899ae0
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;
switch( aUnit )
{
case MILIMETERS:
case DXF_UNIT_MILLIMETERS:
m_unitScalingFactor = 0.00254;
m_measurementDirective = 1;
break;
case INCHES:
case DXF_UNIT_INCHES:
default:
m_unitScalingFactor = 0.0001;
m_measurementDirective = 0;

View File

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

View File

@ -575,7 +575,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() );
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() );
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_plotMode = FILLED;
m_DXFplotPolygonMode = true;
m_DXFplotUnits = INCHES;
m_DXFplotUnits = DXF_PLOTTER::DXF_UNIT_INCHES;
m_useAuxOrigin = false;
m_HPGLPenNum = 1;
m_HPGLPenSpeed = 20; // this param is always in cm/s

View File

@ -44,13 +44,6 @@ public:
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:
// If true, do not plot NPTH pads
// (mainly used to disable NPTH pads plotting on copper layers)
@ -70,7 +63,7 @@ private:
/**
* 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)
PlotFormat m_format;
@ -208,12 +201,12 @@ public:
void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
bool GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; }
void SetDXFPlotUnits( Units aUnit )
void SetDXFPlotUnits( DXF_PLOTTER::DXF_UNITS aUnit )
{
m_DXFplotUnits = aUnit;
}
Units GetDXFPlotUnits() const
DXF_PLOTTER::DXF_UNITS GetDXFPlotUnits() const
{
return m_DXFplotUnits;
}

View File

@ -1029,7 +1029,8 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
case PLOT_FORMAT_DXF:
DXF_PLOTTER* 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;
break;