KiCad PCB EDA Suite
autorout.cpp File Reference

Autorouting command and control. More...

#include <fctsys.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <gr_basic.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <cell.h>
#include <zones.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <convert_to_biu.h>
#include <autorout.h>

Go to the source code of this file.

Macros

#define DRAW_OFFSET_X   -20
 
#define DRAW_OFFSET_Y   20
 

Functions

void DisplayRoutingMatrix (EDA_DRAW_PANEL *panel, wxDC *DC)
 

Variables

MATRIX_ROUTING_HEAD RoutingMatrix
 

Detailed Description

Autorouting command and control.

Definition in file autorout.cpp.

Macro Definition Documentation

#define DRAW_OFFSET_X   -20

Referenced by DisplayRoutingMatrix().

#define DRAW_OFFSET_Y   20

Referenced by DisplayRoutingMatrix().

Function Documentation

void DisplayRoutingMatrix ( EDA_DRAW_PANEL panel,
wxDC *  DC 
)

Definition at line 223 of file autorout.cpp.

References BLACK, BLUE, BOTTOM, CELL_is_EDGE, CELL_is_ZONE, DRAW_OFFSET_X, DRAW_OFFSET_Y, MATRIX_ROUTING_HEAD::GetCell(), EDA_DRAW_PANEL::GetClipBox(), GR_COPY, GREEN, GRPutPixel(), GRSetDrawMode(), HOLE, MATRIX_ROUTING_HEAD::m_Ncols, MATRIX_ROUTING_HEAD::m_Nrows, MATRIX_ROUTING_HEAD::m_RoutingLayersCount, RED, TOP, VIA_IMPOSSIBLE, and YELLOW.

224 {
225  int dcell0;
226  COLOR4D color;
227 
228  int maxi = 600 / RoutingMatrix.m_Ncols;
229  maxi = ( maxi * 3 ) / 4;
230 
231  if( !maxi )
232  maxi = 1;
233 
234  GRSetDrawMode( DC, GR_COPY );
235 
236  for( int col = 0; col < RoutingMatrix.m_Ncols; col++ )
237  {
238  for( int row = 0; row < RoutingMatrix.m_Nrows; row++ )
239  {
240  color = COLOR4D::BLACK;
241  dcell0 = RoutingMatrix.GetCell( row, col, BOTTOM );
242 
243  if( dcell0 & HOLE )
244  color = COLOR4D( GREEN );
245 
246 #if 0
247  int dcell1 = 0;
248 
250  dcell1 = GetCell( row, col, TOP );
251 
252  if( dcell1 & HOLE )
253  color = COLOR4D( RED );
254 
255  dcell0 |= dcell1;
256 #endif
257  if( ( color == COLOR4D::BLACK ) && ( dcell0 & VIA_IMPOSSIBLE ) )
258  color = COLOR4D( BLUE );
259 
260  if( dcell0 & CELL_is_EDGE )
261  color = COLOR4D( YELLOW );
262  else if( dcell0 & CELL_is_ZONE )
263  color = COLOR4D( YELLOW );
264 
265  #define DRAW_OFFSET_X -20
266  #define DRAW_OFFSET_Y 20
267 // if( color )
268  {
269  for( int i = 0; i < maxi; i++ )
270  for( int j = 0; j < maxi; j++ )
271  GRPutPixel( panel->GetClipBox(), DC,
272  ( col * maxi ) + i + DRAW_OFFSET_X,
273  ( row * maxi ) + j + DRAW_OFFSET_Y, color );
274 
275  }
276  }
277  }
278 }
Definition: colors.h:57
#define VIA_IMPOSSIBLE
Definition: cell.h:48
#define DRAW_OFFSET_X
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
#define CELL_is_EDGE
Definition: cell.h:42
#define DRAW_OFFSET_Y
MATRIX_CELL GetCell(int aRow, int aCol, int aSide)
#define TOP
Definition: autorout.h:49
EDA_RECT * GetClipBox()
Definition: colors.h:60
void GRPutPixel(EDA_RECT *ClipBox, wxDC *DC, int x, int y, COLOR4D Color)
Definition: gr_basic.cpp:339
MATRIX_ROUTING_HEAD RoutingMatrix
Definition: autorout.cpp:51
Definition: colors.h:58
#define BOTTOM
Definition: autorout.h:50
Definition: colors.h:45
Definition: colors.h:68
#define HOLE
Definition: cell.h:40
#define CELL_is_ZONE
Definition: cell.h:44
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

Variable Documentation