KiCad PCB EDA Suite
PNS::LINE Class Reference

#include <pns_line.h>

Inheritance diagram for PNS::LINE:
PNS::ITEM

Public Types

typedef std::vector< SEGMENT * > SEGMENT_REFS
 
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

 LINE ()
 Constructor Makes an empty line. More...
 
 LINE (const LINE &aOther)
 
 LINE (const LINE &aBase, const SHAPE_LINE_CHAIN &aLine)
 Constructor Copies properties (net, layers, etc.) from a base line and replaces the shape by another. More...
 
 LINE (const VIA &aVia)
 Constructor Constructs a LINE for a lone VIA (ie a stitching via). More...
 
 ~LINE ()
 
virtual LINEClone () const override
 Function Clone() More...
 
LINEoperator= (const LINE &aOther)
 
void SetShape (const SHAPE_LINE_CHAIN &aLine)
 

Assigns a shape to the line (a polyline/line chain)

More...
 
const SHAPEShape () const override
 

Returns the shape of the line

More...
 
SHAPE_LINE_CHAINLine ()
 

Modifiable accessor to the underlying shape

More...
 
const SHAPE_LINE_CHAINCLine () const
 

Const accessor to the underlying shape

More...
 
int SegmentCount () const
 

Returns the number of segments in the line

More...
 
int PointCount () const
 

Returns the number of points in the line

More...
 
const VECTOR2ICPoint (int aIdx) const
 

Returns the aIdx-th point of the line

More...
 
const SEG CSegment (int aIdx) const
 

Returns the aIdx-th segment of the line

More...
 
void SetWidth (int aWidth)
 

Sets line width

More...
 
int Width () const
 

Returns line width

More...
 
bool CompareGeometry (const LINE &aOther)
 

Returns true if the line is geometrically identical as line aOther

More...
 
void Reverse ()
 

Reverses the point/vertex order

More...
 
void LinkSegment (SEGMENT *aSeg)
 

Adds a reference to a segment registered in a NODE that is a part of this line.

More...
 
SEGMENT_REFSLinkedSegments ()
 

Returns the list of segments from the owning node that constitute this line (or NULL if the line is not linked)

More...
 
bool IsLinked () const
 
bool IsLinkedChecked () const
 
bool ContainsSegment (SEGMENT *aSeg) const
 

Checks if the segment aSeg is a part of the line.

More...
 
SEGMENTGetLink (int aIndex) const
 
void ClearSegmentLinks ()
 

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

More...
 
int LinkCount () const
 

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

More...
 
const LINE ClipToNearestObstacle (NODE *aNode) const
 

Clips the line to the nearest obstacle, traversing from the line's start vertex (0).

More...
 
void ClipVertexRange (int aStart, int aEnd)
 

Clips the line to a given range of vertices.

More...
 
int CountCorners (int aAngles) const
 

Returns the number of corners of angles specified by mask aAngles.

More...
 
bool Walkaround (SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aWalk, SHAPE_LINE_CHAIN &aPost, bool aCw) const
 

Calculates a line thightly wrapping a convex hull of an obstacle object (aObstacle).

More...
 
bool Walkaround (const SHAPE_LINE_CHAIN &aObstacle, SHAPE_LINE_CHAIN &aPath, bool aCw) const
 
bool Is45Degree () const
 
void ShowLinks () const
 

Prints out all linked segments

More...
 
bool EndsWithVia () const
 
void AppendVia (const VIA &aVia)
 
void RemoveVia ()
 
const VIAVia () const
 
virtual void Mark (int aMarker) override
 
virtual void Unmark (int aMarker=-1) override
 
virtual int Marker () const override
 
void DragSegment (const VECTOR2I &aP, int aIndex, int aSnappingThreshold=0, bool aFreeAngle=false)
 
void DragCorner (const VECTOR2I &aP, int aIndex, int aSnappingThreshold=0, bool aFreeAngle=false)
 
void SetRank (int aRank) override
 
int Rank () const override
 
bool HasLoops () const
 
bool HasLockedSegments () const
 
OPT_BOX2I ChangedArea (const LINE *aOther) const
 
virtual const SHAPE_LINE_CHAIN Hull (int aClearance=0, int aWalkaroundThickness=0) 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 VECTOR2I Anchor (int n) const
 
virtual int AnchorCount () 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 Member Functions

void dragSegment45 (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
void dragCorner45 (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
void dragSegmentFree (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
void dragCornerFree (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
VECTOR2I snapToNeighbourSegments (const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
 
VECTOR2I snapDraggedCorner (const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
 
void copyLinks (const LINE *aParent)
 

Copies m_segmentRefs from the line aParent.

More...
 

Private Attributes

SEGMENT_REFS m_segmentRefs
 

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.

More...
 
SHAPE_LINE_CHAIN m_line
 

The actual shape of the line

More...
 
int m_width
 

our width

More...
 
bool m_hasVia
 

If true, the line ends with a via

More...
 
VIA m_via
 

Via at the end point, if m_hasVia == true

More...
 

Detailed Description

Definition at line 61 of file pns_line.h.

Member Typedef Documentation

◆ SEGMENT_REFS

typedef std::vector<SEGMENT*> PNS::LINE::SEGMENT_REFS

Definition at line 64 of file pns_line.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

◆ LINE() [1/4]

PNS::LINE::LINE ( )
inline

Constructor Makes an empty line.

Definition at line 70 of file pns_line.h.

70  : ITEM( LINE_T )
71  {
72  m_hasVia = false;
73  m_width = 1; // Dummy value
74  }
ITEM(PnsKind aKind)
Definition: pns_item.h:70
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:316
int m_width
our width
Definition: pns_line.h:313

References m_hasVia, and m_width.

Referenced by Clone().

◆ LINE() [2/4]

PNS::LINE::LINE ( const LINE aOther)

Definition at line 37 of file pns_line.cpp.

37  :
38  ITEM( aOther ),
39  m_line( aOther.m_line ),
40  m_width( aOther.m_width )
41 {
42  m_net = aOther.m_net;
43  m_movable = aOther.m_movable;
44  m_layers = aOther.m_layers;
45  m_via = aOther.m_via;
46  m_hasVia = aOther.m_hasVia;
47  m_marker = aOther.m_marker;
48  m_rank = aOther.m_rank;
49 
50  copyLinks( &aOther );
51 }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:319
LAYER_RANGE m_layers
Definition: pns_item.h:252
int m_rank
Definition: pns_item.h:257
bool m_movable
Definition: pns_item.h:254
ITEM(PnsKind aKind)
Definition: pns_item.h:70
int m_marker
Definition: pns_item.h:256
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
void copyLinks(const LINE *aParent)
Copies m_segmentRefs from the line aParent.
Definition: pns_line.cpp:118
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:316
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:313

References copyLinks(), m_hasVia, PNS::ITEM::m_layers, PNS::ITEM::m_marker, PNS::ITEM::m_movable, PNS::ITEM::m_net, PNS::ITEM::m_rank, and m_via.

◆ LINE() [3/4]

PNS::LINE::LINE ( const LINE aBase,
const SHAPE_LINE_CHAIN aLine 
)
inline

Constructor Copies properties (net, layers, etc.) from a base line and replaces the shape by another.

Definition at line 83 of file pns_line.h.

83  :
84  ITEM( aBase ),
85  m_line( aLine ),
86  m_width( aBase.m_width )
87  {
88  m_net = aBase.m_net;
89  m_layers = aBase.m_layers;
90  m_hasVia = false;
91  }
LAYER_RANGE m_layers
Definition: pns_item.h:252
ITEM(PnsKind aKind)
Definition: pns_item.h:70
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:316
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:313

References m_hasVia, PNS::ITEM::m_layers, and PNS::ITEM::m_net.

◆ LINE() [4/4]

PNS::LINE::LINE ( const VIA aVia)
inline

Constructor Constructs a LINE for a lone VIA (ie a stitching via).

Parameters
aVia

Definition at line 98 of file pns_line.h.

98  :
99  ITEM( LINE_T )
100  {
101  m_hasVia = true;
102  m_via = aVia;
103  m_width = aVia.Diameter();
104  m_net = aVia.Net();
105  m_layers = aVia.Layers();
106  m_rank = aVia.Rank();
107  }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:319
LAYER_RANGE m_layers
Definition: pns_item.h:252
int m_rank
Definition: pns_item.h:257
ITEM(PnsKind aKind)
Definition: pns_item.h:70
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:316
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:313

References PNS::VIA::Diameter(), PNS::ITEM::Layers(), m_hasVia, PNS::ITEM::m_layers, PNS::ITEM::m_net, PNS::ITEM::m_rank, m_via, m_width, PNS::ITEM::Net(), and PNS::ITEM::Rank().

◆ ~LINE()

PNS::LINE::~LINE ( )

Definition at line 54 of file pns_line.cpp.

55 {
56 }

Member Function Documentation

◆ Anchor()

virtual VECTOR2I PNS::ITEM::Anchor ( int  n) const
inlinevirtualinherited

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

Definition at line 225 of file pns_item.h.

226  {
227  return VECTOR2I();
228  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594

Referenced by PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), PNS::DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR(), and PNS::DIFF_PAIR_PLACER::getDanglingAnchor().

◆ AnchorCount()

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

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

Definition at line 230 of file pns_item.h.

231  {
232  return 0;
233  }

◆ AppendVia()

void PNS::LINE::AppendVia ( const VIA aVia)

Definition at line 778 of file pns_line.cpp.

779 {
780  if( m_line.PointCount() > 1 && aVia.Pos() == m_line.CPoint( 0 ) )
781  {
782  Reverse();
783  }
784 
785  m_hasVia = true;
786  m_via = aVia;
787  m_via.SetNet( m_net );
788 }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:319
int PointCount() const
Function PointCount()
void SetNet(int aNet)
Definition: pns_item.h:147
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
const VECTOR2I & CPoint(int aIndex) const
Function Point()
void Reverse()
Reverses the point/vertex order
Definition: pns_line.cpp:770
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:316
int m_net
Definition: pns_item.h:255

References SHAPE_LINE_CHAIN::CPoint(), m_hasVia, m_line, PNS::ITEM::m_net, m_via, SHAPE_LINE_CHAIN::PointCount(), PNS::VIA::Pos(), Reverse(), and PNS::ITEM::SetNet().

Referenced by PNS::LINE_PLACER::buildInitialLine(), PNS::SHOVE::onReverseCollidingVia(), PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkOnly(), and PNS::DIFF_PAIR::updateLine().

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

◆ ChangedArea()

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

Definition at line 875 of file pns_line.cpp.

876 {
877  BOX2I area;
878  bool areaDefined = false;
879 
880  int i_start = -1;
881  int i_end_self = -1, i_end_other = -1;
882 
883  SHAPE_LINE_CHAIN self( m_line );
884  self.Simplify();
885  SHAPE_LINE_CHAIN other( aOther->m_line );
886  other.Simplify();
887 
888  int np_self = self.PointCount();
889  int np_other = other.PointCount();
890 
891  int n = std::min( np_self, np_other );
892 
893  for( int i = 0; i < n; i++ )
894  {
895  const VECTOR2I p1 = self.CPoint( i );
896  const VECTOR2I p2 = other.CPoint( i );
897 
898  if( p1 != p2 )
899  {
900  if( i != n - 1 )
901  {
902  SEG s = self.CSegment( i );
903 
904  if( !s.Contains( p2 ) )
905  {
906  i_start = i;
907  break;
908  }
909  }
910  else
911  {
912  i_start = i;
913  break;
914  }
915  }
916  }
917 
918  for( int i = 0; i < n; i++ )
919  {
920  const VECTOR2I p1 = self.CPoint( np_self - 1 - i );
921  const VECTOR2I p2 = other.CPoint( np_other - 1 - i );
922 
923  if( p1 != p2 )
924  {
925  i_end_self = np_self - 1 - i;
926  i_end_other = np_other - 1 - i;
927  break;
928  }
929  }
930 
931  if( i_start < 0 )
932  i_start = n;
933 
934  if( i_end_self < 0 )
935  i_end_self = np_self - 1;
936 
937  if( i_end_other < 0 )
938  i_end_other = np_other - 1;
939 
940  for( int i = i_start; i <= i_end_self; i++ )
941  extendBox( area, areaDefined, self.CPoint( i ) );
942 
943  for( int i = i_start; i <= i_end_other; i++ )
944  extendBox( area, areaDefined, other.CPoint( i ) );
945 
946  if( areaDefined )
947  {
948  area.Inflate( std::max( Width(), aOther->Width() ) );
949  return area;
950  }
951 
952  return OPT_BOX2I();
953 }
const VECTOR2I & CPoint(int aIdx) const
Returns the aIdx-th point of the line
Definition: pns_line.h:159
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
bool Contains(const VECTOR2I &aP) const
Definition: seg.cpp:200
Definition: seg.h:39
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301
SHAPE_LINE_CHAIN.
static void extendBox(BOX2I &aBox, bool &aDefined, const VECTOR2I &aP)
Definition: pns_line.cpp:861
int Width() const
Returns line width
Definition: pns_line.h:178
OPT< BOX2I > OPT_BOX2I
Definition: box2.h:524

References SEG::Contains(), CPoint(), SHAPE_LINE_CHAIN::CPoint(), PNS::extendBox(), BOX2< Vec >::Inflate(), m_line, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::Simplify(), and Width().

Referenced by PNS::ChangedArea().

◆ ClassOf()

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

Definition at line 111 of file pns_line.h.

112  {
113  return aItem && LINE_T == aItem->Kind();
114  }

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

◆ ClearSegmentLinks()

void PNS::LINE::ClearSegmentLinks ( )

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

Definition at line 855 of file pns_line.cpp.

856 {
857  m_segmentRefs.clear();
858 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

Referenced by PNS::DRAGGER::dragMarkObstacles(), PNS::DRAGGER::dragShove(), PNS::DRAGGER::dumbDragVia(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onReverseCollidingVia(), PNS::SHOVE::ProcessSingleLine(), PNS::NODE::Remove(), PNS::SHOVE::ShoveLines(), and PNS::SHOVE::ShoveMultiLines().

◆ CLine()

◆ ClipToNearestObstacle()

const LINE PNS::LINE::ClipToNearestObstacle ( NODE aNode) const

Clips the line to the nearest obstacle, traversing from the line's start vertex (0).

Returns the clipped line.

Definition at line 329 of file pns_line.cpp.

330 {
331  const int IterationLimit = 5;
332  int i;
333  LINE l( *this );
334 
335  for( i = 0; i < IterationLimit; i++ )
336  {
337  NODE::OPT_OBSTACLE obs = aNode->NearestObstacle( &l );
338 
339  if( obs )
340  {
341  l.RemoveVia();
342  int p = l.Line().Split( obs->m_ipFirst );
343  l.Line().Remove( p + 1, -1 );
344  } else
345  break;
346  }
347 
348  if( i == IterationLimit )
349  l.Line().Clear();
350 
351  return l;
352 }
LINE()
Constructor Makes an empty line.
Definition: pns_line.h:70
OPT< OBSTACLE > OPT_OBSTACLE
Definition: pns_node.h:143

References SHAPE_LINE_CHAIN::Clear(), Line(), PNS::NODE::NearestObstacle(), SHAPE_LINE_CHAIN::Remove(), RemoveVia(), and SHAPE_LINE_CHAIN::Split().

Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkOnly(), and PNS::WALKAROUND::singleStep().

◆ ClipVertexRange()

void PNS::LINE::ClipVertexRange ( int  aStart,
int  aEnd 
)

Clips the line to a given range of vertices.

Definition at line 820 of file pns_line.cpp.

821 {
822  m_line = m_line.Slice( aStart, aEnd );
823 
824  if( IsLinked() ) {
825  assert( m_segmentRefs.size() < INT_MAX );
826  assert( (int) m_segmentRefs.size() >= (aEnd - aStart) );
827 
828  // Note: The range includes aEnd, but we have n-1 segments.
829  std::rotate(
830  m_segmentRefs.begin(),
831  m_segmentRefs.begin() + aStart,
832  m_segmentRefs.begin() + aEnd
833  );
834 
835  m_segmentRefs.resize( aEnd - aStart );
836  }
837 }
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307
bool IsLinked() const
Definition: pns_line.h:205

References IsLinked(), m_line, m_segmentRefs, and SHAPE_LINE_CHAIN::Slice().

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

◆ Clone()

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

Function Clone()

Returns a deep copy of the item

Implements PNS::ITEM.

Definition at line 78 of file pns_line.cpp.

79 {
80  LINE* l = new LINE( *this );
81 
82  return l;
83 }
LINE()
Constructor Makes an empty line.
Definition: pns_line.h:70

References LINE().

Referenced by PNS::ITEM_SET::Add(), and PNS::ITEM_SET::Prepend().

◆ 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(), EndsWithVia(), PNS::ITEM::LINE_T, PNS::ITEM::m_kind, Via(), and Width().

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

◆ CompareGeometry()

bool PNS::LINE::CompareGeometry ( const LINE aOther)

Returns true if the line is geometrically identical as line aOther

Definition at line 764 of file pns_line.cpp.

765 {
766  return m_line.CompareGeometry( aOther.m_line );
767 }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
bool CompareGeometry(const SHAPE_LINE_CHAIN &aOther) const

References SHAPE_LINE_CHAIN::CompareGeometry(), and m_line.

◆ ContainsSegment()

bool PNS::LINE::ContainsSegment ( SEGMENT aSeg) const
inline

Checks if the segment aSeg is a part of the line.

Definition at line 216 of file pns_line.h.

217  {
218  return std::find( m_segmentRefs.begin(), m_segmentRefs.end(),
219  aSeg ) != m_segmentRefs.end();
220  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

◆ copyLinks()

void PNS::LINE::copyLinks ( const LINE aParent)
private

Copies m_segmentRefs from the line aParent.

Definition at line 118 of file pns_line.cpp.

119 {
120  m_segmentRefs = aParent->m_segmentRefs;
121 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

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

◆ CountCorners()

int PNS::LINE::CountCorners ( int  aAngles) const

Returns the number of corners of angles specified by mask aAngles.

Definition at line 138 of file pns_line.cpp.

139 {
140  int count = 0;
141 
142  for( int i = 0; i < m_line.SegmentCount() - 1; i++ )
143  {
144  const SEG seg1 = m_line.CSegment( i );
145  const SEG seg2 = m_line.CSegment( i + 1 );
146 
147  const DIRECTION_45 dir1( seg1 );
148  const DIRECTION_45 dir2( seg2 );
149 
150  DIRECTION_45::AngleType a = dir1.Angle( dir2 );
151 
152  if( a & aAngles )
153  count++;
154  }
155 
156  return count;
157 }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
DIRECTION_45.
Definition: direction45.h:37
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:39
AngleType
Enum AngleType Represents kind of angle formed by vectors heading in two DIRECTION_45s.
Definition: direction45.h:63
const SEG CSegment(int aIndex) const
Function CSegment()

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

Referenced by PNS::LINE_PLACER::mergeHead(), and PNS::OPTIMIZER::smartPadsSingle().

◆ CPoint()

◆ CSegment()

const SEG PNS::LINE::CSegment ( int  aIdx) const
inline

Returns the aIdx-th segment of the line

Definition at line 165 of file pns_line.h.

166  {
167  return m_line.CSegment( aIdx );
168  }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
const SEG CSegment(int aIndex) const
Function CSegment()

References SHAPE_LINE_CHAIN::CSegment(), and m_line.

Referenced by PNS::SHOVE::checkBumpDirection(), PNS::DIFF_PAIR::EndingPrimitives(), PNS::LINE_PLACER::FixRoute(), PNS::OPTIMIZER::mergeStep(), PNS::LINE_PLACER::optimizeTailHeadTransition(), and PNS::SHOVE::ProcessSingleLine().

◆ DragCorner()

void PNS::LINE::DragCorner ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold = 0,
bool  aFreeAngle = false 
)

Definition at line 477 of file pns_line.cpp.

478 {
479  if( aFreeAngle )
480  {
481  dragCornerFree ( aP, aIndex, aSnappingThreshold );
482  }
483  else
484  {
485  dragCorner45 ( aP, aIndex, aSnappingThreshold );
486  }
487 }
void dragCorner45(const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
Definition: pns_line.cpp:447
void dragCornerFree(const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
Definition: pns_line.cpp:471

References dragCorner45(), and dragCornerFree().

Referenced by PNS::DRAGGER::dragMarkObstacles(), PNS::DRAGGER::dragShove(), and PNS::DRAGGER::dumbDragVia().

◆ dragCorner45()

void PNS::LINE::dragCorner45 ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

Definition at line 447 of file pns_line.cpp.

448 {
449  SHAPE_LINE_CHAIN path;
450 
451  VECTOR2I snapped = snapDraggedCorner( m_line, aP, aIndex, aSnappingThreshold );
452 
453  if( aIndex == 0 )
454  path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse();
455  else if( aIndex == m_line.SegmentCount() )
456  path = dragCornerInternal( m_line, snapped );
457  else
458  {
459  // fixme: awkward behaviour for "outwards" drags
460  path = dragCornerInternal( m_line.Slice( 0, aIndex ), snapped );
461  SHAPE_LINE_CHAIN path_rev = dragCornerInternal( m_line.Slice( aIndex, -1 ).Reverse(),
462  snapped ).Reverse();
463  path.Append( path_rev );
464  }
465 
466  path.Simplify();
467  m_line = path;
468 }
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN dragCornerInternal(const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aP)
Definition: pns_line.cpp:370
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
void Reverse()
Reverses the point/vertex order
Definition: pns_line.cpp:770
int SegmentCount() const
Function SegmentCount()
SHAPE_LINE_CHAIN.
VECTOR2I snapDraggedCorner(const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
Definition: pns_line.cpp:502

References SHAPE_LINE_CHAIN::Append(), PNS::dragCornerInternal(), m_line, Reverse(), SHAPE_LINE_CHAIN::Reverse(), SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::Simplify(), SHAPE_LINE_CHAIN::Slice(), and snapDraggedCorner().

Referenced by DragCorner().

◆ dragCornerFree()

void PNS::LINE::dragCornerFree ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

Definition at line 471 of file pns_line.cpp.

472 {
473  m_line.SetPoint( aIndex, aP );
474  m_line.Simplify();
475 }
void SetPoint(int aIndex, const VECTOR2I &aPos)
Accessor Function to move a point to a specific location.
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()

References m_line, SHAPE_LINE_CHAIN::SetPoint(), and SHAPE_LINE_CHAIN::Simplify().

Referenced by DragCorner().

◆ DragSegment()

void PNS::LINE::DragSegment ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold = 0,
bool  aFreeAngle = false 
)

Definition at line 489 of file pns_line.cpp.

490 {
491  if( aFreeAngle )
492  {
493  assert( false );
494  }
495  else
496  {
497  dragSegment45 ( aP, aIndex, aSnappingThreshold );
498  }
499 }
void dragSegment45(const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
Definition: pns_line.cpp:590

References dragSegment45().

Referenced by PNS::DRAGGER::dragMarkObstacles(), and PNS::DRAGGER::dragShove().

◆ dragSegment45()

void PNS::LINE::dragSegment45 ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

Definition at line 590 of file pns_line.cpp.

591 {
592  SHAPE_LINE_CHAIN path( m_line );
593  VECTOR2I target( aP );
594 
595  SEG guideA[2], guideB[2];
596  int index = aIndex;
597 
598  target = snapToNeighbourSegments( path, aP, aIndex, aSnappingThreshold );
599 
600  if( index == 0 )
601  {
602  path.Insert( 0, path.CPoint( 0 ) );
603  index++;
604  }
605 
606  if( index == path.SegmentCount() - 1 )
607  {
608  path.Insert( path.PointCount() - 1, path.CPoint( -1 ) );
609  }
610 
611  SEG dragged = path.CSegment( index );
612  DIRECTION_45 drag_dir( dragged );
613 
614  SEG s_prev = path.CSegment( index - 1 );
615  SEG s_next = path.CSegment( index + 1 );
616 
617  DIRECTION_45 dir_prev( s_prev );
618  DIRECTION_45 dir_next( s_next );
619 
620  if( dir_prev == drag_dir )
621  {
622  dir_prev = dir_prev.Left();
623  path.Insert( index, path.CPoint( index ) );
624  index++;
625  }
626 
627  if( dir_next == drag_dir )
628  {
629  dir_next = dir_next.Right();
630  path.Insert( index + 1, path.CPoint( index + 1 ) );
631  }
632 
633  s_prev = path.CSegment( index - 1 );
634  s_next = path.CSegment( index + 1 );
635  dragged = path.CSegment( index );
636 
637  const bool lockEndpointA = true;
638  const bool lockEndpointB = true;
639 
640  if( aIndex == 0 )
641  {
642  if( !lockEndpointA )
643  {
644  guideA[0] = guideA[1] = SEG( dragged.A,
645  dragged.A + drag_dir.Right().Right().ToVector() );
646  }
647  else
648  {
649  guideA[0] = SEG( dragged.A, dragged.A + drag_dir.Right().ToVector() );
650  guideA[1] = SEG( dragged.A, dragged.A + drag_dir.Left().ToVector() );
651  }
652  }
653  else
654  {
655  if( dir_prev.Angle( drag_dir ) & (DIRECTION_45::ANG_OBTUSE | DIRECTION_45::ANG_HALF_FULL) )
656  {
657  guideA[0] = SEG( s_prev.A, s_prev.A + drag_dir.Left().ToVector() );
658  guideA[1] = SEG( s_prev.A, s_prev.A + drag_dir.Right().ToVector() );
659  }
660  else
661  guideA[0] = guideA[1] = SEG( dragged.A, dragged.A + dir_prev.ToVector() );
662  }
663 
664  if( aIndex == m_line.SegmentCount() - 1 )
665  {
666  if( !lockEndpointB )
667  {
668  guideB[0] = guideB[1] = SEG( dragged.B,
669  dragged.B + drag_dir.Right().Right().ToVector() );
670  }
671  else
672  {
673  guideB[0] = SEG( dragged.B, dragged.B + drag_dir.Right().ToVector() );
674  guideB[1] = SEG( dragged.B, dragged.B + drag_dir.Left().ToVector() );
675  }
676  }
677  else
678  {
679  if( dir_next.Angle( drag_dir ) & (DIRECTION_45::ANG_OBTUSE | DIRECTION_45::ANG_HALF_FULL) )
680  {
681  guideB[0] = SEG( s_next.B, s_next.B + drag_dir.Left().ToVector() );
682  guideB[1] = SEG( s_next.B, s_next.B + drag_dir.Right().ToVector() );
683  }
684  else
685  guideB[0] = guideB[1] = SEG( dragged.B, dragged.B + dir_next.ToVector() );
686 
687  }
688 
689  SEG s_current( target, target + drag_dir.ToVector() );
690 
691  int best_len = INT_MAX;
692  SHAPE_LINE_CHAIN best;
693 
694  for( int i = 0; i < 2; i++ )
695  {
696  for( int j = 0; j < 2; j++ )
697  {
698  OPT_VECTOR2I ip1 = s_current.IntersectLines( guideA[i] );
699  OPT_VECTOR2I ip2 = s_current.IntersectLines( guideB[j] );
700 
701  SHAPE_LINE_CHAIN np;
702 
703  if( !ip1 || !ip2 )
704  continue;
705 
706  SEG s1( s_prev.A, *ip1 );
707  SEG s2( *ip1, *ip2 );
708  SEG s3( *ip2, s_next.B );
709 
710  OPT_VECTOR2I ip;
711 
712  if( (ip = s1.Intersect( s_next )) )
713  {
714  np.Append( s1.A );
715  np.Append( *ip );
716  np.Append( s_next.B );
717  }
718  else if( (ip = s3.Intersect( s_prev )) )
719  {
720  np.Append( s_prev.A );
721  np.Append( *ip );
722  np.Append( s3.B );
723  }
724  else if( (ip = s1.Intersect( s3 )) )
725  {
726  np.Append( s_prev.A );
727  np.Append( *ip );
728  np.Append( s_next.B );
729  }
730  else
731  {
732  np.Append( s_prev.A );
733  np.Append( *ip1 );
734  np.Append( *ip2 );
735  np.Append( s_next.B );
736  }
737 
738  if( np.Length() < best_len )
739  {
740  best_len = np.Length();
741  best = np;
742  }
743  }
744  }
745 
746  if( !lockEndpointA && aIndex == 0 )
747  best.Remove( 0, 0 );
748  if( !lockEndpointB && aIndex == m_line.SegmentCount() - 1 )
749  best.Remove( -1, -1 );
750 
751  if( m_line.PointCount() == 1 )
752  m_line = best;
753  else if( aIndex == 0 )
754  m_line.Replace( 0, 1, best );
755  else if( aIndex == m_line.SegmentCount() - 1 )
756  m_line.Replace( -2, -1, best );
757  else
758  m_line.Replace( aIndex, aIndex + 1, best );
759 
760  m_line.Simplify();
761 }
long long int Length() const
Function Length()
int PointCount() const
Function PointCount()
VECTOR2I snapToNeighbourSegments(const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
Definition: pns_line.cpp:544
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:37
DIRECTION_45.
Definition: direction45.h:37
void Remove(int aStartIndex, int aEndIndex)
Function Remove()
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:39
SHAPE_LINE_CHAIN.
VECTOR2I A
Definition: seg.h:47
void Replace(int aStartIndex, int aEndIndex, const VECTOR2I &aP)
Function Replace()
VECTOR2I B
Definition: seg.h:48

References SEG::A, DIRECTION_45::ANG_HALF_FULL, DIRECTION_45::ANG_OBTUSE, DIRECTION_45::Angle(), SHAPE_LINE_CHAIN::Append(), SEG::B, SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CSegment(), SHAPE_LINE_CHAIN::Insert(), SEG::Intersect(), DIRECTION_45::Left(), SHAPE_LINE_CHAIN::Length(), m_line, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::Remove(), SHAPE_LINE_CHAIN::Replace(), DIRECTION_45::Right(), SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::Simplify(), snapToNeighbourSegments(), and DIRECTION_45::ToVector().

Referenced by DragSegment().

◆ dragSegmentFree()

void PNS::LINE::dragSegmentFree ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

◆ EndsWithVia()

◆ GetLink()

SEGMENT* PNS::LINE::GetLink ( int  aIndex) const
inline

Definition at line 222 of file pns_line.h.

223  {
224  return m_segmentRefs[aIndex];
225  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

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

◆ HasLockedSegments()

bool PNS::LINE::HasLockedSegments ( ) const

Definition at line 956 of file pns_line.cpp.

957 {
958  for( const SEGMENT* seg : m_segmentRefs )
959  {
960  if( seg->Marker() & MK_LOCKED )
961  return true;
962  }
963  return false;
964 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs, and PNS::MK_LOCKED.

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

◆ HasLoops()

bool PNS::LINE::HasLoops ( ) const

Definition at line 840 of file pns_line.cpp.

841 {
842  for( int i = 0; i < PointCount(); i++ )
843  {
844  for( int j = i + 2; j < PointCount(); j++ )
845  {
846  if( CPoint( i ) == CPoint( j ) )
847  return true;
848  }
849  }
850 
851  return false;
852 }
int PointCount() const
Returns the number of points in the line
Definition: pns_line.h:153
const VECTOR2I & CPoint(int aIdx) const
Returns the aIdx-th point of the line
Definition: pns_line.h:159

References CPoint(), and PointCount().

Referenced by PNS::SHOVE::onCollidingSolid(), and PNS::LINE_PLACER::rhShoveOnly().

◆ Hull()

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

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

Definition at line 112 of file pns_item.h.

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

◆ Is45Degree()

bool PNS::LINE::Is45Degree ( ) const

Definition at line 303 of file pns_line.cpp.

304 {
305  for( int i = 0; i < m_line.SegmentCount(); i++ )
306  {
307  const SEG& s = m_line.CSegment( i );
308 
309  if( s.Length() < 10 )
310  continue;
311 
312  double angle = 180.0 / M_PI *
313  atan2( (double) s.B.y - (double) s.A.y,
314  (double) s.B.x - (double) s.A.x );
315 
316  if( angle < 0 )
317  angle += 360.0;
318 
319  double angle_a = fabs( fmod( angle, 45.0 ) );
320 
321  if( angle_a > 1.0 && angle_a < 44.0 )
322  return false;
323  }
324 
325  return true;
326 }
int Length() const
Function Length()
Definition: seg.h:299
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:39
const SEG CSegment(int aIndex) const
Function CSegment()
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
VECTOR2I A
Definition: seg.h:47
VECTOR2I B
Definition: seg.h:48

References SEG::A, PNS::angle(), SEG::B, SHAPE_LINE_CHAIN::CSegment(), SEG::Length(), m_line, SHAPE_LINE_CHAIN::SegmentCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ IsLinked()

bool PNS::LINE::IsLinked ( ) const
inline

Definition at line 205 of file pns_line.h.

206  {
207  return m_segmentRefs.size() != 0;
208  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

Referenced by PNS::NODE::Add(), ClipVertexRange(), PNS::TOPOLOGY::followTrivialPath(), IsLinkedChecked(), PNS::DIFF_PAIR::NLine(), PNS::DIFF_PAIR::PLine(), Rank(), PNS::OPTIMIZER::removeCachedSegments(), ShowLinks(), and PNS::TOPOLOGY::SimplifyLine().

◆ IsLinkedChecked()

bool PNS::LINE::IsLinkedChecked ( ) const
inline

Definition at line 210 of file pns_line.h.

211  {
212  return IsLinked() && LinkCount() == SegmentCount();
213  }
int SegmentCount() const
Returns the number of segments in the line
Definition: pns_line.h:147
bool IsLinked() const
Definition: pns_line.h:205
int LinkCount() const
Returns the number of segments that were assembled together to form this line.
Definition: pns_line.h:231

References IsLinked(), LinkCount(), and SegmentCount().

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

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

◆ Line()

◆ LinkCount()

int PNS::LINE::LinkCount ( ) const
inline

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

Definition at line 231 of file pns_line.h.

232  {
233  return m_segmentRefs.size();
234  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

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

◆ LinkedSegments()

SEGMENT_REFS& PNS::LINE::LinkedSegments ( )
inline

Returns the list of segments from the owning node that constitute this line (or NULL if the line is not linked)

Definition at line 200 of file pns_line.h.

201  {
202  return m_segmentRefs;
203  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

Referenced by PNS::NODE::Dump(), PNS::TOPOLOGY::followTrivialPath(), PNS::SHOVE::popLineStack(), PNS::SHOVE::ProcessSingleLine(), PNS::NODE::Remove(), PNS::OPTIMIZER::removeCachedSegments(), and PNS::SHOVE::unwindLineStack().

◆ LinkSegment()

void PNS::LINE::LinkSegment ( SEGMENT aSeg)
inline

Adds a reference to a segment registered in a NODE that is a part of this line.

Definition at line 193 of file pns_line.h.

194  {
195  m_segmentRefs.push_back( aSeg );
196  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_segmentRefs.

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

◆ Mark()

void PNS::LINE::Mark ( int  aMarker)
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 86 of file pns_line.cpp.

87 {
88  m_marker = aMarker;
89 
90  for( SEGMENT* s : m_segmentRefs )
91  s->Mark( aMarker );
92 
93 }
int m_marker
Definition: pns_item.h:256
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References PNS::ITEM::m_marker, and m_segmentRefs.

Referenced by PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::ProcessSingleLine(), PNS::SHOVE::ShoveLines(), and PNS::SHOVE::ShoveMultiLines().

◆ Marker()

int PNS::LINE::Marker ( ) const
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 105 of file pns_line.cpp.

106 {
107  int marker = m_marker;
108 
109  for( SEGMENT* s : m_segmentRefs )
110  {
111  marker |= s->Marker();
112  }
113 
114  return marker;
115 }
int m_marker
Definition: pns_item.h:256
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References PNS::ITEM::m_marker, and m_segmentRefs.

Referenced by PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::processHullSet(), PNS::SHOVE::ProcessSingleLine(), and PNS::SEGMENT::SEGMENT().

◆ Net()

◆ OfKind()

◆ operator=()

LINE & PNS::LINE::operator= ( const LINE aOther)

Definition at line 59 of file pns_line.cpp.

60 {
61  m_line = aOther.m_line;
62  m_width = aOther.m_width;
63  m_net = aOther.m_net;
64  m_movable = aOther.m_movable;
65  m_layers = aOther.m_layers;
66  m_via = aOther.m_via;
67  m_hasVia = aOther.m_hasVia;
68  m_marker = aOther.m_marker;
69  m_rank = aOther.m_rank;
70  m_owner = aOther.m_owner;
71 
72  copyLinks( &aOther );
73 
74  return *this;
75 }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:319
NODE * m_owner
Definition: pns_item.h:251
LAYER_RANGE m_layers
Definition: pns_item.h:252
int m_rank
Definition: pns_item.h:257
bool m_movable
Definition: pns_item.h:254
int m_marker
Definition: pns_item.h:256
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
void copyLinks(const LINE *aParent)
Copies m_segmentRefs from the line aParent.
Definition: pns_line.cpp:118
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:316
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:313

References copyLinks(), m_hasVia, PNS::ITEM::m_layers, m_line, PNS::ITEM::m_marker, PNS::ITEM::m_movable, PNS::ITEM::m_net, PNS::ITEM::m_owner, PNS::ITEM::m_rank, m_via, and m_width.

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

◆ PointCount()

int PNS::LINE::PointCount ( ) const
inline

◆ Rank()

int PNS::LINE::Rank ( ) const
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 801 of file pns_line.cpp.

802 {
803  int min_rank = INT_MAX;
804 
805  if( IsLinked() ) {
806  for( SEGMENT *s : m_segmentRefs )
807  {
808  min_rank = std::min( min_rank, s->Rank() );
809  }
810  } else {
811  min_rank = m_rank;
812  }
813 
814  int rank = ( min_rank == INT_MAX ) ? -1 : min_rank;
815 
816  return rank;
817 }
int m_rank
Definition: pns_item.h:257
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307
bool IsLinked() const
Definition: pns_line.h:205

References IsLinked(), PNS::ITEM::m_rank, and m_segmentRefs.

Referenced by PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onCollidingVia(), PNS::SHOVE::onReverseCollidingVia(), PNS::SEGMENT::SEGMENT(), and PNS::SHOVE::shoveIteration().

◆ RemoveVia()

void PNS::LINE::RemoveVia ( )
inline

Definition at line 270 of file pns_line.h.

270 { m_hasVia = false; }
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:316

References m_hasVia.

Referenced by ClipToNearestObstacle(), PNS::LINE_PLACER::initPlacement(), PNS::SHOVE::onReverseCollidingVia(), and PNS::LINE_PLACER::ToggleVia().

◆ Reverse()

void PNS::LINE::Reverse ( )

Reverses the point/vertex order

Definition at line 770 of file pns_line.cpp.

771 {
772  m_line = m_line.Reverse();
773 
774  std::reverse( m_segmentRefs.begin(), m_segmentRefs.end() );
775 }
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References m_line, m_segmentRefs, and SHAPE_LINE_CHAIN::Reverse().

Referenced by AppendVia(), dragCorner45(), PNS::DRAGGER::findViaFanoutByHandle(), and PNS::TOPOLOGY::followTrivialPath().

◆ SegmentCount()

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

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

◆ SetRank()

void PNS::LINE::SetRank ( int  aRank)
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 791 of file pns_line.cpp.

792 {
793  m_rank = aRank;
794 
795  for( SEGMENT* s : m_segmentRefs )
796  s->SetRank( aRank );
797 
798 }
int m_rank
Definition: pns_item.h:257
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References PNS::ITEM::m_rank, and m_segmentRefs.

Referenced by PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onReverseCollidingVia(), PNS::SHOVE::ShoveLines(), and PNS::SHOVE::ShoveMultiLines().

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

◆ SetWidth()

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

Sets line width

Definition at line 171 of file pns_line.h.

172  {
173  m_width = aWidth;
174  m_line.SetWidth( aWidth );
175  }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310
void SetWidth(int aWidth)
Sets the width of all segments in the chain.
int m_width
our width
Definition: pns_line.h:313

References m_line, m_width, and SHAPE_LINE_CHAIN::SetWidth().

Referenced by PNS::NODE::AssembleLine(), PNS::LINE_PLACER::initPlacement(), and PNS::DIFF_PAIR::updateLine().

◆ Shape()

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

Returns the shape of the line

Reimplemented from PNS::ITEM.

Definition at line 129 of file pns_line.h.

130  {
131  return &m_line;
132  }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:310

References m_line.

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

◆ ShowLinks()

void PNS::LINE::ShowLinks ( ) const

Prints out all linked segments

Definition at line 355 of file pns_line.cpp.

356 {
357  if( !IsLinked() )
358  {
359  wxLogTrace( "PNS", "line %p: no links", this );
360  return;
361  }
362 
363  wxLogTrace( "PNS", "line %p: %d linked segs", this, (int) m_segmentRefs.size() );
364 
365  for( int i = 0; i < (int) m_segmentRefs.size(); i++ )
366  wxLogTrace( "PNS", "seg %d: %p\n", i, m_segmentRefs[i] );
367 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307
bool IsLinked() const
Definition: pns_line.h:205

References IsLinked(), and m_segmentRefs.

◆ snapDraggedCorner()

VECTOR2I PNS::LINE::snapDraggedCorner ( const SHAPE_LINE_CHAIN aPath,
const VECTOR2I aP,
int  aIndex,
int  aThreshold 
) const
private

Definition at line 502 of file pns_line.cpp.

504 {
505  int s_start = std::max( aIndex - 2, 0 );
506  int s_end = std::min( aIndex + 2, aPath.SegmentCount() - 1 );
507 
508  int i, j;
509  int best_dist = INT_MAX;
510  VECTOR2I best_snap = aP;
511 
512  if( aThreshold <= 0 )
513  return aP;
514 
515  for( i = s_start; i <= s_end; i++ )
516  {
517  const SEG& a = aPath.CSegment( i );
518 
519  for( j = s_start; j < i; j++ )
520  {
521  const SEG& b = aPath.CSegment( j );
522 
523  if( !( DIRECTION_45( a ).IsObtuse(DIRECTION_45( b ) ) ) )
524  continue;
525 
526  OPT_VECTOR2I ip = a.IntersectLines(b);
527 
528  if( ip )
529  {
530  int dist = ( *ip - aP ).EuclideanNorm();
531 
532  if( dist < aThreshold && dist < best_dist )
533  {
534  best_dist = dist;
535  best_snap = *ip;
536  }
537  }
538  }
539  }
540 
541  return best_snap;
542 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:123
static const int dist[10][10]
Definition: ar_matrix.cpp:326
OPT_VECTOR2I IntersectLines(const SEG &aSeg) const
Function IntersectLines()
Definition: seg.h:186
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:37
DIRECTION_45.
Definition: direction45.h:37
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:39
const SEG CSegment(int aIndex) const
Function CSegment()

References SHAPE_LINE_CHAIN::CSegment(), dist, EuclideanNorm(), SEG::IntersectLines(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by dragCorner45().

◆ snapToNeighbourSegments()

VECTOR2I PNS::LINE::snapToNeighbourSegments ( const SHAPE_LINE_CHAIN aPath,
const VECTOR2I aP,
int  aIndex,
int  aThreshold 
) const
private

Definition at line 544 of file pns_line.cpp.

546 {
547  VECTOR2I snap_p[2];
548  DIRECTION_45 dragDir( aPath.CSegment( aIndex ) );
549  int snap_d[2] = { -1, -1 };
550 
551  if( aThreshold == 0 )
552  return aP;
553 
554  if( aIndex >= 2 )
555  {
556  SEG s = aPath.CSegment( aIndex - 2 );
557 
558  if( DIRECTION_45( s ) == dragDir )
559  snap_d[0] = s.LineDistance( aP );
560 
561  snap_p[0] = s.A;
562  }
563 
564  if( aIndex < aPath.SegmentCount() - 2 )
565  {
566  SEG s = aPath.CSegment( aIndex + 2 );
567 
568  if( DIRECTION_45( s ) == dragDir )
569  snap_d[1] = s.LineDistance(aP);
570 
571  snap_p[1] = s.A;
572  }
573 
574  VECTOR2I best = aP;
575  int minDist = INT_MAX;
576 
577  for( int i = 0; i < 2; i++ )
578  {
579  if( snap_d[i] >= 0 && snap_d[i] < minDist && snap_d[i] <= aThreshold )
580  {
581  minDist = snap_d[i];
582  best = snap_p[i];
583  }
584  }
585 
586  return best;
587 }
int LineDistance(const VECTOR2I &aP, bool aDetermineSide=false) const
Function LineDistance()
Definition: seg.h:360
DIRECTION_45.
Definition: direction45.h:37
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:39
const SEG CSegment(int aIndex) const
Function CSegment()
VECTOR2I A
Definition: seg.h:47

References SEG::A, SHAPE_LINE_CHAIN::CSegment(), SEG::LineDistance(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by dragSegment45().

◆ Unmark()

void PNS::LINE::Unmark ( int  aMarker = -1)
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 96 of file pns_line.cpp.

97 {
98  for( SEGMENT* s : m_segmentRefs )
99  s->Unmark( aMarker );
100 
101  m_marker = 0;
102 }
int m_marker
Definition: pns_item.h:256
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:307

References PNS::ITEM::m_marker, and m_segmentRefs.

Referenced by PNS::DRAGGER::dragShove(), and PNS::SHOVE::onCollidingSolid().

◆ Via()

◆ Walkaround() [1/2]

bool PNS::LINE::Walkaround ( SHAPE_LINE_CHAIN  aObstacle,
SHAPE_LINE_CHAIN aPre,
SHAPE_LINE_CHAIN aWalk,
SHAPE_LINE_CHAIN aPost,
bool  aCw 
) const

Calculates a line thightly wrapping a convex hull of an obstacle object (aObstacle).

aPrePath = path from origin to the obstacle aWalkaroundPath = path around the obstacle aPostPath = past from obstacle till the end aCW = whether to walk around in clockwise or counter-clockwise direction.

Definition at line 160 of file pns_line.cpp.

162 {
163  const SHAPE_LINE_CHAIN& line( CLine() );
164 
165  if( line.SegmentCount() < 1 )
166  return false;
167 
168  const auto pFirst = line.CPoint(0);
169  const auto pLast = line.CPoint(-1);
170 
171  if( aObstacle.PointInside( line.CPoint( 0 ) ) || aObstacle.PointInside( line.CPoint( -1 ) ) )
172  {
173  return false;
174  }
175 
177 
178  line.Intersect( aObstacle, ips );
179 
180  auto eFirst = aObstacle.EdgeContainingPoint( pFirst );
181  auto eLast = aObstacle.EdgeContainingPoint( pLast );
182 
183  aWalk.Clear();
184  aPost.Clear();
185 
186  int nearest_dist = INT_MAX;
187  int farthest_dist = 0;
188 
189  SHAPE_LINE_CHAIN::INTERSECTION nearest, farthest;
191 
192  if( eFirst >= 0 )
193  {
194  is.our = line.CSegment(0);
195  is.their = aObstacle.CSegment( eFirst );
196  is.p = pFirst;
197  ips.push_back(is);
198  }
199 
200  if ( eLast >= 0 )
201  {
202  is.our = line.CSegment(-1);
203  is.their = aObstacle.CSegment( eLast );
204  is.p = pLast;
205  ips.push_back(is);
206  }
207 
208  for( int i = 0; i < (int) ips.size(); i++ )
209  {
210  const VECTOR2I p = ips[i].p;
211  int dist = line.PathLength( p );
212 
213  if( dist < 0 )
214  return false;
215 
216  if( dist <= nearest_dist )
217  {
218  nearest_dist = dist;
219  nearest = ips[i];
220  }
221 
222  if( dist >= farthest_dist )
223  {
224  farthest_dist = dist;
225  farthest = ips[i];
226  }
227  }
228 
229  if( ips.size() <= 1 || nearest.p == farthest.p )
230  {
231  aPre = line;
232  return true;
233  }
234 
235  aPre = line.Slice( 0, nearest.our.Index() );
236  aPre.Append( nearest.p );
237  aPre.Simplify();
238 
239  aWalk.Clear();
240  aWalk.SetClosed( false );
241  aWalk.Append( nearest.p );
242 
243  assert( nearest.their.Index() >= 0 );
244  assert( farthest.their.Index() >= 0 );
245 
246  assert( nearest_dist <= farthest_dist );
247 
248  aObstacle.Split( nearest.p );
249  aObstacle.Split( farthest.p );
250 
251  int i_first = aObstacle.Find( nearest.p );
252  int i_last = aObstacle.Find( farthest.p );
253 
254  int i = i_first;
255 
256  if( i_first < 0 || i_last < 0 )
257  return false;
258 
259  while( i != i_last )
260  {
261  aWalk.Append( aObstacle.CPoint( i ) );
262  i += ( aCw ? 1 : -1 );
263 
264  if( i < 0 )
265  i = aObstacle.PointCount() - 1;
266  else if( i == aObstacle.PointCount() )
267  i = 0;
268  }
269 
270  aWalk.Append( farthest.p );
271  aWalk.Simplify();
272 
273  aPost.Clear();
274  aPost.Append( farthest.p );
275  aPost.Append( line.Slice( farthest.our.Index() + 1, -1 ) );
276  aPost.Simplify();
277 
278  return true;
279 }
int Find(const VECTOR2I &aP) const
Function Find()
const SHAPE_LINE_CHAIN & CLine() const
Const accessor to the underlying shape
Definition: pns_line.h:141
int Index() const
Function Index()
Definition: seg.h:317
int Split(const VECTOR2I &aP)
Function Split()
int EdgeContainingPoint(const VECTOR2I &aP, int aAccuracy=0) const
Function EdgeContainingPoint()
std::vector< INTERSECTION > INTERSECTIONS
static const int dist[10][10]
Definition: ar_matrix.cpp:326
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
VECTOR2I p
point of intersection between our and their.
int PointCount() const
Function PointCount()
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
void SetClosed(bool aClosed)
Function SetClosed()
SEG their
segment belonging from the aOther argument of Intersect()
const SEG CSegment(int aIndex) const
Function CSegment()
SHAPE_LINE_CHAIN.
void Clear()
Function Clear() Removes all points from the line chain.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Function PointInside()
SEG our
segment belonging from the (this) argument of Intersect()

References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::Clear(), CLine(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CSegment(), dist, SHAPE_LINE_CHAIN::EdgeContainingPoint(), SHAPE_LINE_CHAIN::Find(), SEG::Index(), SHAPE_LINE_CHAIN::Intersect(), SHAPE_LINE_CHAIN::INTERSECTION::our, SHAPE_LINE_CHAIN::INTERSECTION::p, SHAPE_LINE_CHAIN::PathLength(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::PointInside(), SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::SetClosed(), SHAPE_LINE_CHAIN::Simplify(), SHAPE_LINE_CHAIN::Slice(), SHAPE_LINE_CHAIN::Split(), and SHAPE_LINE_CHAIN::INTERSECTION::their.

Referenced by PNS::SHOVE::processHullSet(), PNS::WALKAROUND::singleStep(), Walkaround(), and PNS::SHOVE::walkaroundLoneVia().

◆ Walkaround() [2/2]

bool PNS::LINE::Walkaround ( const SHAPE_LINE_CHAIN aObstacle,
SHAPE_LINE_CHAIN aPath,
bool  aCw 
) const

Definition at line 282 of file pns_line.cpp.

283 {
284  SHAPE_LINE_CHAIN walk, post;
285 
286  if( ! Walkaround( aObstacle, aPath, walk, post, aCw ) )
287  return false;
288 
289  aPath.Append( walk );
290  aPath.Append( post );
291  aPath.Simplify();
292 
293  return true;
294 }
bool Walkaround(SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aWalk, SHAPE_LINE_CHAIN &aPost, bool aCw) const
Calculates a line thightly wrapping a convex hull of an obstacle object (aObstacle).
Definition: pns_line.cpp:160
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
SHAPE_LINE_CHAIN.

References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::Simplify(), and Walkaround().

◆ Width()

Member Data Documentation

◆ m_hasVia

bool PNS::LINE::m_hasVia
private

If true, the line ends with a via

Definition at line 316 of file pns_line.h.

Referenced by AppendVia(), EndsWithVia(), LINE(), operator=(), and RemoveVia().

◆ m_kind

PnsKind PNS::ITEM::m_kind
protectedinherited

◆ m_layers

◆ m_line

◆ m_marker

◆ m_movable

bool PNS::ITEM::m_movable
protectedinherited

Definition at line 254 of file pns_item.h.

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

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

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

◆ m_segmentRefs

SEGMENT_REFS PNS::LINE::m_segmentRefs
private

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 307 of file pns_line.h.

Referenced by ClearSegmentLinks(), ClipVertexRange(), ContainsSegment(), copyLinks(), GetLink(), HasLockedSegments(), IsLinked(), LinkCount(), LinkedSegments(), LinkSegment(), Mark(), Marker(), Rank(), Reverse(), SetRank(), ShowLinks(), and Unmark().

◆ m_via

VIA PNS::LINE::m_via
private

Via at the end point, if m_hasVia == true

Definition at line 319 of file pns_line.h.

Referenced by AppendVia(), LINE(), operator=(), and Via().

◆ m_width

int PNS::LINE::m_width
private

our width

Definition at line 313 of file pns_line.h.

Referenced by LINE(), operator=(), SetShape(), SetWidth(), and Width().

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