25 #include <math/vector2d.h>
27 #include <geometry/direction45.h>
28 #include <geometry/seg.h>
29 #include <geometry/shape.h>
30 #include <geometry/shape_line_chain.h>
58 #define PNS_HULL_MARGIN 10
63 typedef std::vector<SEGMENT*> SEGMENT_REFS;
85 m_width( aBase.m_width )
88 m_layers = aBase.m_layers;
94 static inline bool ClassOf(
const ITEM* aItem )
96 return aItem && LINE_T == aItem->
Kind();
102 const LINE& operator=(
const LINE& aOther );
143 return m_line.
CPoint( aIdx );
176 m_segmentRefs.push_back( aSeg );
183 return m_segmentRefs;
186 bool IsLinked()
const
188 return m_segmentRefs.size() != 0;
191 bool IsLinkedChecked()
const
199 return std::find( m_segmentRefs.begin(), m_segmentRefs.end(),
200 aSeg ) != m_segmentRefs.end();
203 SEGMENT* GetLink(
int aIndex )
const
205 return m_segmentRefs[aIndex];
214 return m_segmentRefs.size();
243 bool Is45Degree()
const;
248 bool EndsWithVia()
const {
return m_hasVia; }
250 void AppendVia(
const VIA& aVia );
251 void RemoveVia() { m_hasVia =
false; }
253 const VIA& Via()
const {
return m_via; }
255 virtual void Mark(
int aMarker )
override;
256 virtual void Unmark(
int aMarker = -1 )
override;
257 virtual int Marker()
const override;
259 void DragSegment(
const VECTOR2I& aP,
int aIndex,
int aSnappingThreshold = 0,
bool aFreeAngle =
false );
260 void DragCorner(
const VECTOR2I& aP,
int aIndex,
int aSnappingThreshold = 0,
bool aFreeAngle =
false );
262 void SetRank(
int aRank )
override;
263 int Rank()
const override;
265 bool HasLoops()
const;
266 bool HasLockedSegments()
const;
268 OPT_BOX2I ChangedArea(
const LINE* aOther )
const;
272 void dragSegment45(
const VECTOR2I& aP,
int aIndex,
int aSnappingThreshold );
273 void dragCorner45(
const VECTOR2I& aP,
int aIndex,
int aSnappingThreshold );
274 void dragSegmentFree(
const VECTOR2I& aP,
int aIndex,
int aSnappingThreshold );
275 void dragCornerFree(
const VECTOR2I& aP,
int aIndex,
int aSnappingThreshold );
278 int aIndex,
int aThreshold)
const;
281 int aIndex,
int aThreshold )
const;
284 void copyLinks(
const LINE* aParent ) ;
288 SEGMENT_REFS m_segmentRefs;
305 #endif // __PNS_LINE_H
Definition: pns_line.h:60
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:158
void LinkSegment(SEGMENT *aSeg)
Adds a reference to a segment registered in a NODE that is a part of this line.
Definition: pns_line.h:174
int CountCorners(int aAngles) const
Returns the number of corners of angles specified by mask aAngles.
Definition: pns_line.cpp:136
const SHAPE_LINE_CHAIN & CLine() const
Const accessor to the underlying shape
Definition: pns_line.h:123
Definition: pns_segment.h:38
int SegmentCount() const
Function SegmentCount()
Definition: shape_line_chain.h:171
const SEG CSegment(int aIndex) const
Function CSegment()
Definition: shape_line_chain.h:218
const VECTOR2I & CPoint(int aIdx) const
Returns the aIdx-th point of the line
Definition: pns_line.h:141
void SetShape(const SHAPE_LINE_CHAIN &aLine)
Assigns a shape to the line (a polyline/line chain)
Definition: pns_line.h:105
void Reverse()
Reverses the point/vertex order
Definition: pns_line.cpp:733
const LINE ClipToNearestObstacle(NODE *aNode) const
Clips the line to the nearest obstacle, traversing from the line's start vertex (0).
Definition: pns_line.cpp:302
void SetWidth(int aWidth)
Sets line width
Definition: pns_line.h:153
void ClipVertexRange(int aStart, int aEnd)
Clips the line to a given range of vertices.
Definition: pns_line.cpp:783
int PointCount() const
Returns the number of points in the line
Definition: pns_line.h:135
const SHAPE * Shape() const override
Returns the shape of the line
Definition: pns_line.h:111
int PointCount() const
Function PointCount()
Definition: shape_line_chain.h:186
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
Definition: shape_line_chain.h:253
bool ContainsSegment(SEGMENT *aSeg) const
Checks if the segment aSeg is a part of the line.
Definition: pns_line.h:197
Class ITEM.
Definition: pns_item.h:54
void ClearSegmentLinks()
Erases the linking information. Used to detach the line from the owning node.
Definition: pns_line.cpp:818
SEGMENT_REFS & LinkedSegments()
Returns the list of segments from the owning node that constitute this line (or NULL if the line is n...
Definition: pns_line.h:181
SHAPE_LINE_CHAIN & Line()
Modifiable accessor to the underlying shape
Definition: pns_line.h:117
void ShowLinks() const
Prints out all linked segments
Definition: pns_line.cpp:328
Class NODE.
Definition: pns_node.h:136
Class SHAPE_LINE_CHAIN.
Definition: shape_line_chain.h:47
PnsKind Kind() const
Function Kind()
Definition: pns_item.h:123
Class SHAPE.
Definition: shape.h:58
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.
Definition: pns_line.h:82
virtual LINE * Clone() const override
Function Clone()
Definition: pns_line.cpp:76
int LinkCount() const
Returns the number of segments that were assembled together to form this line.
Definition: pns_line.h:212
bool CompareGeometry(const LINE &aOther)
Returns true if the line is geometrically identical as line aOther
Definition: pns_line.cpp:727
LINE()
Constructor Makes an empty line.
Definition: pns_line.h:69
int Width() const
Returns line width
Definition: pns_line.h:159
int SegmentCount() const
Returns the number of segments in the line
Definition: pns_line.h:129
const SEG CSegment(int aIdx) const
Returns the aIdx-th segment of the line
Definition: pns_line.h:147