KiCad PCB EDA Suite
PNS::ARC Class Reference

#include <pns_arc.h>

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

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

 ARC ()
 
 ARC (const SHAPE_ARC &aArc, int aNet)
 
 ARC (const ARC &aParentArc, const SHAPE_ARC &aArc)
 
 ARC (const LINE &aParentLine, const SHAPE_ARC &aArc)
 
ARCClone () const override
 Function Clone() More...
 
const SHAPEShape () const override
 Function Shape() More...
 
void SetWidth (int aWidth) override
 
int Width () const override
 
const SHAPE_LINE_CHAIN CLine () const
 
const SHAPE_LINE_CHAIN Hull (int aClearance, int aWalkaroundThickness) const override
 
virtual VECTOR2I Anchor (int n) const override
 
virtual int AnchorCount () const override
 
OPT_BOX2I ChangedArea (const ARC *aOther) 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 void Mark (int aMarker)
 
virtual void Unmark (int aMarker=-1)
 
virtual int Marker () const
 
virtual void SetRank (int aRank)
 
virtual int Rank () const
 
bool IsLocked () const
 
void SetRoutable (bool aRoutable)
 
bool IsRoutable () const
 

Static Public Member Functions

static bool ClassOf (const ITEM *aItem)
 

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
 

Private Attributes

SHAPE_ARC m_arc
 

Detailed Description

Definition at line 37 of file pns_arc.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

◆ ARC() [1/4]

PNS::ARC::ARC ( )
inline

Definition at line 40 of file pns_arc.h.

40  : LINKED_ITEM( ARC_T )
41  {}
LINKED_ITEM(PnsKind aKind)

Referenced by Clone().

◆ ARC() [2/4]

PNS::ARC::ARC ( const SHAPE_ARC aArc,
int  aNet 
)
inline

Definition at line 43 of file pns_arc.h.

43  : LINKED_ITEM( ARC_T ), m_arc( aArc )
44  {
45  m_net = aNet;
46  }
SHAPE_ARC m_arc
Definition: pns_arc.h:113
int m_net
Definition: pns_item.h:256
LINKED_ITEM(PnsKind aKind)

References PNS::ITEM::m_net.

◆ ARC() [3/4]

PNS::ARC::ARC ( const ARC aParentArc,
const SHAPE_ARC aArc 
)
inline

Definition at line 48 of file pns_arc.h.

49  : LINKED_ITEM( ARC_T ),
50  m_arc( aArc )
51  {
52  m_net = aParentArc.Net();
53  m_layers = aParentArc.Layers();
54  m_marker = aParentArc.Marker();
55  m_rank = aParentArc.Rank();
56  }
LAYER_RANGE m_layers
Definition: pns_item.h:253
int m_rank
Definition: pns_item.h:258
SHAPE_ARC m_arc
Definition: pns_arc.h:113
int m_marker
Definition: pns_item.h:257
int m_net
Definition: pns_item.h:256
LINKED_ITEM(PnsKind aKind)

References PNS::ITEM::Layers(), PNS::ITEM::m_layers, PNS::ITEM::m_marker, PNS::ITEM::m_net, PNS::ITEM::m_rank, PNS::ITEM::Marker(), PNS::ITEM::Net(), and PNS::ITEM::Rank().

◆ ARC() [4/4]

PNS::ARC::ARC ( const LINE aParentLine,
const SHAPE_ARC aArc 
)
inline

Definition at line 58 of file pns_arc.h.

58  :
59  LINKED_ITEM( ARC_T ),
60  m_arc( aArc.GetP0(), aArc.GetArcMid(), aArc.GetP1(), aParentLine.Width() )
61  {
62  m_net = aParentLine.Net();
63  m_layers = aParentLine.Layers();
64  m_marker = aParentLine.Marker();
65  m_rank = aParentLine.Rank();
66  }
LAYER_RANGE m_layers
Definition: pns_item.h:253
int m_rank
Definition: pns_item.h:258
SHAPE_ARC m_arc
Definition: pns_arc.h:113
int m_marker
Definition: pns_item.h:257
const VECTOR2I & GetP0() const
Definition: shape_arc.h:72
const VECTOR2I & GetArcMid() const
Definition: shape_arc.h:74
int m_net
Definition: pns_item.h:256
LINKED_ITEM(PnsKind aKind)
const VECTOR2I & GetP1() const
Definition: shape_arc.h:73

References PNS::ITEM::Layers(), PNS::ITEM::m_layers, PNS::ITEM::m_marker, PNS::ITEM::m_net, PNS::ITEM::m_rank, PNS::LINE::Marker(), PNS::ITEM::Net(), and PNS::LINE::Rank().

Member Function Documentation

◆ Anchor()

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

Reimplemented from PNS::ITEM.

Definition at line 97 of file pns_arc.h.

98  {
99  if( n == 0 )
100  return m_arc.GetP0();
101  else
102  return m_arc.GetP1();
103  }
SHAPE_ARC m_arc
Definition: pns_arc.h:113
const VECTOR2I & GetP0() const
Definition: shape_arc.h:72
const VECTOR2I & GetP1() const
Definition: shape_arc.h:73

References SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), and m_arc.

Referenced by PNS::NODE::addArc(), PNS::NODE::findRedundantArc(), and PNS::NODE::removeArcIndex().

◆ AnchorCount()

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

Reimplemented from PNS::ITEM.

Definition at line 105 of file pns_arc.h.

106  {
107  return 2;
108  }

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

References PNS::ITEM::m_owner.

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

◆ ChangedArea()

OPT_BOX2I ARC::ChangedArea ( const ARC aOther) const

Definition at line 46 of file pns_arc.cpp.

47 {
48  BOX2I tmp = Shape()->BBox();
49  tmp.Merge( aOther->Shape()->BBox() );
50  return tmp;
51 }
virtual const BOX2I BBox(int aClearance=0) const =0
Function BBox()
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Definition: box2.h:385
const SHAPE * Shape() const override
Function Shape()
Definition: pns_arc.h:75

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

◆ ClassOf()

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

Definition at line 68 of file pns_arc.h.

69  {
70  return aItem && ARC_T == aItem->Kind();
71  }

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

◆ CLine()

const SHAPE_LINE_CHAIN PNS::ARC::CLine ( ) const
inline

Definition at line 90 of file pns_arc.h.

91  {
92  return SHAPE_LINE_CHAIN( m_arc );
93  }
SHAPE_ARC m_arc
Definition: pns_arc.h:113
SHAPE_LINE_CHAIN.

References m_arc.

◆ Clone()

ARC * ARC::Clone ( ) const
overridevirtual

Function Clone()

Returns a deep copy of the item

Implements PNS::ITEM.

Definition at line 38 of file pns_arc.cpp.

39 {
40  ARC* a = new ARC( m_arc, m_net );
41 
42  return a;
43 }
ARC()
Definition: pns_arc.h:40
SHAPE_ARC m_arc
Definition: pns_arc.h:113
int m_net
Definition: pns_item.h:256

References ARC(), m_arc, and PNS::ITEM::m_net.

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

50 {
51  if( collideSimple( aOther, aClearance, aNeedMTV, aMTV, aParentNode, aDifferentNetsOnly ) )
52  return true;
53 
54  // special case for "head" line with a via attached at the end.
55  if( aOther->m_kind == LINE_T )
56  {
57  const LINE* line = static_cast<const LINE*>( aOther );
58  int clearance = aClearance - line->Width() / 2;
59 
60  if( line->EndsWithVia() )
61  {
62  return collideSimple( &line->Via(), clearance, aNeedMTV, aMTV, aParentNode,
63  aDifferentNetsOnly );
64  }
65  }
66 
67  return false;
68 }
bool collideSimple(const ITEM *aOther, int aClearance, bool aNeedMTV, VECTOR2I *aMTV, const NODE *aParentNode, bool aDifferentNetsOnly) const
Definition: pns_item.cpp:30

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

const SHAPE_LINE_CHAIN ARC::Hull ( int  aClearance,
int  aWalkaroundThickness 
) const
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 32 of file pns_arc.cpp.

33 {
34  return ArcHull( m_arc, aClearance, aWalkaroundThickness );
35 }
SHAPE_ARC m_arc
Definition: pns_arc.h:113
const SHAPE_LINE_CHAIN ArcHull(const SHAPE_ARC &aSeg, int aClearance, int aWalkaroundThickness)
Various utility functions.
Definition: pns_utils.cpp:55

References PNS::ArcHull(), and m_arc.

◆ IsLocked()

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

Definition at line 236 of file pns_item.h.

237  {
238  return Marker() & MK_LOCKED;
239  }
virtual int Marker() const
Definition: pns_item.h:221

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

242 { return m_routable; }
bool m_routable
Definition: pns_item.h:259

References PNS::ITEM::m_routable.

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

◆ Kind()

◆ KindStr()

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

Function KindStr()

Returns the kind of the item, as string

Definition at line 71 of file pns_item.cpp.

72 {
73  switch( m_kind )
74  {
75  case ARC_T: return "arc";
76  case LINE_T: return "line";
77  case SEGMENT_T: return "segment";
78  case VIA_T: return "via";
79  case JOINT_T: return "joint";
80  case SOLID_T: return "solid";
81  default: return "unknown";
82  }
83 }
PnsKind m_kind
Definition: pns_item.h:249

References PNS::ITEM::ARC_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

Definition at line 155 of file pns_item.h.

155 { return Layers().Start(); }
int Start() const
Definition: pns_layerset.h:83
const LAYER_RANGE & Layers() const
Definition: pns_item.h:151

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

Referenced by PNS::OPTIMIZER::fanoutCleanup(), and PNS::OPTIMIZER::runSmartPads().

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

219 { m_marker = aMarker; }
int m_marker
Definition: pns_item.h:257

References PNS::ITEM::m_marker.

◆ Marker()

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

Reimplemented in PNS::LINE.

Definition at line 221 of file pns_item.h.

221 { return m_marker; }
int m_marker
Definition: pns_item.h:257

References PNS::ITEM::m_marker.

Referenced by ARC(), PNS::ITEM::IsLocked(), PNS::LOGGER::Log(), 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:252

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

224 { return m_rank; }
int m_rank
Definition: pns_item.h:258

References PNS::ITEM::m_rank.

Referenced by ARC(), PNS::LINE::LINE(), PNS::LOGGER::Log(), 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:253

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

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

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

223 { m_rank = aRank; }
int m_rank
Definition: pns_item.h:258

References PNS::ITEM::m_rank.

◆ SetRoutable()

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

Definition at line 241 of file pns_item.h.

241 { m_routable = aRoutable; }
bool m_routable
Definition: pns_item.h:259

References PNS::ITEM::m_routable.

◆ SetWidth()

void PNS::ARC::SetWidth ( int  aWidth)
inlineoverridevirtual

Reimplemented from PNS::LINKED_ITEM.

Definition at line 80 of file pns_arc.h.

81  {
82  m_arc.SetWidth(aWidth);
83  }
SHAPE_ARC m_arc
Definition: pns_arc.h:113
void SetWidth(int aWidth)
Definition: shape_arc.h:82

References m_arc, and SHAPE_ARC::SetWidth().

◆ Shape()

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

Function Shape()

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

Reimplemented from PNS::ITEM.

Definition at line 75 of file pns_arc.h.

76  {
77  return static_cast<const SHAPE*>( &m_arc );
78  }
SHAPE_ARC m_arc
Definition: pns_arc.h:113

References m_arc.

Referenced by ChangedArea().

◆ Unmark()

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

Reimplemented in PNS::LINE.

Definition at line 220 of file pns_item.h.

220 { m_marker &= ~aMarker; }
int m_marker
Definition: pns_item.h:257

References PNS::ITEM::m_marker.

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

◆ Width()

int PNS::ARC::Width ( ) const
inlineoverridevirtual

Reimplemented from PNS::LINKED_ITEM.

Definition at line 85 of file pns_arc.h.

86  {
87  return m_arc.GetWidth();
88  }
SHAPE_ARC m_arc
Definition: pns_arc.h:113
int GetWidth() const
Definition: shape_arc.h:87

References SHAPE_ARC::GetWidth(), and m_arc.

Member Data Documentation

◆ m_arc

SHAPE_ARC PNS::ARC::m_arc
private

Definition at line 113 of file pns_arc.h.

Referenced by Anchor(), CLine(), Clone(), Hull(), SetWidth(), Shape(), and Width().

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