Pcbnew: fix issue about order of tracks this order was modified when reading and writing a board, even without any change in board.

Fix compil warnings and wx28 compatibility.
code cleaning in autoroute functions.
This commit is contained in:
jean-pierre charras 2012-06-11 14:04:34 +02:00
commit c4c2cd3acd
10 changed files with 267 additions and 350 deletions

View File

@ -59,7 +59,7 @@
* graduated from 0 (rotation allowed) to 10 (rotation count null) * graduated from 0 (rotation allowed) to 10 (rotation count null)
* the count is increased. * the count is increased.
*/ */
static const float OrientPenality[11] = static const double OrientPenality[11] =
{ {
2.0f, /* CntRot = 0 rotation prohibited */ 2.0f, /* CntRot = 0 rotation prohibited */
1.9f, /* CntRot = 1 */ 1.9f, /* CntRot = 1 */
@ -82,7 +82,7 @@ static const float OrientPenality[11] =
static wxPoint CurrPosition; // Current position of the current module placement static wxPoint CurrPosition; // Current position of the current module placement
static bool AutoPlaceShowAll = true; static bool AutoPlaceShowAll = true;
float MinCout; double MinCout;
static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide ); static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide );
@ -251,7 +251,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
DrawInfoPlace( DC ); DrawInfoPlace( DC );
error = GetOptimalModulePlacement( Module, DC ); error = GetOptimalModulePlacement( Module, DC );
float BestScore = MinCout; double BestScore = MinCout;
PosOK = CurrPosition; PosOK = CurrPosition;
if( error == ESC ) if( error == ESC )
@ -388,8 +388,8 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
ox = RoutingMatrix.m_BrdBox.GetX() + (jj * RoutingMatrix.m_GridRouting); ox = RoutingMatrix.m_BrdBox.GetX() + (jj * RoutingMatrix.m_GridRouting);
color = BLACK; color = BLACK;
top_state = GetCell( ii, jj, TOP ); top_state = RoutingMatrix.GetCell( ii, jj, TOP );
bottom_state = GetCell( ii, jj, BOTTOM ); bottom_state = RoutingMatrix.GetCell( ii, jj, BOTTOM );
if( top_state & CELL_is_ZONE ) if( top_state & CELL_is_ZONE )
color = BLUE; color = BLUE;
@ -403,7 +403,8 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
color = LIGHTGREEN; color = LIGHTGREEN;
else /* Display the filling and keep out regions. */ else /* Display the filling and keep out regions. */
{ {
if( GetDist( ii, jj, TOP ) || GetDist( ii, jj, BOTTOM ) ) if( RoutingMatrix.GetDist( ii, jj, TOP ) ||
RoutingMatrix.GetDist( ii, jj, BOTTOM ) )
color = DARKGRAY; color = DARKGRAY;
} }
@ -415,7 +416,6 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
int PCB_EDIT_FRAME::GenPlaceBoard() int PCB_EDIT_FRAME::GenPlaceBoard()
{ {
int NbCells;
wxString msg; wxString msg;
RoutingMatrix.UnInitRoutingMatrix(); RoutingMatrix.UnInitRoutingMatrix();
@ -429,14 +429,14 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
} }
RoutingMatrix.ComputeMatrixSize( GetBoard(), true ); RoutingMatrix.ComputeMatrixSize( GetBoard(), true );
NbCells = Ncols * Nrows; int nbCells = RoutingMatrix.m_Ncols * RoutingMatrix.m_Nrows;
m_messagePanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
msg.Printf( wxT( "%d" ), Ncols ); msg.Printf( wxT( "%d" ), RoutingMatrix.m_Ncols );
m_messagePanel->SetMessage( 1, _( "Cols" ), msg, GREEN ); m_messagePanel->SetMessage( 1, _( "Cols" ), msg, GREEN );
msg.Printf( wxT( "%d" ), Nrows ); msg.Printf( wxT( "%d" ), RoutingMatrix.m_Nrows );
m_messagePanel->SetMessage( 7, _( "Lines" ), msg, GREEN ); m_messagePanel->SetMessage( 7, _( "Lines" ), msg, GREEN );
msg.Printf( wxT( "%d" ), NbCells ); msg.Printf( wxT( "%d" ), nbCells );
m_messagePanel->SetMessage( 14, _( "Cells." ), msg, YELLOW ); m_messagePanel->SetMessage( 14, _( "Cells." ), msg, YELLOW );
/* Choose the number of board sides. */ /* Choose the number of board sides. */
@ -494,7 +494,8 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
// Mark cells of the routing matrix to CELL_is_ZONE // Mark cells of the routing matrix to CELL_is_ZONE
// (i.e. availlable cell to place a module ) // (i.e. availlable cell to place a module )
// Init a starting point of attachment to the area. // Init a starting point of attachment to the area.
OrCell( Nrows / 2, Ncols / 2, BOTTOM, CELL_is_ZONE ); RoutingMatrix.OrCell( RoutingMatrix.m_Nrows / 2, RoutingMatrix.m_Ncols / 2,
BOTTOM, CELL_is_ZONE );
// find and mark all other availlable cells: // find and mark all other availlable cells:
for( int ii = 1; ii != 0; ) for( int ii = 1; ii != 0; )
@ -503,7 +504,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
// Initialize top layer. to the same value as the bottom layer // Initialize top layer. to the same value as the bottom layer
if( RoutingMatrix.m_BoardSide[TOP] ) if( RoutingMatrix.m_BoardSide[TOP] )
memcpy( RoutingMatrix.m_BoardSide[TOP], RoutingMatrix.m_BoardSide[BOTTOM], memcpy( RoutingMatrix.m_BoardSide[TOP], RoutingMatrix.m_BoardSide[BOTTOM],
NbCells * sizeof(MATRIX_CELL) ); nbCells * sizeof(MATRIX_CELL) );
return 1; return 1;
} }
@ -697,10 +698,10 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
LastPosOK = CurrPosition; LastPosOK = CurrPosition;
mincout = Score; mincout = Score;
wxString msg; wxString msg;
msg.Printf( wxT( "Score %g, pos %3.4f, %3.4f" ), msg.Printf( wxT( "Score %g, pos %3.4g, %3.4g" ),
mincout, mincout,
(float) LastPosOK.x / 10000, (double) LastPosOK.x / 10000,
(float) LastPosOK.y / 10000 ); (double) LastPosOK.y / 10000 );
SetStatusText( msg ); SetStatusText( msg );
} }
} }
@ -763,20 +764,20 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side )
if( row_min < 0 ) if( row_min < 0 )
row_min = 0; row_min = 0;
if( row_max >= ( Nrows - 1 ) ) if( row_max >= ( RoutingMatrix.m_Nrows - 1 ) )
row_max = Nrows - 1; row_max = RoutingMatrix.m_Nrows - 1;
if( col_min < 0 ) if( col_min < 0 )
col_min = 0; col_min = 0;
if( col_max >= ( Ncols - 1 ) ) if( col_max >= ( RoutingMatrix.m_Ncols - 1 ) )
col_max = Ncols - 1; col_max = RoutingMatrix.m_Ncols - 1;
for( row = row_min; row <= row_max; row++ ) for( row = row_min; row <= row_max; row++ )
{ {
for( col = col_min; col <= col_max; col++ ) for( col = col_min; col <= col_max; col++ )
{ {
data = GetCell( row, col, side ); data = RoutingMatrix.GetCell( row, col, side );
if( ( data & CELL_is_ZONE ) == 0 ) if( ( data & CELL_is_ZONE ) == 0 )
return OUT_OF_BOARD; return OUT_OF_BOARD;
@ -820,14 +821,14 @@ unsigned int CalculateKeepOutArea( int ux0, int uy0, int ux1, int uy1, int side
if( row_min < 0 ) if( row_min < 0 )
row_min = 0; row_min = 0;
if( row_max >= ( Nrows - 1 ) ) if( row_max >= ( RoutingMatrix.m_Nrows - 1 ) )
row_max = Nrows - 1; row_max = RoutingMatrix.m_Nrows - 1;
if( col_min < 0 ) if( col_min < 0 )
col_min = 0; col_min = 0;
if( col_max >= ( Ncols - 1 ) ) if( col_max >= ( RoutingMatrix.m_Ncols - 1 ) )
col_max = Ncols - 1; col_max = RoutingMatrix.m_Ncols - 1;
keepOut = 0; keepOut = 0;
@ -835,7 +836,7 @@ unsigned int CalculateKeepOutArea( int ux0, int uy0, int ux1, int uy1, int side
{ {
for( col = col_min; col <= col_max; col++ ) for( col = col_min; col <= col_max; col++ )
{ {
keepOut += (int) GetDist( row, col, side ); keepOut += RoutingMatrix.GetDist( row, col, side );
} }
} }
@ -1001,14 +1002,14 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
if( row_min < 0 ) if( row_min < 0 )
row_min = 0; row_min = 0;
if( row_max >= (Nrows - 1) ) if( row_max >= (RoutingMatrix.m_Nrows - 1) )
row_max = Nrows - 1; row_max = RoutingMatrix.m_Nrows - 1;
if( col_min < 0 ) if( col_min < 0 )
col_min = 0; col_min = 0;
if( col_max >= (Ncols - 1) ) if( col_max >= (RoutingMatrix.m_Ncols - 1) )
col_max = Ncols - 1; col_max = RoutingMatrix.m_Ncols - 1;
for( row = row_min; row <= row_max; row++ ) for( row = row_min; row <= row_max; row++ )
{ {
@ -1036,15 +1037,15 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
if( trace & 1 ) if( trace & 1 )
{ {
data = GetDist( row, col, BOTTOM ) + LocalKeepOut; data = RoutingMatrix.GetDist( row, col, BOTTOM ) + LocalKeepOut;
SetDist( row, col, BOTTOM, data ); RoutingMatrix.SetDist( row, col, BOTTOM, data );
} }
if( trace & 2 ) if( trace & 2 )
{ {
data = GetDist( row, col, TOP ); data = RoutingMatrix.GetDist( row, col, TOP );
data = MAX( data, LocalKeepOut ); data = MAX( data, LocalKeepOut );
SetDist( row, col, TOP, data ); RoutingMatrix.SetDist( row, col, TOP, data );
} }
} }
} }
@ -1180,23 +1181,23 @@ int propagate()
#define NO_CELL_ZONE (HOLE | CELL_is_EDGE | CELL_is_ZONE) #define NO_CELL_ZONE (HOLE | CELL_is_EDGE | CELL_is_ZONE)
pt_cell_V.reserve( MAX( Nrows, Ncols ) ); pt_cell_V.reserve( MAX( RoutingMatrix.m_Nrows, RoutingMatrix.m_Ncols ) );
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
// Search from left to right and top to bottom. // Search from left to right and top to bottom.
for( row = 0; row < Nrows; row++ ) for( row = 0; row < RoutingMatrix.m_Nrows; row++ )
{ {
old_cell_H = 0; old_cell_H = 0;
for( col = 0; col < Ncols; col++ ) for( col = 0; col < RoutingMatrix.m_Ncols; col++ )
{ {
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE; current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */ if( current_cell == 0 ) /* a free cell is found */
{ {
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) ) if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
{ {
OrCell( row, col, BOTTOM, CELL_is_ZONE ); RoutingMatrix.OrCell( row, col, BOTTOM, CELL_is_ZONE );
current_cell = CELL_is_ZONE; current_cell = CELL_is_ZONE;
nbpoints++; nbpoints++;
} }
@ -1209,19 +1210,19 @@ int propagate()
// Search from right to left and top to bottom/ // Search from right to left and top to bottom/
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
for( row = 0; row < Nrows; row++ ) for( row = 0; row < RoutingMatrix.m_Nrows; row++ )
{ {
old_cell_H = 0; old_cell_H = 0;
for( col = Ncols - 1; col >= 0; col-- ) for( col = RoutingMatrix.m_Ncols - 1; col >= 0; col-- )
{ {
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE; current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */ if( current_cell == 0 ) /* a free cell is found */
{ {
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) ) if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
{ {
OrCell( row, col, BOTTOM, CELL_is_ZONE ); RoutingMatrix.OrCell( row, col, BOTTOM, CELL_is_ZONE );
current_cell = CELL_is_ZONE; current_cell = CELL_is_ZONE;
nbpoints++; nbpoints++;
} }
@ -1234,19 +1235,19 @@ int propagate()
// Search from bottom to top and right to left. // Search from bottom to top and right to left.
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
for( col = Ncols - 1; col >= 0; col-- ) for( col = RoutingMatrix.m_Ncols - 1; col >= 0; col-- )
{ {
old_cell_H = 0; old_cell_H = 0;
for( row = Nrows - 1; row >= 0; row-- ) for( row = RoutingMatrix.m_Nrows - 1; row >= 0; row-- )
{ {
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE; current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */ if( current_cell == 0 ) /* a free cell is found */
{ {
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) ) if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
{ {
OrCell( row, col, BOTTOM, CELL_is_ZONE ); RoutingMatrix.OrCell( row, col, BOTTOM, CELL_is_ZONE );
current_cell = CELL_is_ZONE; current_cell = CELL_is_ZONE;
nbpoints++; nbpoints++;
} }
@ -1259,19 +1260,19 @@ int propagate()
// Search from bottom to top and left to right. // Search from bottom to top and left to right.
fill( pt_cell_V.begin(), pt_cell_V.end(), 0 ); fill( pt_cell_V.begin(), pt_cell_V.end(), 0 );
for( col = 0; col < Ncols; col++ ) for( col = 0; col < RoutingMatrix.m_Ncols; col++ )
{ {
old_cell_H = 0; old_cell_H = 0;
for( row = Nrows - 1; row >= 0; row-- ) for( row = RoutingMatrix.m_Nrows - 1; row >= 0; row-- )
{ {
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE; current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */ if( current_cell == 0 ) /* a free cell is found */
{ {
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) ) if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
{ {
OrCell( row, col, BOTTOM, CELL_is_ZONE ); RoutingMatrix.OrCell( row, col, BOTTOM, CELL_is_ZONE );
current_cell = CELL_is_ZONE; current_cell = CELL_is_ZONE;
nbpoints++; nbpoints++;
} }

View File

@ -48,9 +48,6 @@
int Nb_Sides; /* Number of layer for autorouting (0 or 1) */ int Nb_Sides; /* Number of layer for autorouting (0 or 1) */
int Nrows = ILLEGAL;
int Ncols = ILLEGAL;
int Ntotal;
int OpenNodes; /* total number of nodes opened */ int OpenNodes; /* total number of nodes opened */
int ClosNodes; /* total number of nodes closed */ int ClosNodes; /* total number of nodes closed */
int MoveNodes; /* total number of nodes moved */ int MoveNodes; /* total number of nodes moved */
@ -194,7 +191,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
PlaceCells( GetBoard(), -1, FORCE_PADS ); PlaceCells( GetBoard(), -1, FORCE_PADS );
/* Construction of the track list for router. */ /* Construction of the track list for router. */
Build_Work( GetBoard() ); RoutingMatrix.m_RouteCount = Build_Work( GetBoard() );
// DisplayRoutingMatrix( m_canvas, DC ); // DisplayRoutingMatrix( m_canvas, DC );
@ -234,7 +231,7 @@ void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
{ {
int dcell0, dcell1 = 0, color; int dcell0, dcell1 = 0, color;
int maxi = 600 / Ncols; int maxi = 600 / RoutingMatrix.m_Ncols;
maxi = ( maxi * 3 ) / 4; maxi = ( maxi * 3 ) / 4;
if( !maxi ) if( !maxi )
@ -242,12 +239,12 @@ void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
for( int col = 0; col < Ncols; col++ ) for( int col = 0; col < RoutingMatrix.m_Ncols; col++ )
{ {
for( int row = 0; row < Nrows; row++ ) for( int row = 0; row < RoutingMatrix.m_Nrows; row++ )
{ {
color = 0; color = 0;
dcell0 = GetCell( row, col, BOTTOM ); dcell0 = RoutingMatrix.GetCell( row, col, BOTTOM );
if( dcell0 & HOLE ) if( dcell0 & HOLE )
color = GREEN; color = GREEN;

View File

@ -68,11 +68,6 @@ extern int Nb_Sides; /* Number of layers for autorouting (0 or 1) */
#define FORCE_PADS 1 /* Force placement of pads for any Netcode */ #define FORCE_PADS 1 /* Force placement of pads for any Netcode */
/* board dimensions */
extern int Nrows;
extern int Ncols;
extern int Ntotal;
/* search statistics */ /* search statistics */
extern int OpenNodes; /* total number of nodes opened */ extern int OpenNodes; /* total number of nodes opened */
extern int ClosNodes; /* total number of nodes closed */ extern int ClosNodes; /* total number of nodes closed */
@ -88,26 +83,35 @@ typedef char DIR_CELL;
/** /**
* class MATRIX_ROUTING_HEAD * class MATRIX_ROUTING_HEAD
* handle the matrix routing that describes the actual board
*/ */
class MATRIX_ROUTING_HEAD /* header of blocks of MATRIX_CELL */ class MATRIX_ROUTING_HEAD
{ {
public: public:
MATRIX_CELL* m_BoardSide[MAX_SIDES_COUNT]; /* ptr to block of memory: 2-sided board */ MATRIX_CELL* m_BoardSide[MAX_SIDES_COUNT]; // the image map of 2 board sides
DIST_CELL* m_DistSide[MAX_SIDES_COUNT]; /* ptr to block of memory: path distance to DIST_CELL* m_DistSide[MAX_SIDES_COUNT]; // the image map of 2 board sides: distance to
* cells */ // cells
DIR_CELL* m_DirSide[MAX_SIDES_COUNT]; /* header of blocks of chars:pointers back to DIR_CELL* m_DirSide[MAX_SIDES_COUNT]; // the image map of 2 board sides: pointers back to
* source */ // source
bool m_InitMatrixDone; bool m_InitMatrixDone;
int m_Layers; int m_Layers; // Layer count (1 2 )
int m_GridRouting; // Size of grid for autoplace/autoroute int m_GridRouting; // Size of grid for autoplace/autoroute
EDA_RECT m_BrdBox; // Actual board bounding box EDA_RECT m_BrdBox; // Actual board bounding box
int m_Nrows, m_Ncols; int m_Nrows, m_Ncols; // Matrix size
int m_MemSize; int m_MemSize; // Memory requirement, just for statistics
int m_RouteCount; // Number of routes
private:
void (MATRIX_ROUTING_HEAD::* m_opWriteCell)( int aRow, int aCol, int aSide, MATRIX_CELL aCell); // a pointeur to the current selected cell op
public: public:
MATRIX_ROUTING_HEAD(); MATRIX_ROUTING_HEAD();
~MATRIX_ROUTING_HEAD(); ~MATRIX_ROUTING_HEAD();
void WriteCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell)
{
(*this.*m_opWriteCell)( aRow, aCol, aSide, aCell );
}
/** /**
* Function ComputeMatrixSize * Function ComputeMatrixSize
* calculates the number of rows and columns of dimensions of \a aPcb for routing and * calculates the number of rows and columns of dimensions of \a aPcb for routing and
@ -127,6 +131,21 @@ public:
int InitRoutingMatrix(); int InitRoutingMatrix();
void UnInitRoutingMatrix(); void UnInitRoutingMatrix();
// Initialize WriteCell to make the aLogicOp
void SetCellOperation( int aLogicOp );
// functions to read/write one cell ( point on grid routing matrix:
MATRIX_CELL GetCell( int aRow, int aCol, int aSide);
void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void AddCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
DIST_CELL GetDist( int aRow, int aCol, int aSide );
void SetDist( int aRow, int aCol, int aSide, DIST_CELL );
int GetDir( int aRow, int aCol, int aSide );
void SetDir( int aRow, int aCol, int aSide, int aDir);
}; };
extern MATRIX_ROUTING_HEAD RoutingMatrix; /* 2-sided board */ extern MATRIX_ROUTING_HEAD RoutingMatrix; /* 2-sided board */
@ -195,20 +214,9 @@ void SortWork(); /* order the work items; shortest first */
int GetApxDist( int r1, int c1, int r2, int c2 ); int GetApxDist( int r1, int c1, int r2, int c2 );
int CalcDist(int x,int y,int z ,int side ); int CalcDist(int x,int y,int z ,int side );
/* BOARD.CPP */ /* routing_matrix.cpp */
int Build_Work( BOARD * Pcb ); int Build_Work( BOARD * Pcb );
void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 ); void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 );
MATRIX_CELL GetCell( int aRow, int aCol, int aSide);
void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
void AddCell( int aRow, int aCol, int aSide, MATRIX_CELL aCell);
DIST_CELL GetDist( int aRow, int aCol, int aSide );
void SetDist( int aRow, int aCol, int aSide, DIST_CELL );
int GetDir( int aRow, int aCol, int aSide );
void SetDir( int aRow, int aCol, int aSide, int aDir);
#endif // AUTOROUT_H #endif // AUTOROUT_H

View File

@ -71,17 +71,17 @@ static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
{ \ { \
if( layer < 0 ) \ if( layer < 0 ) \
{ \ { \
WriteCell( dy, dx, BOTTOM, color ); \ RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \
if( Nb_Sides ) \ if( Nb_Sides ) \
WriteCell( dy, dx, TOP, color ); \ RoutingMatrix.WriteCell( dy, dx, TOP, color ); \
} \ } \
else \ else \
{ \ { \
if( layer == Route_Layer_BOTTOM ) \ if( layer == Route_Layer_BOTTOM ) \
WriteCell( dy, dx, BOTTOM, color ); \ RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \
if( Nb_Sides ) \ if( Nb_Sides ) \
if( layer == Route_Layer_TOP ) \ if( layer == Route_Layer_TOP ) \
WriteCell( dy, dx, TOP, color ); \ RoutingMatrix.WriteCell( dy, dx, TOP, color ); \
} \ } \
} }
@ -151,8 +151,6 @@ void TraceFilledCircle( BOARD* aPcb,
int row_max, col_max, row_min, col_min; int row_max, col_max, row_min, col_min;
int trace = 0; int trace = 0;
double fdistmin, fdistx, fdisty; double fdistmin, fdistx, fdisty;
void (* WriteCell)( int, int, int, MATRIX_CELL );
int tstwrite = 0; int tstwrite = 0;
int distmin; int distmin;
@ -166,29 +164,7 @@ void TraceFilledCircle( BOARD* aPcb,
if( trace == 0 ) if( trace == 0 )
return; return;
switch( op_logic ) RoutingMatrix.SetCellOperation( op_logic );
{
default:
case WRITE_CELL:
WriteCell = SetCell;
break;
case WRITE_OR_CELL:
WriteCell = OrCell;
break;
case WRITE_XOR_CELL:
WriteCell = XorCell;
break;
case WRITE_AND_CELL:
WriteCell = AndCell;
break;
case WRITE_ADD_CELL:
WriteCell = AddCell;
break;
}
cx -= aPcb->GetBoundingBox().GetX(); cx -= aPcb->GetBoundingBox().GetX();
cy -= aPcb->GetBoundingBox().GetY(); cy -= aPcb->GetBoundingBox().GetY();
@ -210,14 +186,14 @@ void TraceFilledCircle( BOARD* aPcb,
if( row_min < 0 ) if( row_min < 0 )
row_min = 0; row_min = 0;
if( row_max >= (Nrows - 1) ) if( row_max >= (RoutingMatrix.m_Nrows - 1) )
row_max = Nrows - 1; row_max = RoutingMatrix.m_Nrows - 1;
if( col_min < 0 ) if( col_min < 0 )
col_min = 0; col_min = 0;
if( col_max >= (Ncols - 1) ) if( col_max >= (RoutingMatrix.m_Ncols - 1) )
col_max = Ncols - 1; col_max = RoutingMatrix.m_Ncols - 1;
// Calculate coordinate limits of cell belonging to the rectangle. // Calculate coordinate limits of cell belonging to the rectangle.
if( row_min > row_max ) if( row_min > row_max )
@ -242,10 +218,10 @@ void TraceFilledCircle( BOARD* aPcb,
continue; continue;
if( trace & 1 ) if( trace & 1 )
WriteCell( row, col, BOTTOM, color ); RoutingMatrix.WriteCell( row, col, BOTTOM, color );
if( trace & 2 ) if( trace & 2 )
WriteCell( row, col, TOP, color ); RoutingMatrix.WriteCell( row, col, TOP, color );
tstwrite = 1; tstwrite = 1;
} }
@ -274,10 +250,10 @@ void TraceFilledCircle( BOARD* aPcb,
continue; continue;
if( trace & 1 ) if( trace & 1 )
WriteCell( row, col, BOTTOM, color ); RoutingMatrix.WriteCell( row, col, BOTTOM, color );
if( trace & 2 ) if( trace & 2 )
WriteCell( row, col, TOP, color ); RoutingMatrix.WriteCell( row, col, TOP, color );
} }
} }
} }
@ -359,26 +335,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
int dx, dy, lim; int dx, dy, lim;
int cumul, inc, il, delta; int cumul, inc, il, delta;
void (* WriteCell)( int, int, int, MATRIX_CELL ); RoutingMatrix.SetCellOperation( op_logic );
switch( op_logic )
{
default:
case WRITE_CELL:
WriteCell = SetCell; break;
case WRITE_OR_CELL:
WriteCell = OrCell; break;
case WRITE_XOR_CELL:
WriteCell = XorCell; break;
case WRITE_AND_CELL:
WriteCell = AndCell; break;
case WRITE_ADD_CELL:
WriteCell = AddCell; break;
}
if( x0 == x1 ) // Vertical. if( x0 == x1 ) // Vertical.
{ {
@ -390,14 +347,14 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
dx = x0 / RoutingMatrix.m_GridRouting; dx = x0 / RoutingMatrix.m_GridRouting;
// Clipping limits of board. // Clipping limits of board.
if( ( dx < 0 ) || ( dx >= Ncols ) ) if( ( dx < 0 ) || ( dx >= RoutingMatrix.m_Ncols ) )
return; return;
if( dy < 0 ) if( dy < 0 )
dy = 0; dy = 0;
if( lim >= Nrows ) if( lim >= RoutingMatrix.m_Nrows )
lim = Nrows - 1; lim = RoutingMatrix.m_Nrows - 1;
for( ; dy <= lim; dy++ ) for( ; dy <= lim; dy++ )
{ {
@ -417,14 +374,14 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
dy = y0 / RoutingMatrix.m_GridRouting; dy = y0 / RoutingMatrix.m_GridRouting;
// Clipping limits of board. // Clipping limits of board.
if( ( dy < 0 ) || ( dy >= Nrows ) ) if( ( dy < 0 ) || ( dy >= RoutingMatrix.m_Nrows ) )
return; return;
if( dx < 0 ) if( dx < 0 )
dx = 0; dx = 0;
if( lim >= Ncols ) if( lim >= RoutingMatrix.m_Ncols )
lim = Ncols - 1; lim = RoutingMatrix.m_Ncols - 1;
for( ; dx <= lim; dx++ ) for( ; dx <= lim; dx++ )
{ {
@ -455,7 +412,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
for( ; dx <= lim; ) for( ; dx <= lim; )
{ {
if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < Ncols ) && ( dy < Nrows ) ) if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < RoutingMatrix.m_Ncols ) && ( dy < RoutingMatrix.m_Nrows ) )
{ {
OP_CELL( layer, dy, dx ); OP_CELL( layer, dy, dx );
} }
@ -492,7 +449,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
for( ; dy <= lim; ) for( ; dy <= lim; )
{ {
if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < Ncols ) && ( dy < Nrows ) ) if( ( dx >= 0 ) && ( dy >= 0 ) && ( dx < RoutingMatrix.m_Ncols ) && ( dy < RoutingMatrix.m_Nrows ) )
{ {
OP_CELL( layer, dy, dx ); OP_CELL( layer, dy, dx );
} }
@ -517,8 +474,6 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
int row_min, row_max, col_min, col_max; int row_min, row_max, col_min, col_max;
int trace = 0; int trace = 0;
void (* WriteCell)( int, int, int, MATRIX_CELL );
if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) ) if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) )
trace = 1; // Trace on BOTTOM trace = 1; // Trace on BOTTOM
@ -528,29 +483,7 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
if( trace == 0 ) if( trace == 0 )
return; return;
switch( op_logic ) RoutingMatrix.SetCellOperation( op_logic );
{
default:
case WRITE_CELL:
WriteCell = SetCell;
break;
case WRITE_OR_CELL:
WriteCell = OrCell;
break;
case WRITE_XOR_CELL:
WriteCell = XorCell;
break;
case WRITE_AND_CELL:
WriteCell = AndCell;
break;
case WRITE_ADD_CELL:
WriteCell = AddCell;
break;
}
ux0 -= aPcb->GetBoundingBox().GetX(); ux0 -= aPcb->GetBoundingBox().GetX();
uy0 -= aPcb->GetBoundingBox().GetY(); uy0 -= aPcb->GetBoundingBox().GetY();
@ -573,24 +506,24 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
if( row_min < 0 ) if( row_min < 0 )
row_min = 0; row_min = 0;
if( row_max >= ( Nrows - 1 ) ) if( row_max >= ( RoutingMatrix.m_Nrows - 1 ) )
row_max = Nrows - 1; row_max = RoutingMatrix.m_Nrows - 1;
if( col_min < 0 ) if( col_min < 0 )
col_min = 0; col_min = 0;
if( col_max >= ( Ncols - 1 ) ) if( col_max >= ( RoutingMatrix.m_Ncols - 1 ) )
col_max = Ncols - 1; col_max = RoutingMatrix.m_Ncols - 1;
for( row = row_min; row <= row_max; row++ ) for( row = row_min; row <= row_max; row++ )
{ {
for( col = col_min; col <= col_max; col++ ) for( col = col_min; col <= col_max; col++ )
{ {
if( trace & 1 ) if( trace & 1 )
WriteCell( row, col, BOTTOM, color ); RoutingMatrix.WriteCell( row, col, BOTTOM, color );
if( trace & 2 ) if( trace & 2 )
WriteCell( row, col, TOP, color ); RoutingMatrix.WriteCell( row, col, TOP, color );
} }
} }
} }
@ -606,8 +539,6 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
int rotrow, rotcol; int rotrow, rotcol;
int trace = 0; int trace = 0;
void (* WriteCell)( int, int, int, MATRIX_CELL );
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
trace = 1; // Trace on BOTTOM trace = 1; // Trace on BOTTOM
@ -620,29 +551,7 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
if( trace == 0 ) if( trace == 0 )
return; return;
switch( op_logic ) RoutingMatrix.SetCellOperation( op_logic );
{
default:
case WRITE_CELL:
WriteCell = SetCell;
break;
case WRITE_OR_CELL:
WriteCell = OrCell;
break;
case WRITE_XOR_CELL:
WriteCell = XorCell;
break;
case WRITE_AND_CELL:
WriteCell = AndCell;
break;
case WRITE_ADD_CELL:
WriteCell = AddCell;
break;
}
ux0 -= aPcb->GetBoundingBox().GetX(); ux0 -= aPcb->GetBoundingBox().GetX();
uy0 -= aPcb->GetBoundingBox().GetY(); uy0 -= aPcb->GetBoundingBox().GetY();
@ -670,14 +579,14 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
if( row_min < 0 ) if( row_min < 0 )
row_min = 0; row_min = 0;
if( row_max >= ( Nrows - 1 ) ) if( row_max >= ( RoutingMatrix.m_Nrows - 1 ) )
row_max = Nrows - 1; row_max = RoutingMatrix.m_Nrows - 1;
if( col_min < 0 ) if( col_min < 0 )
col_min = 0; col_min = 0;
if( col_max >= ( Ncols - 1 ) ) if( col_max >= ( RoutingMatrix.m_Ncols - 1 ) )
col_max = Ncols - 1; col_max = RoutingMatrix.m_Ncols - 1;
for( row = row_min; row <= row_max; row++ ) for( row = row_min; row <= row_max; row++ )
{ {
@ -700,10 +609,10 @@ void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
continue; continue;
if( trace & 1 ) if( trace & 1 )
WriteCell( row, col, BOTTOM, color ); RoutingMatrix.WriteCell( row, col, BOTTOM, color );
if( trace & 2 ) if( trace & 2 )
WriteCell( row, col, TOP, color ); RoutingMatrix.WriteCell( row, col, TOP, color );
} }
} }
} }
@ -721,33 +630,10 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
int row_max, col_max, row_min, col_min; int row_max, col_max, row_min, col_min;
int demi_pas; int demi_pas;
void (* WriteCell)( int, int, int, MATRIX_CELL );
int angle; int angle;
int cx, cy, dx, dy; int cx, cy, dx, dy;
switch( op_logic ) RoutingMatrix.SetCellOperation( op_logic );
{
default:
case WRITE_CELL:
WriteCell = SetCell;
break;
case WRITE_OR_CELL:
WriteCell = OrCell;
break;
case WRITE_XOR_CELL:
WriteCell = XorCell;
break;
case WRITE_AND_CELL:
WriteCell = AndCell;
break;
case WRITE_ADD_CELL:
WriteCell = AddCell;
break;
}
// Make coordinate ux1 tj > ux0 to simplify calculations // Make coordinate ux1 tj > ux0 to simplify calculations
if( ux1 < ux0 ) if( ux1 < ux0 )
@ -771,8 +657,8 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
col_max = ( ux1 + lg + demi_pas ) / RoutingMatrix.m_GridRouting; col_max = ( ux1 + lg + demi_pas ) / RoutingMatrix.m_GridRouting;
if( col_max > ( Ncols - 1 ) ) if( col_max > ( RoutingMatrix.m_Ncols - 1 ) )
col_max = Ncols - 1; col_max = RoutingMatrix.m_Ncols - 1;
if( inc > 0 ) if( inc > 0 )
{ {
@ -788,14 +674,14 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
if( row_min < 0 ) if( row_min < 0 )
row_min = 0; row_min = 0;
if( row_min > ( Nrows - 1 ) ) if( row_min > ( RoutingMatrix.m_Nrows - 1 ) )
row_min = Nrows - 1; row_min = RoutingMatrix.m_Nrows - 1;
if( row_max < 0 ) if( row_max < 0 )
row_max = 0; row_max = 0;
if( row_max > ( Nrows - 1 ) ) if( row_max > ( RoutingMatrix.m_Nrows - 1 ) )
row_max = Nrows - 1; row_max = RoutingMatrix.m_Nrows - 1;
dx = ux1 - ux0; dx = ux1 - ux0;
dy = uy1 - uy0; dy = uy1 - uy0;

View File

@ -69,14 +69,12 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb, bool aUseBoardEdgesOnl
aPcb->SetBoundingBox( m_BrdBox ); aPcb->SetBoundingBox( m_BrdBox );
m_Nrows = Nrows = m_BrdBox.GetHeight() / m_GridRouting; m_Nrows = m_BrdBox.GetHeight() / m_GridRouting;
m_Ncols = Ncols = m_BrdBox.GetWidth() / m_GridRouting; m_Ncols = m_BrdBox.GetWidth() / m_GridRouting;
/* get a small margin for memory allocation: */ // gives a small margin
Ncols += 1; m_Ncols += 1;
m_Nrows = Nrows; m_Nrows += 1;
Nrows += 1;
m_Ncols = Ncols;
return true; return true;
} }
@ -103,15 +101,13 @@ int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
{ {
int ii, kk; int ii, kk;
if( Nrows <= 0 || Ncols <= 0 ) if( m_Nrows <= 0 || m_Ncols <= 0 )
return 0; return 0;
m_Nrows = Nrows;
m_Ncols = Ncols;
m_InitMatrixDone = true; // we have been called m_InitMatrixDone = true; // we have been called
// give a small margin for memory allocation: // give a small margin for memory allocation:
ii = (Nrows + 1) * (Ncols + 1); ii = (RoutingMatrix.m_Nrows + 1) * (RoutingMatrix.m_Ncols + 1);
for( kk = 0; kk < m_Layers; kk++ ) for( kk = 0; kk < m_Layers; kk++ )
{ {
@ -354,7 +350,7 @@ int Build_Work( BOARD* Pcb )
EDA_RECT bbbox = Pcb->GetBoundingBox(); EDA_RECT bbbox = Pcb->GetBoundingBox();
InitWork(); /* clear work list */ InitWork(); /* clear work list */
Ntotal = 0; int cellCount = 0;
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ ) for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
{ {
@ -379,7 +375,7 @@ int Build_Work( BOARD* Pcb )
r1 = ( pt_pad->GetPosition().y - bbbox.GetY() + demi_pas ) / RoutingMatrix.m_GridRouting; r1 = ( pt_pad->GetPosition().y - bbbox.GetY() + demi_pas ) / RoutingMatrix.m_GridRouting;
if( r1 < 0 || r1 >= Nrows ) if( r1 < 0 || r1 >= RoutingMatrix.m_Nrows )
{ {
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1, msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
pt_pad->GetPosition().y, bbbox.GetY() ); pt_pad->GetPosition().y, bbbox.GetY() );
@ -389,7 +385,7 @@ int Build_Work( BOARD* Pcb )
c1 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting; c1 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting;
if( c1 < 0 || c1 >= Ncols ) if( c1 < 0 || c1 >= RoutingMatrix.m_Ncols )
{ {
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1, msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
pt_pad->GetPosition().x, bbbox.GetX() ); pt_pad->GetPosition().x, bbbox.GetX() );
@ -402,7 +398,7 @@ int Build_Work( BOARD* Pcb )
r2 = ( pt_pad->GetPosition().y - bbbox.GetY() r2 = ( pt_pad->GetPosition().y - bbbox.GetY()
+ demi_pas ) / RoutingMatrix.m_GridRouting; + demi_pas ) / RoutingMatrix.m_GridRouting;
if( r2 < 0 || r2 >= Nrows ) if( r2 < 0 || r2 >= RoutingMatrix.m_Nrows )
{ {
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2, msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
pt_pad->GetPosition().y, bbbox.GetY() ); pt_pad->GetPosition().y, bbbox.GetY() );
@ -412,7 +408,7 @@ int Build_Work( BOARD* Pcb )
c2 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting; c2 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / RoutingMatrix.m_GridRouting;
if( c2 < 0 || c2 >= Ncols ) if( c2 < 0 || c2 >= RoutingMatrix.m_Ncols )
{ {
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2, msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
pt_pad->GetPosition().x, bbbox.GetX() ); pt_pad->GetPosition().x, bbbox.GetX() );
@ -421,115 +417,143 @@ int Build_Work( BOARD* Pcb )
} }
SetWork( r1, c1, current_net_code, r2, c2, pt_ch, 0 ); SetWork( r1, c1, current_net_code, r2, c2, pt_ch, 0 );
Ntotal++; cellCount++;
} }
SortWork(); SortWork();
return Ntotal; return cellCount;
}
// Initialize WriteCell to make the aLogicOp
void MATRIX_ROUTING_HEAD::SetCellOperation( int aLogicOp )
{
switch( aLogicOp )
{
default:
case WRITE_CELL:
m_opWriteCell = &MATRIX_ROUTING_HEAD::SetCell;
break;
case WRITE_OR_CELL:
m_opWriteCell = &MATRIX_ROUTING_HEAD::OrCell;
break;
case WRITE_XOR_CELL:
m_opWriteCell = &MATRIX_ROUTING_HEAD::XorCell;
break;
case WRITE_AND_CELL:
m_opWriteCell = &MATRIX_ROUTING_HEAD::AndCell;
break;
case WRITE_ADD_CELL:
m_opWriteCell = &MATRIX_ROUTING_HEAD::AddCell;
break;
}
} }
/* return the value stored in a cell /* return the value stored in a cell
*/ */
MATRIX_CELL GetCell( int aRow, int aCol, int aSide ) MATRIX_CELL MATRIX_ROUTING_HEAD::GetCell( int aRow, int aCol, int aSide )
{ {
MATRIX_CELL* p; MATRIX_CELL* p;
p = RoutingMatrix.m_BoardSide[aSide]; p = RoutingMatrix.m_BoardSide[aSide];
return p[aRow * Ncols + aCol]; return p[aRow * m_Ncols + aCol];
} }
/* basic cell operation : WRITE operation /* basic cell operation : WRITE operation
*/ */
void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL x ) void MATRIX_ROUTING_HEAD::SetCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
{ {
MATRIX_CELL* p; MATRIX_CELL* p;
p = RoutingMatrix.m_BoardSide[aSide]; p = RoutingMatrix.m_BoardSide[aSide];
p[aRow * Ncols + aCol] = x; p[aRow * m_Ncols + aCol] = x;
} }
/* basic cell operation : OR operation /* basic cell operation : OR operation
*/ */
void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL x ) void MATRIX_ROUTING_HEAD::OrCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
{ {
MATRIX_CELL* p; MATRIX_CELL* p;
p = RoutingMatrix.m_BoardSide[aSide]; p = RoutingMatrix.m_BoardSide[aSide];
p[aRow * Ncols + aCol] |= x; p[aRow * m_Ncols + aCol] |= x;
} }
/* basic cell operation : XOR operation /* basic cell operation : XOR operation
*/ */
void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL x ) void MATRIX_ROUTING_HEAD::XorCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
{ {
MATRIX_CELL* p; MATRIX_CELL* p;
p = RoutingMatrix.m_BoardSide[aSide]; p = RoutingMatrix.m_BoardSide[aSide];
p[aRow * Ncols + aCol] ^= x; p[aRow * m_Ncols + aCol] ^= x;
} }
/* basic cell operation : AND operation /* basic cell operation : AND operation
*/ */
void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL x ) void MATRIX_ROUTING_HEAD::AndCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
{ {
MATRIX_CELL* p; MATRIX_CELL* p;
p = RoutingMatrix.m_BoardSide[aSide]; p = RoutingMatrix.m_BoardSide[aSide];
p[aRow * Ncols + aCol] &= x; p[aRow * m_Ncols + aCol] &= x;
} }
/* basic cell operation : ADD operation /* basic cell operation : ADD operation
*/ */
void AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x ) void MATRIX_ROUTING_HEAD::AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
{ {
MATRIX_CELL* p; MATRIX_CELL* p;
p = RoutingMatrix.m_BoardSide[aSide]; p = RoutingMatrix.m_BoardSide[aSide];
p[aRow * Ncols + aCol] += x; p[aRow * m_Ncols + aCol] += x;
} }
/* fetch distance cell */ /* fetch distance cell */
DIST_CELL GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */ DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */
{ {
DIST_CELL* p; DIST_CELL* p;
p = RoutingMatrix.m_DistSide[aSide]; p = RoutingMatrix.m_DistSide[aSide];
return p[aRow * Ncols + aCol]; return p[aRow * m_Ncols + aCol];
} }
/* store distance cell */ /* store distance cell */
void SetDist( int aRow, int aCol, int aSide, DIST_CELL x ) void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
{ {
DIST_CELL* p; DIST_CELL* p;
p = RoutingMatrix.m_DistSide[aSide]; p = RoutingMatrix.m_DistSide[aSide];
p[aRow * Ncols + aCol] = x; p[aRow * m_Ncols + aCol] = x;
} }
/* fetch direction cell */ /* fetch direction cell */
int GetDir( int aRow, int aCol, int aSide ) int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
{ {
DIR_CELL* p; DIR_CELL* p;
p = RoutingMatrix.m_DirSide[aSide]; p = RoutingMatrix.m_DirSide[aSide];
return (int) (p[aRow * Ncols + aCol]); return (int) (p[aRow * m_Ncols + aCol]);
} }
/* store direction cell */ /* store direction cell */
void SetDir( int aRow, int aCol, int aSide, int x ) void MATRIX_ROUTING_HEAD::SetDir( int aRow, int aCol, int aSide, int x )
{ {
DIR_CELL* p; DIR_CELL* p;
p = RoutingMatrix.m_DirSide[aSide]; p = RoutingMatrix.m_DirSide[aSide];
p[aRow * Ncols + aCol] = (char) x; p[aRow * m_Ncols + aCol] = (char) x;
} }

View File

@ -82,7 +82,6 @@ static int segm_oX, segm_oY;
static int segm_fX, segm_fY; /* Origin and position of the current static int segm_fX, segm_fY; /* Origin and position of the current
* trace segment. */ * trace segment. */
static RATSNEST_ITEM* pt_cur_ch; static RATSNEST_ITEM* pt_cur_ch;
static int Ncurrent; /* measures of progress */
static int s_Clearance; // Clearance value used in autorouter static int s_Clearance; // Clearance value used in autorouter
static PICKED_ITEMS_LIST s_ItemsListPicker; static PICKED_ITEMS_LIST s_ItemsListPicker;
@ -272,13 +271,12 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
NETINFO_ITEM* net; NETINFO_ITEM* net;
bool stop = false; bool stop = false;
wxString msg; wxString msg;
int routedCount = 0; // routed ratsnest count
m_canvas->SetAbortRequest( false ); m_canvas->SetAbortRequest( false );
s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance(); s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
Ncurrent = 0;
// Prepare the undo command info // Prepare the undo command info
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but... s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
@ -310,14 +308,14 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
EraseMsgBox(); EraseMsgBox();
Ncurrent++; routedCount++;
net = GetBoard()->FindNet( current_net_code ); net = GetBoard()->FindNet( current_net_code );
if( net ) if( net )
{ {
msg.Printf( wxT( "[%8.8s]" ), GetChars( net->GetNetname() ) ); msg.Printf( wxT( "[%8.8s]" ), GetChars( net->GetNetname() ) );
AppendMsgPanel( wxT( "Net route" ), msg, BROWN ); AppendMsgPanel( wxT( "Net route" ), msg, BROWN );
msg.Printf( wxT( "%d / %d" ), Ncurrent, Ntotal ); msg.Printf( wxT( "%d / %d" ), routedCount, RoutingMatrix.m_RouteCount );
AppendMsgPanel( wxT( "Activity" ), msg, BROWN ); AppendMsgPanel( wxT( "Activity" ), msg, BROWN );
} }
@ -328,25 +326,15 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
segm_fY = GetBoard()->GetBoundingBox().GetY() + (RoutingMatrix.m_GridRouting * row_target); segm_fY = GetBoard()->GetBoundingBox().GetY() + (RoutingMatrix.m_GridRouting * row_target);
/* Draw segment. */ /* Draw segment. */
GRLine( m_canvas->GetClipBox(), GRLine( m_canvas->GetClipBox(), DC,
DC, segm_oX, segm_oY, segm_fX, segm_fY,
segm_oX, 0, WHITE | GR_XOR );
segm_oY,
segm_fX,
segm_fY,
0,
WHITE | GR_XOR );
pt_cur_ch->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); pt_cur_ch->m_PadStart->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
pt_cur_ch->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); pt_cur_ch->m_PadEnd->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
success = Autoroute_One_Track( this, success = Autoroute_One_Track( this, DC,
DC, two_sides, row_source, col_source,
two_sides, row_target, col_target, pt_cur_ch );
row_source,
col_source,
row_target,
col_target,
pt_cur_ch );
switch( success ) switch( success )
{ {
@ -439,7 +427,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 ); marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
/* clear direction flags */ /* clear direction flags */
i = Nrows * Ncols * sizeof(DIR_CELL); i = RoutingMatrix.m_Nrows * RoutingMatrix.m_Ncols * sizeof(DIR_CELL);
memset( RoutingMatrix.m_DirSide[TOP], FROM_NOWHERE, i ); memset( RoutingMatrix.m_DirSide[TOP], FROM_NOWHERE, i );
memset( RoutingMatrix.m_DirSide[BOTTOM], FROM_NOWHERE, i ); memset( RoutingMatrix.m_DirSide[BOTTOM], FROM_NOWHERE, i );
@ -603,7 +591,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
for( ; r != ILLEGAL; GetQueue( &r, &c, &side, &d, &apx_dist ) ) for( ; r != ILLEGAL; GetQueue( &r, &c, &side, &d, &apx_dist ) )
{ {
curcell = GetCell( r, c, side ); curcell = RoutingMatrix.GetCell( r, c, side );
if( curcell & CURRENT_PAD ) if( curcell & CURRENT_PAD )
curcell &= ~HOLE; curcell &= ~HOLE;
@ -675,13 +663,14 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
nc = c + delta[i][1]; nc = c + delta[i][1];
/* off the edge? */ /* off the edge? */
if( nr < 0 || nr >= Nrows || nc < 0 || nc >= Ncols ) if( nr < 0 || nr >= RoutingMatrix.m_Nrows ||
nc < 0 || nc >= RoutingMatrix.m_Ncols )
continue; /* off the edge */ continue; /* off the edge */
if( _self == 5 && selfok2[i].present ) if( _self == 5 && selfok2[i].present )
continue; continue;
newcell = GetCell( nr, nc, side ); newcell = RoutingMatrix.GetCell( nr, nc, side );
if( newcell & CURRENT_PAD ) if( newcell & CURRENT_PAD )
newcell &= ~HOLE; newcell &= ~HOLE;
@ -702,7 +691,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
if( delta[i][0] && delta[i][1] ) if( delta[i][0] && delta[i][1] )
{ {
/* check first buddy */ /* check first buddy */
buddy = GetCell( r + blocking[i].r1, c + blocking[i].c1, side ); buddy = RoutingMatrix.GetCell( r + blocking[i].r1, c + blocking[i].c1, side );
if( buddy & CURRENT_PAD ) if( buddy & CURRENT_PAD )
buddy &= ~HOLE; buddy &= ~HOLE;
@ -712,7 +701,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
// if (buddy & (blocking[i].b1)) continue; // if (buddy & (blocking[i].b1)) continue;
/* check second buddy */ /* check second buddy */
buddy = GetCell( r + blocking[i].r2, c + blocking[i].c2, side ); buddy = RoutingMatrix.GetCell( r + blocking[i].r2, c + blocking[i].c2, side );
if( buddy & CURRENT_PAD ) if( buddy & CURRENT_PAD )
buddy &= ~HOLE; buddy &= ~HOLE;
@ -723,17 +712,17 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
// if (buddy & (blocking[i].b2)) continue; // if (buddy & (blocking[i].b2)) continue;
} }
olddir = GetDir( r, c, side ); olddir = RoutingMatrix.GetDir( r, c, side );
newdist = d + CalcDist( ndir[i], olddir, newdist = d + CalcDist( ndir[i], olddir,
( olddir == FROM_OTHERSIDE ) ? ( olddir == FROM_OTHERSIDE ) ?
GetDir( r, c, 1 - side ) : 0, side ); RoutingMatrix.GetDir( r, c, 1 - side ) : 0, side );
/* if (a) not visited yet, or (b) we have */ /* if (a) not visited yet, or (b) we have */
/* found a better path, add it to queue */ /* found a better path, add it to queue */
if( !GetDir( nr, nc, side ) ) if( !RoutingMatrix.GetDir( nr, nc, side ) )
{ {
SetDir( nr, nc, side, ndir[i] ); RoutingMatrix.SetDir( nr, nc, side, ndir[i] );
SetDist( nr, nc, side, newdist ); RoutingMatrix.SetDist( nr, nc, side, newdist );
if( SetQueue( nr, nc, side, newdist, if( SetQueue( nr, nc, side, newdist,
GetApxDist( nr, nc, row_target, col_target ), GetApxDist( nr, nc, row_target, col_target ),
@ -742,10 +731,10 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
return ERR_MEMORY; return ERR_MEMORY;
} }
} }
else if( newdist < GetDist( nr, nc, side ) ) else if( newdist < RoutingMatrix.GetDist( nr, nc, side ) )
{ {
SetDir( nr, nc, side, ndir[i] ); RoutingMatrix.SetDir( nr, nc, side, ndir[i] );
SetDist( nr, nc, side, newdist ); RoutingMatrix.SetDist( nr, nc, side, newdist );
ReSetQueue( nr, nc, side, newdist, ReSetQueue( nr, nc, side, newdist,
GetApxDist( nr, nc, row_target, col_target ), GetApxDist( nr, nc, row_target, col_target ),
row_target, col_target ); row_target, col_target );
@ -755,7 +744,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
/** Test the other layer. **/ /** Test the other layer. **/
if( two_sides ) if( two_sides )
{ {
olddir = GetDir( r, c, side ); olddir = RoutingMatrix.GetDir( r, c, side );
if( olddir == FROM_OTHERSIDE ) if( olddir == FROM_OTHERSIDE )
continue; /* useless move, so don't bother */ continue; /* useless move, so don't bother */
@ -764,7 +753,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
continue; continue;
/* check for holes or traces on other side */ /* check for holes or traces on other side */
if( ( newcell = GetCell( r, c, 1 - side ) ) != 0 ) if( ( newcell = RoutingMatrix.GetCell( r, c, 1 - side ) ) != 0 )
continue; continue;
/* check for nearby holes or traces on both sides */ /* check for nearby holes or traces on both sides */
@ -772,16 +761,17 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
{ {
nr = r + delta[i][0]; nc = c + delta[i][1]; nr = r + delta[i][0]; nc = c + delta[i][1];
if( nr < 0 || nr >= Nrows || nc < 0 || nc >= Ncols ) if( nr < 0 || nr >= RoutingMatrix.m_Nrows ||
nc < 0 || nc >= RoutingMatrix.m_Ncols )
continue; /* off the edge !! */ continue; /* off the edge !! */
if( GetCell( nr, nc, side ) /* & blocking2[i]*/ ) if( RoutingMatrix.GetCell( nr, nc, side ) /* & blocking2[i]*/ )
{ {
skip = 1; /* can't drill via here */ skip = 1; /* can't drill via here */
break; break;
} }
if( GetCell( nr, nc, 1 - side ) /* & blocking2[i]*/ ) if( RoutingMatrix.GetCell( nr, nc, 1 - side ) /* & blocking2[i]*/ )
{ {
skip = 1; /* can't drill via here */ skip = 1; /* can't drill via here */
break; break;
@ -796,22 +786,21 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
/* if (a) not visited yet, /* if (a) not visited yet,
* or (b) we have found a better path, * or (b) we have found a better path,
* add it to queue */ * add it to queue */
if( !GetDir( r, c, 1 - side ) ) if( !RoutingMatrix.GetDir( r, c, 1 - side ) )
{ {
SetDir( r, c, 1 - side, FROM_OTHERSIDE ); RoutingMatrix.SetDir( r, c, 1 - side, FROM_OTHERSIDE );
SetDist( r, c, 1 - side, newdist ); RoutingMatrix.SetDist( r, c, 1 - side, newdist );
if( SetQueue( r, c, 1 - side, newdist, apx_dist, row_target, col_target ) == 0 ) if( SetQueue( r, c, 1 - side, newdist, apx_dist, row_target, col_target ) == 0 )
{ {
return ERR_MEMORY; return ERR_MEMORY;
} }
} }
else if( newdist < GetDist( r, c, 1 - side ) ) else if( newdist < RoutingMatrix.GetDist( r, c, 1 - side ) )
{ {
SetDir( r, c, 1 - side, FROM_OTHERSIDE ); RoutingMatrix.SetDir( r, c, 1 - side, FROM_OTHERSIDE );
SetDist( r, c, 1 - side, newdist ); RoutingMatrix.SetDist( r, c, 1 - side, newdist );
ReSetQueue( r, ReSetQueue( r, c,
c,
1 - side, 1 - side,
newdist, newdist,
apx_dist, apx_dist,
@ -972,7 +961,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
{ {
/* find where we came from to get here */ /* find where we came from to get here */
r2 = r1; c2 = c1; s2 = s1; r2 = r1; c2 = c1; s2 = s1;
x = GetDir( r1, c1, s1 ); x = RoutingMatrix.GetDir( r1, c1, s1 );
switch( x ) switch( x )
{ {
@ -1017,12 +1006,12 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
break; break;
default: default:
DisplayError( pcbframe, wxT( "Retrace: internal error: no way back" ) ); wxMessageBox( wxT( "Retrace: internal error: no way back" ) );
return 0; return 0;
} }
if( r0 != ILLEGAL ) if( r0 != ILLEGAL )
y = GetDir( r0, c0, s0 ); y = RoutingMatrix.GetDir( r0, c0, s0 );
/* see if target or hole */ /* see if target or hole */
if( ( ( r1 == row_target ) && ( c1 == col_target ) ) || ( s1 != s0 ) ) if( ( ( r1 == row_target ) && ( c1 == col_target ) ) || ( s1 != s0 ) )
@ -1091,7 +1080,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
} }
else else
{ {
DisplayError( pcbframe, wxT( "Retrace: error 2" ) ); wxMessageBox( wxT( "Retrace: error 2" ) );
return 0; return 0;
} }
} }
@ -1136,7 +1125,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
case FROM_OTHERSIDE: case FROM_OTHERSIDE:
default: default:
DisplayError( pcbframe, wxT( "Retrace: error 3" ) ); wxMessageBox( wxT( "Retrace: error 3" ) );
return 0; return 0;
} }

View File

@ -92,13 +92,10 @@ void ReInitWork()
*/ */
static int GetCost( int r1, int c1, int r2, int c2 ); static int GetCost( int r1, int c1, int r2, int c2 );
int SetWork( int r1, int SetWork( int r1, int c1,
int c1,
int n_c, int n_c,
int r2, int r2, int c2,
int c2, RATSNEST_ITEM* pt_ch, int pri )
RATSNEST_ITEM* pt_ch,
int pri )
{ {
CWORK* p; CWORK* p;
@ -226,11 +223,10 @@ void SortWork()
static int GetCost( int r1, int c1, int r2, int c2 ) static int GetCost( int r1, int c1, int r2, int c2 )
{ {
int dx, dy, mx, my; int dx, dy, mx, my;
double incl; double incl = 1.0;
dx = abs( c2 - c1 ); dx = abs( c2 - c1 );
dy = abs( r2 - r1 ); dy = abs( r2 - r1 );
incl = 1.0;
mx = dx; mx = dx;
my = dy; my = dy;

View File

@ -1075,6 +1075,10 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
*/ */
static bool SortTracksByNetCode( const TRACK* const & ref, const TRACK* const & compare ) static bool SortTracksByNetCode( const TRACK* const & ref, const TRACK* const & compare )
{ {
// For items having the same Net, keep the order in list
if( ref->GetNet() == compare->GetNet())
return ref->m_Param < compare->m_Param;
return ref->GetNet() < compare->GetNet(); return ref->GetNet() < compare->GetNet();
} }
@ -1082,6 +1086,7 @@ static bool SortTracksByNetCode( const TRACK* const & ref, const TRACK* const &
* Helper function RebuildTrackChain * Helper function RebuildTrackChain
* rebuilds the track segment linked list in order to have a chain * rebuilds the track segment linked list in order to have a chain
* sorted by increasing netcodes. * sorted by increasing netcodes.
* We try to keep order of track segments in list, when possible
* @param pcb = board to rebuild * @param pcb = board to rebuild
*/ */
static void RebuildTrackChain( BOARD* pcb ) static void RebuildTrackChain( BOARD* pcb )
@ -1094,8 +1099,19 @@ static void RebuildTrackChain( BOARD* pcb )
std::vector<TRACK*> trackList; std::vector<TRACK*> trackList;
trackList.reserve( item_count ); trackList.reserve( item_count );
for( int i = 0; i < item_count; ++i ) // Put track list in a temporary list to sort tracks by netcode
// We try to keep the initial order of track segments in list, when possible
// so we use m_Param (a member variable used for temporary storage)
// to temporary keep trace of the order of segments
// The sort function uses this variable to sort items that
// have the same net code.
// Without this, during sorting, the initial order is sometimes lost
// by the sort algorithm
for( int ii = 0; ii < item_count; ++ii )
{
pcb->m_Track->m_Param = ii;
trackList.push_back( pcb->m_Track.PopFront() ); trackList.push_back( pcb->m_Track.PopFront() );
}
// the list is empty now // the list is empty now
wxASSERT( pcb->m_Track == NULL && pcb->m_Track.GetCount()==0 ); wxASSERT( pcb->m_Track == NULL && pcb->m_Track.GetCount()==0 );

View File

@ -1103,11 +1103,11 @@ PCB_IO::PCB_IO()
BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties )
{ {
wxFFile file( aFileName, "r" ); wxFFile file( aFileName, wxT("r") );
if( !file.IsOpened() ) if( !file.IsOpened() )
{ {
THROW_IO_ERROR( _( "Unable to read file \"" ) + GetChars( aFileName ) + wxT( "\"" ) ); THROW_IO_ERROR( _( "Unable to read file \"" ) + aFileName + wxT( "\"" ) );
} }
PCB_PARSER parser( new FILE_LINE_READER( file.fp(), aFileName ), aAppendToMe ); PCB_PARSER parser( new FILE_LINE_READER( file.fp(), aFileName ), aAppendToMe );

View File

@ -620,7 +620,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
T token; T token;
wxString name; wxString name;
wxString type; wxString type;
bool isVisible; bool isVisible = true;
int visibleLayers = 0; int visibleLayers = 0;
int enabledLayers = 0; int enabledLayers = 0;
std::vector< LAYER > layers; std::vector< LAYER > layers;
@ -655,7 +655,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
Expecting( "hide or )" ); Expecting( "hide or )" );
} }
layers.push_back( LAYER( name, LAYER::ParseType( type.c_str() ), isVisible ) ); layers.push_back( LAYER( name, LAYER::ParseType( TO_UTF8( type ) ), isVisible ) );
} }
int copperLayerCount = 0; int copperLayerCount = 0;
@ -701,7 +701,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
{ {
wxString error; wxString error;
error.Printf( _( "Cannot determine fixed layer list index of layer name \"%s\"" ), error.Printf( _( "Cannot determine fixed layer list index of layer name \"%s\"" ),
layers[i].m_Name ); GetChars( layers[i].m_Name ) );
THROW_IO_ERROR( error ); THROW_IO_ERROR( error );
} }
} }
@ -1110,7 +1110,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR )
wxString error; wxString error;
error.Printf( _( "duplicate NETCLASS name '%s' in file %s at line %d, offset %d" ), error.Printf( _( "duplicate NETCLASS name '%s' in file %s at line %d, offset %d" ),
nc->GetName().GetData(), CurSource(), CurLineNumber(), CurOffset() ); nc->GetName().GetData(), CurSource().GetData(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error ); THROW_IO_ERROR( error );
} }
} }
@ -2268,8 +2268,8 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as ZONE_CONTAINER." ) ); wxT( " as ZONE_CONTAINER." ) );
int hatchStyle; int hatchStyle = CPolyLine::NO_HATCH; // Fix compil warning
int hatchPitch; int hatchPitch = 0; // Fix compil warning
wxPoint pt; wxPoint pt;
T token; T token;