gendrill_Excellon_writer.*: make 3 helper methods private. Coding style fixes.

This commit is contained in:
jean-pierre charras 2017-01-15 16:35:47 +01:00
parent 56fbfeeb4a
commit f079b7f98b
3 changed files with 53 additions and 52 deletions

View File

@ -204,7 +204,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
plotter->SetCurrentLineWidth( -1 );
// Plot board outlines and drill map
PlotDrillMarks( plotter );
plotDrillMarks( plotter );
// Print a list of symbols used.
int charSize = 3 * IU_PER_MM; // text size in IUs
@ -333,7 +333,7 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName )
{
DRILL_LAYER_PAIR pair = hole_sets[pair_ndx];
BuildHolesList( pair, buildNPTHlist );
buildHolesList( pair, buildNPTHlist );
if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
{
@ -369,7 +369,7 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName )
if( !m_merge_PTH_NPTH )
buildNPTHlist = true;
BuildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist );
buildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist );
// nothing wrong with an empty NPTH file in report.
if( m_merge_PTH_NPTH )
@ -388,7 +388,7 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName )
}
bool EXCELLON_WRITER::PlotDrillMarks( PLOTTER* aPlotter )
bool EXCELLON_WRITER::plotDrillMarks( PLOTTER* aPlotter )
{
// Plot the drill map:
wxPoint pos;

View File

@ -6,9 +6,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 2017 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2017 KiCad Developers, see change_log.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
@ -99,11 +99,11 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
// For separate drill files, the last layer pair is the NPTH drill file.
bool doing_npth = m_merge_PTH_NPTH ? false : ( it == hole_sets.end() - 1 );
BuildHolesList( pair, doing_npth );
buildHolesList( pair, doing_npth );
// The file is created if it has holes, or if it is the non plated drill file
// to be sure the NPTH file is up to date in separate files mode.
if( GetHolesCount() > 0 || doing_npth )
if( getHolesCount() > 0 || doing_npth )
{
fn = drillFileName( pair, doing_npth, m_merge_PTH_NPTH );
fn.SetPath( aPlotDirectory );
@ -132,7 +132,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
}
}
CreateDrillFile( file );
createDrillFile( file );
}
if( aGenMap )
@ -167,7 +167,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
}
int EXCELLON_WRITER::CreateDrillFile( FILE* aFile )
int EXCELLON_WRITER::createDrillFile( FILE* aFile )
{
m_file = aFile;
@ -178,7 +178,7 @@ int EXCELLON_WRITER::CreateDrillFile( FILE* aFile )
LOCALE_IO dummy; // Use the standard notation for double numbers
WriteEXCELLONHeader();
writeEXCELLONHeader();
holes_count = 0;
@ -249,7 +249,7 @@ int EXCELLON_WRITER::CreateDrillFile( FILE* aFile )
xt = x0 * m_conversionUnits;
yt = y0 * m_conversionUnits;
WriteCoordinates( line, xt, yt );
writeCoordinates( line, xt, yt );
fputs( line, m_file );
holes_count++;
@ -306,7 +306,7 @@ int EXCELLON_WRITER::CreateDrillFile( FILE* aFile )
xt = x0 * m_conversionUnits;
yt = y0 * m_conversionUnits;
WriteCoordinates( line, xt, yt );
writeCoordinates( line, xt, yt );
/* remove the '\n' from end of line, because we must add the "G85"
* command to the line: */
@ -321,14 +321,14 @@ int EXCELLON_WRITER::CreateDrillFile( FILE* aFile )
xt = xf * m_conversionUnits;
yt = yf * m_conversionUnits;
WriteCoordinates( line, xt, yt );
writeCoordinates( line, xt, yt );
fputs( line, m_file );
fputs( "G05\n", m_file );
holes_count++;
}
WriteEXCELLONEndOfFile();
writeEXCELLONEndOfFile();
return holes_count;
}
@ -361,7 +361,7 @@ void EXCELLON_WRITER::SetFormat( bool aMetric,
}
void EXCELLON_WRITER::WriteCoordinates( char* aLine, double aCoordX, double aCoordY )
void EXCELLON_WRITER::writeCoordinates( char* aLine, double aCoordX, double aCoordY )
{
wxString xs, ys;
int xpad = m_precision.m_lhs + m_precision.m_rhs;
@ -461,7 +461,7 @@ void EXCELLON_WRITER::WriteCoordinates( char* aLine, double aCoordX, double aCoo
}
void EXCELLON_WRITER::WriteEXCELLONHeader()
void EXCELLON_WRITER::writeEXCELLONHeader()
{
fputs( "M48\n", m_file ); // The beginning of a header
@ -526,7 +526,7 @@ void EXCELLON_WRITER::WriteEXCELLONHeader()
}
void EXCELLON_WRITER::WriteEXCELLONEndOfFile()
void EXCELLON_WRITER::writeEXCELLONEndOfFile()
{
//add if minimal here
fputs( "T0\nM30\n", m_file );
@ -554,7 +554,7 @@ static bool CmpHoleSettings( const HOLE_INFO& a, const HOLE_INFO& b )
}
void EXCELLON_WRITER::BuildHolesList( DRILL_LAYER_PAIR aLayerPair,
void EXCELLON_WRITER::buildHolesList( DRILL_LAYER_PAIR aLayerPair,
bool aGenerateNPTH_list )
{
HOLE_INFO new_hole;

View File

@ -6,8 +6,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2015 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2017 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2017 KiCad Developers, see change_log.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
@ -99,7 +99,8 @@ public:
int m_lhs; // Left digit number (integer value of coordinates)
int m_rhs; // Right digit number (decimal value of coordinates)
public: DRILL_PRECISION( int l = 2, int r = 4 )
public:
DRILL_PRECISION( int l = 2, int r = 4 )
{
m_lhs = l; m_rhs = r;
}
@ -215,24 +216,6 @@ public:
m_merge_PTH_NPTH = aMerge_PTH_NPTH;
}
/**
* Function BuildHolesList
* Create the list of holes and tools for a given board
* The list is sorted by increasing drill size.
* Only holes included within aLayerPair are listed.
* If aLayerPair identifies with [F_Cu, B_Cu], then
* pad holes are always included also.
*
* @param aLayerPair is an inclusive range of layers.
* @param aGenerateNPTH_list :
* true to create NPTH only list (with no plated holes)
* false to created plated holes list (with no NPTH )
*/
void BuildHolesList( DRILL_LAYER_PAIR aLayerPair,
bool aGenerateNPTH_list );
int GetHolesCount() const { return m_holeListBuffer.size(); }
/**
* Function CreateDrillandMapFilesSet
* Creates the full set of Excellon drill file for the board
@ -246,14 +229,6 @@ public:
bool aGenDrill, bool aGenMap,
REPORTER * aReporter = NULL );
/**
* Function CreateDrillFile
* Creates an Excellon drill file
* @param aFile = an opened file to write to will be closed by CreateDrillFile
* @return hole count
*/
int CreateDrillFile( FILE * aFile );
/**
* Function GenDrillReportFile
* Create a plain text report file giving a list of drill values and drill count
@ -320,6 +295,32 @@ public:
bool GenDrillMapFile( const wxString& aFullFileName, PlotFormat aFormat );
private:
/**
* Function CreateDrillFile
* Creates an Excellon drill file
* @param aFile = an opened file to write to will be closed by CreateDrillFile
* @return hole count
*/
int createDrillFile( FILE * aFile );
/**
* Function BuildHolesList
* Create the list of holes and tools for a given board
* The list is sorted by increasing drill size.
* Only holes included within aLayerPair are listed.
* If aLayerPair identifies with [F_Cu, B_Cu], then
* pad holes are always included also.
*
* @param aLayerPair is an inclusive range of layers.
* @param aGenerateNPTH_list :
* true to create NPTH only list (with no plated holes)
* false to created plated holes list (with no NPTH )
*/
void buildHolesList( DRILL_LAYER_PAIR aLayerPair,
bool aGenerateNPTH_list );
int getHolesCount() const { return m_holeListBuffer.size(); }
/* Print the DRILL file header. The full header is:
* M48
* ;DRILL file {PCBNEW (2007-11-29-b)} date 17/1/2008-21:02:35
@ -327,15 +328,15 @@ private:
* FMAT,2
* INCH,TZ
*/
void WriteEXCELLONHeader();
void writeEXCELLONHeader();
void WriteEXCELLONEndOfFile();
void writeEXCELLONEndOfFile();
/* Created a line like:
* X48000Y19500
* According to the selected format
*/
void WriteCoordinates( char* aLine, double aCoordX, double aCoordY );
void writeCoordinates( char* aLine, double aCoordX, double aCoordY );
/** Helper function.
* Writes the drill marks in HPGL, POSTSCRIPT or other supported formats
@ -345,7 +346,7 @@ private:
* these other values share the same mark shape
* @param aPlotter = a PLOTTER instance (HPGL, POSTSCRIPT ... plotter).
*/
bool PlotDrillMarks( PLOTTER* aPlotter );
bool plotDrillMarks( PLOTTER* aPlotter );
/// Get unique layer pairs by examining the micro and blind_buried vias.
std::vector<DRILL_LAYER_PAIR> getUniqueLayerPairs() const;