KiCad PCB EDA Suite
PNS::SOLID Class Reference

#include <pns_solid.h>

Inheritance diagram for PNS::SOLID:
PNS::ITEM

Public Types

enum  PnsKind {
  SOLID_T = 1, LINE_T = 2, JOINT_T = 4, SEGMENT_T = 8,
  VIA_T = 16, DIFF_PAIR_T = 32, ANY_T = 0xff
}
 

Supported item types

More...
 

Public Member Functions

 SOLID ()
 
 ~SOLID ()
 
 SOLID (const SOLID &aSolid)
 
ITEMClone () const override
 Function Clone() More...
 
const SHAPEShape () const override
 Function Shape() More...
 
const SHAPE_LINE_CHAIN Hull (int aClearance=0, int aWalkaroundThickness=0) const override
 
void SetShape (SHAPE *shape)
 
const VECTOR2IPos () const
 
void SetPos (const VECTOR2I &aCenter)
 
virtual VECTOR2I Anchor (int aN) const override
 
virtual int AnchorCount () const override
 
VECTOR2I Offset () const
 
void SetOffset (const VECTOR2I &aOffset)
 
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

VECTOR2I m_pos
 
SHAPEm_shape
 
VECTOR2I m_offset
 

Detailed Description

Definition at line 35 of file pns_solid.h.

Member Enumeration Documentation

◆ PnsKind

enum PNS::ITEM::PnsKind
inherited

Supported item types

Enumerator
SOLID_T 
LINE_T 
JOINT_T 
SEGMENT_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  VIA_T = 16,
66  DIFF_PAIR_T = 32,
67  ANY_T = 0xff
68  };

Constructor & Destructor Documentation

◆ SOLID() [1/2]

PNS::SOLID::SOLID ( )
inline

Definition at line 38 of file pns_solid.h.

38  : ITEM( SOLID_T ), m_shape( NULL )
39  {
40  m_movable = false;
41  }
bool m_movable
Definition: pns_item.h:254
ITEM(PnsKind aKind)
Definition: pns_item.h:70
SHAPE * m_shape
Definition: pns_solid.h:106

References PNS::ITEM::m_movable.

Referenced by Clone().

◆ ~SOLID()

PNS::SOLID::~SOLID ( )
inline

Definition at line 43 of file pns_solid.h.

44  {
45  delete m_shape;
46  }
SHAPE * m_shape
Definition: pns_solid.h:106

References m_shape.

◆ SOLID() [2/2]

PNS::SOLID::SOLID ( const SOLID aSolid)
inline

Definition at line 48 of file pns_solid.h.

48  :
49  ITEM( aSolid )
50  {
51  m_shape = aSolid.m_shape->Clone();
52  m_pos = aSolid.m_pos;
53  }
ITEM(PnsKind aKind)
Definition: pns_item.h:70
SHAPE * m_shape
Definition: pns_solid.h:106
virtual SHAPE * Clone() const
Function Clone()
Definition: shape.h:94
VECTOR2I m_pos
Definition: pns_solid.h:105

References SHAPE::Clone(), m_pos, and m_shape.

Member Function Documentation

◆ Anchor()

virtual VECTOR2I PNS::SOLID::Anchor ( int  aN) const
inlineoverridevirtual

Reimplemented from PNS::ITEM.

Definition at line 84 of file pns_solid.h.

85  {
86  return m_pos;
87  }
VECTOR2I m_pos
Definition: pns_solid.h:105

References m_pos.

◆ AnchorCount()

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

Reimplemented from PNS::ITEM.

Definition at line 89 of file pns_solid.h.

90  {
91  return 1;
92  }

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

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

References PNS::ITEM::m_owner.

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

◆ ClassOf()

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

Definition at line 55 of file pns_solid.h.

56  {
57  return aItem && SOLID_T == aItem->Kind();
58  }

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

◆ Clone()

ITEM * PNS::SOLID::Clone ( ) const
overridevirtual

Function Clone()

Returns a deep copy of the item

Implements PNS::ITEM.

Definition at line 76 of file pns_solid.cpp.

77 {
78  ITEM* solid = new SOLID( *this );
79  return solid;
80 }
ITEM(PnsKind aKind)
Definition: pns_item.h:70

References SOLID().

◆ 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 PNS::SOLID::Hull ( int  aClearance = 0,
int  aWalkaroundThickness = 0 
) const
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 35 of file pns_solid.cpp.

36 {
37  int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2;
38 
39  switch( m_shape->Type() )
40  {
41  case SH_RECT:
42  {
43  SHAPE_RECT* rect = static_cast<SHAPE_RECT*>( m_shape );
44  return OctagonalHull( rect->GetPosition(), rect->GetSize(), cl + 1, 0.2 * cl );
45  }
46 
47  case SH_CIRCLE:
48  {
49  SHAPE_CIRCLE* circle = static_cast<SHAPE_CIRCLE*>( m_shape );
50  int r = circle->GetRadius();
51  return OctagonalHull( circle->GetCenter() - VECTOR2I( r, r ), VECTOR2I( 2 * r, 2 * r ),
52  cl + 1, 0.52 * ( r + cl ) );
53  }
54 
55  case SH_SEGMENT:
56  {
57  SHAPE_SEGMENT* seg = static_cast<SHAPE_SEGMENT*>( m_shape );
58  return SegmentHull( *seg, aClearance, aWalkaroundThickness );
59  }
60 
61  case SH_SIMPLE:
62  {
63  SHAPE_SIMPLE* convex = static_cast<SHAPE_SIMPLE*>( m_shape );
64 
65  return ConvexHull( *convex, cl );
66  }
67 
68  default:
69  break;
70  }
71 
72  return SHAPE_LINE_CHAIN();
73 }
const SHAPE_LINE_CHAIN ConvexHull(const SHAPE_SIMPLE &aConvex, int aClearance)
Function ConvexHull()
Definition: pns_utils.cpp:101
Class SHAPE_SIMPLE.
Definition: shape_simple.h:42
int GetRadius() const
Definition: shape_circle.h:79
SHAPE_TYPE Type() const
Function Type()
Definition: shape.h:83
const VECTOR2I GetCenter() const
Definition: shape_circle.h:84
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
const SHAPE_LINE_CHAIN SegmentHull(const SHAPE_SEGMENT &aSeg, int aClearance, int aWalkaroundThickness)
Definition: pns_utils.cpp:53
SHAPE * m_shape
Definition: pns_solid.h:106
const VECTOR2I GetSize() const
Function GetSize()
Definition: shape_rect.h:110
const VECTOR2I & GetPosition() const
Function GetPosition()
Definition: shape_rect.h:100
const SHAPE_LINE_CHAIN OctagonalHull(const VECTOR2I &aP0, const VECTOR2I &aSize, int aClearance, int aChamfer)
Various utility functions.
Definition: pns_utils.cpp:33
line chain (polyline)
Definition: shape.h:46
Class SHAPE_LINE_CHAIN.
Definition: shape.h:43
circle
Definition: shape.h:47
axis-aligned rectangle
Definition: shape.h:44

References PNS::ConvexHull(), SHAPE_CIRCLE::GetCenter(), SHAPE_RECT::GetPosition(), SHAPE_CIRCLE::GetRadius(), SHAPE_RECT::GetSize(), m_shape, PNS::OctagonalHull(), PNS::SegmentHull(), SH_CIRCLE, SH_RECT, SH_SEGMENT, SH_SIMPLE, and SHAPE::Type().

◆ IsLocked()

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

Definition at line 235 of file pns_item.h.

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

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

241 { return m_routable; }
bool m_routable
Definition: pns_item.h:258

References PNS::ITEM::m_routable.

◆ 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 LINE_T: return "line";
76  case SEGMENT_T: return "segment";
77  case VIA_T: return "via";
78  case JOINT_T: return "joint";
79  case SOLID_T: return "solid";
80  default: return "unknown";
81  }
82 }
PnsKind m_kind
Definition: pns_item.h:248

References 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

Reimplemented in PNS::SEGMENT.

Definition at line 154 of file pns_item.h.

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

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

163  {
164  return Layers().Overlaps( aOther->Layers() );
165  }
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:68
const LAYER_RANGE & Layers() const
Definition: pns_item.h:150

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

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

◆ Mark()

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

Reimplemented in PNS::LINE.

Definition at line 218 of file pns_item.h.

218 { m_marker = aMarker; }
int m_marker
Definition: pns_item.h:256

References PNS::ITEM::m_marker.

◆ Marker()

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

Reimplemented in PNS::LINE.

Definition at line 220 of file pns_item.h.

220 { return m_marker; }
int m_marker
Definition: pns_item.h:256

References PNS::ITEM::m_marker.

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

◆ Net()

◆ Offset()

VECTOR2I PNS::SOLID::Offset ( ) const
inline

Definition at line 94 of file pns_solid.h.

95  {
96  return m_offset;
97  }
VECTOR2I m_offset
Definition: pns_solid.h:107

References m_offset.

Referenced by PNS::OPTIMIZER::smartPadsSingle().

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

172 { return m_owner; }
NODE * m_owner
Definition: pns_item.h:251

References PNS::ITEM::m_owner.

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

◆ Parent()

◆ Pos()

const VECTOR2I& PNS::SOLID::Pos ( ) const
inline

Definition at line 74 of file pns_solid.h.

75  {
76  return m_pos;
77  }
VECTOR2I m_pos
Definition: pns_solid.h:105

References m_pos.

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

◆ Rank()

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

Reimplemented in PNS::LINE.

Definition at line 223 of file pns_item.h.

223 { return m_rank; }
int m_rank
Definition: pns_item.h:257

References PNS::ITEM::m_rank.

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

◆ SetLayer()

void PNS::ITEM::SetLayer ( int  aLayer)
inlineinherited

◆ SetLayers()

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

Definition at line 151 of file pns_item.h.

151 { m_layers = aLayers; }
LAYER_RANGE m_layers
Definition: pns_item.h:252

References PNS::ITEM::m_layers.

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::VIA::Clone(), PNS::SEGMENT::SetLayer(), and PNS::VIA::VIA().

◆ SetNet()

◆ SetOffset()

void PNS::SOLID::SetOffset ( const VECTOR2I aOffset)
inline

Definition at line 99 of file pns_solid.h.

100  {
101  m_offset = aOffset;
102  }
VECTOR2I m_offset
Definition: pns_solid.h:107

References m_offset.

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

179 { m_owner = aOwner; }
NODE * m_owner
Definition: pns_item.h:251

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

144 { m_parent = aParent; }
BOARD_CONNECTED_ITEM * m_parent
Definition: pns_item.h:250

References PNS::ITEM::m_parent.

Referenced by PNS_KICAD_IFACE::AddItem().

◆ SetPos()

void PNS::SOLID::SetPos ( const VECTOR2I aCenter)
inline

Definition at line 79 of file pns_solid.h.

80  {
81  m_pos = aCenter;
82  }
VECTOR2I m_pos
Definition: pns_solid.h:105

References m_pos.

◆ SetRank()

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

Reimplemented in PNS::LINE.

Definition at line 222 of file pns_item.h.

222 { m_rank = aRank; }
int m_rank
Definition: pns_item.h:257

References PNS::ITEM::m_rank.

◆ SetRoutable()

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

Definition at line 240 of file pns_item.h.

240 { m_routable = aRoutable; }
bool m_routable
Definition: pns_item.h:258

References PNS::ITEM::m_routable.

◆ SetShape()

void PNS::SOLID::SetShape ( SHAPE shape)
inline

Definition at line 66 of file pns_solid.h.

67  {
68  if( m_shape )
69  delete m_shape;
70 
71  m_shape = shape;
72  }
SHAPE * m_shape
Definition: pns_solid.h:106

References m_shape.

◆ Shape()

const SHAPE* PNS::SOLID::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 62 of file pns_solid.h.

62 { return m_shape; }
SHAPE * m_shape
Definition: pns_solid.h:106

References m_shape.

Referenced by PNS::LOGGER::Log(), and PNS::OPTIMIZER::smartPadsSingle().

◆ Unmark()

virtual void PNS::ITEM::Unmark ( int  aMarker = -1)
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:256

References PNS::ITEM::m_marker.

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

Member Data Documentation

◆ m_kind

PnsKind PNS::ITEM::m_kind
protectedinherited

◆ m_layers

◆ m_marker

◆ m_movable

bool PNS::ITEM::m_movable
protectedinherited

Definition at line 254 of file pns_item.h.

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

◆ m_net

◆ m_offset

VECTOR2I PNS::SOLID::m_offset
private

Definition at line 107 of file pns_solid.h.

Referenced by Offset(), and SetOffset().

◆ m_owner

NODE* PNS::ITEM::m_owner
protectedinherited

◆ m_parent

BOARD_CONNECTED_ITEM* PNS::ITEM::m_parent
protectedinherited

◆ m_pos

VECTOR2I PNS::SOLID::m_pos
private

Definition at line 105 of file pns_solid.h.

Referenced by Anchor(), Pos(), SetPos(), and SOLID().

◆ m_rank

◆ m_routable

bool PNS::ITEM::m_routable
protectedinherited

Definition at line 258 of file pns_item.h.

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

◆ m_shape

SHAPE* PNS::SOLID::m_shape
private

Definition at line 106 of file pns_solid.h.

Referenced by Hull(), SetShape(), Shape(), SOLID(), and ~SOLID().

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