KiCad PCB EDA Suite
PNS::VIA Class Reference

#include <pns_via.h>

Inheritance diagram for PNS::VIA:
PNS::ITEM PNS::VVIA

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
}
 

Public Member Functions

 VIA ()
 
 VIA (const VECTOR2I &aPos, const LAYER_RANGE &aLayers, int aDiameter, int aDrill, int aNet=-1, VIATYPE aViaType=VIATYPE::THROUGH)
 
 VIA (const VIA &aB)
 
const VECTOR2IPos () const
 
void SetPos (const VECTOR2I &aPos)
 
VIATYPE ViaType () const
 
void SetViaType (VIATYPE aViaType)
 
int Diameter () const
 
void SetDiameter (int aDiameter)
 
int Drill () const
 
void SetDrill (int aDrill)
 
bool IsFree () const
 
void SetIsFree (bool aIsFree)
 
bool PushoutForce (NODE *aNode, const VECTOR2I &aDirection, VECTOR2I &aForce, bool aSolidsOnly=true, int aMaxIterations=10)
 
const SHAPEShape () const override
 Return the geometrical shape of the item. More...
 
const SHAPE_CIRCLEHole () const override
 
void SetHole (const SHAPE_CIRCLE &aHole)
 
VIAClone () const override
 Return a deep copy of the item. More...
 
const SHAPE_LINE_CHAIN Hull (int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const override
 
virtual VECTOR2I Anchor (int n) const override
 
virtual int AnchorCount () const override
 
OPT_BOX2I ChangedArea (const VIA *aOther) const
 
const VIA_HANDLE MakeHandle () const
 
virtual const SHAPE_LINE_CHAIN HoleHull (int aClearance, int aWalkaroundThickness, int aLayer) 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) const
 Check for a collision (clearance violation) with between us and item aOther. More...
 
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
 
bool IsLocked () const
 
void SetRoutable (bool aRoutable)
 
bool IsRoutable () const
 
bool IsVirtual () const
 

Static Public Member Functions

static bool ClassOf (const ITEM *aItem)
 

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
 

Private Attributes

int m_diameter
 
int m_drill
 
VECTOR2I m_pos
 
SHAPE_CIRCLE m_shape
 
SHAPE_CIRCLE m_hole
 
VIATYPE m_viaType
 
bool m_isFree
 

Detailed Description

Definition at line 48 of file pns_via.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

◆ VIA() [1/3]

PNS::VIA::VIA ( )
inline

Definition at line 51 of file pns_via.h.

51  :
52  ITEM( VIA_T )
53  {
54  m_diameter = 2; // Dummy value
55  m_drill = 0;
57  m_isFree = false;
58  m_isVirtual = false;
59  }
ITEM(PnsKind aKind)
Definition: pns_item.h:73
int m_drill
Definition: pns_via.h:154
bool m_isFree
Definition: pns_via.h:159
int m_diameter
Definition: pns_via.h:153
bool m_isVirtual
Definition: pns_item.h:253
VIATYPE m_viaType
Definition: pns_via.h:158

References m_diameter, m_drill, m_isFree, PNS::ITEM::m_isVirtual, m_viaType, and THROUGH.

Referenced by Clone().

◆ VIA() [2/3]

PNS::VIA::VIA ( const VECTOR2I aPos,
const LAYER_RANGE aLayers,
int  aDiameter,
int  aDrill,
int  aNet = -1,
VIATYPE  aViaType = VIATYPE::THROUGH 
)
inline

Definition at line 61 of file pns_via.h.

62  :
63  ITEM( VIA_T )
64  {
65  SetNet( aNet );
66  SetLayers( aLayers );
67  m_pos = aPos;
68  m_diameter = aDiameter;
69  m_drill = aDrill;
70  m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 );
71  m_hole = SHAPE_CIRCLE( m_pos, aDrill / 2 );
72  m_viaType = aViaType;
73  m_isFree = false;
74  m_isVirtual = false;
75  }
ITEM(PnsKind aKind)
Definition: pns_item.h:73
int m_drill
Definition: pns_via.h:154
SHAPE_CIRCLE m_hole
Definition: pns_via.h:157
void SetNet(int aNet)
Definition: pns_item.h:149
VECTOR2I m_pos
Definition: pns_via.h:155
bool m_isFree
Definition: pns_via.h:159
int m_diameter
Definition: pns_via.h:153
SHAPE_CIRCLE m_shape
Definition: pns_via.h:156
void SetLayers(const LAYER_RANGE &aLayers)
Definition: pns_item.h:153
bool m_isVirtual
Definition: pns_item.h:253
VIATYPE m_viaType
Definition: pns_via.h:158

References m_diameter, m_drill, m_hole, m_isFree, PNS::ITEM::m_isVirtual, m_pos, m_shape, m_viaType, PNS::ITEM::SetLayers(), and PNS::ITEM::SetNet().

◆ VIA() [3/3]

PNS::VIA::VIA ( const VIA aB)
inline

Definition at line 77 of file pns_via.h.

77  :
78  ITEM( aB )
79  {
80  SetNet( aB.Net() );
81  SetLayers( aB.Layers() );
82  m_pos = aB.m_pos;
83  m_diameter = aB.m_diameter;
85  m_hole = SHAPE_CIRCLE( m_pos, aB.m_drill / 2 );
86  m_marker = aB.m_marker;
87  m_rank = aB.m_rank;
88  m_drill = aB.m_drill;
89  m_viaType = aB.m_viaType;
90  m_isFree = aB.m_isFree;
91  m_isVirtual = aB.m_isVirtual;
92  }
int m_rank
Definition: pns_item.h:251
ITEM(PnsKind aKind)
Definition: pns_item.h:73
int m_drill
Definition: pns_via.h:154
SHAPE_CIRCLE m_hole
Definition: pns_via.h:157
int m_marker
Definition: pns_item.h:250
void SetNet(int aNet)
Definition: pns_item.h:149
VECTOR2I m_pos
Definition: pns_via.h:155
bool m_isFree
Definition: pns_via.h:159
int m_diameter
Definition: pns_via.h:153
SHAPE_CIRCLE m_shape
Definition: pns_via.h:156
void SetLayers(const LAYER_RANGE &aLayers)
Definition: pns_item.h:153
bool m_isVirtual
Definition: pns_item.h:253
VIATYPE m_viaType
Definition: pns_via.h:158

References PNS::ITEM::Layers(), m_diameter, m_drill, m_hole, m_isFree, PNS::ITEM::m_isVirtual, PNS::ITEM::m_marker, m_pos, PNS::ITEM::m_rank, m_shape, m_viaType, PNS::ITEM::Net(), PNS::ITEM::SetLayers(), and PNS::ITEM::SetNet().

Member Function Documentation

◆ Anchor()

virtual VECTOR2I PNS::VIA::Anchor ( int  n) const
inlineoverridevirtual

Reimplemented from PNS::ITEM.

Definition at line 138 of file pns_via.h.

139  {
140  return m_pos;
141  }
VECTOR2I m_pos
Definition: pns_via.h:155

References m_pos.

◆ AnchorCount()

virtual int PNS::VIA::AnchorCount ( ) const
inlineoverridevirtual

Reimplemented from PNS::ITEM.

Definition at line 143 of file pns_via.h.

144  {
145  return 1;
146  }

◆ BelongsTo()

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

Definition at line 179 of file pns_item.h.

180  {
181  return m_owner == aNode;
182  }
NODE * m_owner
Definition: pns_item.h:245

References PNS::ITEM::m_owner.

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

◆ ChangedArea()

OPT_BOX2I PNS::VIA::ChangedArea ( const VIA aOther) const

Definition at line 110 of file pns_via.cpp.

111 {
112  if ( aOther->Pos() != Pos() )
113  {
114  BOX2I tmp = Shape()->BBox();
115  tmp.Merge( aOther->Shape()->BBox() );
116  return tmp;
117  }
118 
119  return OPT_BOX2I();
120 }
const SHAPE * Shape() const override
Return the geometrical shape of the item.
Definition: pns_via.h:128
const VECTOR2I & Pos() const
Definition: pns_via.h:99
virtual const BOX2I BBox(int aClearance=0) const =0
Compute a bounding box of the shape, with a margin of aClearance a collision.
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:363
OPT< BOX2I > OPT_BOX2I
Definition: box2.h:509

References SHAPE::BBox(), BOX2< Vec >::Merge(), Pos(), and Shape().

Referenced by PNS::ChangedArea().

◆ ClassOf()

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

Definition at line 94 of file pns_via.h.

95  {
96  return aItem && VIA_T == aItem->Kind();
97  }

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

◆ Clone()

VIA * PNS::VIA::Clone ( ) const
overridevirtual

Return a deep copy of the item.

Implements PNS::ITEM.

Definition at line 89 of file pns_via.cpp.

90 {
91  VIA* v = new VIA();
92 
93  v->SetNet( Net() );
94  v->SetLayers( Layers() );
95  v->m_pos = m_pos;
96  v->m_diameter = m_diameter;
97  v->m_drill = m_drill;
98  v->m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 );
99  v->m_rank = m_rank;
100  v->m_marker = m_marker;
101  v->m_viaType = m_viaType;
102  v->m_parent = m_parent;
103  v->m_isFree = m_isFree;
104  v->m_isVirtual = m_isVirtual;
105 
106  return v;
107 }
VIA()
Definition: pns_via.h:51
int m_rank
Definition: pns_item.h:251
int m_drill
Definition: pns_via.h:154
int m_marker
Definition: pns_item.h:250
VECTOR2I m_pos
Definition: pns_via.h:155
bool m_isFree
Definition: pns_via.h:159
BOARD_ITEM * m_parent
Definition: pns_item.h:244
int m_diameter
Definition: pns_via.h:153
int Net() const
Definition: pns_item.h:150
bool m_isVirtual
Definition: pns_item.h:253
VIATYPE m_viaType
Definition: pns_via.h:158
const LAYER_RANGE & Layers() const
Definition: pns_item.h:152

References PNS::ITEM::Layers(), m_diameter, m_drill, m_isFree, PNS::ITEM::m_isVirtual, PNS::ITEM::m_marker, PNS::ITEM::m_parent, m_pos, PNS::ITEM::m_rank, m_shape, m_viaType, PNS::ITEM::Net(), PNS::ITEM::SetLayers(), PNS::ITEM::SetNet(), and VIA().

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

98 {
99  if( collideSimple( aOther, aNode, aDifferentNetsOnly ) )
100  return true;
101 
102  // Special cases for "head" lines with vias attached at the end. Note that this does not
103  // support head-line-via to head-line-via collisions, but you can't route two independent
104  // tracks at once so it shouldn't come up.
105 
106  if( m_kind == LINE_T )
107  {
108  const LINE* line = static_cast<const LINE*>( this );
109 
110  if( line->EndsWithVia() && line->Via().collideSimple( aOther, aNode, aDifferentNetsOnly ) )
111  return true;
112  }
113 
114  if( aOther->m_kind == LINE_T )
115  {
116  const LINE* line = static_cast<const LINE*>( aOther );
117 
118  if( line->EndsWithVia() && line->Via().collideSimple( this, aNode, aDifferentNetsOnly ) )
119  return true;
120  }
121 
122  return false;
123 }
PnsKind m_kind
Definition: pns_item.h:242
bool collideSimple(const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly) const
Definition: pns_item.cpp:31

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

◆ Diameter()

int PNS::VIA::Diameter ( ) const
inline

Definition at line 111 of file pns_via.h.

111 { return m_diameter; }
int m_diameter
Definition: pns_via.h:153

References m_diameter.

Referenced by PNS::LINE::LINE(), PNS::DIFF_PAIR_PLACER::propagateDpHeadForces(), and PNS::SHOVE::shoveLineFromLoneVia().

◆ Drill()

int PNS::VIA::Drill ( ) const
inline

Definition at line 119 of file pns_via.h.

119 { return m_drill; }
int m_drill
Definition: pns_via.h:154

References m_drill.

Referenced by PNS::SHOVE::shoveLineFromLoneVia().

◆ Hole()

const SHAPE_CIRCLE* PNS::VIA::Hole ( ) const
inlineoverridevirtual

Reimplemented from PNS::ITEM.

Definition at line 130 of file pns_via.h.

130 { return &m_hole; }
SHAPE_CIRCLE m_hole
Definition: pns_via.h:157

References m_hole.

◆ HoleHull()

virtual const SHAPE_LINE_CHAIN PNS::ITEM::HoleHull ( int  aClearance,
int  aWalkaroundThickness,
int  aLayer 
) const
inlinevirtualinherited

Reimplemented in PNS::SOLID.

Definition at line 119 of file pns_item.h.

121  {
122  return SHAPE_LINE_CHAIN();
123  }
Represent a polyline (an zero-thickness chain of connected line segments).

◆ Hull()

const SHAPE_LINE_CHAIN PNS::VIA::Hull ( int  aClearance = 0,
int  aWalkaroundThickness = 0,
int  aLayer = -1 
) const
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 74 of file pns_via.cpp.

75 {
76  int cl = ( aClearance + aWalkaroundThickness / 2 );
77  int width = m_diameter;
78 
79  if( !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) )
80  width = m_drill;
81 
82  // Chamfer = width * ( 1 - sqrt(2)/2 ) for equilateral octagon
83  return OctagonalHull( m_pos - VECTOR2I( width / 2, width / 2 ),
84  VECTOR2I( width, width ),
85  cl + 1, ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) );
86 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
int m_drill
Definition: pns_via.h:154
VECTOR2I m_pos
Definition: pns_via.h:155
int m_diameter
Definition: pns_via.h:153
const SHAPE_LINE_CHAIN OctagonalHull(const VECTOR2I &aP0, const VECTOR2I &aSize, int aClearance, int aChamfer)
Definition: pns_utils.cpp:35
virtual bool IsFlashedOnLayer(const PNS::ITEM *aItem, int aLayer) const =0
ROUTER_IFACE * GetInterface() const
Definition: pns_router.h:207
static ROUTER * GetInstance()
Definition: pns_router.cpp:78

References PNS::ROUTER::GetInstance(), PNS::ROUTER::GetInterface(), PNS::ROUTER_IFACE::IsFlashedOnLayer(), m_diameter, m_drill, m_pos, and PNS::OctagonalHull().

Referenced by PNS::SHOVE::shoveLineFromLoneVia(), and PNS::SHOVE::ShoveObstacleLine().

◆ IsFree()

bool PNS::VIA::IsFree ( ) const
inline

Definition at line 122 of file pns_via.h.

122 { return m_isFree; }
bool m_isFree
Definition: pns_via.h:159

References m_isFree.

◆ IsLocked()

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

Definition at line 225 of file pns_item.h.

226  {
227  return Marker() & MK_LOCKED;
228  }
virtual int Marker() const
Definition: pns_item.h:210

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

231 { return m_routable; }
bool m_routable
Definition: pns_item.h:252

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

127 {
128  switch( m_kind )
129  {
130  case ARC_T: return "arc";
131  case LINE_T: return "line";
132  case SEGMENT_T: return "segment";
133  case VIA_T: return "via";
134  case JOINT_T: return "joint";
135  case SOLID_T: return "solid";
136  case DIFF_PAIR_T: return "diff-pair";
137  default: return "unknown";
138  }
139 }
PnsKind m_kind
Definition: pns_item.h:242

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

152 { return m_layers; }
LAYER_RANGE m_layers
Definition: pns_item.h:246

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(), 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(), 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(), ROUTER_PREVIEW_ITEM::Update(), PNS::TOOL_BASE::updateEndItem(), PNS::DIFF_PAIR::updateLine(), PNS::TOOL_BASE::updateStartItem(), and 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 161 of file pns_item.h.

162  {
163  return Layers().Overlaps( aOther->Layers() );
164  }
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:67
const LAYER_RANGE & Layers() const
Definition: pns_item.h:152

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

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

◆ MakeHandle()

const VIA_HANDLE PNS::VIA::MakeHandle ( ) const

Definition at line 122 of file pns_via.cpp.

123 {
124  VIA_HANDLE h;
125  h.pos = Pos();
126  h.layers = Layers();
127  h.net = Net();
128  h.valid = true;
129  return h;
130 }
const VECTOR2I & Pos() const
Definition: pns_via.h:99
int Net() const
Definition: pns_item.h:150
const LAYER_RANGE & Layers() const
Definition: pns_item.h:152

References PNS::VIA_HANDLE::layers, PNS::ITEM::Layers(), PNS::VIA_HANDLE::net, PNS::ITEM::Net(), PNS::VIA_HANDLE::pos, Pos(), and PNS::VIA_HANDLE::valid.

Referenced by PNS::SHOVE::pushSpringback(), PNS::SHOVE::ShoveDraggingVia(), and PNS::DRAGGER::startDragVia().

◆ Mark()

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

Reimplemented in PNS::LINE.

Definition at line 208 of file pns_item.h.

208 { m_marker = aMarker; }
int m_marker
Definition: pns_item.h:250

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

◆ OfKind()

◆ Owner()

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

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

Definition at line 169 of file pns_item.h.

169 { return m_owner; }
NODE * m_owner
Definition: pns_item.h:245

References PNS::ITEM::m_owner.

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

◆ Parent()

◆ Pos()

◆ PushoutForce()

bool PNS::VIA::PushoutForce ( NODE aNode,
const VECTOR2I aDirection,
VECTOR2I aForce,
bool  aSolidsOnly = true,
int  aMaxIterations = 10 
)

Definition at line 32 of file pns_via.cpp.

34 {
35  int iter = 0;
36  VIA mv( *this );
37  VECTOR2I force, totalForce;
38 
39  while( iter < aMaxIterations )
40  {
41  NODE::OPT_OBSTACLE obs = aNode->CheckColliding( &mv, aSolidsOnly ? ITEM::SOLID_T
42  : ITEM::ANY_T );
43 
44  if( !obs )
45  break;
46 
47  int clearance = aNode->GetClearance( obs->m_item, &mv );
48 
49  if( iter > aMaxIterations / 2 )
50  {
51  VECTOR2I l = aDirection.Resize( m_diameter / 2 );
52  totalForce += l;
53  mv.SetPos( mv.Pos() + l );
54  }
55 
56  if( obs->m_item->Shape()->Collide( mv.Shape(), clearance, &force ) )
57  {
58  totalForce += force;
59  mv.SetPos( mv.Pos() + force );
60  }
61 
62  iter++;
63  }
64 
65  if( iter == aMaxIterations )
66  return false;
67 
68  aForce = totalForce;
69 
70  return true;
71 }
VIA()
Definition: pns_via.h:51
int m_diameter
Definition: pns_via.h:153
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:404
OPT< OBSTACLE > OPT_OBSTACLE
Definition: pns_node.h:147

References PNS::ITEM::ANY_T, PNS::NODE::CheckColliding(), PNS::NODE::GetClearance(), m_diameter, Pos(), VECTOR2< T >::Resize(), SetPos(), Shape(), and PNS::ITEM::SOLID_T.

Referenced by PNS::LINE_PLACER::buildInitialLine().

◆ Rank()

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

Reimplemented in PNS::LINE.

Definition at line 213 of file pns_item.h.

213 { return m_rank; }
int m_rank
Definition: pns_item.h:251

References PNS::ITEM::m_rank.

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

◆ SetDiameter()

void PNS::VIA::SetDiameter ( int  aDiameter)
inline

Definition at line 113 of file pns_via.h.

114  {
115  m_diameter = aDiameter;
117  }
int m_diameter
Definition: pns_via.h:153
SHAPE_CIRCLE m_shape
Definition: pns_via.h:156
void SetRadius(int aRadius)
Definition: shape_circle.h:97

References m_diameter, m_shape, and SHAPE_CIRCLE::SetRadius().

Referenced by PNS::DIFF_PAIR_PLACER::propagateDpHeadForces(), PNS::LINE::SetViaDiameter(), and PNS::DIFF_PAIR::SetViaDiameter().

◆ SetDrill()

void PNS::VIA::SetDrill ( int  aDrill)
inline

Definition at line 120 of file pns_via.h.

120 { m_drill = aDrill; m_hole.SetRadius( aDrill / 2 ); }
int m_drill
Definition: pns_via.h:154
SHAPE_CIRCLE m_hole
Definition: pns_via.h:157
void SetRadius(int aRadius)
Definition: shape_circle.h:97

References m_drill, m_hole, and SHAPE_CIRCLE::SetRadius().

Referenced by PNS::LINE::SetViaDrill(), and PNS::DIFF_PAIR::SetViaDrill().

◆ SetHole()

void PNS::VIA::SetHole ( const SHAPE_CIRCLE aHole)
inline

Definition at line 131 of file pns_via.h.

131 { m_hole = aHole; }
SHAPE_CIRCLE m_hole
Definition: pns_via.h:157

References m_hole.

Referenced by PNS::VVIA::VVIA().

◆ SetIsFree()

void PNS::VIA::SetIsFree ( bool  aIsFree)
inline

Definition at line 123 of file pns_via.h.

123 { m_isFree = aIsFree; }
bool m_isFree
Definition: pns_via.h:159

References m_isFree.

◆ SetLayer()

◆ SetLayers()

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

Definition at line 153 of file pns_item.h.

153 { m_layers = aLayers; }
LAYER_RANGE m_layers
Definition: pns_item.h:246

References PNS::ITEM::m_layers.

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), Clone(), and 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 174 of file pns_item.h.

174 { m_owner = aOwner; }
NODE * m_owner
Definition: pns_item.h:245

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

146 { m_parent = aParent; }
BOARD_ITEM * m_parent
Definition: pns_item.h:244

References PNS::ITEM::m_parent.

Referenced by PNS_KICAD_IFACE::AddItem().

◆ SetPos()

void PNS::VIA::SetPos ( const VECTOR2I aPos)
inline

Definition at line 101 of file pns_via.h.

102  {
103  m_pos = aPos;
104  m_shape.SetCenter( aPos );
105  m_hole.SetCenter( aPos );
106  }
void SetCenter(const VECTOR2I &aCenter)
Definition: shape_circle.h:102
SHAPE_CIRCLE m_hole
Definition: pns_via.h:157
VECTOR2I m_pos
Definition: pns_via.h:155
SHAPE_CIRCLE m_shape
Definition: pns_via.h:156

References m_hole, m_pos, m_shape, and SHAPE_CIRCLE::SetCenter().

Referenced by PNS::LINE_PLACER::buildInitialLine(), PNS::DIFF_PAIR_PLACER::propagateDpHeadForces(), PushoutForce(), PNS::SHOVE::ShoveDraggingVia(), and PNS::SHOVE::ShoveLines().

◆ SetRank()

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

Reimplemented in PNS::LINE.

Definition at line 212 of file pns_item.h.

212 { m_rank = aRank; }
int m_rank
Definition: pns_item.h:251

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

230 { m_routable = aRoutable; }
bool m_routable
Definition: pns_item.h:252

References PNS::ITEM::m_routable.

◆ SetViaType()

void PNS::VIA::SetViaType ( VIATYPE  aViaType)
inline

Definition at line 109 of file pns_via.h.

109 { m_viaType = aViaType; }
VIATYPE m_viaType
Definition: pns_via.h:158

References m_viaType.

◆ Shape()

const SHAPE* PNS::VIA::Shape ( ) const
inlineoverridevirtual

Return the geometrical shape of the item.

Used for collision detection and spatial indexing.

Reimplemented from PNS::ITEM.

Definition at line 128 of file pns_via.h.

128 { return &m_shape; }
SHAPE_CIRCLE m_shape
Definition: pns_via.h:156

References m_shape.

Referenced by ChangedArea(), PNS::SHOVE::onCollidingVia(), PNS::DIFF_PAIR_PLACER::propagateDpHeadForces(), and PushoutForce().

◆ Unmark()

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

Reimplemented in PNS::LINE.

Definition at line 209 of file pns_item.h.

209 { m_marker &= ~aMarker; }
int m_marker
Definition: pns_item.h:250

References PNS::ITEM::m_marker.

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

◆ ViaType()

VIATYPE PNS::VIA::ViaType ( ) const
inline

Definition at line 108 of file pns_via.h.

108 { return m_viaType; }
VIATYPE m_viaType
Definition: pns_via.h:158

References m_viaType.

Member Data Documentation

◆ m_diameter

int PNS::VIA::m_diameter
private

Definition at line 153 of file pns_via.h.

Referenced by Clone(), Diameter(), Hull(), PushoutForce(), SetDiameter(), and VIA().

◆ m_drill

int PNS::VIA::m_drill
private

Definition at line 154 of file pns_via.h.

Referenced by Clone(), Drill(), Hull(), SetDrill(), and VIA().

◆ m_hole

SHAPE_CIRCLE PNS::VIA::m_hole
private

Definition at line 157 of file pns_via.h.

Referenced by Hole(), SetDrill(), SetHole(), SetPos(), and VIA().

◆ m_isFree

bool PNS::VIA::m_isFree
private

Definition at line 159 of file pns_via.h.

Referenced by Clone(), IsFree(), SetIsFree(), and VIA().

◆ m_isVirtual

bool PNS::ITEM::m_isVirtual
protectedinherited

Definition at line 253 of file pns_item.h.

Referenced by Clone(), PNS::ITEM::IsVirtual(), PNS::ITEM::ITEM(), VIA(), and PNS::VVIA::VVIA().

◆ 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_ITEM* PNS::ITEM::m_parent
protectedinherited

Definition at line 244 of file pns_item.h.

Referenced by Clone(), PNS::ITEM::ITEM(), PNS::ITEM::Parent(), and PNS::ITEM::SetParent().

◆ m_pos

VECTOR2I PNS::VIA::m_pos
private

Definition at line 155 of file pns_via.h.

Referenced by Anchor(), Clone(), Hull(), Pos(), SetPos(), and VIA().

◆ m_rank

◆ m_routable

bool PNS::ITEM::m_routable
protectedinherited

Definition at line 252 of file pns_item.h.

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

◆ m_shape

SHAPE_CIRCLE PNS::VIA::m_shape
private

Definition at line 156 of file pns_via.h.

Referenced by Clone(), SetDiameter(), SetPos(), Shape(), and VIA().

◆ m_viaType

VIATYPE PNS::VIA::m_viaType
private

Definition at line 158 of file pns_via.h.

Referenced by Clone(), SetViaType(), VIA(), and ViaType().

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