KiCad PCB EDA Suite
|
#include <connectivity_data.h>
Public Member Functions | |
CONNECTIVITY_DATA () | |
~CONNECTIVITY_DATA () | |
CONNECTIVITY_DATA (const std::vector< BOARD_ITEM * > &aItems, bool aSkipItems=false) | |
bool | Build (BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) |
Function Build() Builds the connectivity database for the board aBoard. More... | |
void | Build (const std::vector< BOARD_ITEM * > &aItems) |
Function Build() Builds the connectivity database for a set of items aItems. More... | |
bool | Add (BOARD_ITEM *aItem) |
Function Add() Adds an item to the connectivity data. More... | |
bool | Remove (BOARD_ITEM *aItem) |
Function Remove() Removes an item from the connectivity data. More... | |
bool | Update (BOARD_ITEM *aItem) |
Function Update() Updates the connectivity data for an item. More... | |
void | Move (const VECTOR2I &aDelta) |
Moves the connectivity list anchors. More... | |
void | ClearRatsnest () |
Function Clear() Erases the connectivity database. More... | |
int | GetNetCount () const |
Function GetNetCount() Returns the total number of nets in the connectivity database. More... | |
RN_NET * | GetRatsnestForNet (int aNet) |
Function GetRatsnestForNet() Returns the ratsnest, expressed as a set of graph edges for a given net. More... | |
void | PropagateNets (BOARD_COMMIT *aCommit=nullptr) |
Propagates the net codes from the source pads to the tracks/vias. More... | |
void | FillIsolatedIslandsMap (std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > &aMap, bool aConnectivityAlreadyRebuilt=false) |
Fill the isolate islands list for each layer of each zone. More... | |
void | RecalculateRatsnest (BOARD_COMMIT *aCommit=nullptr) |
Function RecalculateRatsnest() Updates the ratsnest for the board. More... | |
unsigned int | GetUnconnectedCount (bool aVisibileOnly) const |
bool | IsConnectedOnLayer (const BOARD_CONNECTED_ITEM *aItem, int aLayer, const std::initializer_list< KICAD_T > &aTypes={}) const |
unsigned int | GetNodeCount (int aNet=-1) const |
unsigned int | GetPadCount (int aNet=-1) const |
const std::vector< PCB_TRACK * > | GetConnectedTracks (const BOARD_CONNECTED_ITEM *aItem) const |
const std::vector< PAD * > | GetConnectedPads (const BOARD_CONNECTED_ITEM *aItem) const |
void | GetConnectedPads (const BOARD_CONNECTED_ITEM *aItem, std::set< PAD * > *pads) const |
void | GetConnectedPadsAndVias (const BOARD_CONNECTED_ITEM *aItem, std::vector< PAD * > *pads, std::vector< PCB_VIA * > *vias) |
const std::vector< BOARD_CONNECTED_ITEM * > | GetConnectedItemsAtAnchor (const BOARD_CONNECTED_ITEM *aItem, const VECTOR2I &aAnchor, const std::initializer_list< KICAD_T > &aTypes, const int &aMaxError=0) const |
Function GetConnectedItemsAtAnchor() Returns a list of items connected to a source item aItem at position aAnchor with an optional maximum distance from the defined anchor. More... | |
void | RunOnUnconnectedEdges (std::function< bool(CN_EDGE &)> aFunc) |
bool | TestTrackEndpointDangling (PCB_TRACK *aTrack, VECTOR2I *aPos=nullptr) const |
void | ClearLocalRatsnest () |
Function ClearLocalRatsnest() Erases the temporary, selection-based ratsnest (i.e. More... | |
void | HideLocalRatsnest () |
Hides the temporary, selection-based ratsnest lines. More... | |
void | ComputeLocalRatsnest (const std::vector< BOARD_ITEM * > &aItems, const CONNECTIVITY_DATA *aDynamicData, VECTOR2I aInternalOffset={ 0, 0 }) |
Function ComputeLocalRatsnest() Calculates the temporary (usually selection-based) ratsnest for the set of aItems. More... | |
const std::vector< RN_DYNAMIC_LINE > & | GetLocalRatsnest () const |
const std::vector< BOARD_CONNECTED_ITEM * > | GetConnectedItems (const BOARD_CONNECTED_ITEM *aItem, const std::initializer_list< KICAD_T > &aTypes, bool aIgnoreNetcodes=false) const |
Function GetConnectedItems() Returns a list of items connected to a source item aItem. More... | |
const std::vector< BOARD_CONNECTED_ITEM * > | GetNetItems (int aNetCode, const std::initializer_list< KICAD_T > &aTypes) const |
Function GetNetItems() Returns the list of items that belong to a certain net. More... | |
void | BlockRatsnestItems (const std::vector< BOARD_ITEM * > &aItems) |
std::shared_ptr< CN_CONNECTIVITY_ALGO > | GetConnectivityAlgo () const |
KISPINLOCK & | GetLock () |
void | MarkItemNetAsDirty (BOARD_ITEM *aItem) |
void | SetProgressReporter (PROGRESS_REPORTER *aReporter) |
const std::map< int, wxString > & | GetNetclassMap () const |
const std::vector< CN_EDGE > | GetRatsnestForItems (const std::vector< BOARD_ITEM * > aItems) |
const std::vector< CN_EDGE > | GetRatsnestForPad (const PAD *aPad) |
const std::vector< CN_EDGE > | GetRatsnestForComponent (FOOTPRINT *aComponent, bool aSkipInternalConnections=false) |
std::shared_ptr< FROM_TO_CACHE > | GetFromToCache () |
Private Member Functions | |
void | internalRecalculateRatsnest (BOARD_COMMIT *aCommit=nullptr) |
Updates the ratsnest for the board without locking the connectivity mutex. More... | |
void | updateRatsnest () |
void | addRatsnestCluster (const std::shared_ptr< CN_CLUSTER > &aCluster) |
Private Attributes | |
std::shared_ptr< CN_CONNECTIVITY_ALGO > | m_connAlgo |
std::shared_ptr< FROM_TO_CACHE > | m_fromToCache |
std::vector< RN_DYNAMIC_LINE > | m_dynamicRatsnest |
std::vector< RN_NET * > | m_nets |
bool | m_skipRatsnest = false |
Used to suppress ratsnest calculations on dynamic ratsnests. More... | |
KISPINLOCK | m_lock |
std::map< int, wxString > | m_netclassMap |
Map of netcode -> netclass the net is a member of; used for ratsnest painting. More... | |
PROGRESS_REPORTER * | m_progressReporter |
Definition at line 86 of file connectivity_data.h.
CONNECTIVITY_DATA::CONNECTIVITY_DATA | ( | ) |
Definition at line 47 of file connectivity_data.cpp.
References m_connAlgo, m_fromToCache, and m_progressReporter.
CONNECTIVITY_DATA::~CONNECTIVITY_DATA | ( | ) |
Definition at line 64 of file connectivity_data.cpp.
References m_nets.
CONNECTIVITY_DATA::CONNECTIVITY_DATA | ( | const std::vector< BOARD_ITEM * > & | aItems, |
bool | aSkipItems = false |
||
) |
Definition at line 55 of file connectivity_data.cpp.
References Build(), m_fromToCache, and m_progressReporter.
bool CONNECTIVITY_DATA::Add | ( | BOARD_ITEM * | aItem | ) |
Function Add() Adds an item to the connectivity data.
aItem | is an item to be added. |
Definition at line 73 of file connectivity_data.cpp.
References m_connAlgo.
|
private |
Definition at line 206 of file connectivity_data.cpp.
References RN_NET::AddCluster(), and m_nets.
Referenced by internalRecalculateRatsnest().
void CONNECTIVITY_DATA::BlockRatsnestItems | ( | const std::vector< BOARD_ITEM * > & | aItems | ) |
Definition at line 280 of file connectivity_data.cpp.
References anchor, CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY::GetItems(), m_connAlgo, pad, and PCB_FOOTPRINT_T.
bool CONNECTIVITY_DATA::Build | ( | BOARD * | aBoard, |
PROGRESS_REPORTER * | aReporter = nullptr |
||
) |
Function Build() Builds the connectivity database for the board aBoard.
Definition at line 95 of file connectivity_data.cpp.
References _, BOARD::CacheTriangulation(), NETCLASS::Default, BOARD::GetDesignSettings(), BOARD::GetNetInfo(), internalRecalculateRatsnest(), PROGRESS_REPORTER::KeepRefreshing(), m_connAlgo, m_lock, m_netclassMap, BOARD_DESIGN_SETTINGS::m_NetSettings, PROGRESS_REPORTER::Report(), and PROGRESS_REPORTER::SetCurrentProgress().
Referenced by CONNECTIVITY_DATA().
void CONNECTIVITY_DATA::Build | ( | const std::vector< BOARD_ITEM * > & | aItems | ) |
Function Build() Builds the connectivity database for a set of items aItems.
Definition at line 143 of file connectivity_data.cpp.
References internalRecalculateRatsnest(), m_connAlgo, and m_lock.
void CONNECTIVITY_DATA::ClearLocalRatsnest | ( | ) |
Function ClearLocalRatsnest() Erases the temporary, selection-based ratsnest (i.e.
the ratsnest lines that pcbnew displays when moving an item/set of items).
Definition at line 395 of file connectivity_data.cpp.
References anchor, HideLocalRatsnest(), and m_connAlgo.
void CONNECTIVITY_DATA::ClearRatsnest | ( | ) |
Function Clear() Erases the connectivity database.
Definition at line 520 of file connectivity_data.cpp.
References m_nets.
void CONNECTIVITY_DATA::ComputeLocalRatsnest | ( | const std::vector< BOARD_ITEM * > & | aItems, |
const CONNECTIVITY_DATA * | aDynamicData, | ||
VECTOR2I | aInternalOffset = { 0, 0 } |
||
) |
Function ComputeLocalRatsnest() Calculates the temporary (usually selection-based) ratsnest for the set of aItems.
We don't need to compute the dynamic ratsnest in two cases: 1) We are not moving any net elements 2) We are moving all net elements
Definition at line 327 of file connectivity_data.cpp.
References RN_DYNAMIC_LINE::a, RN_DYNAMIC_LINE::b, GetKiCadThreadPool(), RN_NET::GetNodeCount(), GetRatsnestForItems(), m_dynamicRatsnest, m_nets, RN_NET::NearestBicoloredPair(), RN_DYNAMIC_LINE::netCode, and tp.
void CONNECTIVITY_DATA::FillIsolatedIslandsMap | ( | std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > & | aMap, |
bool | aConnectivityAlreadyRebuilt = false |
||
) |
Fill the isolate islands list for each layer of each zone.
Isolated islands are individual polygons in a zone fill that don't connect to a net.
Definition at line 320 of file connectivity_data.cpp.
References m_connAlgo.
const std::vector< BOARD_CONNECTED_ITEM * > CONNECTIVITY_DATA::GetConnectedItems | ( | const BOARD_CONNECTED_ITEM * | aItem, |
const std::initializer_list< KICAD_T > & | aTypes, | ||
bool | aIgnoreNetcodes = false |
||
) | const |
Function GetConnectedItems() Returns a list of items connected to a source item aItem.
aItem | is the reference item to find other connected items. |
aTypes | allows one to filter by item types. |
Definition at line 528 of file connectivity_data.cpp.
References CN_CONNECTIVITY_ALGO::CSM_CONNECTIVITY_CHECK, CN_CONNECTIVITY_ALGO::CSM_PROPAGATE, BOARD_CONNECTED_ITEM::GetNetCode(), and m_connAlgo.
const std::vector< BOARD_CONNECTED_ITEM * > CONNECTIVITY_DATA::GetConnectedItemsAtAnchor | ( | const BOARD_CONNECTED_ITEM * | aItem, |
const VECTOR2I & | aAnchor, | ||
const std::initializer_list< KICAD_T > & | aTypes, | ||
const int & | aMaxError = 0 |
||
) | const |
Function GetConnectedItemsAtAnchor() Returns a list of items connected to a source item aItem at position aAnchor with an optional maximum distance from the defined anchor.
aItem | is the reference item to find other connected items. |
aAnchor | is the position to find connected items on. |
aTypes | allows one to filter by item types. |
aMaxError | Maximum distance of the found items' anchors to aAnchor in IU |
Definition at line 866 of file connectivity_data.cpp.
References anchor, CN_ITEM::ConnectedItems(), CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY::GetItems(), and m_connAlgo.
const std::vector< PAD * > CONNECTIVITY_DATA::GetConnectedPads | ( | const BOARD_CONNECTED_ITEM * | aItem | ) | const |
Definition at line 627 of file connectivity_data.cpp.
References GetConnectedPads().
Referenced by GetConnectedPads().
void CONNECTIVITY_DATA::GetConnectedPads | ( | const BOARD_CONNECTED_ITEM * | aItem, |
std::set< PAD * > * | pads | ||
) | const |
Definition at line 613 of file connectivity_data.cpp.
References CN_ITEM::ConnectedItems(), m_connAlgo, and PCB_PAD_T.
void CONNECTIVITY_DATA::GetConnectedPadsAndVias | ( | const BOARD_CONNECTED_ITEM * | aItem, |
std::vector< PAD * > * | pads, | ||
std::vector< PCB_VIA * > * | vias | ||
) |
Definition at line 640 of file connectivity_data.cpp.
References CN_ITEM::ConnectedItems(), m_connAlgo, PCB_PAD_T, PCB_VIA_T, and EDA_ITEM::Type().
const std::vector< PCB_TRACK * > CONNECTIVITY_DATA::GetConnectedTracks | ( | const BOARD_CONNECTED_ITEM * | aItem | ) | const |
Definition at line 587 of file connectivity_data.cpp.
References CN_ITEM::ConnectedItems(), CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY::GetItems(), m_connAlgo, PCB_ARC_T, PCB_TRACE_T, and PCB_VIA_T.
|
inline |
Definition at line 263 of file connectivity_data.h.
References m_connAlgo.
Referenced by TestTrackEndpointDangling().
|
inline |
Definition at line 281 of file connectivity_data.h.
References m_fromToCache.
|
inline |
Definition at line 239 of file connectivity_data.h.
References m_dynamicRatsnest.
|
inline |
Definition at line 265 of file connectivity_data.h.
References m_lock.
|
inline |
Definition at line 270 of file connectivity_data.h.
References m_netclassMap.
int CONNECTIVITY_DATA::GetNetCount | ( | ) | const |
Function GetNetCount() Returns the total number of nets in the connectivity database.
Definition at line 314 of file connectivity_data.cpp.
References m_connAlgo.
const std::vector< BOARD_CONNECTED_ITEM * > CONNECTIVITY_DATA::GetNetItems | ( | int | aNetCode, |
const std::initializer_list< KICAD_T > & | aTypes | ||
) | const |
Function GetNetItems() Returns the list of items that belong to a certain net.
aNetCode | is the net code. |
aTypes | allows one to filter by item types. |
Definition at line 560 of file connectivity_data.cpp.
References m_connAlgo, MAX_STRUCT_TYPE_ID, CN_ITEM::Net(), CN_ITEM::Parent(), EDA_ITEM::Type(), and CN_ITEM::Valid().
unsigned int CONNECTIVITY_DATA::GetNodeCount | ( | int | aNet = -1 | ) | const |
Definition at line 662 of file connectivity_data.cpp.
References m_nets.
unsigned int CONNECTIVITY_DATA::GetPadCount | ( | int | aNet = -1 | ) | const |
Definition at line 680 of file connectivity_data.cpp.
References m_connAlgo, pad, and PCB_PAD_T.
const std::vector< CN_EDGE > CONNECTIVITY_DATA::GetRatsnestForComponent | ( | FOOTPRINT * | aComponent, |
bool | aSkipInternalConnections = false |
||
) |
Definition at line 998 of file connectivity_data.cpp.
References RN_NET::GetEdges(), GetRatsnestForNet(), pad, and FOOTPRINT::Pads().
const std::vector< CN_EDGE > CONNECTIVITY_DATA::GetRatsnestForItems | ( | const std::vector< BOARD_ITEM * > | aItems | ) |
Definition at line 934 of file connectivity_data.cpp.
References RN_NET::GetEdges(), GetRatsnestForNet(), pad, FOOTPRINT::Pads(), and PCB_FOOTPRINT_T.
Referenced by ComputeLocalRatsnest().
RN_NET * CONNECTIVITY_DATA::GetRatsnestForNet | ( | int | aNet | ) |
Function GetRatsnestForNet() Returns the ratsnest, expressed as a set of graph edges for a given net.
Definition at line 902 of file connectivity_data.cpp.
References m_nets.
Referenced by GetRatsnestForComponent(), GetRatsnestForItems(), and GetRatsnestForPad().
Definition at line 983 of file connectivity_data.cpp.
References RN_NET::GetEdges(), BOARD_CONNECTED_ITEM::GetNetCode(), and GetRatsnestForNet().
unsigned int CONNECTIVITY_DATA::GetUnconnectedCount | ( | bool | aVisibileOnly | ) | const |
aVisibleOnly | include only visbile edges in the count |
Definition at line 500 of file connectivity_data.cpp.
References m_nets.
void CONNECTIVITY_DATA::HideLocalRatsnest | ( | ) |
Hides the temporary, selection-based ratsnest lines.
Definition at line 405 of file connectivity_data.cpp.
References m_dynamicRatsnest.
Referenced by ClearLocalRatsnest().
|
private |
Updates the ratsnest for the board without locking the connectivity mutex.
aCommit | is used to save the undo state of items modified by this call |
Definition at line 225 of file connectivity_data.cpp.
References addRatsnestCluster(), m_connAlgo, m_nets, m_skipRatsnest, and updateRatsnest().
Referenced by Build(), and RecalculateRatsnest().
bool CONNECTIVITY_DATA::IsConnectedOnLayer | ( | const BOARD_CONNECTED_ITEM * | aItem, |
int | aLayer, | ||
const std::initializer_list< KICAD_T > & | aTypes = {} |
||
) | const |
Definition at line 417 of file connectivity_data.cpp.
References CN_ITEM::ConnectedItems(), alg::contains(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoints(), ZONE::GetFill(), CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY::GetItems(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::IsFilled(), m_connAlgo, pad, CN_ITEM::Parent(), PCB_PAD_T, PCB_VIA_T, SHAPE_LINE_CHAIN_BASE::PointInside(), CN_ZONE_LAYER::SubpolyIndex(), ToLAYER_ID(), EDA_ITEM::Type(), and via.
void CONNECTIVITY_DATA::MarkItemNetAsDirty | ( | BOARD_ITEM * | aItem | ) |
Definition at line 913 of file connectivity_data.cpp.
References BOARD_ITEM::IsConnected(), m_connAlgo, pad, PCB_FOOTPRINT_T, and EDA_ITEM::Type().
void CONNECTIVITY_DATA::Move | ( | const VECTOR2I & | aDelta | ) |
Moves the connectivity list anchors.
N.B., this does not move the bounding boxes for the RTree, so the use of this function will invalidate the connectivity data for uses other than the dynamic ratsnest
aDelta | vector for movement of the tree |
Definition at line 157 of file connectivity_data.cpp.
References anchor, and m_connAlgo.
Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest().
void CONNECTIVITY_DATA::PropagateNets | ( | BOARD_COMMIT * | aCommit = nullptr | ) |
Propagates the net codes from the source pads to the tracks/vias.
aCommit | is used to save the undo state of items modified by this call |
aMode | controls how conflicts between pads are resolved |
Definition at line 411 of file connectivity_data.cpp.
References m_connAlgo.
void CONNECTIVITY_DATA::RecalculateRatsnest | ( | BOARD_COMMIT * | aCommit = nullptr | ) |
Function RecalculateRatsnest() Updates the ratsnest for the board.
aCommit | is used to save the undo state of items modified by this call |
Definition at line 214 of file connectivity_data.cpp.
References internalRecalculateRatsnest(), and m_lock.
bool CONNECTIVITY_DATA::Remove | ( | BOARD_ITEM * | aItem | ) |
Function Remove() Removes an item from the connectivity data.
aItem | is an item to be updated. |
Definition at line 80 of file connectivity_data.cpp.
References m_connAlgo.
void CONNECTIVITY_DATA::RunOnUnconnectedEdges | ( | std::function< bool(CN_EDGE &)> | aFunc | ) |
Definition at line 699 of file connectivity_data.cpp.
References m_nets.
void CONNECTIVITY_DATA::SetProgressReporter | ( | PROGRESS_REPORTER * | aReporter | ) |
Definition at line 927 of file connectivity_data.cpp.
References m_connAlgo, and m_progressReporter.
bool CONNECTIVITY_DATA::TestTrackEndpointDangling | ( | PCB_TRACK * | aTrack, |
VECTOR2I * | aPos = nullptr |
||
) | const |
Definition at line 734 of file connectivity_data.cpp.
References SHAPE_CIRCLE::BBox(), CN_ITEM::ConnectedItems(), BOARD_ITEM::GetBoard(), GetConnectivityAlgo(), BOARD_ITEM::GetEffectiveShape(), PCB_TRACK::GetEnd(), EDA_ITEM::GetFlags(), BOARD_ITEM::GetLayer(), getMinDist(), PCB_TRACK::GetPosition(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), IS_DELETED, KiROUND(), BOARD::m_CopperZoneRTreeCache, PCB_ARC_T, PCB_TRACE_T, PCB_VIA_T, DRC_RTREE::QueryColliding(), EDA_ITEM::Type(), UNDEFINED_LAYER, and CN_ITEM::Valid().
bool CONNECTIVITY_DATA::Update | ( | BOARD_ITEM * | aItem | ) |
Function Update() Updates the connectivity data for an item.
aItem | is an item to be updated. |
Definition at line 87 of file connectivity_data.cpp.
References m_connAlgo.
|
private |
Definition at line 166 of file connectivity_data.cpp.
References GetKiCadThreadPool(), m_nets, PROF_TIMER::Show(), and tp.
Referenced by internalRecalculateRatsnest().
|
private |
Definition at line 295 of file connectivity_data.h.
Referenced by Add(), BlockRatsnestItems(), Build(), ClearLocalRatsnest(), CONNECTIVITY_DATA(), FillIsolatedIslandsMap(), GetConnectedItems(), GetConnectedItemsAtAnchor(), GetConnectedPads(), GetConnectedPadsAndVias(), GetConnectedTracks(), GetConnectivityAlgo(), GetNetCount(), GetNetItems(), GetPadCount(), internalRecalculateRatsnest(), IsConnectedOnLayer(), MarkItemNetAsDirty(), Move(), PropagateNets(), Remove(), SetProgressReporter(), and Update().
|
private |
Definition at line 298 of file connectivity_data.h.
Referenced by ComputeLocalRatsnest(), GetLocalRatsnest(), and HideLocalRatsnest().
|
private |
Definition at line 297 of file connectivity_data.h.
Referenced by CONNECTIVITY_DATA(), and GetFromToCache().
|
private |
Definition at line 304 of file connectivity_data.h.
Referenced by Build(), GetLock(), and RecalculateRatsnest().
|
private |
Map of netcode -> netclass the net is a member of; used for ratsnest painting.
Definition at line 307 of file connectivity_data.h.
Referenced by Build(), and GetNetclassMap().
|
private |
Definition at line 299 of file connectivity_data.h.
Referenced by addRatsnestCluster(), ClearRatsnest(), ComputeLocalRatsnest(), GetNodeCount(), GetRatsnestForNet(), GetUnconnectedCount(), internalRecalculateRatsnest(), RunOnUnconnectedEdges(), updateRatsnest(), and ~CONNECTIVITY_DATA().
|
private |
Definition at line 309 of file connectivity_data.h.
Referenced by CONNECTIVITY_DATA(), and SetProgressReporter().
|
private |
Used to suppress ratsnest calculations on dynamic ratsnests.
Definition at line 302 of file connectivity_data.h.
Referenced by internalRecalculateRatsnest().