27 #include <math/vector2d.h> 30 #include "pns_segment.h" 31 #include "pns_itemset.h" 46 typedef ITEM_SET::ENTRIES LINKED_ITEMS;
64 return ( (hash<int>()( aP.pos.x )
65 ^ (hash<int>()( aP.pos.y ) << 1) ) >> 1 )
66 ^ (hash<int>()( aP.net ) << 1);
71 ITEM( JOINT_T ), m_locked(
false ) {}
85 m_layers = aB.m_layers;
86 m_tag.pos = aB.m_tag.pos;
87 m_tag.net = aB.m_tag.net;
88 m_linkedItems = aB.m_linkedItems;
89 m_layers = aB.m_layers;
90 m_locked = aB.m_locked;
103 if( m_linkedItems.Size() != 2 || m_linkedItems.Count( SEGMENT_T ) != 2 )
110 return seg1->Width() == seg2->Width();
113 bool IsNonFanoutVia()
const 115 int vias = m_linkedItems.Count( VIA_T );
116 int segs = m_linkedItems.Count( SEGMENT_T );
118 return ( m_linkedItems.Size() == 3 && vias == 1 && segs == 2 );
121 bool IsTraceWidthChange()
const 123 if( m_linkedItems.Size() != 2 )
126 if( m_linkedItems.Count( SEGMENT_T ) != 2)
132 return seg1->Width() != seg2->Width();
138 if( m_linkedItems.Contains( aItem ) )
141 m_linkedItems.Add( aItem );
148 m_linkedItems.Erase( aItem );
149 return m_linkedItems.Size() == 0;
159 return static_cast<SEGMENT*
>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
164 for(
ITEM* item : m_linkedItems.Items() )
166 if( item->OfKind( VIA_T ) )
167 return static_cast<VIA*>( item );
190 const LINKED_ITEMS& LinkList()
const 192 return m_linkedItems.CItems();
197 return m_linkedItems;
202 return m_linkedItems;
205 int LinkCount(
int aMask = -1 )
const 207 return m_linkedItems.Count( aMask );
212 bool operator==(
const JOINT& rhs )
const 214 return m_tag.pos == rhs.m_tag.pos && m_tag.net == rhs.m_tag.net;
217 void Merge(
const JOINT& aJoint )
219 if( !Overlaps( aJoint ) )
222 m_layers.Merge( aJoint.m_layers );
224 if( aJoint.IsLocked() )
227 for(
ITEM* item : aJoint.LinkList() )
229 m_linkedItems.Add( item );
233 bool Overlaps(
const JOINT& rhs )
const 235 return m_tag.pos == rhs.m_tag.pos &&
236 m_tag.net == rhs.m_tag.net && m_layers.Overlaps( rhs.m_layers );
239 void Lock(
bool aLock =
true )
244 bool IsLocked()
const 262 return aP1.pos == aP2.pos && aP1.net == aP2.net;
267 #endif // __PNS_JOINT_H Class ITEM.
Definition: pns_item.h:54
Definition: pns_joint.h:56
Definition: pns_itemset.h:39
bool Unlink(ITEM *aItem)
Unlinks a given board item from the joint (upon its removal from a NODE) Returns true if the joint be...
Definition: pns_joint.h:146
SEGMENT * NextSegment(SEGMENT *aCurrent) const
For trivial joints, returns the segment adjacent to (aCurrent).
Definition: pns_joint.h:154
Joints are hashed by their position, layers and net.
Definition: pns_joint.h:50
Class JOINT.
Definition: pns_joint.h:43
bool IsLineCorner() const
Returns true if the joint is a trivial line corner, connecting two segments of the same net...
Definition: pns_joint.h:101
const HASH_TAG & Tag() const
trivial accessors
Definition: pns_joint.h:175
ITEM * Clone() const override
Function Clone()
Definition: pns_joint.h:93
void Link(ITEM *aItem)
Links the joint to a given board item (when it's added to the NODE)
Definition: pns_joint.h:136
Definition: pns_segment.h:38
Definition: pns_algo_base.cpp:26
Class LAYER_RANGE.
Definition: pns_layerset.h:32