KiCad PCB EDA Suite
PNS::DIFF_PAIR Class Reference

Basic class for a differential pair. More...

#include <pns_diff_pair.h>

Inheritance diagram for PNS::DIFF_PAIR:
PNS::LINK_HOLDER PNS::ITEM

Classes

struct  COUPLED_SEGMENTS
 

Public Types

typedef std::vector< COUPLED_SEGMENTSCOUPLED_SEGMENTS_VEC
 
typedef std::vector< LINKED_ITEM * > LINKS
 
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

 DIFF_PAIR ()
 
 DIFF_PAIR (int aGap)
 
 DIFF_PAIR (const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN, int aGap=0)
 
 DIFF_PAIR (const LINE &aLineP, const LINE &aLineN, int aGap=0)
 
DIFF_PAIRClone () const override
 Return a deep copy of the item. More...
 
virtual void ClearLinks () override
 Return the number of segments that were assembled together to form this line. More...
 
void SetShape (const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN, bool aSwapLanes=false)
 
void SetShape (const DIFF_PAIR &aPair)
 
void SetNets (int aP, int aN)
 
void SetWidth (int aWidth)
 
int Width () const
 
void SetGap (int aGap)
 
int Gap () const
 
void AppendVias (const VIA &aViaP, const VIA &aViaN)
 
void RemoveVias ()
 
bool EndsWithVias () const
 
void SetViaDiameter (int aDiameter)
 
void SetViaDrill (int aDrill)
 
int NetP () const
 
int NetN () const
 
LINEPLine ()
 
LINENLine ()
 
DP_PRIMITIVE_PAIR EndingPrimitives ()
 
double CoupledLength () const
 
double TotalLength () const
 
double CoupledLengthFactor () const
 
double Skew () const
 
void CoupledSegmentPairs (COUPLED_SEGMENTS_VEC &aPairs) const
 
void Clear ()
 
void Append (const DIFF_PAIR &aOther)
 
bool Empty () const
 
const SHAPE_LINE_CHAINCP () const
 
const SHAPE_LINE_CHAINCN () const
 
bool BuildInitial (const DP_GATEWAY &aEntry, const DP_GATEWAY &aTarget, bool aPrefDiagonal)
 
bool CheckConnectionAngle (const DIFF_PAIR &aOther, int allowedAngles) const
 
int CoupledLength (const SEG &aP, const SEG &aN) const
 
int64_t CoupledLength (const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN &aN) const
 
const RANGED_NUM< int > GapConstraint () const
 
void Link (LINKED_ITEM *aLink)
 Return the list of links from the owning node that constitute this line (or NULL if the line is not linked). More...
 
LINKSLinks ()
 
const LINKSLinks () const
 
bool IsLinked () const
 Check if the segment aLink is a part of the line. More...
 
bool ContainsLink (const LINKED_ITEM *aItem) const
 
LINKED_ITEMGetLink (int aIndex) const
 Erase the linking information. Used to detach the line from the owning node. More...
 
int LinkCount () const
 
void ShowLinks () 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)
 
int Net () const
 
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, int aOverrideClearance=-1) 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
 
bool IsLocked () const
 
void SetRoutable (bool aRoutable)
 
bool IsRoutable () const
 
void SetIsFreePad (bool aIsFreePad=true)
 
bool IsFreePad () const
 
bool IsVirtual () const
 
void SetIsCompoundShapePrimitive ()
 
bool IsCompoundShapePrimitive () const
 
virtual const std::string Format () const
 

Static Public Member Functions

static bool ClassOf (const ITEM *aItem)
 
static DIFF_PAIRAssembleDp (LINE *aLine)
 

Static Public Attributes

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

Protected Member Functions

void copyLinks (const LINK_HOLDER *aParent)
 < Copy m_links from the line aParent. More...
 

Protected Attributes

LINKS m_links
 
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_isFreePad
 
bool m_isCompoundShapePrimitive
 

Private Member Functions

void updateLine (LINE &aLine, const SHAPE_LINE_CHAIN &aShape, int aNet, const VIA &aVia)
 
bool collideSimple (const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly, int aOverrideClearance) const
 

Private Attributes

SHAPE_LINE_CHAIN m_n
 
SHAPE_LINE_CHAIN m_p
 
LINE m_line_p
 
LINE m_line_n
 
VIA m_via_p
 
VIA m_via_n
 
bool m_hasVias
 
int m_net_p
 
int m_net_n
 
int m_width
 
int m_gap
 
int m_viaGap
 
int m_maxUncoupledLength
 
int m_chamferLimit
 
RANGED_NUM< int > m_gapConstraint
 

Detailed Description

Basic class for a differential pair.

Stores two PNS_LINEs (for positive and negative nets, respectively), the gap and coupling constraints.

Definition at line 234 of file pns_diff_pair.h.

Member Typedef Documentation

◆ COUPLED_SEGMENTS_VEC

Definition at line 257 of file pns_diff_pair.h.

◆ LINKS

typedef std::vector<LINKED_ITEM*> PNS::LINK_HOLDER::LINKS
inherited

Definition at line 36 of file pns_link_holder.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 };
@ SOLID_T
Definition: pns_item.h:63
@ LINE_T
Definition: pns_item.h:64
@ SEGMENT_T
Definition: pns_item.h:66
@ DIFF_PAIR_T
Definition: pns_item.h:69
@ JOINT_T
Definition: pns_item.h:65

Constructor & Destructor Documentation

◆ DIFF_PAIR() [1/4]

PNS::DIFF_PAIR::DIFF_PAIR ( )
inline

Definition at line 259 of file pns_diff_pair.h.

259 :
261 m_hasVias( false )
262 {
263 // Initialize some members, to avoid uninitialized variables.
264 m_net_p = 0;
265 m_net_n = 0;;
266 m_width = 0;
267 m_gap = 0;
268 m_viaGap = 0;
270 m_chamferLimit = 0;
271 }

References m_chamferLimit, m_gap, m_maxUncoupledLength, m_net_n, m_net_p, m_viaGap, and m_width.

◆ DIFF_PAIR() [2/4]

PNS::DIFF_PAIR::DIFF_PAIR ( int  aGap)
inline

Definition at line 273 of file pns_diff_pair.h.

273 :
275 m_hasVias( false )
276 {
277 m_gapConstraint = aGap;
278
279 // Initialize other members, to avoid uninitialized variables.
280 m_net_p = 0;
281 m_net_n = 0;;
282 m_width = 0;
283 m_gap = 0;
284 m_viaGap = 0;
286 m_chamferLimit = 0;
287 }
RANGED_NUM< int > m_gapConstraint

References m_chamferLimit, m_gap, m_gapConstraint, m_maxUncoupledLength, m_net_n, m_net_p, m_viaGap, and m_width.

◆ DIFF_PAIR() [3/4]

PNS::DIFF_PAIR::DIFF_PAIR ( const SHAPE_LINE_CHAIN aP,
const SHAPE_LINE_CHAIN aN,
int  aGap = 0 
)
inline

Definition at line 289 of file pns_diff_pair.h.

289 :
291 m_n( aN ),
292 m_p( aP ),
293 m_hasVias( false )
294 {
295 m_gapConstraint = aGap;
296
297 // Initialize other members, to avoid uninitialized variables.
298 m_net_p = 0;
299 m_net_n = 0;;
300 m_width = 0;
301 m_gap = 0;
302 m_viaGap = 0;
304 m_chamferLimit = 0;
305 }
SHAPE_LINE_CHAIN m_p
SHAPE_LINE_CHAIN m_n

References m_chamferLimit, m_gap, m_gapConstraint, m_maxUncoupledLength, m_net_n, m_net_p, m_viaGap, and m_width.

◆ DIFF_PAIR() [4/4]

PNS::DIFF_PAIR::DIFF_PAIR ( const LINE aLineP,
const LINE aLineN,
int  aGap = 0 
)
inline

Definition at line 307 of file pns_diff_pair.h.

307 :
309 m_line_p( aLineP ),
310 m_line_n( aLineN ),
311 m_hasVias( false )
312 {
313 m_gapConstraint = aGap;
314 m_net_p = aLineP.Net();
315 m_net_n = aLineN.Net();
316 m_p = aLineP.CLine();
317 m_n = aLineN.CLine();
318
319 // Do not leave uninitialized members, and keep static analyzer quiet:
320 m_width = 0;
321 m_gap = 0;
322 m_viaGap = 0;
324 m_chamferLimit = 0;
325 }

References PNS::LINE::CLine(), m_chamferLimit, m_gap, m_gapConstraint, m_maxUncoupledLength, m_n, m_net_n, m_net_p, m_p, m_viaGap, m_width, and PNS::ITEM::Net().

Member Function Documentation

◆ Anchor()

◆ AnchorCount()

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

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

Definition at line 224 of file pns_item.h.

225 {
226 return 0;
227 }

◆ Append()

void PNS::DIFF_PAIR::Append ( const DIFF_PAIR aOther)
inline

Definition at line 465 of file pns_diff_pair.h.

466 {
467 m_n.Append( aOther.m_n );
468 m_p.Append( aOther.m_p );
469 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.

References SHAPE_LINE_CHAIN::Append(), m_n, and m_p.

◆ AppendVias()

void PNS::DIFF_PAIR::AppendVias ( const VIA aViaP,
const VIA aViaN 
)
inline

Definition at line 393 of file pns_diff_pair.h.

394 {
395 m_hasVias = true;
396 m_via_p = aViaP;
397 m_via_n = aViaN;
398 }

References m_hasVias, m_via_n, and m_via_p.

Referenced by PNS::DIFF_PAIR_PLACER::routeHead().

◆ AssembleDp()

static DIFF_PAIR * PNS::DIFF_PAIR::AssembleDp ( LINE aLine)
static

◆ BelongsTo()

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

Definition at line 183 of file pns_item.h.

184 {
185 return m_owner == aNode;
186 }
NODE * m_owner
Definition: pns_item.h:257

References PNS::ITEM::m_owner.

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

◆ BuildInitial()

bool PNS::DIFF_PAIR::BuildInitial ( const DP_GATEWAY aEntry,
const DP_GATEWAY aTarget,
bool  aPrefDiagonal 
)

Definition at line 205 of file pns_diff_pair.cpp.

207{
208 SHAPE_LINE_CHAIN p = DIRECTION_45().BuildInitialTrace ( aEntry.AnchorP(), aTarget.AnchorP(),
209 aPrefDiagonal );
210 SHAPE_LINE_CHAIN n = DIRECTION_45().BuildInitialTrace ( aEntry.AnchorN(), aTarget.AnchorN(),
211 aPrefDiagonal );
212
213 int mask = aEntry.AllowedAngles() | DIRECTION_45::ANG_STRAIGHT | DIRECTION_45::ANG_OBTUSE;
214
215 SHAPE_LINE_CHAIN sum_n, sum_p;
216 m_p = p;
217 m_n = n;
218
219 if( aEntry.HasEntryLines() )
220 {
221 if( !aEntry.Entry().CheckConnectionAngle( *this, mask ) )
222 return false;
223
224 sum_p = aEntry.Entry().CP();
225 sum_n = aEntry.Entry().CN();
226 sum_p.Append( p );
227 sum_n.Append( n );
228 }
229 else
230 {
231 sum_p = p;
232 sum_n = n;
233 }
234
235 mask = aTarget.AllowedAngles() | DIRECTION_45::ANG_STRAIGHT | DIRECTION_45::ANG_OBTUSE;
236
237 m_p = sum_p;
238 m_n = sum_n;
239
240 if( aTarget.HasEntryLines() )
241 {
242 DP_GATEWAY t(aTarget) ;
243 t.Reverse();
244
245 if( !CheckConnectionAngle( t.Entry(), mask ) )
246 return false;
247
248 sum_p.Append( t.Entry().CP() );
249 sum_n.Append( t.Entry().CN() );
250 }
251
252 m_p = sum_p;
253 m_n = sum_n;
254
255 if( !checkGap ( p, n, m_gapConstraint ) )
256 return false;
257
258 if( p.SelfIntersecting() || n.SelfIntersecting() )
259 return false;
260
261 if( p.Intersects( n ) )
262 return false;
263
264 return true;
265}
Represent route directions & corner angles in a 45-degree metric.
Definition: direction45.h:37
const SHAPE_LINE_CHAIN BuildInitialTrace(const VECTOR2I &aP0, const VECTOR2I &aP1, bool aStartDiagonal=false, CORNER_MODE aMode=CORNER_MODE::MITERED_45) const
Build a 2-segment line chain between points aP0 and aP1 and following 45-degree routing regime.
bool CheckConnectionAngle(const DIFF_PAIR &aOther, int allowedAngles) const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const std::optional< INTERSECTION > SelfIntersecting() const
Check if the line chain is self-intersecting.
bool Intersects(const SHAPE_LINE_CHAIN &aChain) const
static bool checkGap(const SHAPE_LINE_CHAIN &p, const SHAPE_LINE_CHAIN &n, int gap)

References PNS::DP_GATEWAY::AllowedAngles(), PNS::DP_GATEWAY::AnchorN(), PNS::DP_GATEWAY::AnchorP(), DIRECTION_45::ANG_OBTUSE, DIRECTION_45::ANG_STRAIGHT, SHAPE_LINE_CHAIN::Append(), DIRECTION_45::BuildInitialTrace(), CheckConnectionAngle(), PNS::checkGap(), CN(), CP(), PNS::DP_GATEWAY::Entry(), PNS::DP_GATEWAY::HasEntryLines(), SHAPE_LINE_CHAIN::Intersects(), m_gapConstraint, m_n, m_p, PNS::DP_GATEWAY::Reverse(), and SHAPE_LINE_CHAIN::SelfIntersecting().

Referenced by PNS::DP_GATEWAYS::FitGateways().

◆ CheckConnectionAngle()

bool PNS::DIFF_PAIR::CheckConnectionAngle ( const DIFF_PAIR aOther,
int  allowedAngles 
) const

Definition at line 268 of file pns_diff_pair.cpp.

269{
270 bool checkP, checkN;
271
272 if( m_p.SegmentCount() == 0 || aOther.m_p.SegmentCount() == 0 )
273 checkP = true;
274 else
275 {
276 DIRECTION_45 p0( m_p.CSegment( -1 ) );
277 DIRECTION_45 p1( aOther.m_p.CSegment( 0 ) );
278
279 checkP = ( p0.Angle( p1 ) & aAllowedAngles ) != 0;
280 }
281
282 if( m_n.SegmentCount() == 0 || aOther.m_n.SegmentCount() == 0 )
283 {
284 checkN = true;
285 }
286 else
287 {
288 DIRECTION_45 n0( m_n.CSegment( -1 ) );
289 DIRECTION_45 n1( aOther.m_n.CSegment( 0 ) );
290
291 checkN = ( n0.Angle( n1 ) & aAllowedAngles ) != 0;
292 }
293
294 return checkP && checkN;
295}
int SegmentCount() const
Return the number of segments in this line chain.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.

References DIRECTION_45::Angle(), SHAPE_LINE_CHAIN::CSegment(), m_n, m_p, and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by BuildInitial().

◆ ClassOf()

static bool PNS::DIFF_PAIR::ClassOf ( const ITEM aItem)
inlinestatic

Definition at line 327 of file pns_diff_pair.h.

328 {
329 return aItem && ITEM::DIFF_PAIR_T == aItem->Kind();
330 }

References PNS::ITEM::DIFF_PAIR_T, and PNS::ITEM::Kind().

◆ Clear()

void PNS::DIFF_PAIR::Clear ( )
inline

Definition at line 459 of file pns_diff_pair.h.

460 {
461 m_n.Clear();
462 m_p.Clear();
463 }
void Clear()
Remove all points from the line chain.

References SHAPE_LINE_CHAIN::Clear(), m_n, and m_p.

◆ ClearLinks()

virtual void PNS::DIFF_PAIR::ClearLinks ( )
inlineoverridevirtual

Return the number of segments that were assembled together to form this line.

Reimplemented from PNS::LINK_HOLDER.

Definition at line 338 of file pns_diff_pair.h.

339 {
340 m_links.clear();
343 }

References PNS::LINK_HOLDER::ClearLinks(), m_line_n, m_line_p, and PNS::LINK_HOLDER::m_links.

◆ Clone()

DIFF_PAIR * PNS::DIFF_PAIR::Clone ( ) const
inlineoverridevirtual

Return a deep copy of the item.

Implements PNS::ITEM.

Definition at line 332 of file pns_diff_pair.h.

333 {
334 assert( false );
335 return nullptr;
336 }

◆ CN()

◆ Collide()

bool PNS::ITEM::Collide ( const ITEM aOther,
const NODE aNode,
bool  aDifferentNetsOnly = true,
int  aOverrideClearance = -1 
) 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 169 of file pns_item.cpp.

170{
171 if( collideSimple( aOther, aNode, aDifferentNetsOnly, aOverrideClearance ) )
172 return true;
173
174 // Special cases for "head" lines with vias attached at the end. Note that this does not
175 // support head-line-via to head-line-via collisions, but you can't route two independent
176 // tracks at once so it shouldn't come up.
177
178 if( m_kind == LINE_T )
179 {
180 const LINE* line = static_cast<const LINE*>( this );
181
182 if( line->EndsWithVia() && line->Via().collideSimple( aOther, aNode, aDifferentNetsOnly, aOverrideClearance ) )
183 return true;
184 }
185
186 if( aOther->m_kind == LINE_T )
187 {
188 const LINE* line = static_cast<const LINE*>( aOther );
189
190 if( line->EndsWithVia() && line->Via().collideSimple( this, aNode, aDifferentNetsOnly, aOverrideClearance ) )
191 return true;
192 }
193
194 return false;
195}
PnsKind m_kind
Definition: pns_item.h:254
bool collideSimple(const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly, int aOverrideClearance) 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::fixupViaCollisions(), PNS::SHOVE::onCollidingSolid(), PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()(), PNS::OPTIMIZER::CACHE_VISITOR::operator()(), PNS::SHOVE::shoveLineFromLoneVia(), PNS::SHOVE::shoveLineToHullSet(), PNS::COMPONENT_DRAGGER::Start(), and PNS::verifyDpBypass().

◆ collideSimple()

bool PNS::ITEM::collideSimple ( const ITEM aOther,
const NODE aNode,
bool  aDifferentNetsOnly,
int  aOverrideClearance 
) const
privateinherited

Definition at line 32 of file pns_item.cpp.

33{
34 const ROUTER_IFACE* iface = ROUTER::GetInstance()->GetInterface();
35 const SHAPE* shapeA = Shape();
36 const SHAPE* holeA = Hole();
37 int lineWidthA = 0;
38 const SHAPE* shapeB = aOther->Shape();
39 const SHAPE* holeB = aOther->Hole();
40 int lineWidthB = 0;
41
42 // Sadly collision routines ignore SHAPE_POLY_LINE widths so we have to pass them in as part
43 // of the clearance value.
44 if( m_kind == LINE_T )
45 lineWidthA = static_cast<const LINE*>( this )->Width() / 2;
46
47 if( aOther->m_kind == LINE_T )
48 lineWidthB = static_cast<const LINE*>( aOther )->Width() / 2;
49
50 // same nets? no collision!
51 if( aDifferentNetsOnly && m_net == aOther->m_net && m_net >= 0 && aOther->m_net >= 0 )
52 return false;
53
54 // a pad associated with a "free" pin (NIC) doesn't have a net until it has been used
55 if( aDifferentNetsOnly && ( IsFreePad() || aOther->IsFreePad() ) )
56 return false;
57
58 // check if we are not on completely different layers first
59 if( !m_layers.Overlaps( aOther->m_layers ) )
60 return false;
61
62 auto checkKeepout =
63 []( const ZONE* aKeepout, const BOARD_ITEM* aOther )
64 {
65 if( aKeepout->GetDoNotAllowTracks() && aOther->IsType( { PCB_ARC_T, PCB_TRACE_T } ) )
66 return true;
67
68 if( aKeepout->GetDoNotAllowVias() && aOther->Type() == PCB_VIA_T )
69 return true;
70
71 if( aKeepout->GetDoNotAllowPads() && aOther->Type() == PCB_PAD_T )
72 return true;
73
74 // Incomplete test, but better than nothing:
75 if( aKeepout->GetDoNotAllowFootprints() && aOther->Type() == PCB_PAD_T )
76 {
77 return !aKeepout->GetParentFootprint()
78 || aKeepout->GetParentFootprint() != aOther->GetParentFootprint();
79 }
80
81 return false;
82 };
83
84 const ZONE* zoneA = dynamic_cast<ZONE*>( Parent() );
85 const ZONE* zoneB = dynamic_cast<ZONE*>( aOther->Parent() );
86
87 if( zoneA && aOther->Parent() && !checkKeepout( zoneA, aOther->Parent() ) )
88 return false;
89
90 if( zoneB && Parent() && !checkKeepout( zoneB, Parent() ) )
91 return false;
92
93 bool thisNotFlashed = !iface->IsFlashedOnLayer( this, aOther->Layer() );
94 bool otherNotFlashed = !iface->IsFlashedOnLayer( aOther, Layer() );
95
96 if( ( aNode->GetCollisionQueryScope() == NODE::CQS_ALL_RULES
97 || ( thisNotFlashed || otherNotFlashed ) )
98 && ( holeA || holeB ) )
99 {
100 int holeClearance = aNode->GetHoleClearance( this, aOther );
101
102 if( holeClearance >= 0 && holeA && holeA->Collide( shapeB, holeClearance + lineWidthB ) )
103 {
104 Mark( Marker() | MK_HOLE );
105 return true;
106 }
107
108 if( holeB && holeClearance >= 0 && holeB->Collide( shapeA, holeClearance + lineWidthA ) )
109 {
110 aOther->Mark( aOther->Marker() | MK_HOLE );
111 return true;
112 }
113
114 if( holeA && holeB )
115 {
116 int holeToHoleClearance = aNode->GetHoleToHoleClearance( this, aOther );
117
118 if( holeToHoleClearance >= 0 && holeA->Collide( holeB, holeToHoleClearance ) )
119 {
120 Mark( Marker() | MK_HOLE );
121 aOther->Mark( aOther->Marker() | MK_HOLE );
122 return true;
123 }
124 }
125 }
126
127 if( !aOther->Layers().IsMultilayer() && thisNotFlashed )
128 return false;
129
130 if( !Layers().IsMultilayer() && otherNotFlashed )
131 return false;
132
133 int clearance = aOverrideClearance >= 0 ? aOverrideClearance : aNode->GetClearance( this, aOther );
134
135 if( clearance >= 0 )
136 {
137 bool checkCastellation = ( m_parent && m_parent->GetLayer() == Edge_Cuts );
138 bool checkNetTie = aNode->GetRuleResolver()->IsInNetTie( this );
139
140 if( checkCastellation || checkNetTie )
141 {
142 // Slow method
143 int actual;
144 VECTOR2I pos;
145
146 if( shapeA->Collide( shapeB, clearance + lineWidthA, &actual, &pos ) )
147 {
148 if( checkCastellation && aNode->QueryEdgeExclusions( pos ) )
149 return false;
150
151 if( checkNetTie && aNode->GetRuleResolver()->IsNetTieExclusion( aOther, pos, this ) )
152 return false;
153
154 return true;
155 }
156 }
157 else
158 {
159 // Fast method
160 if( shapeA->Collide( shapeB, clearance + lineWidthA + lineWidthB ) )
161 return true;
162 }
163 }
164
165 return false;
166}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:180
BOARD_ITEM_CONTAINER * GetParentFootprint() const
Definition: board_item.cpp:239
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:67
BOARD_ITEM * Parent() const
Definition: pns_item.h:151
bool IsFreePad() const
Definition: pns_item.h:238
int m_net
Definition: pns_item.h:261
virtual const SHAPE * Hole() const
Definition: pns_item.h:207
LAYER_RANGE m_layers
Definition: pns_item.h:258
virtual int Layer() const
Definition: pns_item.h:160
virtual const SHAPE * Shape() const
Return the geometrical shape of the item.
Definition: pns_item.h:202
const LAYER_RANGE & Layers() const
Definition: pns_item.h:156
virtual void Mark(int aMarker) const
Definition: pns_item.h:212
virtual int Marker() const
Definition: pns_item.h:214
BOARD_ITEM * m_parent
Definition: pns_item.h:256
@ CQS_ALL_RULES
check all rules
Definition: pns_node.h:162
ROUTER_IFACE * GetInterface() const
Definition: pns_router.h:214
static ROUTER * GetInstance()
Definition: pns_router.cpp:78
An abstract shape on 2D plane.
Definition: shape.h:123
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Definition: shape.h:178
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
bool GetDoNotAllowVias() const
Definition: zone.h:699
bool GetDoNotAllowPads() const
Definition: zone.h:701
bool GetDoNotAllowTracks() const
Definition: zone.h:700
bool GetDoNotAllowFootprints() const
Definition: zone.h:702
@ Edge_Cuts
Definition: layer_ids.h:113
@ MK_HOLE
Definition: pns_item.h:45
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101

References SHAPE::Collide(), PNS::NODE::CQS_ALL_RULES, Edge_Cuts, PNS::NODE::GetClearance(), PNS::NODE::GetCollisionQueryScope(), ZONE::GetDoNotAllowFootprints(), ZONE::GetDoNotAllowPads(), ZONE::GetDoNotAllowTracks(), ZONE::GetDoNotAllowVias(), PNS::NODE::GetHoleClearance(), PNS::NODE::GetHoleToHoleClearance(), PNS::ROUTER::GetInstance(), PNS::ROUTER::GetInterface(), BOARD_ITEM::GetLayer(), BOARD_ITEM::GetParentFootprint(), PNS::NODE::GetRuleResolver(), PNS::ITEM::Hole(), PNS::ROUTER_IFACE::IsFlashedOnLayer(), PNS::ITEM::IsFreePad(), PNS::RULE_RESOLVER::IsInNetTie(), LAYER_RANGE::IsMultilayer(), PNS::RULE_RESOLVER::IsNetTieExclusion(), PNS::ITEM::Layer(), PNS::ITEM::Layers(), PNS::ITEM::LINE_T, PNS::ITEM::m_kind, PNS::ITEM::m_layers, PNS::ITEM::m_net, PNS::ITEM::m_parent, PNS::ITEM::Mark(), PNS::ITEM::Marker(), PNS::MK_HOLE, LAYER_RANGE::Overlaps(), PNS::ITEM::Parent(), PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, PNS::NODE::QueryEdgeExclusions(), and PNS::ITEM::Shape().

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

◆ ContainsLink()

bool PNS::LINK_HOLDER::ContainsLink ( const LINKED_ITEM aItem) const
inlineinherited

Definition at line 58 of file pns_link_holder.h.

59 {
60 return alg::contains( m_links, aItem );
61 }
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99

References alg::contains(), and PNS::LINK_HOLDER::m_links.

Referenced by PNS::TOOL_BASE::checkSnap().

◆ copyLinks()

void PNS::LINK_HOLDER::copyLinks ( const LINK_HOLDER aParent)
inlineprotectedinherited

< Copy m_links from the line aParent.

List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is not a part of any node.

Definition at line 98 of file pns_link_holder.h.

References PNS::LINK_HOLDER::m_links.

Referenced by PNS::LINE::LINE(), and PNS::LINE::operator=().

◆ CoupledLength() [1/3]

double PNS::DIFF_PAIR::CoupledLength ( ) const

Definition at line 876 of file pns_diff_pair.cpp.

877{
879
880 CoupledSegmentPairs( pairs );
881
882 double l = 0.0;
883
884 for( unsigned int i = 0; i < pairs.size(); i++ )
885 l += pairs[i].coupledP.Length();
886
887 return l;
888}
std::vector< COUPLED_SEGMENTS > COUPLED_SEGMENTS_VEC
void CoupledSegmentPairs(COUPLED_SEGMENTS_VEC &aPairs) const

References CoupledSegmentPairs().

Referenced by PNS::coupledBypass(), CoupledLengthFactor(), PNS::OPTIMIZER::mergeDpStep(), and PNS::DIFF_PAIR_PLACER::tryWalkDp().

◆ CoupledLength() [2/3]

int PNS::DIFF_PAIR::CoupledLength ( const SEG aP,
const SEG aN 
) const

Definition at line 911 of file pns_diff_pair.cpp.

912{
913 SEG p_clip, n_clip;
914 int64_t dist = std::abs( aP.Distance( aN ) - m_width );
915
916 if( aP.ApproxParallel( aN ) && m_gapConstraint.Matches( dist ) &&
917 commonParallelProjection ( aP, aN, p_clip, n_clip ) )
918 return p_clip.Length();
919
920 return 0;
921}
bool Matches(const T &aOther) const
Definition: ranged_num.h:43
Definition: seg.h:42
int Length() const
Return the length (this).
Definition: seg.h:326
bool ApproxParallel(const SEG &aSeg, int aDistanceThreshold=1) const
Definition: seg.cpp:393
int Distance(const SEG &aSeg) const
Compute minimum Euclidean distance to segment aSeg.
Definition: seg.cpp:319
bool commonParallelProjection(SEG p, SEG n, SEG &pClip, SEG &nClip)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401

References std::abs(), SEG::ApproxParallel(), PNS::commonParallelProjection(), SEG::Distance(), SEG::Length(), m_gapConstraint, m_width, and RANGED_NUM< T >::Matches().

◆ CoupledLength() [3/3]

int64_t PNS::DIFF_PAIR::CoupledLength ( const SHAPE_LINE_CHAIN aP,
const SHAPE_LINE_CHAIN aN 
) const

Definition at line 851 of file pns_diff_pair.cpp.

852{
853 int64_t total = 0;
854
855 for( int i = 0; i < aP.SegmentCount(); i++ )
856 {
857 for( int j = 0; j < aN.SegmentCount(); j++ )
858 {
859 SEG sp = aP.CSegment( i );
860 SEG sn = aN.CSegment( j );
861
862 SEG p_clip, n_clip;
863
864 int64_t dist = std::abs( sp.Distance(sn) - m_width );
865
866 if( sp.ApproxParallel( sn ) && m_gapConstraint.Matches( dist ) &&
867 commonParallelProjection( sp, sn, p_clip, n_clip ) )
868 total += p_clip.Length();
869 }
870 }
871
872 return total;
873}

References std::abs(), SEG::ApproxParallel(), PNS::commonParallelProjection(), SHAPE_LINE_CHAIN::CSegment(), SEG::Distance(), SEG::Length(), m_gapConstraint, m_width, RANGED_NUM< T >::Matches(), and SHAPE_LINE_CHAIN::SegmentCount().

◆ CoupledLengthFactor()

double PNS::DIFF_PAIR::CoupledLengthFactor ( ) const

Definition at line 891 of file pns_diff_pair.cpp.

892{
893 double t = TotalLength();
894
895 if( t == 0.0 )
896 return 0.0;
897
898 return CoupledLength() / t;
899}
double CoupledLength() const
double TotalLength() const

References CoupledLength(), and TotalLength().

◆ CoupledSegmentPairs()

void PNS::DIFF_PAIR::CoupledSegmentPairs ( COUPLED_SEGMENTS_VEC aPairs) const

Definition at line 821 of file pns_diff_pair.cpp.

822{
825
826 p.Simplify();
827 n.Simplify();
828
829 for( int i = 0; i < p.SegmentCount(); i++ )
830 {
831 for( int j = 0; j < n.SegmentCount(); j++ )
832 {
833 SEG sp = p.Segment( i );
834 SEG sn = n.Segment( j );
835
836 SEG p_clip, n_clip;
837
838 int64_t dist = std::abs( sp.Distance( sn ) - m_width );
839
840 if( sp.ApproxParallel( sn, 2 ) && m_gapConstraint.Matches( dist ) &&
841 commonParallelProjection( sp, sn, p_clip, n_clip ) )
842 {
843 const COUPLED_SEGMENTS spair( p_clip, sp, i, n_clip, sn, j );
844 aPairs.push_back( spair );
845 }
846 }
847 }
848}

References std::abs(), SEG::ApproxParallel(), PNS::commonParallelProjection(), SEG::Distance(), m_gapConstraint, m_n, m_p, m_width, RANGED_NUM< T >::Matches(), SHAPE_LINE_CHAIN::Segment(), SHAPE_LINE_CHAIN::SegmentCount(), and SHAPE_LINE_CHAIN::Simplify().

Referenced by CoupledLength(), and PNS::DP_MEANDER_PLACER::Move().

◆ CP()

◆ Empty()

bool PNS::DIFF_PAIR::Empty ( ) const
inline

Definition at line 471 of file pns_diff_pair.h.

472 {
473 return ( m_n.SegmentCount() == 0 ) || ( m_p.SegmentCount() == 0 );
474 }

References m_n, m_p, and SHAPE_LINE_CHAIN::SegmentCount().

◆ EndingPrimitives()

DP_PRIMITIVE_PAIR PNS::DIFF_PAIR::EndingPrimitives ( )

Definition at line 751 of file pns_diff_pair.cpp.

752{
753 if( m_hasVias )
754 {
755 return DP_PRIMITIVE_PAIR( &m_via_p, &m_via_n );
756 }
757 else
758 {
759 const LINE lP( PLine() );
760 const LINE lN( NLine() );
761
762 SEGMENT sP( lP, lP.CSegment( -1 ) );
763 SEGMENT sN( lN, lN.CSegment( -1 ) );
764
765 DP_PRIMITIVE_PAIR dpair( &sP, &sN );
766 dpair.SetAnchors( sP.Seg().B, sN.Seg().B );
767
768 return dpair;
769 }
770}

References SEG::B, PNS::LINE::CSegment(), m_hasVias, m_via_n, m_via_p, NLine(), PLine(), PNS::SEGMENT::Seg(), and PNS::DP_PRIMITIVE_PAIR::SetAnchors().

Referenced by PNS::DIFF_PAIR_PLACER::FixRoute().

◆ EndsWithVias()

bool PNS::DIFF_PAIR::EndsWithVias ( ) const
inline

Definition at line 407 of file pns_diff_pair.h.

408 {
409 return m_hasVias;
410 }

References m_hasVias.

Referenced by PNS::DIFF_PAIR_PLACER::FixRoute(), and PNS::DIFF_PAIR_PLACER::UpdateSizes().

◆ Format()

const std::string PNS::ITEM::Format ( ) const
virtualinherited

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

Definition at line 218 of file pns_item.cpp.

219{
220 std::stringstream ss;
221 ss << KindStr() << " ";
222 ss << "net " << m_net << " ";
223 ss << "layers " << m_layers.Start() << " " << m_layers.End();
224 return ss.str();
225}
int Start() const
Definition: pns_layerset.h:82
int End() const
Definition: pns_layerset.h:87
std::string KindStr() const
Returns the kind of the item, as string.
Definition: pns_item.cpp:198

References LAYER_RANGE::End(), PNS::ITEM::KindStr(), PNS::ITEM::m_layers, PNS::ITEM::m_net, and LAYER_RANGE::Start().

Referenced by PNS::NODE::Dump(), PNS::SEGMENT::Format(), and PNS::VIA::Format().

◆ Gap()

int PNS::DIFF_PAIR::Gap ( ) const
inline

◆ GapConstraint()

const RANGED_NUM< int > PNS::DIFF_PAIR::GapConstraint ( ) const
inline

Definition at line 485 of file pns_diff_pair.h.

486 {
487 return m_gapConstraint;
488 }

References m_gapConstraint.

Referenced by PNS::findCoupledVertices().

◆ GetLink()

LINKED_ITEM * PNS::LINK_HOLDER::GetLink ( int  aIndex) const
inlineinherited

Erase the linking information. Used to detach the line from the owning node.

Definition at line 63 of file pns_link_holder.h.

References PNS::LINK_HOLDER::m_links.

Referenced by PNS::LINE_PLACER::removeLoops(), PNS::TOPOLOGY::SimplifyLine(), PNS::DP_MEANDER_PLACER::Start(), and PNS::MEANDER_SKEW_PLACER::Start().

◆ Hole()

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

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

Definition at line 207 of file pns_item.h.

208 {
209 return nullptr;
210 }

Referenced by PNS::ITEM::collideSimple(), PNS::VIA::PushoutForce(), 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::SOLID, and PNS::VIA.

Definition at line 123 of file pns_item.h.

125 {
126 return SHAPE_LINE_CHAIN();
127 }

◆ Hull()

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

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

Definition at line 117 of file pns_item.h.

119 {
120 return SHAPE_LINE_CHAIN();
121 }

◆ IsCompoundShapePrimitive()

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

Definition at line 246 of file pns_item.h.

bool m_isCompoundShapePrimitive
Definition: pns_item.h:267

References PNS::ITEM::m_isCompoundShapePrimitive.

◆ IsFreePad()

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

Definition at line 238 of file pns_item.h.

238{ return m_isFreePad; }
bool m_isFreePad
Definition: pns_item.h:266

References PNS::ITEM::m_isFreePad.

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

◆ IsLinked()

bool PNS::LINK_HOLDER::IsLinked ( ) const
inlineinherited

◆ IsLocked()

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

Definition at line 229 of file pns_item.h.

230 {
231 return Marker() & MK_LOCKED;
232 }
@ MK_LOCKED
Definition: pns_item.h:43

References PNS::ITEM::Marker(), and PNS::MK_LOCKED.

Referenced by ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::performDragging(), and PNS::SHOVE::pushOrShoveVia().

◆ IsRoutable()

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

Definition at line 235 of file pns_item.h.

235{ return m_routable; }
bool m_routable
Definition: pns_item.h:264

References PNS::ITEM::m_routable.

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

◆ 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 198 of file pns_item.cpp.

199{
200 switch( m_kind )
201 {
202 case ARC_T: return "arc";
203 case LINE_T: return "line";
204 case SEGMENT_T: return "segment";
205 case VIA_T: return "via";
206 case JOINT_T: return "joint";
207 case SOLID_T: return "solid";
208 case DIFF_PAIR_T: return "diff-pair";
209 default: return "unknown";
210 }
211}

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::ITEM::Format(), PNS::TOOL_BASE::pickSingleItem(), and PNS::TOOL_BASE::updateEndItem().

◆ Layer()

◆ Layers()

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

Definition at line 156 of file pns_item.h.

156{ return m_layers; }

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(), comparePnsItems(), PNS::DP_MEANDER_PLACER::CurrentLayer(), PNS::MEANDER_PLACER::CurrentLayer(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::NODE::FindJoint(), PNS::NODE::FindLinesBetweenJoints(), PNS::NODE::findRedundantArc(), PNS::NODE::findRedundantSegment(), PNS::NODE::FixupVirtualVias(), PNS::ROUTER::getNearestRatnestAnchor(), ROUTER_TOOL::getStartLayer(), PNS_PCBNEW_RULE_RESOLVER::HoleClearance(), PNS_PCBNEW_RULE_RESOLVER::HoleToHoleClearance(), PNS_KICAD_IFACE_BASE::IsFlashedOnLayer(), PNS::ITEM::Layer(), PNS::ITEM::LayersOverlap(), PNS::LINE::LINE(), PNS::NODE::LockJoint(), PNS::VIA::MakeHandle(), PNS::ROUTER::markViolations(), PNS::TOPOLOGY::NearestUnconnectedAnchorPoint(), 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_LOG_PLAYER::ReplayLog(), PNS::SEGMENT::SEGMENT(), PNS::LINE_PLACER::SetLayer(), PNS::COMPONENT_DRAGGER::Start(), ROUTER_PREVIEW_ITEM::Update(), PNS::TOOL_BASE::updateEndItem(), 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 165 of file pns_item.h.

166 {
167 return Layers().Overlaps( aOther->Layers() );
168 }

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

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

◆ Link()

void PNS::LINK_HOLDER::Link ( LINKED_ITEM aLink)
inlineinherited

Return the list of links from the owning node that constitute this line (or NULL if the line is not linked).

Definition at line 42 of file pns_link_holder.h.

References PNS::LINK_HOLDER::m_links.

Referenced by PNS::NODE::Add(), and PNS::NODE::AssembleLine().

◆ LinkCount()

int PNS::LINK_HOLDER::LinkCount ( ) const
inlineinherited

Definition at line 75 of file pns_link_holder.h.

76 {
77 return m_links.size();
78 }

References PNS::LINK_HOLDER::m_links.

Referenced by PNS::LINE::IsLinkedChecked(), and PNS::LINE_PLACER::removeLoops().

◆ Links() [1/2]

◆ Links() [2/2]

const LINKS & PNS::LINK_HOLDER::Links ( ) const
inlineinherited

Definition at line 50 of file pns_link_holder.h.

50{ return m_links; }

References PNS::LINK_HOLDER::m_links.

◆ Mark()

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

Reimplemented in PNS::LINE.

Definition at line 212 of file pns_item.h.

212{ m_marker = aMarker; }
int m_marker
Definition: pns_item.h:262

References PNS::ITEM::m_marker.

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

◆ Marker()

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

◆ Net()

int PNS::ITEM::Net ( ) const
inlineinherited

Definition at line 154 of file pns_item.h.

154{ return m_net; }

References PNS::ITEM::m_net.

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::AssembleCluster(), PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::LINE_PLACER::buildInitialLine(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), PNS::VIA::Clone(), comparePnsItems(), PNS::DRAGGER::CurrentNets(), PNS::MEANDER_PLACER::CurrentNets(), DIFF_PAIR(), PNS::OPTIMIZER::fanoutCleanup(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::NODE::FindJoint(), PNS::NODE::findRedundantArc(), PNS::NODE::findRedundantSegment(), PNS::LINE_PLACER::FixRoute(), ROUTER_TOOL::InlineDrag(), PNS_PCBNEW_RULE_RESOLVER::IsDiffPair(), PNS_PCBNEW_RULE_RESOLVER::IsNetTieExclusion(), PNS::ROUTER::isStartingPointRoutable(), PNS::LINE::LINE(), PNS::NODE::LockJoint(), PNS::VIA::MakeHandle(), PNS::MEANDER_SKEW_PLACER::origPathLength(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), ROUTER_TOOL::prepareInteractive(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), PNS::NODE::rebuildJoint(), PNS::INDEX::Remove(), PNS::NODE::removeArcIndex(), PNS::NODE::removeSegmentIndex(), PNS::NODE::removeSolidIndex(), PNS::NODE::removeViaIndex(), PNS::OPTIMIZER::runSmartPads(), PNS::SEGMENT::SEGMENT(), PNS::SHOVE::ShoveObstacleLine(), PNS::DIFF_PAIR_PLACER::Start(), PNS::LINE_PLACER::Start(), PNS::MEANDER_SKEW_PLACER::Start(), and PNS::VIA::VIA().

◆ NetN()

int PNS::DIFF_PAIR::NetN ( ) const
inline

Definition at line 429 of file pns_diff_pair.h.

430 {
431 return m_net_n;
432 }

References m_net_n.

Referenced by PNS::DP_MEANDER_PLACER::CurrentNets().

◆ NetP()

int PNS::DIFF_PAIR::NetP ( ) const
inline

◆ NLine()

◆ OfKind()

◆ Owner()

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

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

Definition at line 173 of file pns_item.h.

173{ return m_owner; }

References PNS::ITEM::m_owner.

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

◆ Parent()

◆ PLine()

◆ Rank()

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

Reimplemented in PNS::LINE.

Definition at line 217 of file pns_item.h.

217{ return m_rank; }
int m_rank
Definition: pns_item.h:263

References PNS::ITEM::m_rank.

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

◆ RemoveVias()

void PNS::DIFF_PAIR::RemoveVias ( )
inline

Definition at line 400 of file pns_diff_pair.h.

401 {
402 m_hasVias = false;
405 }
void RemoveVia()
Definition: pns_line.h:197

References m_hasVias, m_line_n, m_line_p, and PNS::LINE::RemoveVia().

Referenced by PNS::DIFF_PAIR_PLACER::routeHead().

◆ SetGap()

◆ SetIsCompoundShapePrimitive()

void PNS::ITEM::SetIsCompoundShapePrimitive ( )
inlineinherited

Definition at line 245 of file pns_item.h.

References PNS::ITEM::m_isCompoundShapePrimitive.

◆ SetIsFreePad()

void PNS::ITEM::SetIsFreePad ( bool  aIsFreePad = true)
inlineinherited

Definition at line 237 of file pns_item.h.

237{ m_isFreePad = aIsFreePad; }

References PNS::ITEM::m_isFreePad.

◆ SetLayer()

◆ SetLayers()

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

◆ SetNet()

◆ SetNets()

void PNS::DIFF_PAIR::SetNets ( int  aP,
int  aN 
)
inline

Definition at line 367 of file pns_diff_pair.h.

368 {
369 m_net_p = aP;
370 m_net_n = aN;
371 }

References m_net_n, and m_net_p.

Referenced by PNS::DIFF_PAIR_PLACER::routeHead(), and PNS::DIFF_PAIR_PLACER::Start().

◆ 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 178 of file pns_item.h.

178{ m_owner = aOwner; }

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 150 of file pns_item.h.

150{ m_parent = aParent; }

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 216 of file pns_item.h.

216{ m_rank = aRank; }

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 234 of file pns_item.h.

234{ m_routable = aRoutable; }

References PNS::ITEM::m_routable.

◆ SetShape() [1/2]

void PNS::DIFF_PAIR::SetShape ( const DIFF_PAIR aPair)
inline

Definition at line 361 of file pns_diff_pair.h.

362 {
363 m_p = aPair.m_p;
364 m_n = aPair.m_n;
365 }

References m_n, and m_p.

◆ SetShape() [2/2]

void PNS::DIFF_PAIR::SetShape ( const SHAPE_LINE_CHAIN aP,
const SHAPE_LINE_CHAIN aN,
bool  aSwapLanes = false 
)
inline

Definition at line 347 of file pns_diff_pair.h.

348 {
349 if( aSwapLanes )
350 {
351 m_p = aN;
352 m_n = aP;
353 }
354 else
355 {
356 m_p = aP;
357 m_n = aN;
358 }
359 }

References m_n, and m_p.

Referenced by PNS::DIFF_PAIR_PLACER::attemptWalk(), PNS::DP_GATEWAYS::FitGateways(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::OPTIMIZER::mergeDpStep(), PNS::DP_MEANDER_PLACER::Move(), and PNS::DIFF_PAIR_PLACER::tryWalkDp().

◆ SetViaDiameter()

void PNS::DIFF_PAIR::SetViaDiameter ( int  aDiameter)
inline

Definition at line 412 of file pns_diff_pair.h.

413 {
414 m_via_p.SetDiameter( aDiameter );
415 m_via_n.SetDiameter( aDiameter );
416 }
void SetDiameter(int aDiameter)
Definition: pns_via.h:114

References m_via_n, m_via_p, and PNS::VIA::SetDiameter().

Referenced by PNS::DIFF_PAIR_PLACER::UpdateSizes().

◆ SetViaDrill()

void PNS::DIFF_PAIR::SetViaDrill ( int  aDrill)
inline

Definition at line 418 of file pns_diff_pair.h.

419 {
420 m_via_p.SetDrill( aDrill );
421 m_via_n.SetDrill( aDrill );
422 }
void SetDrill(int aDrill)
Definition: pns_via.h:122

References m_via_n, m_via_p, and PNS::VIA::SetDrill().

Referenced by PNS::DIFF_PAIR_PLACER::UpdateSizes().

◆ SetWidth()

void PNS::DIFF_PAIR::SetWidth ( int  aWidth)
inline

Definition at line 373 of file pns_diff_pair.h.

374 {
375 m_width = aWidth;
376 m_n.SetWidth( aWidth );
377 m_p.SetWidth( aWidth );
378 }
void SetWidth(int aWidth)
Set the width of all segments in the chain.

References m_n, m_p, m_width, and SHAPE_LINE_CHAIN::SetWidth().

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::DIFF_PAIR_PLACER::routeHead(), and PNS::DIFF_PAIR_PLACER::UpdateSizes().

◆ Shape()

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

◆ ShowLinks()

void PNS::LINK_HOLDER::ShowLinks ( ) const
inlineinherited
Todo:
move outside header.

Definition at line 80 of file pns_link_holder.h.

81 {
82#if 0
83 if( !IsLinked() )
84 {
85 wxLogTrace( wxT( "PNS" ), wxT( "item %p: no links" ), this );
86 return;
87 }
88
89 wxLogTrace( wxT( "PNS" ), wxT( "item %p: %d links" ), this, (int) m_links.size() );
90
91 for( int i = 0; i < (int) m_links.size(); i++ )
92 wxLogTrace( wxT( "PNS" ), wxT( "item %d: %p\n" ), i, m_links[i] );
93#endif
94 }

References PNS::LINK_HOLDER::IsLinked(), and PNS::LINK_HOLDER::m_links.

◆ Skew()

double PNS::DIFF_PAIR::Skew ( ) const

Definition at line 815 of file pns_diff_pair.cpp.

816{
817 return m_p.Length() - m_n.Length();
818}
long long int Length() const
Return length of the line chain in Euclidean metric.

References SHAPE_LINE_CHAIN::Length(), m_n, and m_p.

Referenced by PNS::DIFF_PAIR_PLACER::tryWalkDp().

◆ TotalLength()

double PNS::DIFF_PAIR::TotalLength ( ) const

Definition at line 902 of file pns_diff_pair.cpp.

903{
904 double lenP = m_p.Length();
905 double lenN = m_n.Length();
906
907 return (lenN + lenP ) / 2.0;
908}

References SHAPE_LINE_CHAIN::Length(), m_n, and m_p.

Referenced by CoupledLengthFactor().

◆ Unmark()

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

Reimplemented in PNS::LINE.

Definition at line 213 of file pns_item.h.

213{ m_marker &= ~aMarker; }

References PNS::ITEM::m_marker.

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

◆ updateLine()

void PNS::DIFF_PAIR::updateLine ( LINE aLine,
const SHAPE_LINE_CHAIN aShape,
int  aNet,
const VIA aVia 
)
inlineprivate

Definition at line 491 of file pns_diff_pair.h.

492 {
493 aLine.SetShape( aShape );
494 aLine.SetWidth( m_width );
495 aLine.SetNet( aNet );
496 aLine.SetLayer( Layers().Start() );
497
498 if( m_hasVias )
499 aLine.AppendVia( aVia );
500 }

References PNS::LINE::AppendVia(), PNS::ITEM::Layers(), m_hasVias, m_width, PNS::ITEM::SetLayer(), PNS::ITEM::SetNet(), PNS::LINE::SetShape(), and PNS::LINE::SetWidth().

Referenced by NLine(), and PLine().

◆ Width()

int PNS::DIFF_PAIR::Width ( ) const
inline

Definition at line 380 of file pns_diff_pair.h.

380{ return m_width; }

References m_width.

Referenced by PNS::findCoupledVertices(), PNS::DP_MEANDER_PLACER::Move(), and PNS::DP_MEANDER_PLACER::Start().

Member Data Documentation

◆ m_chamferLimit

int PNS::DIFF_PAIR::m_chamferLimit
private

Definition at line 512 of file pns_diff_pair.h.

Referenced by DIFF_PAIR().

◆ m_gap

int PNS::DIFF_PAIR::m_gap
private

Definition at line 509 of file pns_diff_pair.h.

Referenced by DIFF_PAIR(), Gap(), and SetGap().

◆ m_gapConstraint

RANGED_NUM<int> PNS::DIFF_PAIR::m_gapConstraint
private

◆ m_hasVias

bool PNS::DIFF_PAIR::m_hasVias
private

Definition at line 506 of file pns_diff_pair.h.

Referenced by AppendVias(), EndingPrimitives(), EndsWithVias(), RemoveVias(), and updateLine().

◆ m_isCompoundShapePrimitive

bool PNS::ITEM::m_isCompoundShapePrimitive
protectedinherited

◆ m_isFreePad

bool PNS::ITEM::m_isFreePad
protectedinherited

Definition at line 266 of file pns_item.h.

Referenced by PNS::ITEM::IsFreePad(), PNS::ITEM::ITEM(), and PNS::ITEM::SetIsFreePad().

◆ m_isVirtual

bool PNS::ITEM::m_isVirtual
protectedinherited

◆ m_kind

PnsKind PNS::ITEM::m_kind
protectedinherited

◆ m_layers

◆ m_line_n

LINE PNS::DIFF_PAIR::m_line_n
private

Definition at line 503 of file pns_diff_pair.h.

Referenced by ClearLinks(), NLine(), and RemoveVias().

◆ m_line_p

LINE PNS::DIFF_PAIR::m_line_p
private

Definition at line 503 of file pns_diff_pair.h.

Referenced by ClearLinks(), PLine(), and RemoveVias().

◆ m_links

◆ m_marker

◆ m_maxUncoupledLength

int PNS::DIFF_PAIR::m_maxUncoupledLength
private

Definition at line 511 of file pns_diff_pair.h.

Referenced by DIFF_PAIR().

◆ m_movable

bool PNS::ITEM::m_movable
protectedinherited

◆ m_n

◆ m_net

◆ m_net_n

int PNS::DIFF_PAIR::m_net_n
private

Definition at line 507 of file pns_diff_pair.h.

Referenced by DIFF_PAIR(), NetN(), NLine(), and SetNets().

◆ m_net_p

int PNS::DIFF_PAIR::m_net_p
private

Definition at line 507 of file pns_diff_pair.h.

Referenced by DIFF_PAIR(), NetP(), PLine(), and SetNets().

◆ m_owner

NODE* PNS::ITEM::m_owner
protectedinherited

◆ m_p

◆ m_parent

BOARD_ITEM* PNS::ITEM::m_parent
protectedinherited

◆ m_rank

◆ m_routable

bool PNS::ITEM::m_routable
protectedinherited

Definition at line 264 of file pns_item.h.

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

◆ m_via_n

VIA PNS::DIFF_PAIR::m_via_n
private

Definition at line 504 of file pns_diff_pair.h.

Referenced by AppendVias(), EndingPrimitives(), NLine(), SetViaDiameter(), and SetViaDrill().

◆ m_via_p

VIA PNS::DIFF_PAIR::m_via_p
private

Definition at line 504 of file pns_diff_pair.h.

Referenced by AppendVias(), EndingPrimitives(), PLine(), SetViaDiameter(), and SetViaDrill().

◆ m_viaGap

int PNS::DIFF_PAIR::m_viaGap
private

Definition at line 510 of file pns_diff_pair.h.

Referenced by DIFF_PAIR().

◆ m_width

int PNS::DIFF_PAIR::m_width
private

◆ 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: