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
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>
================================================================================
Gerbview:

View File

@ -31,7 +31,8 @@ option(USE_WX_OVERLAY
"Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental")
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.
@ -39,9 +40,9 @@ option(USE_BOOST_POLYGON_LIBRARY
if(CMAKE_COMPILER_IS_GNUCXX)
# 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_EXE_LINKER_FLAGS_RELEASE "-s")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc")
# Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")

View File

@ -13,10 +13,10 @@
/* Used icons:
* lang_xx_xpm[]; // Icons of various national flags
* show_3d_xpm[]; // 3D icon
* lang_xx_xpm[]; // Icons of various national flags
* show_3d_xpm[]; // 3D icon
* edit_module_xpm[];
* kicad_icon_xpm[]; // Icon of the application
* kicad_icon_xpm[]; // Icon of the application
*/
#include "bitmaps.h"
#include "wxstruct.h"
@ -73,7 +73,14 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
#else
<< wxT( " Ansi " );
#endif
libVersion << wxT( "and " )
#if USE_BOOST_POLYGON_LIBRARY
<< wxT( "boost::polygon" );
#else
<< wxT( "kbool library" );
#endif
libVersion << wxT( "\n" );
/* 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
* to form a HTML hyperlink.
*
* @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 url the url that will be embedded in an anchor tag containing a hyperlink reference
* @param description the optional describing text that will be represented as a hyperlink.
* If not specified the url will be used as hyperlink.
* @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,
// true = relative Coord
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_ImageRotation = 0; // Allowed 0, 90, 180, 270 (in 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_Relative; // false = absolute Coord, true = relative Coord
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
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

View File

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