27#include <math/vector2d.h>
29#include <geometry/direction45.h>
30#include <geometry/seg.h>
31#include <geometry/shape.h>
32#include <geometry/shape_line_chain.h>
36#include "pns_link_holder.h"
44#define PNS_HULL_MARGIN 10
68 m_blockingObstacle( nullptr )
83 m_width( aBase.m_width ),
84 m_snapThreshhold( aBase.m_snapThreshhold ),
85 m_blockingObstacle( nullptr )
88 m_layers = aBase.m_layers;
97 m_blockingObstacle( nullptr )
101 m_width = aVia.Diameter();
103 m_layers = aVia.Layers();
104 m_rank = aVia.Rank();
105 m_snapThreshhold = 0;
110 static inline bool ClassOf(
const ITEM* aItem )
112 return aItem && LINE_T == aItem->
Kind();
118 LINE& operator=(
const LINE& aOther );
139 int SegmentCount()
const {
return m_line.
SegmentCount(); }
140 int PointCount()
const {
return m_line.
PointCount(); }
141 int ArcCount()
const {
return m_line.ArcCount(); }
145 const VECTOR2I& CPoint(
int aIdx )
const {
return m_line.
CPoint( aIdx ); }
156 int Width()
const {
return m_width; }
172 int CountCorners(
int aAngles )
const;
189 void ShowLinks()
const;
191 bool EndsWithVia()
const {
return m_hasVia; }
193 void AppendVia(
const VIA& aVia );
194 void RemoveVia() { m_hasVia =
false; }
196 const VIA& Via()
const {
return m_via; }
198 void SetViaDiameter(
int aDiameter ) { m_via.SetDiameter( aDiameter ); }
199 void SetViaDrill(
int aDrill ) { m_via.SetDrill( aDrill ); }
201 virtual void Mark(
int aMarker )
const override;
202 virtual void Unmark(
int aMarker = -1 )
const override;
203 virtual int Marker()
const override;
205 void SetBlockingObstacle( ITEM* aObstacle ) { m_blockingObstacle = aObstacle; }
206 ITEM* GetBlockingObstacle()
const {
return m_blockingObstacle; }
208 void DragSegment(
const VECTOR2I& aP,
int aIndex,
bool aFreeAngle =
false );
209 void DragCorner(
const VECTOR2I& aP,
int aIndex,
bool aFreeAngle =
false );
211 void SetRank(
int aRank )
override;
212 int Rank()
const override;
214 bool HasLoops()
const;
215 bool HasLockedSegments()
const;
219 OPT_BOX2I ChangedArea(
const LINE* aOther )
const;
221 void SetSnapThreshhold(
int aThreshhold )
223 m_snapThreshhold = aThreshhold;
226 int GetSnapThreshhold()
const
228 return m_snapThreshhold;
232 void dragSegment45(
const VECTOR2I& aP,
int aIndex );
233 void dragCorner45(
const VECTOR2I& aP,
int aIndex );
234 void dragSegmentFree(
const VECTOR2I& aP,
int aIndex );
235 void dragCornerFree(
const VECTOR2I& aP,
int aIndex );
247 int m_snapThreshhold;
252 ITEM* m_blockingObstacle;
Base class for PNS router board items.
Definition pns_item.h:57
PnsKind Kind() const
Return the type (kind) of the item.
Definition pns_item.h:131
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition pns_line.h:61
LINE(const VIA &aVia)
Construct a LINE for a lone VIA (ie a stitching via).
Definition pns_line.h:95
const SHAPE * Shape() const override
Modifiable accessor to the underlying shape.
Definition pns_line.h:133
void SetShape(const SHAPE_LINE_CHAIN &aLine)
Return the shape of the line.
Definition pns_line.h:126
void ClipVertexRange(int aStart, int aEnd)
Return the number of corners of angles specified by mask aAngles.
Definition pns_line.cpp:1088
LINE(const LINE &aBase, const SHAPE_LINE_CHAIN &aLine)
Copy properties (net, layers, etc.) from a base line and replaces the shape by another.
Definition pns_line.h:80
LINE()
Makes an empty line.
Definition pns_line.h:66
virtual LINE * Clone() const override
Return a deep copy of the item.
Definition pns_line.cpp:81
void Reverse()
Clip the line to the nearest obstacle, traversing from the line's start vertex (0).
Definition pns_line.cpp:1038
const LINE ClipToNearestObstacle(NODE *aNode) const
Clip the line to a given range of vertices.
Definition pns_line.cpp:566
bool IsLinkedChecked() const
Assign a shape to the line (a polyline/line chain).
Definition pns_line.h:120
bool Is45Degree() const
Print out all linked segments.
Definition pns_line.cpp:537
bool CompareGeometry(const LINE &aOther)
Reverse the point/vertex order.
Definition pns_line.cpp:1032
int ShapeCount() const
Return the aIdx-th point of the line.
Definition pns_line.h:142
void SetWidth(int aWidth)
Return line width.
Definition pns_line.h:149
bool Walkaround(SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aWalk, SHAPE_LINE_CHAIN &aPost, bool aCw) const
Calculate a line tightly wrapping a convex hull of an obstacle object (aObstacle).
const SEG CSegment(int aIdx) const
Set line width.
Definition pns_line.h:146
int Width() const
Return true if the line is geometrically identical as line aOther.
Definition pns_line.h:156
Definition pns_link_holder.h:34
bool IsLinked() const
Check if the segment aLink is a part of the line.
Definition pns_link_holder.h:52
Keep the router "world" - i.e.
Definition pns_node.h:148
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Definition shape_line_chain.h:81
int ShapeCount() const
Return the number of shapes (line segments or arcs) in this line chain.
Definition shape_line_chain.cpp:903
int PointCount() const
Return the number of points (vertices) in this line chain.
Definition shape_line_chain.h:318
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Definition shape_line_chain.h:393
int SegmentCount() const
Return the number of segments in this line chain.
Definition shape_line_chain.h:295
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
Definition shape_line_chain.h:348
void SetWidth(int aWidth)
Set the width of all segments in the chain.
Definition shape_line_chain.h:275
An abstract shape on 2D plane.
Definition shape.h:117