KiCad PCB EDA Suite
|
#include <ar_autoplacer.h>
Public Member Functions | |
AR_AUTOPLACER (BOARD *aBoard) | |
AR_RESULT | AutoplaceFootprints (std::vector< FOOTPRINT * > &aFootprints, BOARD_COMMIT *aCommit, bool aPlaceOffboardModules=false) |
void | SetOverlay (std::shared_ptr< KIGFX::VIEW_OVERLAY > aOverlay) |
Set a VIEW overlay to draw items during a autoplace session. | |
void | SetRefreshCallback (std::function< int(FOOTPRINT *aFootprint)> aCallback) |
Callback to redraw on screen the view after changes, for instance after moving a footprint. | |
void | SetProgressReporter (PROGRESS_REPORTER *aReporter) |
Private Member Functions | |
void | drawPlacementRoutingMatrix () |
int | genPlacementRoutingMatrix () |
bool | fillMatrix () |
Fill m_matrix cells from m_boardShape. | |
void | genModuleOnRoutingMatrix (FOOTPRINT *aFootprint) |
int | testRectangle (const BOX2I &aRect, int side) |
unsigned int | calculateKeepOutArea (const BOX2I &aRect, int side) |
int | testFootprintOnBoard (FOOTPRINT *aFootprint, bool TstOtherSide, const VECTOR2I &aOffset) |
int | getOptimalFPPlacement (FOOTPRINT *aFootprint) |
double | computePlacementRatsnestCost (FOOTPRINT *aFootprint, const VECTOR2I &aOffset) |
FOOTPRINT * | pickFootprint () |
Find the "best" footprint place. | |
void | placeFootprint (FOOTPRINT *aFootprint, bool aDoNotRecreateRatsnest, const VECTOR2I &aPos) |
const PAD * | nearestPad (FOOTPRINT *aRefFP, PAD *aRefPad, const VECTOR2I &aOffset) |
void | addFpBody (const VECTOR2I &aStart, const VECTOR2I &aEnd, LSET aLayerMask) |
void | addPad (PAD *aPad, int aClearance) |
void | buildFpAreas (FOOTPRINT *aFootprint, int aFpClearance) |
Private Attributes | |
AR_MATRIX | m_matrix |
SHAPE_POLY_SET | m_topFreeArea |
SHAPE_POLY_SET | m_bottomFreeArea |
SHAPE_POLY_SET | m_boardShape |
SHAPE_POLY_SET | m_fpAreaTop |
SHAPE_POLY_SET | m_fpAreaBottom |
BOARD * | m_board |
VECTOR2I | m_curPosition |
double | m_minCost |
int | m_gridSize |
std::shared_ptr< KIGFX::VIEW_OVERLAY > | m_overlay |
std::unique_ptr< CONNECTIVITY_DATA > | m_connectivity |
std::function< int(FOOTPRINT *aFootprint)> | m_refreshCallback |
PROGRESS_REPORTER * | m_progressReporter |
Definition at line 58 of file ar_autoplacer.h.
AR_AUTOPLACER::AR_AUTOPLACER | ( | BOARD * | aBoard | ) |
Definition at line 60 of file ar_autoplacer.cpp.
References BOARD::Footprints(), m_board, m_connectivity, m_gridSize, m_minCost, m_progressReporter, m_refreshCallback, EDA_IU_SCALE::mmToIU(), pcbIUScale, and STEP_AR_MM.
|
private |
Definition at line 254 of file ar_autoplacer.cpp.
References SHAPE_POLY_SET::Append(), B_Cu, F_Cu, m_fpAreaBottom, m_fpAreaTop, SHAPE_POLY_SET::NewOutline(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by buildFpAreas().
|
private |
Definition at line 277 of file ar_autoplacer.cpp.
References SHAPE_POLY_SET::Append(), B_Cu, F_Cu, BOX2< Vec >::GetBottom(), PAD::GetBoundingBox(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), BOX2< Vec >::Inflate(), PAD::IsOnLayer(), m_fpAreaBottom, m_fpAreaTop, and SHAPE_POLY_SET::NewOutline().
Referenced by buildFpAreas().
AR_RESULT AR_AUTOPLACER::AutoplaceFootprints | ( | std::vector< FOOTPRINT * > & | aFootprints, |
BOARD_COMMIT * | aCommit, | ||
bool | aPlaceOffboardModules = false |
||
) |
Definition at line 828 of file ar_autoplacer.cpp.
References _, PROGRESS_REPORTER::AdvanceProgress(), AR_ABORT_PLACEMENT, AR_CANCELLED, AR_COMPLETED, AR_FAILURE, BOX2< Vec >::Contains(), drawPlacementRoutingMatrix(), BOARD::Footprints(), genModuleOnRoutingMatrix(), genPlacementRoutingMatrix(), getOptimalFPPlacement(), FOOTPRINT::GetReference(), PROGRESS_REPORTER::KeepRefreshing(), m_board, AR_MATRIX::m_BrdBox, m_curPosition, AR_MATRIX::m_GridRouting, m_gridSize, m_matrix, m_progressReporter, m_refreshCallback, EDA_IU_SCALE::mmToIU(), COMMIT::Modify(), pcbIUScale, pickFootprint(), placeFootprint(), PROGRESS_REPORTER::Report(), FOOTPRINT::SetIsPlaced(), PROGRESS_REPORTER::SetMaxProgress(), FOOTPRINT::SetNeedsPlaced(), PROGRESS_REPORTER::SetTitle(), and AR_MATRIX::UnInitRoutingMatrix().
Referenced by AUTOPLACE_TOOL::autoplace().
|
private |
Definition at line 303 of file ar_autoplacer.cpp.
References addFpBody(), addPad(), B_CrtYd, B_Cu, FOOTPRINT::BuildCourtyardCaches(), F_CrtYd, F_Cu, FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetCourtyard(), BOX2< Vec >::GetEnd(), FOOTPRINT::GetLayer(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::Inflate(), m_fpAreaBottom, m_fpAreaTop, AR_MATRIX::m_GridRouting, m_matrix, pad, FOOTPRINT::Pads(), SHAPE_POLY_SET::RemoveAllContours(), and BASE_SET::set().
Referenced by genModuleOnRoutingMatrix(), and testFootprintOnBoard().
|
private |
Definition at line 454 of file ar_autoplacer.cpp.
References AR_MATRIX::GetDist(), BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), AR_MATRIX::m_BrdBox, AR_MATRIX::m_GridRouting, m_matrix, AR_MATRIX::m_Ncols, AR_MATRIX::m_Nrows, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by testFootprintOnBoard().
|
private |
Definition at line 667 of file ar_autoplacer.cpp.
References PAD::GetPosition(), nearestPad(), pad, FOOTPRINT::Pads(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by getOptimalFPPlacement().
|
private |
Definition at line 797 of file ar_autoplacer.cpp.
References SHAPE_POLY_SET::CloneDropTriangulation(), SHAPE_POLY_SET::Fracture(), m_bottomFreeArea, m_overlay, m_topFreeArea, SHAPE_POLY_SET::OutlineCount(), and SHAPE_POLY_SET::PM_FAST.
Referenced by AutoplaceFootprints().
|
private |
Fill m_matrix cells from m_boardShape.
Cells inside m_boardShape are set to CELL_IS_ZONE.
Definition at line 140 of file ar_autoplacer.cpp.
References AR_SIDE_BOTTOM, SHAPE_LINE_CHAIN::BBox(), CELL_IS_ZONE, SHAPE_POLY_SET::CloneDropTriangulation(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_POLY_SET::Fracture(), BOX2< Vec >::GetBottom(), AR_MATRIX::GetBrdCoordOrigin(), BOX2< Vec >::GetY(), m_boardShape, AR_MATRIX::m_GridRouting, m_matrix, AR_MATRIX::m_Ncols, AR_MATRIX::m_Nrows, SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::PM_FAST, SHAPE_LINE_CHAIN::PointCount(), AR_MATRIX::SetCell(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by genPlacementRoutingMatrix().
|
private |
Definition at line 336 of file ar_autoplacer.cpp.
References AR_GAIN, AR_KEEPOUT_MARGIN, B_Cu, SHAPE_POLY_SET::BooleanSubtract(), buildFpAreas(), CELL_IS_MODULE, AR_MATRIX::CreateKeepOutRectangle(), F_Cu, BOX2< Vec >::GetBottom(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetLayer(), FOOTPRINT::GetPadCount(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), BOX2< Vec >::Inflate(), m_bottomFreeArea, AR_MATRIX::m_BrdBox, m_fpAreaBottom, m_fpAreaTop, AR_MATRIX::m_GridRouting, m_matrix, m_topFreeArea, pad, FOOTPRINT::Pads(), AR_MATRIX::PlacePad(), SHAPE_POLY_SET::PM_FAST, BASE_SET::set(), AR_MATRIX::TraceFilledRectangle(), and AR_MATRIX::WRITE_OR_CELL.
Referenced by AutoplaceFootprints().
|
private |
Definition at line 86 of file ar_autoplacer.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, B_Cu, CELL_IS_EDGE, CELL_IS_HOLE, AR_MATRIX::ComputeMatrixSize(), BOARD::Drawings(), Edge_Cuts, F_Cu, fillMatrix(), BOARD::GetBoardEdgesBoundingBox(), BOARD::GetBoardPolygonOutlines(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), AR_MATRIX::InitRoutingMatrix(), m_board, m_boardShape, AR_MATRIX::m_BoardSide, m_bottomFreeArea, AR_MATRIX::m_GridRouting, m_matrix, AR_MATRIX::m_Ncols, AR_MATRIX::m_Nrows, AR_MATRIX::m_routeLayerBottom, AR_MATRIX::m_routeLayerTop, AR_MATRIX::m_RoutingLayersCount, m_topFreeArea, PCB_SHAPE_T, AR_MATRIX::TraceSegmentPcb(), AR_MATRIX::UnInitRoutingMatrix(), and AR_MATRIX::WRITE_CELL.
Referenced by AutoplaceFootprints().
|
private |
Definition at line 541 of file ar_autoplacer.cpp.
References B_Cu, computePlacementRatsnestCost(), F_Cu, FOOTPRINT::GetBoundingBox(), BOX2< Vec >::GetEnd(), FOOTPRINT::GetLayer(), BOX2< Vec >::GetOrigin(), FOOTPRINT::GetPosition(), AR_MATRIX::m_BrdBox, m_curPosition, AR_MATRIX::m_GridRouting, m_matrix, m_minCost, AR_MATRIX::m_RoutingLayersCount, BOX2< Vec >::Move(), pad, FOOTPRINT::Pads(), BOX2< Vec >::SetOrigin(), testFootprintOnBoard(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AutoplaceFootprints().
|
private |
Definition at line 634 of file ar_autoplacer.cpp.
References BOX2< Vec >::Contains(), BOARD::Footprints(), BOARD_CONNECTED_ITEM::GetNetCode(), PAD::GetPosition(), m_board, AR_MATRIX::m_BrdBox, m_matrix, and pad.
Referenced by computePlacementRatsnestCost().
|
private |
Find the "best" footprint place.
The criteria are:
Definition at line 736 of file ar_autoplacer.cpp.
References BOARD::Footprints(), FOOTPRINT::GetFlag(), m_board, m_connectivity, FOOTPRINT::NeedsPlaced(), FOOTPRINT::SetFlag(), sortFootprintsByComplexity(), and sortFootprintsByRatsnestSize().
Referenced by AutoplaceFootprints().
|
private |
Definition at line 75 of file ar_autoplacer.cpp.
References m_connectivity, and FOOTPRINT::SetPosition().
Referenced by AutoplaceFootprints().
|
inline |
Set a VIEW overlay to draw items during a autoplace session.
Definition at line 69 of file ar_autoplacer.h.
References m_overlay.
Referenced by AUTOPLACE_TOOL::autoplace().
|
inline |
Definition at line 82 of file ar_autoplacer.h.
References m_progressReporter.
Referenced by AUTOPLACE_TOOL::autoplace().
|
inline |
Callback to redraw on screen the view after changes, for instance after moving a footprint.
Definition at line 77 of file ar_autoplacer.h.
References m_refreshCallback.
Referenced by AUTOPLACE_TOOL::autoplace().
|
private |
Definition at line 503 of file ar_autoplacer.cpp.
References AR_FREE_CELL, AR_GAIN, AR_SIDE_BOTTOM, AR_SIDE_TOP, B_Cu, buildFpAreas(), calculateKeepOutArea(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetLayer(), FOOTPRINT::GetPadCount(), BOX2< Vec >::Inflate(), AR_MATRIX::m_GridRouting, m_matrix, BOX2< Vec >::Move(), and testRectangle().
Referenced by getOptimalFPPlacement().
|
private |
Definition at line 401 of file ar_autoplacer.cpp.
References AR_FREE_CELL, AR_OCCUIPED_BY_MODULE, AR_OUT_OF_BOARD, CELL_IS_MODULE, CELL_IS_ZONE, AR_MATRIX::GetCell(), BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::Inflate(), AR_MATRIX::m_BrdBox, AR_MATRIX::m_GridRouting, m_matrix, AR_MATRIX::m_Ncols, AR_MATRIX::m_Nrows, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by testFootprintOnBoard().
|
private |
Definition at line 135 of file ar_autoplacer.h.
Referenced by AR_AUTOPLACER(), AutoplaceFootprints(), genPlacementRoutingMatrix(), nearestPad(), and pickFootprint().
|
private |
Definition at line 129 of file ar_autoplacer.h.
Referenced by fillMatrix(), and genPlacementRoutingMatrix().
|
private |
Definition at line 128 of file ar_autoplacer.h.
Referenced by drawPlacementRoutingMatrix(), genModuleOnRoutingMatrix(), and genPlacementRoutingMatrix().
|
private |
Definition at line 142 of file ar_autoplacer.h.
Referenced by AR_AUTOPLACER(), pickFootprint(), and placeFootprint().
|
private |
Definition at line 137 of file ar_autoplacer.h.
Referenced by AutoplaceFootprints(), and getOptimalFPPlacement().
|
private |
Definition at line 132 of file ar_autoplacer.h.
Referenced by addFpBody(), addPad(), buildFpAreas(), and genModuleOnRoutingMatrix().
|
private |
Definition at line 130 of file ar_autoplacer.h.
Referenced by addFpBody(), addPad(), buildFpAreas(), and genModuleOnRoutingMatrix().
|
private |
Definition at line 139 of file ar_autoplacer.h.
Referenced by AR_AUTOPLACER(), and AutoplaceFootprints().
|
private |
Definition at line 126 of file ar_autoplacer.h.
Referenced by AutoplaceFootprints(), buildFpAreas(), calculateKeepOutArea(), fillMatrix(), genModuleOnRoutingMatrix(), genPlacementRoutingMatrix(), getOptimalFPPlacement(), nearestPad(), testFootprintOnBoard(), and testRectangle().
|
private |
Definition at line 138 of file ar_autoplacer.h.
Referenced by AR_AUTOPLACER(), and getOptimalFPPlacement().
|
private |
Definition at line 141 of file ar_autoplacer.h.
Referenced by drawPlacementRoutingMatrix(), and SetOverlay().
|
private |
Definition at line 144 of file ar_autoplacer.h.
Referenced by AR_AUTOPLACER(), AutoplaceFootprints(), and SetProgressReporter().
|
private |
Definition at line 143 of file ar_autoplacer.h.
Referenced by AR_AUTOPLACER(), AutoplaceFootprints(), and SetRefreshCallback().
|
private |
Definition at line 127 of file ar_autoplacer.h.
Referenced by drawPlacementRoutingMatrix(), genModuleOnRoutingMatrix(), and genPlacementRoutingMatrix().