Pcbnew: For zone filling algo, change the default polygon library from Kbool to Boost::polygon (USE_BOOST_POLYGON_LIBRARY default is ON). (need to rebuild makefile)

Gerbview: added decimal format for coordinates, sometimes found in Gerber files.
This commit is contained in:
jean-pierre charras 2010-12-02 18:26:32 +01:00
parent 8c4075216e
commit 6886e50d15
7 changed files with 55 additions and 31 deletions

View File

@ -4,6 +4,12 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-dec-02, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
Pcbnew:
For zone filling algo, change the default polygon library from Kbool to Boost::polygon.
2010-dec-01, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-dec-01, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
Gerbview: Gerbview:

View File

@ -31,7 +31,8 @@ option(USE_WX_OVERLAY
"Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental") "Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental")
option(USE_BOOST_POLYGON_LIBRARY option(USE_BOOST_POLYGON_LIBRARY
"Use boost polygon library instead of Kbool to calculate filled areas in zones (default OFF). Warning, this is experimental") "Use boost polygon library instead of Kbool to calculate filled areas in zones (default ON)."
ON )
#================================================ #================================================
# Set flags for GCC. # Set flags for GCC.
@ -39,9 +40,9 @@ option(USE_BOOST_POLYGON_LIBRARY
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
# Set default flags for Release build. # Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG") set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG ")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc")
# Set default flags for Debug build. # Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG") set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")

View File

@ -13,10 +13,10 @@
/* Used icons: /* Used icons:
* lang_xx_xpm[]; // Icons of various national flags * lang_xx_xpm[]; // Icons of various national flags
* show_3d_xpm[]; // 3D icon * show_3d_xpm[]; // 3D icon
* edit_module_xpm[]; * edit_module_xpm[];
* kicad_icon_xpm[]; // Icon of the application * kicad_icon_xpm[]; // Icon of the application
*/ */
#include "bitmaps.h" #include "bitmaps.h"
#include "wxstruct.h" #include "wxstruct.h"
@ -73,7 +73,14 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
#else #else
<< wxT( " Ansi " ); << wxT( " Ansi " );
#endif #endif
libVersion << wxT( "and " )
#if USE_BOOST_POLYGON_LIBRARY
<< wxT( "boost::polygon" );
#else
<< wxT( "kbool library" );
#endif
libVersion << wxT( "\n" );
/* Operating System Information */ /* Operating System Information */
@ -281,8 +288,8 @@ bool ShowAboutDialog( wxWindow* parent )
* Wraps the given url with a HTML anchor tag containing a hyperlink text reference * Wraps the given url with a HTML anchor tag containing a hyperlink text reference
* to form a HTML hyperlink. * to form a HTML hyperlink.
* *
* @url the url that will be embedded in an anchor tag containing a hyperlink reference * @param url the url that will be embedded in an anchor tag containing a hyperlink reference
* @description the optional describing text that will be represented as a hyperlink. * @param description the optional describing text that will be represented as a hyperlink.
* If not specified the url will be used as hyperlink. * If not specified the url will be used as hyperlink.
* @return a HTML conform hyperlink like <a href='url'>description</a> * @return a HTML conform hyperlink like <a href='url'>description</a>
*/ */

View File

@ -158,6 +158,7 @@ void GERBER_IMAGE::ResetDefaultValues()
m_Relative = false; // false = absolute Coord, m_Relative = false; // false = absolute Coord,
// true = relative Coord // true = relative Coord
m_NoTrailingZeros = false; // true: trailing zeros deleted m_NoTrailingZeros = false; // true: trailing zeros deleted
m_DecimalFormat = false; // true: use floating point notations for coordinates
m_ImageOffset.x = m_ImageOffset.y = 0; // Coord Offset, from IO command m_ImageOffset.x = m_ImageOffset.y = 0; // Coord Offset, from IO command
m_ImageRotation = 0; // Allowed 0, 90, 180, 270 (in degree) m_ImageRotation = 0; // Allowed 0, 90, 180, 270 (in degree)
m_LocalRotation = 0.0; // Layer totation from RO command (in 0.1 degree) m_LocalRotation = 0.0; // Layer totation from RO command (in 0.1 degree)

View File

@ -92,6 +92,8 @@ public:
bool m_GerbMetric; // false = Inches, true = metric bool m_GerbMetric; // false = Inches, true = metric
bool m_Relative; // false = absolute Coord, true = relative Coord bool m_Relative; // false = absolute Coord, true = relative Coord
bool m_NoTrailingZeros; // true: remove tailing zeros. bool m_NoTrailingZeros; // true: remove tailing zeros.
bool m_DecimalFormat; // true: use floating point notations for coordinates
// If true, overrides m_NoTrailingZeros parameter.
wxPoint m_ImageOffset; // Coord Offset, from IO command wxPoint m_ImageOffset; // Coord Offset, from IO command
wxSize m_FmtScale; // Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4 wxSize m_FmtScale; // Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4
wxSize m_FmtLen; // Nb chars per coord. ex fmt 2.3, m_FmtLen = 5 wxSize m_FmtLen; // Nb chars per coord. ex fmt 2.3, m_FmtLen = 5

View File

@ -11,13 +11,13 @@
/* These routines read the text string point from Text. /* These routines read the text string point from Text.
* After use, advanced Text the beginning of the sequence unread * On exit, Text points the beginning of the sequence unread
*/ */
wxPoint GERBER_IMAGE::ReadXYCoord( char*& Text ) wxPoint GERBER_IMAGE::ReadXYCoord( char*& Text )
{ {
wxPoint pos; wxPoint pos;
int type_coord = 0, current_coord, nbdigits; int type_coord = 0, current_coord, nbdigits;
bool is_float = false; bool is_float = m_DecimalFormat;
char* text; char* text;
char line[256]; char line[256];
@ -41,7 +41,7 @@ wxPoint GERBER_IMAGE::ReadXYCoord( char*& Text )
nbdigits = 0; nbdigits = 0;
while( IsNumber( *Text ) ) while( IsNumber( *Text ) )
{ {
if( *Text == '.' ) if( *Text == '.' ) // Force decimat format if reading a floating point number
is_float = true; is_float = true;
// count digits only (sign and decimal point are not counted) // count digits only (sign and decimal point are not counted)

View File

@ -151,7 +151,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{ {
int code; int code;
int xy_seq_len, xy_seq_char; int xy_seq_len, xy_seq_char;
bool ok = TRUE; bool ok = true;
char line[GERBER_BUFZ]; char line[GERBER_BUFZ];
wxString msg; wxString msg;
double fcoord; double fcoord;
@ -173,22 +173,29 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
break; break;
case 'L': // No Leading 0 case 'L': // No Leading 0
m_NoTrailingZeros = FALSE; m_DecimalFormat = false;
m_NoTrailingZeros = false;
text++; text++;
break; break;
case 'T': // No trailing 0 case 'T': // No trailing 0
m_NoTrailingZeros = TRUE; m_DecimalFormat = false;
m_NoTrailingZeros = true;
text++;
break;
case 'D': // Decimal format: sometimes found, but not really documented
m_DecimalFormat = true;
text++; text++;
break; break;
case 'A': // Absolute coord case 'A': // Absolute coord
m_Relative = FALSE; m_Relative = false;
text++; text++;
break; break;
case 'I': // Absolute coord case 'I': // Relative coord
m_Relative = TRUE; m_Relative = true;
text++; text++;
break; break;
@ -236,7 +243,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
default: default:
GetEndOfBlock( buff, text, m_Current_File ); GetEndOfBlock( buff, text, m_Current_File );
ok = FALSE; ok = false;
break; break;
} }
} }
@ -277,9 +284,9 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
case MODE_OF_UNITS: case MODE_OF_UNITS:
code = ReadXCommand( text ); code = ReadXCommand( text );
if( code == INCH ) if( code == INCH )
m_GerbMetric = FALSE; m_GerbMetric = false;
else if( code == MILLIMETER ) else if( code == MILLIMETER )
m_GerbMetric = TRUE; m_GerbMetric = true;
conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT; conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT;
break; break;
@ -505,7 +512,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
case INCLUDE_FILE: case INCLUDE_FILE:
if( m_FilesPtr >= INCLUDE_FILES_CNT_MAX ) if( m_FilesPtr >= INCLUDE_FILES_CNT_MAX )
{ {
ok = FALSE; ok = false;
ReportMessage( _( "Too many include files!!" ) ); ReportMessage( _( "Too many include files!!" ) );
break; break;
} }
@ -518,7 +525,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{ {
msg.Printf( wxT( "include file <%s> not found." ), line ); msg.Printf( wxT( "include file <%s> not found." ), line );
ReportMessage( msg ); ReportMessage( msg );
ok = FALSE; ok = false;
m_Current_File = m_FilesList[m_FilesPtr]; m_Current_File = m_FilesList[m_FilesPtr];
break; break;
} }
@ -542,11 +549,11 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
*/ */
if( *text++ != 'D' ) if( *text++ != 'D' )
{ {
ok = FALSE; ok = false;
break; break;
} }
m_Has_DCode = TRUE; m_Has_DCode = true;
code = ReadInt( text ); code = ReadInt( text );
@ -593,7 +600,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
dcode->m_DrillShape = APT_DEF_RECT_HOLE; dcode->m_DrillShape = APT_DEF_RECT_HOLE;
} }
dcode->m_Defined = TRUE; dcode->m_Defined = true;
break; break;
case 'O': // oval case 'O': // oval
@ -631,7 +638,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
wxRound( ReadDouble( text ) * conv_scale ); wxRound( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_RECT_HOLE; dcode->m_DrillShape = APT_DEF_RECT_HOLE;
} }
dcode->m_Defined = TRUE; dcode->m_Defined = true;
break; break;
case 'P': case 'P':
@ -679,7 +686,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
wxRound( ReadDouble( text ) * conv_scale ); wxRound( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_RECT_HOLE; dcode->m_DrillShape = APT_DEF_RECT_HOLE;
} }
dcode->m_Defined = TRUE; dcode->m_Defined = true;
break; break;
} }
} }
@ -722,7 +729,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
break; break;
default: default:
ok = FALSE; ok = false;
break; break;
} }
@ -739,10 +746,10 @@ bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file )
while( (text < buff + GERBER_BUFZ) && *text ) while( (text < buff + GERBER_BUFZ) && *text )
{ {
if( *text == '*' ) if( *text == '*' )
return TRUE; return true;
if( *text == '%' ) if( *text == '%' )
return TRUE; return true;
text++; text++;
} }
@ -753,7 +760,7 @@ bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file )
text = buff; text = buff;
} }
return FALSE; return false;
} }
/** /**