KiCad PCB EDA Suite
PNS::LINKED_ITEM Class Referenceabstract

#include <pns_linked_item.h>

Inheritance diagram for PNS::LINKED_ITEM:
PNS::ITEM PNS::ARC PNS::SEGMENT

Public Types

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
}
 

Supported item types

More...
 

Public Member Functions

 LINKED_ITEM (PnsKind aKind)
 
virtual void SetWidth (int aWidth)
 
virtual int Width () const
 
virtual ITEMClone () const =0
 Function Clone() More...
 
virtual const SHAPE_LINE_CHAIN Hull (int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const
 
PnsKind Kind () const
 Function Kind() More...
 
bool OfKind (int aKindMask) const
 Function OfKind() More...
 
std::string KindStr () const
 Function KindStr() More...
 
void SetParent (BOARD_CONNECTED_ITEM *aParent)
 
BOARD_CONNECTED_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
 Function LayersOverlap() More...
 
NODEOwner () const
 Function Owner() More...
 
void SetOwner (NODE *aOwner)
 Functon SetOwner() More...
 
bool BelongsTo (NODE *aNode) const
 Function BelongsTo() More...
 
virtual bool Collide (const ITEM *aOther, int aClearance, bool aNeedMTV, VECTOR2I *aMTV, const NODE *aParentNode, bool aDifferentNetsOnly=true) const
 Function Collide() More...
 
virtual const SHAPEShape () const
 Function Shape() More...
 
virtual const SHAPEAlternateShape () const
 
virtual void Mark (int aMarker)
 
virtual void Unmark (int aMarker=-1)
 
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
 

Static Public Attributes

static const int UnusedNet = INT_MAX
 

Protected Attributes

PnsKind m_kind
 
BOARD_CONNECTED_ITEMm_parent
 
NODEm_owner
 
LAYER_RANGE m_layers
 
bool m_movable
 
int m_net
 
int m_marker
 
int m_rank
 
bool m_routable
 

Detailed Description

Definition at line 29 of file pns_linked_item.h.

Member Enumeration Documentation

◆ PnsKind

enum PNS::ITEM::PnsKind
inherited

Supported item types

Enumerator
SOLID_T 
LINE_T 
JOINT_T 
SEGMENT_T 
ARC_T 
VIA_T 
DIFF_PAIR_T 
ANY_T 

Definition at line 59 of file pns_item.h.

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

Constructor & Destructor Documentation

◆ LINKED_ITEM()

PNS::LINKED_ITEM::LINKED_ITEM ( PnsKind  aKind)
inline

Definition at line 33 of file pns_linked_item.h.

33  : ITEM( aKind )
34  {}
ITEM(PnsKind aKind)
Definition: pns_item.h:71

Member Function Documentation

◆ AlternateShape()

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

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

Definition at line 219 of file pns_item.h.

220  {
221  return Shape();
222  }
virtual const SHAPE * Shape() const
Function Shape()
Definition: pns_item.h:214

References PNS::ITEM::Shape().

Referenced by PNS::INDEX::Add(), and PNS::ITEM::collideSimple().

◆ Anchor()

◆ AnchorCount()

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

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

Definition at line 236 of file pns_item.h.

237  {
238  return 0;
239  }

◆ BelongsTo()

bool PNS::ITEM::BelongsTo ( NODE aNode) const
inlineinherited

Function BelongsTo()

Returns
true if the item is owned by the node aNode.

Definition at line 187 of file pns_item.h.

188  {
189  return m_owner == aNode;
190  }
NODE * m_owner
Definition: pns_item.h:257

References PNS::ITEM::m_owner.

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

◆ Clone()

virtual ITEM* PNS::ITEM::Clone ( ) const
pure virtualinherited

◆ Collide()

bool PNS::ITEM::Collide ( const ITEM aOther,
int  aClearance,
bool  aNeedMTV,
VECTOR2I aMTV,
const NODE aParentNode,
bool  aDifferentNetsOnly = true 
) const
virtualinherited

Function Collide()

Checks for a collision (clearance violation) with between us and item aOther. Collision checking takes all PCB stuff into accound (layers, nets, DRC rules). Optionally returns a minimum translation vector for force propagation algorithm.

Parameters
aOtheritem to check collision against
aClearancedesired clearance
aNeedMTVwhen true, the minimum translation vector is calculated
aMTVthe minimum translation vector
Returns
true, if a collision was found.

Definition at line 74 of file pns_item.cpp.

76 {
77  if( collideSimple( aOther, aClearance, aNeedMTV, aMTV, aParentNode, aDifferentNetsOnly ) )
78  return true;
79 
80  // special case for "head" line with a via attached at the end.
81  if( aOther->m_kind == LINE_T )
82  {
83  const LINE* line = static_cast<const LINE*>( aOther );
84  int clearance = aClearance - line->Width() / 2;
85 
86  if( line->EndsWithVia() )
87  {
88  return collideSimple( &line->Via(), clearance, aNeedMTV, aMTV, aParentNode,
89  aDifferentNetsOnly );
90  }
91  }
92 
93  return false;
94 }
bool collideSimple(const ITEM *aOther, int aClearance, bool aNeedMTV, VECTOR2I *aMTV, const NODE *aParentNode, bool aDifferentNetsOnly) const
Definition: pns_item.cpp:31

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

Referenced by PNS::NODE::CheckColliding(), PNS::OPTIMIZER::CACHE_VISITOR::operator()(), and PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()().

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

114  {
115  return SHAPE_LINE_CHAIN();
116  }
SHAPE_LINE_CHAIN.

◆ IsLocked()

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

Definition at line 241 of file pns_item.h.

242  {
243  return Marker() & MK_LOCKED;
244  }
virtual int Marker() const
Definition: pns_item.h:226

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

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

◆ IsRoutable()

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

Definition at line 247 of file pns_item.h.

247 { 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().

◆ Kind()

◆ KindStr()

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

Function KindStr()

Returns the kind of the item, as string

Definition at line 97 of file pns_item.cpp.

98 {
99  switch( m_kind )
100  {
101  case ARC_T: return "arc";
102  case LINE_T: return "line";
103  case SEGMENT_T: return "segment";
104  case VIA_T: return "via";
105  case JOINT_T: return "joint";
106  case SOLID_T: return "solid";
107  case DIFF_PAIR_T: return "diff-pair";
108  default: return "unknown";
109  }
110 }
PnsKind m_kind
Definition: pns_item.h:254

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()

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

◆ Layers()

◆ LayersOverlap()

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

Function LayersOverlap()

Returns 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:68
const LAYER_RANGE & Layers() const
Definition: pns_item.h:151

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

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

◆ Mark()

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

Reimplemented in PNS::LINE.

Definition at line 224 of file pns_item.h.

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

References PNS::ITEM::m_marker.

◆ Marker()

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

Reimplemented in PNS::LINE.

Definition at line 226 of file pns_item.h.

226 { return m_marker; }
int m_marker
Definition: pns_item.h:262

References PNS::ITEM::m_marker.

Referenced by PNS::ARC::ARC(), PNS::ITEM::IsLocked(), PNS::SHOVE::pushOrShoveVia(), and ROUTER_PREVIEW_ITEM::Update().

◆ Net()

◆ OfKind()

◆ Owner()

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

Function Owner()

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

Definition at line 173 of file pns_item.h.

173 { return m_owner; }
NODE * m_owner
Definition: pns_item.h:257

References PNS::ITEM::m_owner.

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

◆ Parent()

◆ Rank()

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

Reimplemented in PNS::LINE.

Definition at line 229 of file pns_item.h.

229 { 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().

◆ SetLayer()

◆ SetLayers()

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

Definition at line 152 of file pns_item.h.

152 { m_layers = aLayers; }
LAYER_RANGE m_layers
Definition: pns_item.h:258

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

Functon SetOwner()

Sets the node that owns this item. An item can belong to a single NODE or be unowned.

Definition at line 180 of file pns_item.h.

180 { m_owner = aOwner; }
NODE * m_owner
Definition: pns_item.h:257

References PNS::ITEM::m_owner.

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

◆ SetParent()

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

Definition at line 145 of file pns_item.h.

145 { m_parent = aParent; }
BOARD_CONNECTED_ITEM * m_parent
Definition: pns_item.h:256

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

228 { m_rank = aRank; }
int m_rank
Definition: pns_item.h:263

References PNS::ITEM::m_rank.

◆ SetRoutable()

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

Definition at line 246 of file pns_item.h.

246 { m_routable = aRoutable; }
bool m_routable
Definition: pns_item.h:264

References PNS::ITEM::m_routable.

◆ SetWidth()

virtual void PNS::LINKED_ITEM::SetWidth ( int  aWidth)
inlinevirtual

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

Definition at line 36 of file pns_linked_item.h.

37  {};

◆ Shape()

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

Function Shape()

Returns the geometrical shape of the item. Used for collision detection & spatial indexing.

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

Definition at line 214 of file pns_item.h.

215  {
216  return NULL;
217  }
#define NULL

References NULL.

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

◆ Unmark()

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

Reimplemented in PNS::LINE.

Definition at line 225 of file pns_item.h.

225 { m_marker &= ~aMarker; }
int m_marker
Definition: pns_item.h:262

References PNS::ITEM::m_marker.

Referenced by PNS::DRAGGER::Start().

◆ Width()

virtual int PNS::LINKED_ITEM::Width ( ) const
inlinevirtual

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

Definition at line 39 of file pns_linked_item.h.

40  {
41  return 0;
42  }

Referenced by PNS::NODE::AssembleLine(), and PNS::TOOL_BASE::snapToItem().

Member Data Documentation

◆ m_kind

PnsKind PNS::ITEM::m_kind
protectedinherited

◆ m_layers

◆ m_marker

◆ m_movable

bool PNS::ITEM::m_movable
protectedinherited

◆ m_net

◆ m_owner

NODE* PNS::ITEM::m_owner
protectedinherited

◆ m_parent

BOARD_CONNECTED_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().

◆ UnusedNet

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

Definition at line 56 of file pns_item.h.

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


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