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() )
155 std::set<VECTOR2I> uniqueAnchors;
156 pad->Padstack().ForEachUniqueLayer(
159 uniqueAnchors.insert(
pad->ShapePos( aLayer ) );
163 item->AddAnchor(
anchor );
167 switch(
pad->GetAttribute() )
173 LSEQ lmsk =
pad->GetLayerSet().CuStack();
176 item->SetLayer( lmsk.front() );
235 std::vector<CN_ITEM*> rv;
237 for(
int j = 0; j < polys->OutlineCount(); j++ )
246 rv.push_back(
Add( zitem ) );
287 aGarbage.push_back ( item );
294 m_items.resize( lastItem - m_items.begin() );
296 for(
CN_ITEM* item : aGarbage )
297 m_index.Remove( item );
299 m_hasInvalid =
false;
305 assert(
m_item->Valid() );
334 size_t minimal_count = 1;
335 size_t connected_count =
m_item->ConnectedItems().size();
339 return connected_count < 2;
341 if(
m_item->AnchorCount() == 1 )
342 return connected_count < minimal_count;
357 ZONE* zone =
static_cast<ZONE*
>( item->Parent() );
362 else if( item->Parent()->HitTest(
Pos(),
accuracy ) )
368 return connected_count < minimal_count;
377 int connected_count = 0;
383 ZONE* zone =
static_cast<ZONE*
>( item->Parent() );
388 else if( item->Parent()->HitTest(
Pos() ) )
394 return connected_count;
430 [&aItem](
const CN_ITEM* item )
432 return item->Valid() && item->Parent() == aItem;
441 wxLogTrace( wxT(
"CN" ), wxT(
" - item : %p bitem : %p type : %d inet %s\n" ),
444 item->Parent()->Type(),
445 (
const char*) item->Parent()->GetNetname().c_str() );
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() );
460 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,...
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,...
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
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()
virtual const VECTOR2I GetAnchor(int n) const override
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.
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:
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