Loading pcbnew/CMakeLists.txt +15 −9 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ add_definitions(-DPCBNEW) include_directories(BEFORE ${INC_BEFORE}) include_directories( ./dialogs ./autorouter ../3d-viewer ../common ${Boost_INCLUDE_DIR} Loading Loading @@ -85,16 +86,26 @@ set(PCBNEW_DIALOGS dialogs/dialog_set_grid_base.cpp ) set(PCBNEW_AUTOROUTER_SRCS autorouter/automove.cpp autorouter/autoplac.cpp autorouter/autorout.cpp autorouter/routing_matrix.cpp autorouter/dist.cpp autorouter/queue.cpp autorouter/solve.cpp autorouter/graphpcb.cpp autorouter/work.cpp ) set(PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} tool_modview.cpp modview.cpp modview_frame.cpp pcbframe.cpp attribut.cpp automove.cpp autoplac.cpp autorout.cpp board.cpp board_items_to_polygon_shape_transform.cpp board_undo_redo.cpp block.cpp Loading @@ -109,7 +120,6 @@ set(PCBNEW_SRCS cross-probing.cpp deltrack.cpp ${PCBNEW_DIALOGS} dist.cpp dragsegm.cpp drc.cpp drc_clearance_test_functions.cpp Loading @@ -133,7 +143,6 @@ set(PCBNEW_SRCS gendrill.cpp globaleditpad.cpp gpcb_exchange.cpp graphpcb.cpp highlight.cpp hotkeys.cpp hotkeys_board_editor.cpp Loading Loading @@ -173,10 +182,8 @@ set(PCBNEW_SRCS plot_rtn.cpp print_board_functions.cpp printout_controler.cpp queue.cpp ratsnest.cpp set_grid.cpp solve.cpp specctra.cpp specctra_export.cpp specctra_import.cpp Loading @@ -189,7 +196,6 @@ set(PCBNEW_SRCS tracepcb.cpp tr_modif.cpp trpiste.cpp work.cpp xchgmod.cpp zones_convert_brd_items_to_polygons_with_Boost.cpp zones_convert_to_polygons_aux_functions.cpp Loading pcbnew/ar_protos.hdeleted 100644 → 0 +0 −85 Original line number Diff line number Diff line /** * @file ar_protos.h */ #ifndef _AR_PROTOS_H_ #define _AR_PROTOS_H_ #include <autorout.h> class PCB_EDIT_FRAME; class BOARD; class D_PAD; class RATSNEST_ITEM; class TRACK; int Propagation( PCB_EDIT_FRAME* frame ); /* Initialize a color value, the cells included in the board edge of the * pad surface by pt_pad, with the margin reserved for isolation and the * half width of the runway * Parameters: * Pt_pad: pointer to the description of the pad * color: mask write in cells * margin: add a value to the radius or half the score pad * op_logic: type of writing in the cell (WRITE, OR) */ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int type, int marge, int op_logic ); /* Draws a segment of track on the board. */ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int type, int marge, int op_logic ); /* Uses the color value of all cells included in the board * coord of the rectangle ux0, uy0 (top right corner) * a ux1, uy1 (lower left corner) (coord PCB) * the rectangle is horizontal (or vertical) * masque_layer = mask layers; * op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL */ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side, int color, int op_logic); /* Same as above, but the rectangle is inclined angle angle. */ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int angle, int masque_layer, int color, int op_logic ); /* QUEUE.CPP */ void FreeQueue(); void InitQueue(); void GetQueue( int *, int *, int *, int *, int * ); int SetQueue( int, int, int, int, int, int, int ); void ReSetQueue( int, int, int, int, int, int, int ); /* WORK.CPP */ void InitWork(); void ReInitWork(); int SetWork( int, int, int , int, int, RATSNEST_ITEM *, int ); void GetWork( int *, int *, int *, int *, int *, RATSNEST_ITEM ** ); void SortWork(); /* order the work items; shortest first */ /* DIST.CPP */ int GetApxDist( int, int, int, int ); int CalcDist( int, int, int ,int ); /* BOARD.CPP */ int Build_Work( BOARD * Pcb ); 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 // _AR_PROTOS_H_ pcbnew/automove.cpp→pcbnew/autorouter/automove.cpp +0 −0 File moved. View file pcbnew/autoplac.cpp→pcbnew/autorouter/autoplac.cpp +52 −51 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ #include <pcbcommon.h> #include <protos.h> #include <ar_protos.h> #include <autorout.h> #include <cell.h> #include <colors_selection.h> Loading @@ -46,6 +46,7 @@ #include <class_module.h> #include <class_track.h> #include <class_drawsegment.h> #include <convert_to_biu.h> #define GAIN 16 Loading Loading @@ -150,11 +151,11 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) lay_tmp_BOTTOM = Route_Layer_BOTTOM; lay_tmp_TOP = Route_Layer_TOP; Board.m_GridRouting = (int) GetScreen()->GetGridSize().x; RoutingMatrix.m_GridRouting = (int) GetScreen()->GetGridSize().x; // Ensure Board.m_GridRouting has a reasonable value: if( Board.m_GridRouting < 10 ) Board.m_GridRouting = 10; // Min value = 1/1000 inch if( RoutingMatrix.m_GridRouting < 10*IU_PER_MILS ) RoutingMatrix.m_GridRouting = 10*IU_PER_MILS; // Min value = 1/1000 inch /* Compute module parameters used in auto place */ Module = GetBoard()->m_Modules; Loading Loading @@ -371,7 +372,7 @@ end_of_tst: CurrPosition = memopos; Board.UnInitBoard(); RoutingMatrix.UnInitBoard(); Route_Layer_TOP = lay_tmp_TOP; Route_Layer_BOTTOM = lay_tmp_BOTTOM; Loading @@ -397,13 +398,13 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC ) GRSetDrawMode( DC, GR_COPY ); for( ii = 0; ii < Board.m_Nrows; ii++ ) for( ii = 0; ii < RoutingMatrix.m_Nrows; ii++ ) { oy = bbbox.GetY() + ( ii * Board.m_GridRouting ); oy = bbbox.GetY() + ( ii * RoutingMatrix.m_GridRouting ); for( jj = 0; jj < Board.m_Ncols; jj++ ) for( jj = 0; jj < RoutingMatrix.m_Ncols; jj++ ) { ox = bbbox.GetX() + (jj * Board.m_GridRouting); ox = bbbox.GetX() + (jj * RoutingMatrix.m_GridRouting); color = BLACK; top_state = GetCell( ii, jj, TOP ); Loading Loading @@ -438,7 +439,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() EDA_ITEM* PtStruct; wxString msg; Board.UnInitBoard(); RoutingMatrix.UnInitBoard(); bbbox = GetBoard()->ComputeBoundingBox( true ); Loading @@ -449,19 +450,19 @@ int PCB_EDIT_FRAME::GenPlaceBoard() } /* The boundary box must have its start point on placing grid: */ bbbox.SetX( bbbox.GetX() - ( bbbox.GetX() % Board.m_GridRouting ) ); bbbox.SetY( bbbox.GetY() - ( bbbox.GetY() % Board.m_GridRouting ) ); bbbox.SetX( bbbox.GetX() - ( bbbox.GetX() % RoutingMatrix.m_GridRouting ) ); bbbox.SetY( bbbox.GetY() - ( bbbox.GetY() % RoutingMatrix.m_GridRouting ) ); /* The boundary box must have its end point on placing grid: */ wxPoint end = bbbox.GetEnd(); end.x -= end.x % Board.m_GridRouting; end.x += Board.m_GridRouting; end.y -= end.y % Board.m_GridRouting; end.y += Board.m_GridRouting; end.x -= end.x % RoutingMatrix.m_GridRouting; end.x += RoutingMatrix.m_GridRouting; end.y -= end.y % RoutingMatrix.m_GridRouting; end.y += RoutingMatrix.m_GridRouting; bbbox.SetEnd( end ); Nrows = bbbox.GetHeight() / Board.m_GridRouting; Ncols = bbbox.GetWidth() / Board.m_GridRouting; Nrows = bbbox.GetHeight() / RoutingMatrix.m_GridRouting; Ncols = bbbox.GetWidth() / RoutingMatrix.m_GridRouting; /* get a small margin for memory allocation: */ Ncols += 2; Nrows += 2; NbCells = Ncols * Nrows; Loading @@ -480,10 +481,10 @@ int PCB_EDIT_FRAME::GenPlaceBoard() m_messagePanel->SetMessage( 22, wxT( "S" ), ( Nb_Sides == TWO_SIDES ) ? wxT( "2" ) : wxT( "1" ), WHITE ); Board.InitBoard(); RoutingMatrix.InitBoard(); /* Display memory usage. */ msg.Printf( wxT( "%d" ), Board.m_MemSize / 1024 ); msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 ); m_messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN ); Route_Layer_BOTTOM = LAYER_N_FRONT; Loading @@ -499,7 +500,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() TmpSegm.SetLayer( -1 ); TmpSegm.SetNet( -1 ); TmpSegm.m_Width = Board.m_GridRouting / 2; TmpSegm.m_Width = RoutingMatrix.m_GridRouting / 2; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { Loading @@ -519,7 +520,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() TmpSegm.m_Param = DrawSegm->GetAngle(); TraceSegmentPcb( GetBoard(), &TmpSegm, HOLE | CELL_is_EDGE, Board.m_GridRouting, WRITE_CELL ); RoutingMatrix.m_GridRouting, WRITE_CELL ); break; case PCB_TEXT_T: Loading @@ -543,8 +544,8 @@ int PCB_EDIT_FRAME::GenPlaceBoard() } /* Initialize top layer. */ if( Board.m_BoardSide[TOP] ) memcpy( Board.m_BoardSide[TOP], Board.m_BoardSide[BOTTOM], if( RoutingMatrix.m_BoardSide[TOP] ) memcpy( RoutingMatrix.m_BoardSide[TOP], RoutingMatrix.m_BoardSide[BOTTOM], NbCells * sizeof(MATRIX_CELL) ); return 1; Loading @@ -556,7 +557,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module ) { int ox, oy, fx, fy; int marge = Board.m_GridRouting / 2; int marge = RoutingMatrix.m_GridRouting / 2; int layerMask; D_PAD* Pad; Loading Loading @@ -612,7 +613,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module ) } /* Trace clearance. */ marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN; marge = ( RoutingMatrix.m_GridRouting * Module->m_PadNum ) / GAIN; CreateKeepOutRectangle( GetBoard(), ox, oy, fx, fy, marge, KEEP_OUT_MARGIN, layerMask ); } Loading Loading @@ -643,8 +644,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) CurrPosition.y = bbbox.GetY() - oy; /* Module placement on grid. */ CurrPosition.x -= CurrPosition.x % Board.m_GridRouting; CurrPosition.y -= CurrPosition.y % Board.m_GridRouting; CurrPosition.x -= CurrPosition.x % RoutingMatrix.m_GridRouting; CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting; g_Offset_Module.x = cx - CurrPosition.x; g_Offset_Module.y = cy - CurrPosition.y; Loading Loading @@ -680,7 +681,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) SetStatusText( wxT( "Score ??, pos ??" ) ); for( ; CurrPosition.x < bbbox.GetRight() - fx; CurrPosition.x += Board.m_GridRouting ) CurrPosition.x += RoutingMatrix.m_GridRouting ) { wxYield(); Loading @@ -702,12 +703,12 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) CurrPosition.y = bbbox.GetY() - oy; /* Placement on grid. */ CurrPosition.y -= CurrPosition.y % Board.m_GridRouting; CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting; DrawModuleOutlines( m_canvas, aDC, aModule ); for( ; CurrPosition.y < bbbox.GetBottom() - fy; CurrPosition.y += Board.m_GridRouting ) CurrPosition.y += RoutingMatrix.m_GridRouting ) { /* Erase traces. */ DrawModuleOutlines( m_canvas, aDC, aModule ); Loading Loading @@ -785,16 +786,16 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side ) ux1 -= Pcb->GetBoundingBox().GetX(); uy1 -= Pcb->GetBoundingBox().GetY(); row_max = uy1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting; row_min = uy0 / Board.m_GridRouting; row_max = uy1 / RoutingMatrix.m_GridRouting; col_max = ux1 / RoutingMatrix.m_GridRouting; row_min = uy0 / RoutingMatrix.m_GridRouting; if( uy0 > row_min * Board.m_GridRouting ) if( uy0 > row_min * RoutingMatrix.m_GridRouting ) row_min++; col_min = ux0 / Board.m_GridRouting; col_min = ux0 / RoutingMatrix.m_GridRouting; if( ux0 > col_min * Board.m_GridRouting ) if( ux0 > col_min * RoutingMatrix.m_GridRouting ) col_min++; if( row_min < 0 ) Loading Loading @@ -842,16 +843,16 @@ unsigned int CalculateKeepOutArea( BOARD* Pcb, int ux0, int uy0, int ux1, int uy ux1 -= Pcb->GetBoundingBox().GetX(); uy1 -= Pcb->GetBoundingBox().GetY(); row_max = uy1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting; row_min = uy0 / Board.m_GridRouting; row_max = uy1 / RoutingMatrix.m_GridRouting; col_max = ux1 / RoutingMatrix.m_GridRouting; row_min = uy0 / RoutingMatrix.m_GridRouting; if( uy0 > row_min * Board.m_GridRouting ) if( uy0 > row_min * RoutingMatrix.m_GridRouting ) row_min++; col_min = ux0 / Board.m_GridRouting; col_min = ux0 / RoutingMatrix.m_GridRouting; if( ux0 > col_min * Board.m_GridRouting ) if( ux0 > col_min * RoutingMatrix.m_GridRouting ) col_min++; if( row_min < 0 ) Loading Loading @@ -914,7 +915,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide ) return error; } marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN; marge = ( RoutingMatrix.m_GridRouting * Module->m_PadNum ) / GAIN; return CalculateKeepOutArea( Pcb, ox - marge, oy - marge, fx + marge, fy + marge, side ); } Loading Loading @@ -1019,22 +1020,22 @@ static void CreateKeepOutRectangle( BOARD* Pcb, ux0 -= marge; ux1 += marge; uy0 -= marge; uy1 += marge; pmarge = marge / Board.m_GridRouting; pmarge = marge / RoutingMatrix.m_GridRouting; if( pmarge < 1 ) pmarge = 1; /* Calculate the coordinate limits of the rectangle. */ row_max = uy1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting; row_min = uy0 / Board.m_GridRouting; row_max = uy1 / RoutingMatrix.m_GridRouting; col_max = ux1 / RoutingMatrix.m_GridRouting; row_min = uy0 / RoutingMatrix.m_GridRouting; if( uy0 > row_min * Board.m_GridRouting ) if( uy0 > row_min * RoutingMatrix.m_GridRouting ) row_min++; col_min = ux0 / Board.m_GridRouting; col_min = ux0 / RoutingMatrix.m_GridRouting; if( ux0 > col_min * Board.m_GridRouting ) if( ux0 > col_min * RoutingMatrix.m_GridRouting ) col_min++; if( row_min < 0 ) Loading pcbnew/autorout.cpp→pcbnew/autorouter/autorout.cpp +18 −24 Original line number Diff line number Diff line Loading @@ -11,14 +11,15 @@ #include <pcbnew.h> #include <cell.h> #include <zones.h> #include <ar_protos.h> #include <class_board.h> #include <class_module.h> #include <class_track.h> #include <convert_to_biu.h> #include <autorout.h> int E_scale; /* Scaling factor of distance tables. */ int Nb_Sides; /* Number of layer for autorouting (0 or 1) */ int Nrows = ILLEGAL; int Ncols = ILLEGAL; Loading @@ -28,8 +29,7 @@ int ClosNodes; /* total number of nodes closed */ int MoveNodes; /* total number of nodes moved */ int MaxNodes; /* maximum number of nodes opened at one time */ MATRIX_ROUTING_HEAD Board; /* 2-sided board */ MATRIX_ROUTING_HEAD RoutingMatrix; // routing matrix (grid) to route 2-sided boards /* init board, route traces*/ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) Loading Loading @@ -139,18 +139,14 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) start = time( NULL ); /* Calculation of no fixed routing to 5 mils and more. */ Board.m_GridRouting = (int)GetScreen()->GetGridSize().x; if( Board.m_GridRouting < 50 ) Board.m_GridRouting = 50; RoutingMatrix.m_GridRouting = (int)GetScreen()->GetGridSize().x; E_scale = Board.m_GridRouting / 50; if( RoutingMatrix.m_GridRouting < (5*IU_PER_MILS) ) RoutingMatrix.m_GridRouting = 5*IU_PER_MILS; if( E_scale < 1 ) E_scale = 1; /* Calculated ncol and nrow, matrix size for routing. */ Board.ComputeMatrixSize( GetBoard() ); RoutingMatrix.ComputeMatrixSize( GetBoard() ); m_messagePanel->EraseMsgBox(); Loading @@ -160,10 +156,10 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) if( Route_Layer_TOP != Route_Layer_BOTTOM ) Nb_Sides = TWO_SIDES; if( Board.InitBoard() < 0 ) if( RoutingMatrix.InitBoard() < 0 ) { wxMessageBox( _( "No memory for autorouting" ) ); Board.UnInitBoard(); /* Free memory. */ RoutingMatrix.UnInitBoard(); /* Free memory. */ return; } Loading @@ -173,7 +169,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) /* Construction of the track list for router. */ Build_Work( GetBoard() ); // DisplayBoard(m_canvas, DC); // DisplayRoutingMatrix( m_canvas, DC ); if( Nb_Sides == TWO_SIDES ) Solve( DC, TWO_SIDES ); /* double face */ Loading @@ -183,7 +179,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) /* Free memory. */ FreeQueue(); InitWork(); /* Free memory for the list of router connections. */ Board.UnInitBoard(); RoutingMatrix.UnInitBoard(); stop = time( NULL ) - start; msg.Printf( wxT( "time = %d second%s" ), stop, ( stop == 1 ) ? wxT( "" ) : wxT( "s" ) ); SetStatusText( msg ); Loading @@ -207,13 +203,11 @@ void PCB_EDIT_FRAME::Reset_Noroutable( wxDC* DC ) /* DEBUG Function: displays the routing matrix */ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC ) void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC ) { int row, col, i, j; int dcell0, dcell1 = 0, color; int maxi; maxi = 600 / Ncols; int maxi = 600 / Ncols; maxi = ( maxi * 3 ) / 4; if( !maxi ) Loading @@ -221,9 +215,9 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC ) GRSetDrawMode( DC, GR_COPY ); for( col = 0; col < Ncols; col++ ) for( int col = 0; col < Ncols; col++ ) { for( row = 0; row < Nrows; row++ ) for( int row = 0; row < Nrows; row++ ) { color = 0; dcell0 = GetCell( row, col, BOTTOM ); Loading Loading @@ -251,8 +245,8 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC ) #define DRAW_OFFSET_Y 20 // if( color ) { for( i = 0; i < maxi; i++ ) for( j = 0; j < maxi; j++ ) for( int i = 0; i < maxi; i++ ) for( int j = 0; j < maxi; j++ ) GRPutPixel( panel->GetClipBox(), DC, ( col * maxi ) + i + DRAW_OFFSET_X, ( row * maxi ) + j + DRAW_OFFSET_Y, color ); Loading Loading
pcbnew/CMakeLists.txt +15 −9 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ add_definitions(-DPCBNEW) include_directories(BEFORE ${INC_BEFORE}) include_directories( ./dialogs ./autorouter ../3d-viewer ../common ${Boost_INCLUDE_DIR} Loading Loading @@ -85,16 +86,26 @@ set(PCBNEW_DIALOGS dialogs/dialog_set_grid_base.cpp ) set(PCBNEW_AUTOROUTER_SRCS autorouter/automove.cpp autorouter/autoplac.cpp autorouter/autorout.cpp autorouter/routing_matrix.cpp autorouter/dist.cpp autorouter/queue.cpp autorouter/solve.cpp autorouter/graphpcb.cpp autorouter/work.cpp ) set(PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} tool_modview.cpp modview.cpp modview_frame.cpp pcbframe.cpp attribut.cpp automove.cpp autoplac.cpp autorout.cpp board.cpp board_items_to_polygon_shape_transform.cpp board_undo_redo.cpp block.cpp Loading @@ -109,7 +120,6 @@ set(PCBNEW_SRCS cross-probing.cpp deltrack.cpp ${PCBNEW_DIALOGS} dist.cpp dragsegm.cpp drc.cpp drc_clearance_test_functions.cpp Loading @@ -133,7 +143,6 @@ set(PCBNEW_SRCS gendrill.cpp globaleditpad.cpp gpcb_exchange.cpp graphpcb.cpp highlight.cpp hotkeys.cpp hotkeys_board_editor.cpp Loading Loading @@ -173,10 +182,8 @@ set(PCBNEW_SRCS plot_rtn.cpp print_board_functions.cpp printout_controler.cpp queue.cpp ratsnest.cpp set_grid.cpp solve.cpp specctra.cpp specctra_export.cpp specctra_import.cpp Loading @@ -189,7 +196,6 @@ set(PCBNEW_SRCS tracepcb.cpp tr_modif.cpp trpiste.cpp work.cpp xchgmod.cpp zones_convert_brd_items_to_polygons_with_Boost.cpp zones_convert_to_polygons_aux_functions.cpp Loading
pcbnew/ar_protos.hdeleted 100644 → 0 +0 −85 Original line number Diff line number Diff line /** * @file ar_protos.h */ #ifndef _AR_PROTOS_H_ #define _AR_PROTOS_H_ #include <autorout.h> class PCB_EDIT_FRAME; class BOARD; class D_PAD; class RATSNEST_ITEM; class TRACK; int Propagation( PCB_EDIT_FRAME* frame ); /* Initialize a color value, the cells included in the board edge of the * pad surface by pt_pad, with the margin reserved for isolation and the * half width of the runway * Parameters: * Pt_pad: pointer to the description of the pad * color: mask write in cells * margin: add a value to the radius or half the score pad * op_logic: type of writing in the cell (WRITE, OR) */ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int type, int marge, int op_logic ); /* Draws a segment of track on the board. */ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int type, int marge, int op_logic ); /* Uses the color value of all cells included in the board * coord of the rectangle ux0, uy0 (top right corner) * a ux1, uy1 (lower left corner) (coord PCB) * the rectangle is horizontal (or vertical) * masque_layer = mask layers; * op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL */ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side, int color, int op_logic); /* Same as above, but the rectangle is inclined angle angle. */ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int angle, int masque_layer, int color, int op_logic ); /* QUEUE.CPP */ void FreeQueue(); void InitQueue(); void GetQueue( int *, int *, int *, int *, int * ); int SetQueue( int, int, int, int, int, int, int ); void ReSetQueue( int, int, int, int, int, int, int ); /* WORK.CPP */ void InitWork(); void ReInitWork(); int SetWork( int, int, int , int, int, RATSNEST_ITEM *, int ); void GetWork( int *, int *, int *, int *, int *, RATSNEST_ITEM ** ); void SortWork(); /* order the work items; shortest first */ /* DIST.CPP */ int GetApxDist( int, int, int, int ); int CalcDist( int, int, int ,int ); /* BOARD.CPP */ int Build_Work( BOARD * Pcb ); 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 // _AR_PROTOS_H_
pcbnew/autoplac.cpp→pcbnew/autorouter/autoplac.cpp +52 −51 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ #include <pcbcommon.h> #include <protos.h> #include <ar_protos.h> #include <autorout.h> #include <cell.h> #include <colors_selection.h> Loading @@ -46,6 +46,7 @@ #include <class_module.h> #include <class_track.h> #include <class_drawsegment.h> #include <convert_to_biu.h> #define GAIN 16 Loading Loading @@ -150,11 +151,11 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) lay_tmp_BOTTOM = Route_Layer_BOTTOM; lay_tmp_TOP = Route_Layer_TOP; Board.m_GridRouting = (int) GetScreen()->GetGridSize().x; RoutingMatrix.m_GridRouting = (int) GetScreen()->GetGridSize().x; // Ensure Board.m_GridRouting has a reasonable value: if( Board.m_GridRouting < 10 ) Board.m_GridRouting = 10; // Min value = 1/1000 inch if( RoutingMatrix.m_GridRouting < 10*IU_PER_MILS ) RoutingMatrix.m_GridRouting = 10*IU_PER_MILS; // Min value = 1/1000 inch /* Compute module parameters used in auto place */ Module = GetBoard()->m_Modules; Loading Loading @@ -371,7 +372,7 @@ end_of_tst: CurrPosition = memopos; Board.UnInitBoard(); RoutingMatrix.UnInitBoard(); Route_Layer_TOP = lay_tmp_TOP; Route_Layer_BOTTOM = lay_tmp_BOTTOM; Loading @@ -397,13 +398,13 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC ) GRSetDrawMode( DC, GR_COPY ); for( ii = 0; ii < Board.m_Nrows; ii++ ) for( ii = 0; ii < RoutingMatrix.m_Nrows; ii++ ) { oy = bbbox.GetY() + ( ii * Board.m_GridRouting ); oy = bbbox.GetY() + ( ii * RoutingMatrix.m_GridRouting ); for( jj = 0; jj < Board.m_Ncols; jj++ ) for( jj = 0; jj < RoutingMatrix.m_Ncols; jj++ ) { ox = bbbox.GetX() + (jj * Board.m_GridRouting); ox = bbbox.GetX() + (jj * RoutingMatrix.m_GridRouting); color = BLACK; top_state = GetCell( ii, jj, TOP ); Loading Loading @@ -438,7 +439,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() EDA_ITEM* PtStruct; wxString msg; Board.UnInitBoard(); RoutingMatrix.UnInitBoard(); bbbox = GetBoard()->ComputeBoundingBox( true ); Loading @@ -449,19 +450,19 @@ int PCB_EDIT_FRAME::GenPlaceBoard() } /* The boundary box must have its start point on placing grid: */ bbbox.SetX( bbbox.GetX() - ( bbbox.GetX() % Board.m_GridRouting ) ); bbbox.SetY( bbbox.GetY() - ( bbbox.GetY() % Board.m_GridRouting ) ); bbbox.SetX( bbbox.GetX() - ( bbbox.GetX() % RoutingMatrix.m_GridRouting ) ); bbbox.SetY( bbbox.GetY() - ( bbbox.GetY() % RoutingMatrix.m_GridRouting ) ); /* The boundary box must have its end point on placing grid: */ wxPoint end = bbbox.GetEnd(); end.x -= end.x % Board.m_GridRouting; end.x += Board.m_GridRouting; end.y -= end.y % Board.m_GridRouting; end.y += Board.m_GridRouting; end.x -= end.x % RoutingMatrix.m_GridRouting; end.x += RoutingMatrix.m_GridRouting; end.y -= end.y % RoutingMatrix.m_GridRouting; end.y += RoutingMatrix.m_GridRouting; bbbox.SetEnd( end ); Nrows = bbbox.GetHeight() / Board.m_GridRouting; Ncols = bbbox.GetWidth() / Board.m_GridRouting; Nrows = bbbox.GetHeight() / RoutingMatrix.m_GridRouting; Ncols = bbbox.GetWidth() / RoutingMatrix.m_GridRouting; /* get a small margin for memory allocation: */ Ncols += 2; Nrows += 2; NbCells = Ncols * Nrows; Loading @@ -480,10 +481,10 @@ int PCB_EDIT_FRAME::GenPlaceBoard() m_messagePanel->SetMessage( 22, wxT( "S" ), ( Nb_Sides == TWO_SIDES ) ? wxT( "2" ) : wxT( "1" ), WHITE ); Board.InitBoard(); RoutingMatrix.InitBoard(); /* Display memory usage. */ msg.Printf( wxT( "%d" ), Board.m_MemSize / 1024 ); msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 ); m_messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN ); Route_Layer_BOTTOM = LAYER_N_FRONT; Loading @@ -499,7 +500,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() TmpSegm.SetLayer( -1 ); TmpSegm.SetNet( -1 ); TmpSegm.m_Width = Board.m_GridRouting / 2; TmpSegm.m_Width = RoutingMatrix.m_GridRouting / 2; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { Loading @@ -519,7 +520,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() TmpSegm.m_Param = DrawSegm->GetAngle(); TraceSegmentPcb( GetBoard(), &TmpSegm, HOLE | CELL_is_EDGE, Board.m_GridRouting, WRITE_CELL ); RoutingMatrix.m_GridRouting, WRITE_CELL ); break; case PCB_TEXT_T: Loading @@ -543,8 +544,8 @@ int PCB_EDIT_FRAME::GenPlaceBoard() } /* Initialize top layer. */ if( Board.m_BoardSide[TOP] ) memcpy( Board.m_BoardSide[TOP], Board.m_BoardSide[BOTTOM], if( RoutingMatrix.m_BoardSide[TOP] ) memcpy( RoutingMatrix.m_BoardSide[TOP], RoutingMatrix.m_BoardSide[BOTTOM], NbCells * sizeof(MATRIX_CELL) ); return 1; Loading @@ -556,7 +557,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module ) { int ox, oy, fx, fy; int marge = Board.m_GridRouting / 2; int marge = RoutingMatrix.m_GridRouting / 2; int layerMask; D_PAD* Pad; Loading Loading @@ -612,7 +613,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module ) } /* Trace clearance. */ marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN; marge = ( RoutingMatrix.m_GridRouting * Module->m_PadNum ) / GAIN; CreateKeepOutRectangle( GetBoard(), ox, oy, fx, fy, marge, KEEP_OUT_MARGIN, layerMask ); } Loading Loading @@ -643,8 +644,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) CurrPosition.y = bbbox.GetY() - oy; /* Module placement on grid. */ CurrPosition.x -= CurrPosition.x % Board.m_GridRouting; CurrPosition.y -= CurrPosition.y % Board.m_GridRouting; CurrPosition.x -= CurrPosition.x % RoutingMatrix.m_GridRouting; CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting; g_Offset_Module.x = cx - CurrPosition.x; g_Offset_Module.y = cy - CurrPosition.y; Loading Loading @@ -680,7 +681,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) SetStatusText( wxT( "Score ??, pos ??" ) ); for( ; CurrPosition.x < bbbox.GetRight() - fx; CurrPosition.x += Board.m_GridRouting ) CurrPosition.x += RoutingMatrix.m_GridRouting ) { wxYield(); Loading @@ -702,12 +703,12 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) CurrPosition.y = bbbox.GetY() - oy; /* Placement on grid. */ CurrPosition.y -= CurrPosition.y % Board.m_GridRouting; CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting; DrawModuleOutlines( m_canvas, aDC, aModule ); for( ; CurrPosition.y < bbbox.GetBottom() - fy; CurrPosition.y += Board.m_GridRouting ) CurrPosition.y += RoutingMatrix.m_GridRouting ) { /* Erase traces. */ DrawModuleOutlines( m_canvas, aDC, aModule ); Loading Loading @@ -785,16 +786,16 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side ) ux1 -= Pcb->GetBoundingBox().GetX(); uy1 -= Pcb->GetBoundingBox().GetY(); row_max = uy1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting; row_min = uy0 / Board.m_GridRouting; row_max = uy1 / RoutingMatrix.m_GridRouting; col_max = ux1 / RoutingMatrix.m_GridRouting; row_min = uy0 / RoutingMatrix.m_GridRouting; if( uy0 > row_min * Board.m_GridRouting ) if( uy0 > row_min * RoutingMatrix.m_GridRouting ) row_min++; col_min = ux0 / Board.m_GridRouting; col_min = ux0 / RoutingMatrix.m_GridRouting; if( ux0 > col_min * Board.m_GridRouting ) if( ux0 > col_min * RoutingMatrix.m_GridRouting ) col_min++; if( row_min < 0 ) Loading Loading @@ -842,16 +843,16 @@ unsigned int CalculateKeepOutArea( BOARD* Pcb, int ux0, int uy0, int ux1, int uy ux1 -= Pcb->GetBoundingBox().GetX(); uy1 -= Pcb->GetBoundingBox().GetY(); row_max = uy1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting; row_min = uy0 / Board.m_GridRouting; row_max = uy1 / RoutingMatrix.m_GridRouting; col_max = ux1 / RoutingMatrix.m_GridRouting; row_min = uy0 / RoutingMatrix.m_GridRouting; if( uy0 > row_min * Board.m_GridRouting ) if( uy0 > row_min * RoutingMatrix.m_GridRouting ) row_min++; col_min = ux0 / Board.m_GridRouting; col_min = ux0 / RoutingMatrix.m_GridRouting; if( ux0 > col_min * Board.m_GridRouting ) if( ux0 > col_min * RoutingMatrix.m_GridRouting ) col_min++; if( row_min < 0 ) Loading Loading @@ -914,7 +915,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide ) return error; } marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN; marge = ( RoutingMatrix.m_GridRouting * Module->m_PadNum ) / GAIN; return CalculateKeepOutArea( Pcb, ox - marge, oy - marge, fx + marge, fy + marge, side ); } Loading Loading @@ -1019,22 +1020,22 @@ static void CreateKeepOutRectangle( BOARD* Pcb, ux0 -= marge; ux1 += marge; uy0 -= marge; uy1 += marge; pmarge = marge / Board.m_GridRouting; pmarge = marge / RoutingMatrix.m_GridRouting; if( pmarge < 1 ) pmarge = 1; /* Calculate the coordinate limits of the rectangle. */ row_max = uy1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting; row_min = uy0 / Board.m_GridRouting; row_max = uy1 / RoutingMatrix.m_GridRouting; col_max = ux1 / RoutingMatrix.m_GridRouting; row_min = uy0 / RoutingMatrix.m_GridRouting; if( uy0 > row_min * Board.m_GridRouting ) if( uy0 > row_min * RoutingMatrix.m_GridRouting ) row_min++; col_min = ux0 / Board.m_GridRouting; col_min = ux0 / RoutingMatrix.m_GridRouting; if( ux0 > col_min * Board.m_GridRouting ) if( ux0 > col_min * RoutingMatrix.m_GridRouting ) col_min++; if( row_min < 0 ) Loading
pcbnew/autorout.cpp→pcbnew/autorouter/autorout.cpp +18 −24 Original line number Diff line number Diff line Loading @@ -11,14 +11,15 @@ #include <pcbnew.h> #include <cell.h> #include <zones.h> #include <ar_protos.h> #include <class_board.h> #include <class_module.h> #include <class_track.h> #include <convert_to_biu.h> #include <autorout.h> int E_scale; /* Scaling factor of distance tables. */ int Nb_Sides; /* Number of layer for autorouting (0 or 1) */ int Nrows = ILLEGAL; int Ncols = ILLEGAL; Loading @@ -28,8 +29,7 @@ int ClosNodes; /* total number of nodes closed */ int MoveNodes; /* total number of nodes moved */ int MaxNodes; /* maximum number of nodes opened at one time */ MATRIX_ROUTING_HEAD Board; /* 2-sided board */ MATRIX_ROUTING_HEAD RoutingMatrix; // routing matrix (grid) to route 2-sided boards /* init board, route traces*/ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) Loading Loading @@ -139,18 +139,14 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) start = time( NULL ); /* Calculation of no fixed routing to 5 mils and more. */ Board.m_GridRouting = (int)GetScreen()->GetGridSize().x; if( Board.m_GridRouting < 50 ) Board.m_GridRouting = 50; RoutingMatrix.m_GridRouting = (int)GetScreen()->GetGridSize().x; E_scale = Board.m_GridRouting / 50; if( RoutingMatrix.m_GridRouting < (5*IU_PER_MILS) ) RoutingMatrix.m_GridRouting = 5*IU_PER_MILS; if( E_scale < 1 ) E_scale = 1; /* Calculated ncol and nrow, matrix size for routing. */ Board.ComputeMatrixSize( GetBoard() ); RoutingMatrix.ComputeMatrixSize( GetBoard() ); m_messagePanel->EraseMsgBox(); Loading @@ -160,10 +156,10 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) if( Route_Layer_TOP != Route_Layer_BOTTOM ) Nb_Sides = TWO_SIDES; if( Board.InitBoard() < 0 ) if( RoutingMatrix.InitBoard() < 0 ) { wxMessageBox( _( "No memory for autorouting" ) ); Board.UnInitBoard(); /* Free memory. */ RoutingMatrix.UnInitBoard(); /* Free memory. */ return; } Loading @@ -173,7 +169,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) /* Construction of the track list for router. */ Build_Work( GetBoard() ); // DisplayBoard(m_canvas, DC); // DisplayRoutingMatrix( m_canvas, DC ); if( Nb_Sides == TWO_SIDES ) Solve( DC, TWO_SIDES ); /* double face */ Loading @@ -183,7 +179,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) /* Free memory. */ FreeQueue(); InitWork(); /* Free memory for the list of router connections. */ Board.UnInitBoard(); RoutingMatrix.UnInitBoard(); stop = time( NULL ) - start; msg.Printf( wxT( "time = %d second%s" ), stop, ( stop == 1 ) ? wxT( "" ) : wxT( "s" ) ); SetStatusText( msg ); Loading @@ -207,13 +203,11 @@ void PCB_EDIT_FRAME::Reset_Noroutable( wxDC* DC ) /* DEBUG Function: displays the routing matrix */ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC ) void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC ) { int row, col, i, j; int dcell0, dcell1 = 0, color; int maxi; maxi = 600 / Ncols; int maxi = 600 / Ncols; maxi = ( maxi * 3 ) / 4; if( !maxi ) Loading @@ -221,9 +215,9 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC ) GRSetDrawMode( DC, GR_COPY ); for( col = 0; col < Ncols; col++ ) for( int col = 0; col < Ncols; col++ ) { for( row = 0; row < Nrows; row++ ) for( int row = 0; row < Nrows; row++ ) { color = 0; dcell0 = GetCell( row, col, BOTTOM ); Loading Loading @@ -251,8 +245,8 @@ void DisplayBoard( EDA_DRAW_PANEL* panel, wxDC* DC ) #define DRAW_OFFSET_Y 20 // if( color ) { for( i = 0; i < maxi; i++ ) for( j = 0; j < maxi; j++ ) for( int i = 0; i < maxi; i++ ) for( int j = 0; j < maxi; j++ ) GRPutPixel( panel->GetClipBox(), DC, ( col * maxi ) + i + DRAW_OFFSET_X, ( row * maxi ) + j + DRAW_OFFSET_Y, color ); Loading