KiCad PCB EDA Suite
PNS::JOINT Class Reference

A 2D point on a given set of layers and belonging to a certain net, that links together a number of board items. More...

#include <pns_joint.h>

Inheritance diagram for PNS::JOINT:
PNS::ITEM

Classes

struct  HASH_TAG
 
struct  JOINT_TAG_HASH
 

Public Types

typedef ITEM_SET::ENTRIES LINKED_ITEMS
 Joints are hashed by their position, layers and net. More...
 
enum  PnsKind {
  SOLID_T = 1, LINE_T = 2, JOINT_T = 4, SEGMENT_T = 8,
  ARC_T = 16, VIA_T = 32, DIFF_PAIR_T = 64, ANY_T = 0xff
}
 

Public Member Functions

 JOINT ()
 
 JOINT (const VECTOR2I &aPos, const LAYER_RANGE &aLayers, int aNet=-1)
 
 JOINT (const JOINT &aB)
 
ITEMClone () const override
 Return a deep copy of the item. More...
 
bool IsLineCorner (bool aAllowLockedSegs=false) const
 Checks if a joint connects two segments of the same net, layer, and width. More...
 
bool IsNonFanoutVia () const
 
bool IsStitchingVia () const
 
bool IsTraceWidthChange () const
 Link the joint to a given board item (when it's added to the NODE). More...
 
void Link (ITEM *aItem)
 Unlink a given board item from the joint (upon its removal from a NODE) More...
 
bool Unlink (ITEM *aItem)
 For trivial joints, return the segment adjacent to (aCurrent). More...
 
LINKED_ITEMNextSegment (ITEM *aCurrent, bool aAllowLockedSegs=false) const
 
VIAVia ()
 
const HASH_TAGTag () const
 trivial accessors More...
 
const VECTOR2IPos () const
 
int Net () const
 
const LINKED_ITEMSLinkList () const
 
const ITEM_SETCLinks () const
 
ITEM_SETLinks ()
 
int LinkCount (int aMask=-1) const
 
void Dump () const
 
bool operator== (const JOINT &rhs) const
 
void Merge (const JOINT &aJoint)
 
bool Overlaps (const JOINT &rhs) const
 
void Lock (bool aLock=true)
 
bool IsLocked () const
 
virtual const SHAPE_LINE_CHAIN Hull (int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const
 
virtual const SHAPE_LINE_CHAIN HoleHull (int aClearance, int aWalkaroundThickness=0, int aLayer=-1) const
 
PnsKind Kind () const
 Return the type (kind) of the item. More...
 
bool OfKind (int aKindMask) const
 Return true if the item's type matches the mask aKindMask. More...
 
std::string KindStr () const
 Returns the kind of the item, as string. More...
 
void SetParent (BOARD_ITEM *aParent)
 
BOARD_ITEMParent () const
 
void SetNet (int aNet)
 
const LAYER_RANGELayers () const
 
void SetLayers (const LAYER_RANGE &aLayers)
 
void SetLayer (int aLayer)
 
virtual int Layer () const
 
bool LayersOverlap (const ITEM *aOther) const
 Return true if the set of layers spanned by aOther overlaps our layers. More...
 
NODEOwner () const
 Return the owner of this item, or NULL if there's none. More...
 
void SetOwner (NODE *aOwner)
 Set the node that owns this item. More...
 
bool BelongsTo (NODE *aNode) const
 
bool Collide (const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly=true) const
 Check for a collision (clearance violation) with between us and item aOther. More...
 
virtual const SHAPEShape () const
 Return the geometrical shape of the item. More...
 
virtual const SHAPEHole () const
 
virtual void Mark (int aMarker) const
 
virtual void Unmark (int aMarker=-1) const
 
virtual int Marker () const
 
virtual void SetRank (int aRank)
 
virtual int Rank () const
 
virtual VECTOR2I Anchor (int n) const
 
virtual int AnchorCount () const
 
void SetRoutable (bool aRoutable)
 
bool IsRoutable () const
 
bool IsVirtual () const
 
void SetIsCompoundShapePrimitive ()
 
bool IsCompoundShapePrimitive () const
 

Static Public Attributes

static const int UnusedNet = INT_MAX
 Supported item types. More...
 

Protected Attributes

PnsKind m_kind
 
BOARD_ITEMm_parent
 
NODEm_owner
 
LAYER_RANGE m_layers
 
bool m_movable
 
int m_net
 
int m_marker
 
int m_rank
 
bool m_routable
 
bool m_isVirtual
 
bool m_isCompoundShapePrimitive
 

Private Attributes

HASH_TAG m_tag
 < hash tag for unordered_multimap More...
 
ITEM_SET m_linkedItems
 locked (non-movable) flag More...
 
bool m_locked
 

Detailed Description

A 2D point on a given set of layers and belonging to a certain net, that links together a number of board items.

A hash table of joints is used by the router to follow connectivity between the items.

Definition at line 42 of file pns_joint.h.

Member Typedef Documentation

◆ LINKED_ITEMS

Joints are hashed by their position, layers and net.

Linked items are, obviously, not hashed.

Definition at line 45 of file pns_joint.h.

Member Enumeration Documentation

◆ PnsKind

enum PNS::ITEM::PnsKind
inherited
Enumerator
SOLID_T 
LINE_T 
JOINT_T 
SEGMENT_T 
ARC_T 
VIA_T 
DIFF_PAIR_T 
ANY_T 

Definition at line 61 of file pns_item.h.

62  {
63  SOLID_T = 1,
64  LINE_T = 2,
65  JOINT_T = 4,
66  SEGMENT_T = 8,
67  ARC_T = 16,
68  VIA_T = 32,
69  DIFF_PAIR_T = 64,
70  ANY_T = 0xff
71  };

Constructor & Destructor Documentation

◆ JOINT() [1/3]

PNS::JOINT::JOINT ( )
inline

Definition at line 69 of file pns_joint.h.

69  :
70  ITEM( JOINT_T ), m_tag(), m_locked( false ) {}
ITEM(PnsKind aKind)
Definition: pns_item.h:73
bool m_locked
Definition: pns_joint.h:300
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294

◆ JOINT() [2/3]

PNS::JOINT::JOINT ( const VECTOR2I aPos,
const LAYER_RANGE aLayers,
int  aNet = -1 
)
inline

Definition at line 72 of file pns_joint.h.

72  :
73  ITEM( JOINT_T )
74  {
75  m_tag.pos = aPos;
76  m_tag.net = aNet;
77  m_layers = aLayers;
78  m_locked = false;
79  }
LAYER_RANGE m_layers
Definition: pns_item.h:251
ITEM(PnsKind aKind)
Definition: pns_item.h:73
bool m_locked
Definition: pns_joint.h:300
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294

References PNS::ITEM::m_layers, m_locked, m_tag, PNS::JOINT::HASH_TAG::net, and PNS::JOINT::HASH_TAG::pos.

◆ JOINT() [3/3]

PNS::JOINT::JOINT ( const JOINT aB)
inline

Definition at line 81 of file pns_joint.h.

81  :
82  ITEM( JOINT_T )
83  {
84  m_layers = aB.m_layers;
85  m_tag.pos = aB.m_tag.pos;
86  m_tag.net = aB.m_tag.net;
87  m_linkedItems = aB.m_linkedItems;
88  m_layers = aB.m_layers;
89  m_locked = aB.m_locked;
90  }
LAYER_RANGE m_layers
Definition: pns_item.h:251
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297
ITEM(PnsKind aKind)
Definition: pns_item.h:73
bool m_locked
Definition: pns_joint.h:300
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294

References PNS::ITEM::m_layers, m_linkedItems, m_locked, m_tag, PNS::JOINT::HASH_TAG::net, and PNS::JOINT::HASH_TAG::pos.

Member Function Documentation

◆ Anchor()

◆ AnchorCount()

virtual int PNS::ITEM::AnchorCount ( ) const
inlinevirtualinherited

Reimplemented in PNS::VIA, PNS::SEGMENT, PNS::SOLID, and PNS::ARC.

Definition at line 222 of file pns_item.h.

223  {
224  return 0;
225  }

◆ BelongsTo()

bool PNS::ITEM::BelongsTo ( NODE aNode) const
inlineinherited
Returns
true if the item is owned by the node aNode.

Definition at line 181 of file pns_item.h.

182  {
183  return m_owner == aNode;
184  }
NODE * m_owner
Definition: pns_item.h:250

References PNS::ITEM::m_owner.

Referenced by PNS::NODE::doRemove().

◆ CLinks()

const ITEM_SET& PNS::JOINT::CLinks ( ) const
inline

Definition at line 238 of file pns_joint.h.

239  {
240  return m_linkedItems;
241  }
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297

References m_linkedItems.

◆ Clone()

ITEM* PNS::JOINT::Clone ( ) const
inlineoverridevirtual

Return a deep copy of the item.

Implements PNS::ITEM.

Definition at line 92 of file pns_joint.h.

93  {
94  assert( false );
95  return nullptr;
96  }

◆ Collide()

bool PNS::ITEM::Collide ( const ITEM aOther,
const NODE aNode,
bool  aDifferentNetsOnly = true 
) const
inherited

Check for a collision (clearance violation) with between us and item aOther.

Collision checking takes all PCB stuff into account (layers, nets, DRC rules). Optionally returns a minimum translation vector for force propagation algorithm.

Parameters
aOtheris the item to check collision against.
Returns
true, if a collision was found.

Definition at line 131 of file pns_item.cpp.

132 {
133  if( collideSimple( aOther, aNode, aDifferentNetsOnly ) )
134  return true;
135 
136  // Special cases for "head" lines with vias attached at the end. Note that this does not
137  // support head-line-via to head-line-via collisions, but you can't route two independent
138  // tracks at once so it shouldn't come up.
139 
140  if( m_kind == LINE_T )
141  {
142  const LINE* line = static_cast<const LINE*>( this );
143 
144  if( line->EndsWithVia() && line->Via().collideSimple( aOther, aNode, aDifferentNetsOnly ) )
145  return true;
146  }
147 
148  if( aOther->m_kind == LINE_T )
149  {
150  const LINE* line = static_cast<const LINE*>( aOther );
151 
152  if( line->EndsWithVia() && line->Via().collideSimple( this, aNode, aDifferentNetsOnly ) )
153  return true;
154  }
155 
156  return false;
157 }
PnsKind m_kind
Definition: pns_item.h:247
bool collideSimple(const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly) const
Definition: pns_item.cpp:32

References PNS::ITEM::collideSimple(), PNS::LINE::EndsWithVia(), PNS::ITEM::LINE_T, PNS::ITEM::m_kind, and PNS::LINE::Via().

Referenced by PNS::SHOVE::onCollidingSolid(), PNS::OPTIMIZER::CACHE_VISITOR::operator()(), PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()(), PNS::SHOVE::shoveLineFromLoneVia(), PNS::SHOVE::shoveLineToHullSet(), and PNS::COMPONENT_DRAGGER::Start().

◆ Dump()

void PNS::JOINT::Dump ( ) const

Definition at line 1242 of file pns_node.cpp.

1243 {
1244  wxLogTrace( wxT( "PNS" ), wxT( "joint layers %d-%d, net %d, pos %s, links: %d" ),
1245  m_layers.Start(),
1246  m_layers.End(),
1247  m_tag.net,
1248  m_tag.pos.Format().c_str(),
1249  LinkCount() );
1250 }
LAYER_RANGE m_layers
Definition: pns_item.h:251
int Start() const
Definition: pns_layerset.h:82
int End() const
Definition: pns_layerset.h:87
const std::string Format() const
Return the vector formatted as a string.
Definition: vector2d.h:434
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294
int LinkCount(int aMask=-1) const
Definition: pns_joint.h:248

References LAYER_RANGE::End(), VECTOR2< T >::Format(), LinkCount(), PNS::ITEM::m_layers, m_tag, PNS::JOINT::HASH_TAG::net, PNS::JOINT::HASH_TAG::pos, and LAYER_RANGE::Start().

◆ Hole()

virtual const SHAPE* PNS::ITEM::Hole ( ) const
inlinevirtualinherited

Reimplemented in PNS::VIA, and PNS::SOLID.

Definition at line 205 of file pns_item.h.

206  {
207  return nullptr;
208  }

Referenced by PNS::ITEM::collideSimple(), ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM(), and ROUTER_PREVIEW_ITEM::Update().

◆ HoleHull()

virtual const SHAPE_LINE_CHAIN PNS::ITEM::HoleHull ( int  aClearance,
int  aWalkaroundThickness = 0,
int  aLayer = -1 
) const
inlinevirtualinherited

Reimplemented in PNS::VIA, and PNS::SOLID.

Definition at line 121 of file pns_item.h.

123  {
124  return SHAPE_LINE_CHAIN();
125  }
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...

◆ Hull()

virtual const SHAPE_LINE_CHAIN PNS::ITEM::Hull ( int  aClearance = 0,
int  aWalkaroundThickness = 0,
int  aLayer = -1 
) const
inlinevirtualinherited

Reimplemented in PNS::VIA, PNS::SEGMENT, PNS::ARC, and PNS::SOLID.

Definition at line 115 of file pns_item.h.

117  {
118  return SHAPE_LINE_CHAIN();
119  }
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...

◆ IsCompoundShapePrimitive()

bool PNS::ITEM::IsCompoundShapePrimitive ( ) const
inlineinherited

Definition at line 241 of file pns_item.h.

241 { return m_isCompoundShapePrimitive; }
bool m_isCompoundShapePrimitive
Definition: pns_item.h:259

References PNS::ITEM::m_isCompoundShapePrimitive.

◆ IsLineCorner()

bool PNS::JOINT::IsLineCorner ( bool  aAllowLockedSegs = false) const
inline

Checks if a joint connects two segments of the same net, layer, and width.

Parameters
aAllowLockedSegswill consider joints between locked and unlocked segments as trivial
Returns
true if the joint is a trivial line corner

Definition at line 103 of file pns_joint.h.

104  {
105  if( m_linkedItems.Size() != 2 || m_linkedItems.Count( SEGMENT_T | ARC_T ) != 2 )
106  {
107  if( !aAllowLockedSegs )
108  {
109  return false;
110  }
111  // There will be multiple VVIAs on joints between two locked segments, because we
112  // naively add a VVIA to each end of a locked segment.
113  else if( ( m_linkedItems.Size() - m_linkedItems.Count( SEGMENT_T | ARC_T ) )
114  == m_linkedItems.Count( VIA_T ) )
115  {
116  const VIA* via = nullptr;
117  bool hasNonVirtualVia = false;
118 
119  for( const ITEM* item : m_linkedItems.CItems() )
120  {
121  if( item->Kind() == VIA_T )
122  {
123  via = static_cast<const VIA*>( item );
124 
125  hasNonVirtualVia = !via->IsVirtual();
126 
127  if( hasNonVirtualVia )
128  break;
129  }
130  }
131 
132  assert( via );
133 
134  if( !via || hasNonVirtualVia )
135  return false;
136  }
137  else
138  {
139  return false;
140  }
141  }
142 
143  auto seg1 = static_cast<LINKED_ITEM*>( m_linkedItems[0] );
144  auto seg2 = static_cast<LINKED_ITEM*>( m_linkedItems[1] );
145 
146  // joints between segments of different widths are not considered trivial.
147  return seg1->Width() == seg2->Width();
148  }
int Count(int aKindMask=-1) const
Definition: pns_itemset.h:114
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297
int Size() const
Definition: pns_itemset.h:160
ITEM(PnsKind aKind)
Definition: pns_item.h:73
Normal via.
Definition: router_tool.cpp:72
const ENTRIES & CItems() const
Definition: pns_itemset.h:136

References PNS::ITEM::ARC_T, PNS::ITEM_SET::CItems(), PNS::ITEM_SET::Count(), m_linkedItems, PNS::ITEM::SEGMENT_T, PNS::ITEM_SET::Size(), via, and PNS::ITEM::VIA_T.

Referenced by PNS::NODE::followLine(), NextSegment(), and PNS::LINE_PLACER::simplifyNewLine().

◆ IsLocked()

bool PNS::JOINT::IsLocked ( ) const
inline

Definition at line 287 of file pns_joint.h.

288  {
289  return m_locked;
290  }
bool m_locked
Definition: pns_joint.h:300

References m_locked.

Referenced by PNS::NODE::followLine(), and Merge().

◆ IsNonFanoutVia()

bool PNS::JOINT::IsNonFanoutVia ( ) const
inline

Definition at line 150 of file pns_joint.h.

151  {
152  int vias = m_linkedItems.Count( VIA_T );
153  int segs = m_linkedItems.Count( SEGMENT_T );
154  segs += m_linkedItems.Count( ARC_T );
155 
156  return ( m_linkedItems.Size() == 3 && vias == 1 && segs == 2 );
157  }
int Count(int aKindMask=-1) const
Definition: pns_itemset.h:114
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297
int Size() const
Definition: pns_itemset.h:160

References PNS::ITEM::ARC_T, PNS::ITEM_SET::Count(), m_linkedItems, PNS::ITEM::SEGMENT_T, PNS::ITEM_SET::Size(), and PNS::ITEM::VIA_T.

Referenced by PNS::TOPOLOGY::AssembleTrivialPath(), and PNS::TOPOLOGY::followTrivialPath().

◆ IsRoutable()

bool PNS::ITEM::IsRoutable ( ) const
inlineinherited

Definition at line 233 of file pns_item.h.

233 { return m_routable; }
bool m_routable
Definition: pns_item.h:257

References PNS::ITEM::m_routable.

Referenced by PNS::NODE::addSolid(), and PNS::NODE::removeSolidIndex().

◆ IsStitchingVia()

bool PNS::JOINT::IsStitchingVia ( ) const
inline

Definition at line 159 of file pns_joint.h.

160  {
161  return ( m_linkedItems.Size() == 1 && m_linkedItems.Count( VIA_T ) == 1 );
162  }
int Count(int aKindMask=-1) const
Definition: pns_itemset.h:114
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297
int Size() const
Definition: pns_itemset.h:160

References PNS::ITEM_SET::Count(), m_linkedItems, PNS::ITEM_SET::Size(), and PNS::ITEM::VIA_T.

◆ IsTraceWidthChange()

bool PNS::JOINT::IsTraceWidthChange ( ) const
inline

Link the joint to a given board item (when it's added to the NODE).

Definition at line 164 of file pns_joint.h.

References PNS::ITEM_SET::Count(), m_linkedItems, PNS::ITEM::SEGMENT_T, PNS::ITEM_SET::Size(), and PNS::SEGMENT::Width().

Referenced by PNS::TOPOLOGY::followTrivialPath().

◆ IsVirtual()

bool PNS::ITEM::IsVirtual ( ) const
inlineinherited

◆ Kind()

◆ KindStr()

std::string PNS::ITEM::KindStr ( ) const
inherited

Returns the kind of the item, as string.

Definition at line 160 of file pns_item.cpp.

161 {
162  switch( m_kind )
163  {
164  case ARC_T: return "arc";
165  case LINE_T: return "line";
166  case SEGMENT_T: return "segment";
167  case VIA_T: return "via";
168  case JOINT_T: return "joint";
169  case SOLID_T: return "solid";
170  case DIFF_PAIR_T: return "diff-pair";
171  default: return "unknown";
172  }
173 }
PnsKind m_kind
Definition: pns_item.h:247

References PNS::ITEM::ARC_T, PNS::ITEM::DIFF_PAIR_T, PNS::ITEM::JOINT_T, PNS::ITEM::LINE_T, PNS::ITEM::m_kind, PNS::ITEM::SEGMENT_T, PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by PNS::TOOL_BASE::pickSingleItem(), and PNS::TOOL_BASE::updateEndItem().

◆ Layer()

◆ Layers()

const LAYER_RANGE& PNS::ITEM::Layers ( ) const
inlineinherited

Definition at line 154 of file pns_item.h.

154 { return m_layers; }
LAYER_RANGE m_layers
Definition: pns_item.h:251

References PNS::ITEM::m_layers.

Referenced by PNS::INDEX::Add(), PNS::NODE::Add(), PNS::NODE::addArc(), PNS_KICAD_IFACE::AddItem(), PNS::NODE::addSegment(), PNS::NODE::addSolid(), PNS::NODE::addVia(), PNS::ARC::ARC(), PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), PNS_PCBNEW_RULE_RESOLVER::Clearance(), PNS::VIA::Clone(), PNS::ITEM::collideSimple(), PNS::MEANDER_PLACER::CurrentLayer(), PNS::DP_MEANDER_PLACER::CurrentLayer(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::NODE::FindJoint(), PNS::NODE::FindLinesBetweenJoints(), PNS::NODE::findRedundantArc(), PNS::NODE::findRedundantSegment(), PNS::NODE::FixupVirtualVias(), ROUTER_TOOL::getStartLayer(), PNS_PCBNEW_RULE_RESOLVER::HoleClearance(), PNS_PCBNEW_RULE_RESOLVER::HoleToHoleClearance(), PNS_KICAD_IFACE::IsFlashedOnLayer(), PNS::ITEM::Layer(), PNS::ITEM::LayersOverlap(), PNS::LINE::LINE(), PNS::NODE::LockJoint(), PNS::VIA::MakeHandle(), PNS::ROUTER::markViolations(), PNS::SHOVE::onCollidingSolid(), LENGTH_TUNER_TOOL::performTuning(), PNS::TOOL_BASE::pickSingleItem(), PNS::INDEX::Query(), PNS::INDEX::Remove(), PNS::NODE::removeArcIndex(), PNS::NODE::removeSegmentIndex(), PNS::NODE::removeSolidIndex(), PNS::NODE::removeViaIndex(), PNS_TEST_ENVIRONMENT::ReplayLog(), PNS::SEGMENT::SEGMENT(), PNS::LINE_PLACER::SetLayer(), PNS::COMPONENT_DRAGGER::Start(), ROUTER_PREVIEW_ITEM::Update(), PNS::TOOL_BASE::updateEndItem(), PNS::DIFF_PAIR::updateLine(), PNS::TOOL_BASE::updateStartItem(), and PNS::VIA::VIA().

◆ LayersOverlap()

bool PNS::ITEM::LayersOverlap ( const ITEM aOther) const
inlineinherited

Return true if the set of layers spanned by aOther overlaps our layers.

Definition at line 163 of file pns_item.h.

164  {
165  return Layers().Overlaps( aOther->Layers() );
166  }
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:67
const LAYER_RANGE & Layers() const
Definition: pns_item.h:154

References PNS::ITEM::Layers(), and LAYER_RANGE::Overlaps().

Referenced by PNS::SHOVE::onCollidingArc(), PNS::SHOVE::onCollidingSegment(), PNS::NODE::rebuildJoint(), and PNS::SHOVE::ShoveObstacleLine().

◆ Link()

void PNS::JOINT::Link ( ITEM aItem)
inline

Unlink a given board item from the joint (upon its removal from a NODE)

Returns
true if the joint became dangling after unlinking.

Definition at line 179 of file pns_joint.h.

References PNS::ITEM_SET::Add(), PNS::ITEM_SET::Contains(), and m_linkedItems.

Referenced by PNS::NODE::linkJoint().

◆ LinkCount()

int PNS::JOINT::LinkCount ( int  aMask = -1) const
inline

Definition at line 248 of file pns_joint.h.

249  {
250  return m_linkedItems.Count( aMask );
251  }
int Count(int aKindMask=-1) const
Definition: pns_itemset.h:114
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297

References PNS::ITEM_SET::Count(), and m_linkedItems.

Referenced by Dump(), PNS::getDanglingAnchor(), PNS::TOPOLOGY::LeadingRatLine(), PNS::LINE_PLACER::simplifyNewLine(), PNS::LINE_PLACER::SplitAdjacentSegments(), and PNS::COMPONENT_DRAGGER::Start().

◆ LinkList()

◆ Links()

ITEM_SET& PNS::JOINT::Links ( )
inline

Definition at line 243 of file pns_joint.h.

244  {
245  return m_linkedItems;
246  }
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297

References m_linkedItems.

Referenced by PNS::TOPOLOGY::AssembleTrivialPath(), PNS::TOPOLOGY::followTrivialPath(), PNS_KICAD_IFACE_BASE::inheritTrackWidth(), and PNS::LINE_PLACER::simplifyNewLine().

◆ Lock()

void PNS::JOINT::Lock ( bool  aLock = true)
inline

Definition at line 282 of file pns_joint.h.

283  {
284  m_locked = aLock;
285  }
bool m_locked
Definition: pns_joint.h:300

References m_locked.

Referenced by PNS::NODE::LockJoint().

◆ Mark()

virtual void PNS::ITEM::Mark ( int  aMarker) const
inlinevirtualinherited

Reimplemented in PNS::LINE.

Definition at line 210 of file pns_item.h.

210 { m_marker = aMarker; }
int m_marker
Definition: pns_item.h:255

References PNS::ITEM::m_marker.

Referenced by PNS::ITEM::collideSimple(), and PNS::SHOVE::ShoveDraggingVia().

◆ Marker()

virtual int PNS::ITEM::Marker ( ) const
inlinevirtualinherited

◆ Merge()

void PNS::JOINT::Merge ( const JOINT aJoint)
inline

Definition at line 260 of file pns_joint.h.

261  {
262  if( !Overlaps( aJoint ) )
263  return;
264 
265  m_layers.Merge( aJoint.m_layers );
266 
267  if( aJoint.IsLocked() )
268  m_locked = true;
269 
270  for( ITEM* item : aJoint.LinkList() )
271  {
272  m_linkedItems.Add( item );
273  }
274  }
LAYER_RANGE m_layers
Definition: pns_item.h:251
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297
ITEM(PnsKind aKind)
Definition: pns_item.h:73
void Add(const LINE &aLine)
Definition: pns_itemset.cpp:32
bool m_locked
Definition: pns_joint.h:300
void Merge(const LAYER_RANGE &aOther)
Shortcut for comparisons/overlap tests.
Definition: pns_layerset.h:92
bool Overlaps(const JOINT &rhs) const
Definition: pns_joint.h:276

References PNS::ITEM_SET::Add(), IsLocked(), LinkList(), PNS::ITEM::m_layers, m_linkedItems, m_locked, LAYER_RANGE::Merge(), and Overlaps().

Referenced by PNS::NODE::touchJoint().

◆ Net()

int PNS::JOINT::Net ( ) const
inline

Definition at line 228 of file pns_joint.h.

229  {
230  return m_tag.net;
231  }
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294

References m_tag, and PNS::JOINT::HASH_TAG::net.

Referenced by PNS::NODE::FixupVirtualVias(), PNS::TOPOLOGY::LeadingRatLine(), PNS::TOPOLOGY::NearestUnconnectedItem(), and PNS::COMPONENT_DRAGGER::Start().

◆ NextSegment()

LINKED_ITEM* PNS::JOINT::NextSegment ( ITEM aCurrent,
bool  aAllowLockedSegs = false 
) const
inline

Definition at line 197 of file pns_joint.h.

198  {
199  if( !IsLineCorner( aAllowLockedSegs ) )
200  return nullptr;
201 
202  return static_cast<LINKED_ITEM*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
203  }
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297
bool IsLineCorner(bool aAllowLockedSegs=false) const
Checks if a joint connects two segments of the same net, layer, and width.
Definition: pns_joint.h:103

References IsLineCorner(), and m_linkedItems.

Referenced by PNS::NODE::followLine().

◆ OfKind()

◆ operator==()

bool PNS::JOINT::operator== ( const JOINT rhs) const
inline

Definition at line 255 of file pns_joint.h.

256  {
257  return m_tag.pos == rhs.m_tag.pos && m_tag.net == rhs.m_tag.net;
258  }
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294

References m_tag, PNS::JOINT::HASH_TAG::net, and PNS::JOINT::HASH_TAG::pos.

◆ Overlaps()

bool PNS::JOINT::Overlaps ( const JOINT rhs) const
inline

Definition at line 276 of file pns_joint.h.

277  {
278  return m_tag.pos == rhs.m_tag.pos &&
279  m_tag.net == rhs.m_tag.net && m_layers.Overlaps( rhs.m_layers );
280  }
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:67
LAYER_RANGE m_layers
Definition: pns_item.h:251
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294

References PNS::ITEM::m_layers, m_tag, PNS::JOINT::HASH_TAG::net, LAYER_RANGE::Overlaps(), and PNS::JOINT::HASH_TAG::pos.

Referenced by Merge().

◆ Owner()

NODE* PNS::ITEM::Owner ( ) const
inlineinherited

Return the owner of this item, or NULL if there's none.

Definition at line 171 of file pns_item.h.

171 { return m_owner; }
NODE * m_owner
Definition: pns_item.h:250

References PNS::ITEM::m_owner.

Referenced by PNS_KICAD_IFACE_BASE::inheritTrackWidth(), PNS::LINE_PLACER::Move(), and PNS::LINE_PLACER::rhShoveOnly().

◆ Parent()

◆ Pos()

const VECTOR2I& PNS::JOINT::Pos ( ) const
inline

◆ Rank()

virtual int PNS::ITEM::Rank ( ) const
inlinevirtualinherited

Reimplemented in PNS::LINE.

Definition at line 215 of file pns_item.h.

215 { return m_rank; }
int m_rank
Definition: pns_item.h:256

References PNS::ITEM::m_rank.

Referenced by PNS::ARC::ARC(), PNS::LINE::LINE(), and PNS::SHOVE::shoveIteration().

◆ SetIsCompoundShapePrimitive()

void PNS::ITEM::SetIsCompoundShapePrimitive ( )
inlineinherited

Definition at line 240 of file pns_item.h.

240 { m_isCompoundShapePrimitive = true; }
bool m_isCompoundShapePrimitive
Definition: pns_item.h:259

References PNS::ITEM::m_isCompoundShapePrimitive.

◆ SetLayer()

◆ SetLayers()

void PNS::ITEM::SetLayers ( const LAYER_RANGE aLayers)
inlineinherited

Definition at line 155 of file pns_item.h.

155 { m_layers = aLayers; }
LAYER_RANGE m_layers
Definition: pns_item.h:251

References PNS::ITEM::m_layers.

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::VIA::Clone(), and PNS::VIA::VIA().

◆ SetNet()

◆ SetOwner()

void PNS::ITEM::SetOwner ( NODE aOwner)
inlineinherited

Set the node that owns this item.

An item can belong to a single NODE or be unowned.

Definition at line 176 of file pns_item.h.

176 { m_owner = aOwner; }
NODE * m_owner
Definition: pns_item.h:250

References PNS::ITEM::m_owner.

Referenced by PNS::NODE::AssembleLine(), PNS::NODE::doRemove(), and PNS::NODE::Remove().

◆ SetParent()

void PNS::ITEM::SetParent ( BOARD_ITEM aParent)
inlineinherited

Definition at line 148 of file pns_item.h.

148 { m_parent = aParent; }
BOARD_ITEM * m_parent
Definition: pns_item.h:249

References PNS::ITEM::m_parent.

Referenced by PNS_KICAD_IFACE::AddItem().

◆ SetRank()

virtual void PNS::ITEM::SetRank ( int  aRank)
inlinevirtualinherited

Reimplemented in PNS::LINE.

Definition at line 214 of file pns_item.h.

214 { m_rank = aRank; }
int m_rank
Definition: pns_item.h:256

References PNS::ITEM::m_rank.

Referenced by PNS::NODE::Commit(), and PNS::SHOVE::ShoveDraggingVia().

◆ SetRoutable()

void PNS::ITEM::SetRoutable ( bool  aRoutable)
inlineinherited

Definition at line 232 of file pns_item.h.

232 { m_routable = aRoutable; }
bool m_routable
Definition: pns_item.h:257

References PNS::ITEM::m_routable.

◆ Shape()

virtual const SHAPE* PNS::ITEM::Shape ( ) const
inlinevirtualinherited

Return the geometrical shape of the item.

Used for collision detection and spatial indexing.

Reimplemented in PNS::LINE, PNS::VIA, PNS::SOLID, PNS::ARC, and PNS::SEGMENT.

Definition at line 200 of file pns_item.h.

201  {
202  return nullptr;
203  }

Referenced by PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::ITEM::collideSimple(), PNS::OPTIMIZER::computeBreakouts(), PNS::OPTIMIZER::customBreakouts(), PNS::HIT_VISITOR::operator()(), PNS::INDEX::Query(), ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM(), and ROUTER_PREVIEW_ITEM::Update().

◆ Tag()

const HASH_TAG& PNS::JOINT::Tag ( ) const
inline

trivial accessors

Definition at line 218 of file pns_joint.h.

219  {
220  return m_tag;
221  }
HASH_TAG m_tag
< hash tag for unordered_multimap
Definition: pns_joint.h:294

References m_tag.

◆ Unlink()

bool PNS::JOINT::Unlink ( ITEM aItem)
inline

For trivial joints, return the segment adjacent to (aCurrent).

For non-trival ones, return NULL, indicating the end of line.

Definition at line 189 of file pns_joint.h.

References PNS::ITEM_SET::Erase(), m_linkedItems, and PNS::ITEM_SET::Size().

Referenced by PNS::NODE::unlinkJoint().

◆ Unmark()

virtual void PNS::ITEM::Unmark ( int  aMarker = -1) const
inlinevirtualinherited

Reimplemented in PNS::LINE.

Definition at line 211 of file pns_item.h.

211 { m_marker &= ~aMarker; }
int m_marker
Definition: pns_item.h:255

References PNS::ITEM::m_marker.

Referenced by PNS::NODE::Commit(), and PNS::DRAGGER::Start().

◆ Via()

VIA* PNS::JOINT::Via ( )
inline

Definition at line 205 of file pns_joint.h.

206  {
207  for( ITEM* item : m_linkedItems.Items() )
208  {
209  if( item->OfKind( VIA_T ) )
210  return static_cast<VIA*>( item );
211  }
212 
213  return nullptr;
214  }
ENTRIES & Items()
Definition: pns_itemset.h:135
ITEM_SET m_linkedItems
locked (non-movable) flag
Definition: pns_joint.h:297
ITEM(PnsKind aKind)
Definition: pns_item.h:73

References PNS::ITEM_SET::Items(), m_linkedItems, and PNS::ITEM::VIA_T.

Member Data Documentation

◆ m_isCompoundShapePrimitive

bool PNS::ITEM::m_isCompoundShapePrimitive
protectedinherited

◆ m_isVirtual

bool PNS::ITEM::m_isVirtual
protectedinherited

◆ m_kind

PnsKind PNS::ITEM::m_kind
protectedinherited

◆ m_layers

◆ m_linkedItems

ITEM_SET PNS::JOINT::m_linkedItems
private

◆ m_locked

bool PNS::JOINT::m_locked
private

Definition at line 300 of file pns_joint.h.

Referenced by IsLocked(), JOINT(), Lock(), and Merge().

◆ m_marker

◆ m_movable

bool PNS::ITEM::m_movable
protectedinherited

◆ m_net

◆ m_owner

NODE* PNS::ITEM::m_owner
protectedinherited

◆ m_parent

BOARD_ITEM* PNS::ITEM::m_parent
protectedinherited

◆ m_rank

◆ m_routable

bool PNS::ITEM::m_routable
protectedinherited

Definition at line 257 of file pns_item.h.

Referenced by PNS::ITEM::IsRoutable(), PNS::ITEM::ITEM(), and PNS::ITEM::SetRoutable().

◆ m_tag

HASH_TAG PNS::JOINT::m_tag
private

< hash tag for unordered_multimap

list of items linked to this joint

Definition at line 294 of file pns_joint.h.

Referenced by Dump(), JOINT(), Net(), operator==(), Overlaps(), Pos(), and Tag().

◆ UnusedNet

const int PNS::ITEM::UnusedNet = INT_MAX
staticinherited

Supported item types.

Definition at line 58 of file pns_item.h.

Referenced by PNS::ITEM::ITEM().


The documentation for this class was generated from the following files: