|
KiCad PCB EDA Suite
|
Handle the matrix routing that describes the actual board. More...
#include <ar_matrix.h>
Public Types | |
| enum | CELL_OP { WRITE_CELL = 0 , WRITE_OR_CELL = 1 , WRITE_XOR_CELL = 2 , WRITE_AND_CELL = 3 , WRITE_ADD_CELL = 4 } |
| typedef unsigned char | MATRIX_CELL |
| typedef int | DIST_CELL |
Public Member Functions | |
| AR_MATRIX () | |
| ~AR_MATRIX () | |
| void | WriteCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell) |
| VECTOR2I | GetBrdCoordOrigin () |
| bool | ComputeMatrixSize (const BOX2I &aBoundingBox) |
| Calculate the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area. | |
| int | InitRoutingMatrix () |
| Initialize the data structures. | |
| void | UnInitRoutingMatrix () |
| void | SetCellOperation (CELL_OP aLogicOp) |
| 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) |
| void | TracePcbShape (PCB_SHAPE *aShape, int aColor, int aMargin, AR_MATRIX::CELL_OP op_logic) |
| void | CreateKeepOutRectangle (int ux0, int uy0, int ux1, int uy1, int margin, int aKeepOut, const LSET &aLayerMask) |
| Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,y0 a x1,y1 are incremented by value aKeepOut Cell outside this rectangle, but inside the rectangle x0,y0 -margin to x1,y1 + margin are incremented by a decreasing value (aKeepOut ... 0). | |
| void | PlacePad (PAD *aPad, int color, int margin, AR_MATRIX::CELL_OP op_logic) |
| void | TraceFilledRectangle (int ux0, int uy0, int ux1, int uy1, const EDA_ANGLE &angle, const LSET &aLayerMask, int color, AR_MATRIX::CELL_OP op_logic) |
| void | TraceFilledRectangle (int ux0, int uy0, int ux1, int uy1, const LSET &aLayerMask, int color, AR_MATRIX::CELL_OP op_logic) |
Public Attributes | |
| MATRIX_CELL * | m_BoardSide [AR_MAX_ROUTING_LAYERS_COUNT] |
| DIST_CELL * | m_DistSide [AR_MAX_ROUTING_LAYERS_COUNT] |
| int | m_RoutingLayersCount |
| int | m_GridRouting |
| BOX2I | m_BrdBox |
| int | m_Nrows |
| int | m_Ncols |
| int | m_MemSize |
| int | m_RouteCount |
Private Member Functions | |
| void | drawSegmentQcq (int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, CELL_OP op_logic) |
| void | traceCircle (int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic) |
| void | traceFilledCircle (int cx, int cy, int radius, const LSET &aLayerMask, int color, AR_MATRIX::CELL_OP op_logic) |
| void | traceArc (int ux0, int uy0, int ux1, int uy1, const EDA_ANGLE &arcAngle, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic) |
Private Attributes | |
| void(AR_MATRIX::* | m_opWriteCell )(int aRow, int aCol, int aSide, MATRIX_CELL aCell) |
Handle the matrix routing that describes the actual board.
Definition at line 42 of file ar_matrix.h.
| typedef int AR_MATRIX::DIST_CELL |
Definition at line 46 of file ar_matrix.h.
| typedef unsigned char AR_MATRIX::MATRIX_CELL |
Definition at line 45 of file ar_matrix.h.
| enum AR_MATRIX::CELL_OP |
| Enumerator | |
|---|---|
| WRITE_CELL | |
| WRITE_OR_CELL | |
| WRITE_XOR_CELL | |
| WRITE_AND_CELL | |
| WRITE_ADD_CELL | |
Definition at line 48 of file ar_matrix.h.
| AR_MATRIX::AR_MATRIX | ( | ) |
Definition at line 33 of file ar_matrix.cpp.
References m_BoardSide, m_DistSide, m_GridRouting, m_MemSize, m_Ncols, m_Nrows, m_opWriteCell, m_RouteCount, and m_RoutingLayersCount.
|
inline |
Definition at line 58 of file ar_matrix.h.
| void AR_MATRIX::AddCell | ( | int | aRow, |
| int | aCol, | ||
| int | aSide, | ||
| MATRIX_CELL | aCell ) |
Definition at line 200 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
| void AR_MATRIX::AndCell | ( | int | aRow, |
| int | aCol, | ||
| int | aSide, | ||
| MATRIX_CELL | aCell ) |
Definition at line 191 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
| bool AR_MATRIX::ComputeMatrixSize | ( | const BOX2I & | aBoundingBox | ) |
Calculate the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area.
Definition at line 49 of file ar_matrix.cpp.
References end, KiROUND(), m_BrdBox, m_GridRouting, m_Ncols, and m_Nrows.
| void AR_MATRIX::CreateKeepOutRectangle | ( | int | ux0, |
| int | uy0, | ||
| int | ux1, | ||
| int | uy1, | ||
| int | margin, | ||
| int | aKeepOut, | ||
| const LSET & | aLayerMask ) |
Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,y0 a x1,y1 are incremented by value aKeepOut Cell outside this rectangle, but inside the rectangle x0,y0 -margin to x1,y1 + margin are incremented by a decreasing value (aKeepOut ... 0).
The decreasing value depends on the distance to the first rectangle Therefore the cost is high in rect x0,y0 to x1,y1, and decrease outside this rectangle
Definition at line 648 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, B_Cu, F_Cu, GetDist(), m_BrdBox, m_GridRouting, m_Ncols, m_Nrows, m_RoutingLayersCount, and SetDist().
|
private |
Definition at line 249 of file ar_matrix.cpp.
References KiROUND(), m_GridRouting, m_Ncols, m_Nrows, OP_CELL, RotatePoint(), and SetCellOperation().
Referenced by traceArc(), traceCircle(), and TracePcbShape().
|
inline |
Definition at line 69 of file ar_matrix.h.
References m_BrdBox.
Referenced by traceFilledCircle(), TraceFilledRectangle(), TraceFilledRectangle(), and TracePcbShape().
| AR_MATRIX::MATRIX_CELL AR_MATRIX::GetCell | ( | int | aRow, |
| int | aCol, | ||
| int | aSide ) |
Definition at line 155 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
| AR_MATRIX::DIST_CELL AR_MATRIX::GetDist | ( | int | aRow, |
| int | aCol, | ||
| int | aSide ) |
Definition at line 208 of file ar_matrix.cpp.
References m_DistSide, and m_Ncols.
Referenced by CreateKeepOutRectangle().
| int AR_MATRIX::InitRoutingMatrix | ( | ) |
Initialize the data structures.
Definition at line 79 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, m_BoardSide, m_DistSide, m_MemSize, m_Ncols, m_Nrows, m_RouteCount, and m_RoutingLayersCount.
| void AR_MATRIX::OrCell | ( | int | aRow, |
| int | aCol, | ||
| int | aSide, | ||
| MATRIX_CELL | aCell ) |
Definition at line 173 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
| void AR_MATRIX::PlacePad | ( | PAD * | aPad, |
| int | color, | ||
| int | margin, | ||
| AR_MATRIX::CELL_OP | op_logic ) |
Definition at line 729 of file ar_matrix.cpp.
References ANGLE_270, ANGLE_90, B_Cu, CIRCLE, PADSTACK::EffectiveLayerFor(), F_Cu, PAD::GetDelta(), PAD::GetLayerSet(), PAD::GetOrientation(), PAD::GetShape(), PAD::GetSize(), EDA_ANGLE::IsCardinal(), m_RoutingLayersCount, PAD::Padstack(), PAD::ShapePos(), traceFilledCircle(), TraceFilledRectangle(), TRAPEZOID, VECTOR2< T >::x, and VECTOR2< T >::y.
| void AR_MATRIX::SetCell | ( | int | aRow, |
| int | aCol, | ||
| int | aSide, | ||
| MATRIX_CELL | aCell ) |
Definition at line 164 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
| void AR_MATRIX::SetCellOperation | ( | AR_MATRIX::CELL_OP | aLogicOp | ) |
Definition at line 139 of file ar_matrix.cpp.
References AddCell(), AndCell(), m_opWriteCell, OrCell(), SetCell(), WRITE_ADD_CELL, WRITE_AND_CELL, WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, and XorCell().
Referenced by drawSegmentQcq(), traceFilledCircle(), TraceFilledRectangle(), and TraceFilledRectangle().
| void AR_MATRIX::SetDist | ( | int | aRow, |
| int | aCol, | ||
| int | aSide, | ||
| DIST_CELL | x ) |
Definition at line 216 of file ar_matrix.cpp.
References m_DistSide, and m_Ncols.
Referenced by CreateKeepOutRectangle().
|
private |
Definition at line 463 of file ar_matrix.cpp.
References std::abs(), EDA_ANGLE::AsDegrees(), EDA_ANGLE::Cos(), VECTOR2< T >::Distance(), drawSegmentQcq(), KiROUND(), EDA_ANGLE::Normalize(), and radius.
Referenced by TracePcbShape().
|
private |
Definition at line 331 of file ar_matrix.cpp.
References ANGLE_360, EDA_ANGLE::Cos(), VECTOR2< T >::Distance(), drawSegmentQcq(), KiROUND(), radius, and EDA_ANGLE::Sin().
Referenced by TracePcbShape().
|
private |
Definition at line 362 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, B_Cu, F_Cu, GetBrdCoordOrigin(), m_GridRouting, m_Ncols, m_Nrows, m_RoutingLayersCount, radius, SetCellOperation(), WriteCell(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PlacePad().
| void AR_MATRIX::TraceFilledRectangle | ( | int | ux0, |
| int | uy0, | ||
| int | ux1, | ||
| int | uy1, | ||
| const EDA_ANGLE & | angle, | ||
| const LSET & | aLayerMask, | ||
| int | color, | ||
| AR_MATRIX::CELL_OP | op_logic ) |
Definition at line 497 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, B_Cu, center, VECTOR2< T >::Distance(), F_Cu, GetBrdCoordOrigin(), KiROUND(), m_GridRouting, m_Ncols, m_Nrows, m_RoutingLayersCount, radius, RotatePoint(), SetCellOperation(), WriteCell(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PlacePad().
| void AR_MATRIX::TraceFilledRectangle | ( | int | ux0, |
| int | uy0, | ||
| int | ux1, | ||
| int | uy1, | ||
| const LSET & | aLayerMask, | ||
| int | color, | ||
| AR_MATRIX::CELL_OP | op_logic ) |
Definition at line 562 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, B_Cu, F_Cu, GetBrdCoordOrigin(), m_GridRouting, m_Ncols, m_Nrows, m_RoutingLayersCount, SetCellOperation(), WriteCell(), VECTOR2< T >::x, and VECTOR2< T >::y.
| void AR_MATRIX::TracePcbShape | ( | PCB_SHAPE * | aShape, |
| int | aColor, | ||
| int | aMargin, | ||
| AR_MATRIX::CELL_OP | op_logic ) |
Definition at line 607 of file ar_matrix.cpp.
References ARC, CIRCLE, drawSegmentQcq(), EDA_SHAPE::GetArcAngle(), GetBrdCoordOrigin(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), PCB_SHAPE::GetWidth(), SEGMENT, traceArc(), traceCircle(), UNDEFINED_LAYER, VECTOR2< T >::x, and VECTOR2< T >::y.
| void AR_MATRIX::UnInitRoutingMatrix | ( | ) |
Definition at line 116 of file ar_matrix.cpp.
References AR_MAX_ROUTING_LAYERS_COUNT, m_BoardSide, m_DistSide, m_Ncols, and m_Nrows.
|
inline |
Definition at line 60 of file ar_matrix.h.
References m_opWriteCell.
Referenced by traceFilledCircle(), TraceFilledRectangle(), and TraceFilledRectangle().
| void AR_MATRIX::XorCell | ( | int | aRow, |
| int | aCol, | ||
| int | aSide, | ||
| MATRIX_CELL | aCell ) |
Definition at line 182 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
| MATRIX_CELL* AR_MATRIX::m_BoardSide[AR_MAX_ROUTING_LAYERS_COUNT] |
Definition at line 126 of file ar_matrix.h.
Referenced by AddCell(), AndCell(), AR_MATRIX(), GetCell(), InitRoutingMatrix(), OrCell(), SetCell(), UnInitRoutingMatrix(), and XorCell().
| BOX2I AR_MATRIX::m_BrdBox |
Definition at line 131 of file ar_matrix.h.
Referenced by ComputeMatrixSize(), CreateKeepOutRectangle(), and GetBrdCoordOrigin().
| DIST_CELL* AR_MATRIX::m_DistSide[AR_MAX_ROUTING_LAYERS_COUNT] |
Definition at line 127 of file ar_matrix.h.
Referenced by AR_MATRIX(), GetDist(), InitRoutingMatrix(), SetDist(), and UnInitRoutingMatrix().
| int AR_MATRIX::m_GridRouting |
Definition at line 130 of file ar_matrix.h.
Referenced by AR_MATRIX(), ComputeMatrixSize(), CreateKeepOutRectangle(), drawSegmentQcq(), traceFilledCircle(), TraceFilledRectangle(), and TraceFilledRectangle().
| int AR_MATRIX::m_MemSize |
Definition at line 133 of file ar_matrix.h.
Referenced by AR_MATRIX(), and InitRoutingMatrix().
| int AR_MATRIX::m_Ncols |
Definition at line 132 of file ar_matrix.h.
Referenced by AddCell(), AndCell(), AR_MATRIX(), ComputeMatrixSize(), CreateKeepOutRectangle(), drawSegmentQcq(), GetCell(), GetDist(), InitRoutingMatrix(), OrCell(), SetCell(), SetDist(), traceFilledCircle(), TraceFilledRectangle(), TraceFilledRectangle(), UnInitRoutingMatrix(), and XorCell().
| int AR_MATRIX::m_Nrows |
Definition at line 132 of file ar_matrix.h.
Referenced by AR_MATRIX(), ComputeMatrixSize(), CreateKeepOutRectangle(), drawSegmentQcq(), InitRoutingMatrix(), traceFilledCircle(), TraceFilledRectangle(), TraceFilledRectangle(), and UnInitRoutingMatrix().
|
private |
Definition at line 138 of file ar_matrix.h.
Referenced by AR_MATRIX(), SetCellOperation(), and WriteCell().
| int AR_MATRIX::m_RouteCount |
Definition at line 134 of file ar_matrix.h.
Referenced by AR_MATRIX(), and InitRoutingMatrix().
| int AR_MATRIX::m_RoutingLayersCount |
Definition at line 129 of file ar_matrix.h.
Referenced by AR_MATRIX(), CreateKeepOutRectangle(), InitRoutingMatrix(), PlacePad(), traceFilledCircle(), TraceFilledRectangle(), and TraceFilledRectangle().