![]() |
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) | |
void | 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 | Clear () |
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 () |
Function PropagateNets() Propagates the net codes from the source pads to the tracks/vias. More... | |
bool | CheckConnectivity (std::vector< CN_DISJOINT_NET_ENTRY > &aReport) |
void | FindIsolatedCopperIslands (ZONE *aZone, std::vector< int > &aIslands) |
Function FindIsolatedCopperIslands() Searches for copper islands in zone aZone that are not connected to any pad. More... | |
void | FindIsolatedCopperIslands (std::vector< CN_ZONE_ISOLATED_ISLAND_LIST > &aZones) |
void | RecalculateRatsnest (BOARD_COMMIT *aCommit=nullptr) |
Function RecalculateRatsnest() Updates the ratsnest for the board. More... | |
unsigned int | GetUnconnectedCount () const |
Function GetUnconnectedCount() Returns the number of remaining edges in the ratsnest. More... | |
bool | IsConnectedOnLayer (const BOARD_CONNECTED_ITEM *aItem, int aLayer, std::vector< KICAD_T > aTypes={}) const |
unsigned int | GetNodeCount (int aNet=-1) const |
unsigned int | GetPadCount (int aNet=-1) const |
const std::vector< 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 |
const std::vector< BOARD_CONNECTED_ITEM * > | GetConnectedItemsAtAnchor (const BOARD_CONNECTED_ITEM *aItem, const VECTOR2I &aAnchor, const KICAD_T aTypes[]) const |
Function GetConnectedItemsAtAnchor() Returns a list of items connected to a source item aItem at position aAnchor. More... | |
void | GetUnconnectedEdges (std::vector< CN_EDGE > &aEdges) const |
bool | TestTrackEndpointDangling (TRACK *aTrack, wxPoint *aPos=nullptr) |
void | ClearDynamicRatsnest () |
Function ClearDynamicRatsnest() Erases the temporary dynamic ratsnest (i.e. More... | |
void | HideDynamicRatsnest () |
Hides the temporary dynamic ratsnest lines. More... | |
void | ComputeDynamicRatsnest (const std::vector< BOARD_ITEM * > &aItems, const CONNECTIVITY_DATA *aDynamicData) |
Function ComputeDynamicRatsnest() Calculates the temporary dynamic ratsnest (i.e. More... | |
const std::vector< RN_DYNAMIC_LINE > & | GetDynamicRatsnest () const |
const std::vector< BOARD_CONNECTED_ITEM * > | GetConnectedItems (const BOARD_CONNECTED_ITEM *aItem, const 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 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 > | GetRatsnestForComponent (FOOTPRINT *aComponent, bool aSkipInternalConnections=false) |
std::shared_ptr< FROM_TO_CACHE > | GetFromToCache () |
Private Member Functions | |
void | updateRatsnest () |
void | updateItemPositions (const std::vector< BOARD_ITEM * > &aItems) |
Updates the item positions without modifying the dirtyNet flag. More... | |
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 |
PROGRESS_REPORTER * | m_progressReporter |
bool | m_skipRatsnest = false |
KISPINLOCK | m_lock |
std::map< int, wxString > | m_netclassMap |
Map of netcode -> netclass the net is a member of; used for ratsnest painting. More... | |
Definition at line 86 of file connectivity_data.h.
CONNECTIVITY_DATA::CONNECTIVITY_DATA | ( | ) |
Definition at line 40 of file connectivity_data.cpp.
References m_connAlgo, m_fromToCache, and m_progressReporter.
CONNECTIVITY_DATA::~CONNECTIVITY_DATA | ( | ) |
Definition at line 57 of file connectivity_data.cpp.
References Clear().
CONNECTIVITY_DATA::CONNECTIVITY_DATA | ( | const std::vector< BOARD_ITEM * > & | aItems, |
bool | aSkipItems = false |
||
) |
Definition at line 48 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 63 of file connectivity_data.cpp.
References m_connAlgo.
|
private |
Definition at line 163 of file connectivity_data.cpp.
References m_nets.
Referenced by RecalculateRatsnest().
void CONNECTIVITY_DATA::BlockRatsnestItems | ( | const std::vector< BOARD_ITEM * > & | aItems | ) |
Definition at line 223 of file connectivity_data.cpp.
References m_connAlgo, and PCB_FOOTPRINT_T.
void CONNECTIVITY_DATA::Build | ( | BOARD * | aBoard, |
PROGRESS_REPORTER * | aReporter = nullptr |
||
) |
Function Build() Builds the connectivity database for the board aBoard.
Definition at line 85 of file connectivity_data.cpp.
References NETCLASS::Default, BOARD::GetNetInfo(), m_connAlgo, m_netclassMap, and RecalculateRatsnest().
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 100 of file connectivity_data.cpp.
References m_connAlgo, and RecalculateRatsnest().
bool CONNECTIVITY_DATA::CheckConnectivity | ( | std::vector< CN_DISJOINT_NET_ENTRY > & | aReport | ) |
Definition at line 461 of file connectivity_data.cpp.
References CN_DISJOINT_NET_ENTRY::a, CN_DISJOINT_NET_ENTRY::anchorA, CN_DISJOINT_NET_ENTRY::anchorB, CN_DISJOINT_NET_ENTRY::b, m_nets, CN_DISJOINT_NET_ENTRY::net, and RecalculateRatsnest().
void CONNECTIVITY_DATA::Clear | ( | ) |
Function Clear() Erases the connectivity database.
Definition at line 399 of file connectivity_data.cpp.
References m_nets.
Referenced by ~CONNECTIVITY_DATA().
void CONNECTIVITY_DATA::ClearDynamicRatsnest | ( | ) |
Function ClearDynamicRatsnest() Erases the temporary dynamic ratsnest (i.e.
the ratsnest lines that pcbnew displays when moving an item/set of items)
Definition at line 326 of file connectivity_data.cpp.
References HideDynamicRatsnest(), m_connAlgo, and CN_ANCHOR::SetNoLine().
void CONNECTIVITY_DATA::ComputeDynamicRatsnest | ( | const std::vector< BOARD_ITEM * > & | aItems, |
const CONNECTIVITY_DATA * | aDynamicData | ||
) |
Function ComputeDynamicRatsnest() Calculates the temporary dynamic ratsnest (i.e.
the ratsnest lines that) for the set of items aItems.
Definition at line 277 of file connectivity_data.cpp.
References RN_DYNAMIC_LINE::a, RN_DYNAMIC_LINE::b, GetRatsnestForItems(), m_dynamicRatsnest, m_nets, and RN_DYNAMIC_LINE::netCode.
void CONNECTIVITY_DATA::FindIsolatedCopperIslands | ( | ZONE * | aZone, |
std::vector< int > & | aIslands | ||
) |
Function FindIsolatedCopperIslands() Searches for copper islands in zone aZone that are not connected to any pad.
aZone | zone to test |
aIslands | list of islands that have no connections (outline indices in the polygon set) |
Definition at line 263 of file connectivity_data.cpp.
References m_connAlgo.
void CONNECTIVITY_DATA::FindIsolatedCopperIslands | ( | std::vector< CN_ZONE_ISOLATED_ISLAND_LIST > & | aZones | ) |
Definition at line 271 of file connectivity_data.cpp.
References m_connAlgo.
const std::vector< BOARD_CONNECTED_ITEM * > CONNECTIVITY_DATA::GetConnectedItems | ( | const BOARD_CONNECTED_ITEM * | aItem, |
const 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 408 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 KICAD_T | aTypes[] | ||
) | const |
Function GetConnectedItemsAtAnchor() Returns a list of items connected to a source item aItem at position aAnchor.
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. |
Definition at line 648 of file connectivity_data.cpp.
References m_connAlgo.
const std::vector< PAD * > CONNECTIVITY_DATA::GetConnectedPads | ( | const BOARD_CONNECTED_ITEM * | aItem | ) | const |
Definition at line 525 of file connectivity_data.cpp.
void CONNECTIVITY_DATA::GetConnectedPads | ( | const BOARD_CONNECTED_ITEM * | aItem, |
std::set< PAD * > * | pads | ||
) | const |
Definition at line 511 of file connectivity_data.cpp.
References CN_ITEM::ConnectedItems(), m_connAlgo, and PCB_PAD_T.
const std::vector< TRACK * > CONNECTIVITY_DATA::GetConnectedTracks | ( | const BOARD_CONNECTED_ITEM * | aItem | ) | const |
Definition at line 486 of file connectivity_data.cpp.
References m_connAlgo, PCB_ARC_T, PCB_TRACE_T, and PCB_VIA_T.
|
inline |
Definition at line 260 of file connectivity_data.h.
References m_connAlgo.
Referenced by TestTrackEndpointDangling().
|
inline |
Definition at line 235 of file connectivity_data.h.
References m_dynamicRatsnest.
|
inline |
Definition at line 285 of file connectivity_data.h.
References m_fromToCache.
|
inline |
|
inline |
Definition at line 273 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 257 of file connectivity_data.cpp.
References m_connAlgo.
const std::vector< BOARD_CONNECTED_ITEM * > CONNECTIVITY_DATA::GetNetItems | ( | int | aNetCode, |
const 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 436 of file connectivity_data.cpp.
References EOT, 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 |
unsigned int CONNECTIVITY_DATA::GetPadCount | ( | int | aNet = -1 | ) | const |
Definition at line 556 of file connectivity_data.cpp.
References m_connAlgo, and PCB_PAD_T.
const std::vector< CN_EDGE > CONNECTIVITY_DATA::GetRatsnestForComponent | ( | FOOTPRINT * | aComponent, |
bool | aSkipInternalConnections = false |
||
) |
Definition at line 762 of file connectivity_data.cpp.
References GetRatsnestForNet(), and FOOTPRINT::Pads().
const std::vector< CN_EDGE > CONNECTIVITY_DATA::GetRatsnestForItems | ( | const std::vector< BOARD_ITEM * > | aItems | ) |
Definition at line 713 of file connectivity_data.cpp.
References GetRatsnestForNet(), FOOTPRINT::Pads(), and PCB_FOOTPRINT_T.
Referenced by ComputeDynamicRatsnest().
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 681 of file connectivity_data.cpp.
References m_nets.
Referenced by GetRatsnestForComponent(), and GetRatsnestForItems().
unsigned int CONNECTIVITY_DATA::GetUnconnectedCount | ( | ) | const |
Function GetUnconnectedCount() Returns the number of remaining edges in the ratsnest.
Definition at line 378 of file connectivity_data.cpp.
References m_nets.
void CONNECTIVITY_DATA::GetUnconnectedEdges | ( | std::vector< CN_EDGE > & | aEdges | ) | const |
Definition at line 575 of file connectivity_data.cpp.
References m_nets.
void CONNECTIVITY_DATA::HideDynamicRatsnest | ( | ) |
Hides the temporary dynamic ratsnest lines.
Definition at line 336 of file connectivity_data.cpp.
References m_dynamicRatsnest.
Referenced by ClearDynamicRatsnest().
bool CONNECTIVITY_DATA::IsConnectedOnLayer | ( | const BOARD_CONNECTED_ITEM * | aItem, |
int | aLayer, | ||
std::vector< KICAD_T > | aTypes = {} |
||
) | const |
Definition at line 347 of file connectivity_data.cpp.
References CN_ITEM::ConnectedItems(), CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY::GetItems(), BOARD_CONNECTED_ITEM::GetNetCode(), and m_connAlgo.
void CONNECTIVITY_DATA::MarkItemNetAsDirty | ( | BOARD_ITEM * | aItem | ) |
Definition at line 692 of file connectivity_data.cpp.
References BOARD_ITEM::IsConnected(), m_connAlgo, 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 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 109 of file connectivity_data.cpp.
References m_connAlgo, and CN_ANCHOR::Move().
Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest().
void CONNECTIVITY_DATA::PropagateNets | ( | ) |
Function PropagateNets() Propagates the net codes from the source pads to the tracks/vias.
Definition at line 342 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 171 of file connectivity_data.cpp.
References addRatsnestCluster(), m_connAlgo, m_nets, m_skipRatsnest, and updateRatsnest().
Referenced by Build(), and CheckConnectivity().
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 70 of file connectivity_data.cpp.
References m_connAlgo.
void CONNECTIVITY_DATA::SetProgressReporter | ( | PROGRESS_REPORTER * | aReporter | ) |
Definition at line 706 of file connectivity_data.cpp.
References m_connAlgo, and m_progressReporter.
bool CONNECTIVITY_DATA::TestTrackEndpointDangling | ( | TRACK * | aTrack, |
wxPoint * | aPos = nullptr |
||
) |
Definition at line 588 of file connectivity_data.cpp.
References CN_ITEM::Anchors(), CN_ITEM::ConnectedItems(), GetConnectivityAlgo(), TRACK::GetPosition(), PCB_VIA_T, EDA_ITEM::Type(), 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 77 of file connectivity_data.cpp.
References m_connAlgo.
Referenced by updateRatsnest().
|
private |
Updates the item positions without modifying the dirtyNet flag.
This is valid only when the item list contains all elements in the connectivity database
aItems | List of items with new positions |
|
private |
Definition at line 118 of file connectivity_data.cpp.
References m_nets, PROF_COUNTER::Show(), and Update().
Referenced by RecalculateRatsnest().
|
private |
Definition at line 302 of file connectivity_data.h.
Referenced by Add(), BlockRatsnestItems(), Build(), ClearDynamicRatsnest(), CONNECTIVITY_DATA(), FindIsolatedCopperIslands(), GetConnectedItems(), GetConnectedItemsAtAnchor(), GetConnectedPads(), GetConnectedTracks(), GetConnectivityAlgo(), GetNetCount(), GetNetItems(), GetPadCount(), IsConnectedOnLayer(), MarkItemNetAsDirty(), Move(), PropagateNets(), RecalculateRatsnest(), Remove(), SetProgressReporter(), and Update().
|
private |
Definition at line 304 of file connectivity_data.h.
Referenced by ComputeDynamicRatsnest(), GetDynamicRatsnest(), and HideDynamicRatsnest().
|
private |
Definition at line 303 of file connectivity_data.h.
Referenced by CONNECTIVITY_DATA(), and GetFromToCache().
|
private |
Definition at line 311 of file connectivity_data.h.
Referenced by GetLock().
|
private |
Map of netcode -> netclass the net is a member of; used for ratsnest painting.
Definition at line 314 of file connectivity_data.h.
Referenced by Build(), and GetNetclassMap().
|
private |
Definition at line 305 of file connectivity_data.h.
Referenced by addRatsnestCluster(), CheckConnectivity(), Clear(), ComputeDynamicRatsnest(), GetNodeCount(), GetRatsnestForNet(), GetUnconnectedCount(), GetUnconnectedEdges(), RecalculateRatsnest(), and updateRatsnest().
|
private |
Definition at line 307 of file connectivity_data.h.
Referenced by CONNECTIVITY_DATA(), and SetProgressReporter().
|
private |
Definition at line 309 of file connectivity_data.h.
Referenced by RecalculateRatsnest().