63 return static_cast<PAD*
>(
m_parent )->GetPosition();
87 wxLogTrace( wxT(
"CN" ), wxT(
" valid: %d, connected: \n" ), !!
Valid() );
92 wxLogTrace( wxT(
"CN" ), wxT(
" - %p %d\n" ), t, t->
Type() );
136 if( !(*it)->Valid() )
146 if( !
pad->IsOnCopperLayer() )
151 std::set<VECTOR2I> uniqueAnchors;
152 pad->Padstack().ForEachUniqueLayer(
155 uniqueAnchors.insert(
pad->ShapePos( aLayer ) );
159 item->AddAnchor(
anchor );
163 switch(
pad->GetAttribute() )
169 LSEQ lmsk =
pad->GetLayerSet().CuStack();
172 item->SetLayer( lmsk.front() );
185 item->SetDirty(
true );
244 std::vector<CN_ITEM*> rv;
246 for(
int j = 0; j < polys->OutlineCount(); j++ )
255 rv.push_back(
Add( zitem ) );
302 aGarbage.push_back ( item );
309 m_items.resize( lastItem - m_items.begin() );
311 for(
CN_ITEM* item : aGarbage )
312 m_index.Remove( item );
314 m_hasInvalid =
false;
320 assert(
m_item->Valid() );
349 size_t minimal_count = 1;
350 size_t connected_count =
m_item->ConnectedItems().size();
354 return connected_count < 2;
356 if(
m_item->AnchorCount() == 1 )
357 return connected_count < minimal_count;
372 ZONE* zone =
static_cast<ZONE*
>( item->Parent() );
377 else if( item->Parent()->HitTest(
Pos(),
accuracy ) )
383 return connected_count < minimal_count;
392 int connected_count = 0;
398 ZONE* zone =
static_cast<ZONE*
>( item->Parent() );
403 else if( item->Parent()->HitTest(
Pos() ) )
409 return connected_count;
445 [&aItem](
const CN_ITEM* item )
447 return item->Valid() && item->Parent() == aItem;
456 wxLogTrace( wxT(
"CN" ), wxT(
" - item : %p bitem : %p type : %d inet %s\n" ),
459 item->Parent()->Type(),
460 (
const char*) item->Parent()->GetNetname().c_str() );
461 wxLogTrace( wxT(
"CN" ), wxT(
"- item : %p bitem : %p type : %d inet %s\n" ),
464 item->Parent()->Type(),
465 (
const char*) item->Parent()->GetNetname().c_str() );
475 int netCode = item->
Net();
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PCB_LAYER_ID GetLayer() const override
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,...
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)
void SetLayers(int aStartLayer, int aEndLayer)
Set the layers spanned by the item to aStartLayer and aEndLayer.
virtual const VECTOR2I GetAnchor(int n) const
void SetDirty(bool aDirty)
CN_ITEM(BOARD_CONNECTED_ITEM *aParent, bool aCanChangeNet, int aAnchorCount=2)
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()
const SHAPE_LINE_CHAIN & GetOutline() const
virtual const VECTOR2I GetAnchor(int n) const override
bool HasValidOutline() const
KICAD_T Type() const
Returns the type of object.
LSEQ is a sequence (and therefore also 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
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const std::vector< VECTOR2I > & CPoints() const
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Handle a list of polygons defining a copper zone.
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:
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.
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ SMD
Smd pad, appears on the solder paste layer (default)
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
@ 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)
VECTOR2< int32_t > VECTOR2I