63 return static_cast<PAD*
>(
m_parent )->GetPosition();
87 wxLogDebug(
" valid: %d, connected: \n", !!
Valid());
92 wxLogDebug( wxT(
" - %p %d\n" ), t, t->
Type() );
140 if( !(*it)->Valid() )
150 if( !
pad->IsOnCopperLayer() )
154 item->AddAnchor(
pad->ShapePos() );
157 switch(
pad->GetAttribute() )
159 case PAD_ATTRIB::SMD:
160 case PAD_ATTRIB::NPTH:
161 case PAD_ATTRIB::CONN:
163 LSET lmsk =
pad->GetLayerSet();
230 std::vector<CN_ITEM*> rv;
232 for(
int j = 0; j < polys->OutlineCount(); j++ )
241 rv.push_back(
Add( zitem ) );
282 aGarbage.push_back ( item );
289 m_items.resize( lastItem - m_items.begin() );
292 item->RemoveInvalidRefs();
294 for(
CN_ITEM* item : aGarbage )
295 m_index.Remove( item );
297 m_hasInvalid =
false;
332 size_t minimal_count = 1;
337 return connected_count < 2;
340 return connected_count < minimal_count;
350 if( !shape->IsFilled() )
351 accuracy =
KiROUND( shape->GetWidth() / 2 );
362 ZONE* zone =
static_cast<ZONE*
>( item->Parent() );
367 else if( item->Parent()->HitTest(
Pos(), accuracy ) )
373 return connected_count < minimal_count;
382 int connected_count = 0;
388 ZONE* zone =
static_cast<ZONE*
>( item->Parent() );
393 else if( item->Parent()->HitTest(
Pos() ) )
399 return connected_count;
435 [&aItem](
const CN_ITEM* item )
437 return item->Valid() && item->Parent() == aItem;
446 wxLogTrace( wxT(
"CN" ), wxT(
" - item : %p bitem : %p type : %d inet %s\n" ),
449 item->Parent()->Type(),
450 (
const char*) item->Parent()->GetNetname().c_str() );
451 wxLogTrace( wxT(
"CN" ), wxT(
"- item : %p bitem : %p type : %d inet %s\n" ),
454 item->Parent()->Type(),
455 (
const char*) item->Parent()->GetNetname().c_str() );
465 int netCode = item->
Net();
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetname() const
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
CN_ITEM * m_item
Pad or track/arc/via owning the anchor.
int ConnectedItemsCount() const
std::shared_ptr< CN_CLUSTER > m_cluster
Cluster to which the anchor belongs.
const VECTOR2I & Pos() const
BOARD_CONNECTED_ITEM * Parent() const
bool IsDangling() const
The anchor point is dangling if the parent is a track and this anchor point is not connected to anoth...
std::vector< CN_ITEM * > m_items
bool Contains(const CN_ITEM *aItem)
wxString OriginNetName() const
std::unordered_map< int, int > m_netRanks
CN_ITEM represents a BOARD_CONNETED_ITEM in the connectivity system (ie: a pad, track/arc/via,...
void SetLayers(const LAYER_RANGE &aLayers)
Set the layers spanned by the item to aLayers.
virtual int AnchorCount() const
std::vector< CN_ITEM * > m_connected
list of physically touching items
const std::vector< CN_ITEM * > & ConnectedItems() const
BOARD_CONNECTED_ITEM * m_parent
std::shared_ptr< CN_ANCHOR > AddAnchor(const VECTOR2I &aPos)
virtual const VECTOR2I GetAnchor(int n) const
void SetLayer(int aLayer)
Set the layers spanned by the item to a single layer aLayer.
std::vector< std::shared_ptr< CN_ANCHOR > > m_anchors
bool m_valid
used to identify garbage items (we use lazy removal)
BOARD_CONNECTED_ITEM * Parent() const
void SetDirty(bool aDirty=true)
std::vector< CN_ITEM * > m_items
void addItemtoTree(CN_ITEM *item)
void RemoveInvalidItems(std::vector< CN_ITEM * > &aGarbage)
virtual int AnchorCount() const override
bool HasSingleConnection()
virtual const VECTOR2I GetAnchor(int n) const override
KICAD_T Type() const
Returns the type of object.
virtual wxString GetClass() const =0
Return the class name.
Represent a contiguous set of PCB layers.
LSET is a set of PCB_LAYER_IDs.
std::vector< VECTOR2I > GetConnectionPoints() const
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
Handle a list of polygons defining a copper zone.
const std::shared_ptr< SHAPE_POLY_SET > & GetFilledPolysList(PCB_LAYER_ID aLayer) const
bool HitTestFilledArea(PCB_LAYER_ID aLayer, const VECTOR2I &aRefPos, int aAccuracy=0) const
Test if the given VECTOR2I is within the bounds of a filled area of this zone.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".