Horizon
Loading...
Searching...
No Matches
PNS::LINE Class Reference

Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads, junctions between multiple traces or two traces different widths and combinations of these). More...

#include <pns_line.h>

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

Public Member Functions

 LINE ()
 Makes an empty line.
 LINE (const LINE &aOther)
 LINE (const LINE &aBase, const SHAPE_LINE_CHAIN &aLine)
 Copy properties (net, layers, etc.) from a base line and replaces the shape by another.
 LINE (const VIA &aVia)
 Construct a LINE for a lone VIA (ie a stitching via).
virtual LINEClone () const override
 Return a deep copy of the item.
LINEoperator= (const LINE &aOther)
bool IsLinkedChecked () const
 Assign a shape to the line (a polyline/line chain).
void SetShape (const SHAPE_LINE_CHAIN &aLine)
 Return the shape of the line.
const SHAPEShape () const override
 Modifiable accessor to the underlying shape.
SHAPE_LINE_CHAINLine ()
const SHAPE_LINE_CHAINCLine () const
int SegmentCount () const
int PointCount () const
int ArcCount () const
int ShapeCount () const
 Return the aIdx-th point of the line.
const VECTOR2I & CPoint (int aIdx) const
const SEG CSegment (int aIdx) const
 Set line width.
void SetWidth (int aWidth)
 Return line width.
int Width () const
 Return true if the line is geometrically identical as line aOther.
bool CompareGeometry (const LINE &aOther)
 Reverse the point/vertex order.
void Reverse ()
 Clip the line to the nearest obstacle, traversing from the line's start vertex (0).
const LINE ClipToNearestObstacle (NODE *aNode) const
 Clip the line to a given range of vertices.
void ClipVertexRange (int aStart, int aEnd)
 Return the number of corners of angles specified by mask aAngles.
int CountCorners (int aAngles) const
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).
bool Walkaround (const SHAPE_LINE_CHAIN &aObstacle, SHAPE_LINE_CHAIN &aPath, bool aCw) const
bool Is45Degree () const
 Print out all linked segments.
void ShowLinks () const
bool EndsWithVia () const
void AppendVia (const VIA &aVia)
void RemoveVia ()
const VIAVia () const
void SetViaDiameter (int aDiameter)
void SetViaDrill (int aDrill)
virtual void Mark (int aMarker) const override
virtual void Unmark (int aMarker=-1) const override
virtual int Marker () const override
void SetBlockingObstacle (ITEM *aObstacle)
ITEMGetBlockingObstacle () const
void DragSegment (const VECTOR2I &aP, int aIndex, bool aFreeAngle=false)
void DragCorner (const VECTOR2I &aP, int aIndex, bool aFreeAngle=false)
void SetRank (int aRank) override
int Rank () const override
bool HasLoops () const
bool HasLockedSegments () const
void Clear ()
OPT_BOX2I ChangedArea (const LINE *aOther) const
void SetSnapThreshhold (int aThreshhold)
int GetSnapThreshhold () const
Public Member Functions inherited from PNS::ITEM
 ITEM (PnsKind aKind)
 ITEM (const ITEM &aOther)
virtual const SHAPE_LINE_CHAIN Hull (int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const
virtual const SHAPE_LINE_CHAIN HoleHull (int aClearance, int aWalkaroundThickness, int aLayer) const
PnsKind Kind () const
 Return the type (kind) of the item.
bool OfKind (int aKindMask) const
 Return true if the item's type matches the mask aKindMask.
std::string KindStr () const
 Returns the kind of the item, as string.
void SetParent (const PNS_HORIZON_PARENT_ITEM *aParent)
const PNS_HORIZON_PARENT_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
 Return true if the set of layers spanned by aOther overlaps our layers.
NODEOwner () const
 Return the owner of this item, or NULL if there's none.
void SetOwner (NODE *aOwner)
 Set the node that owns this item.
bool BelongsTo (NODE *aNode) const
bool Collide (const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly=true) const
 Check for a collision (clearance violation) with between us and item aOther.
virtual const SHAPEHole () const
virtual VECTOR2I Anchor (int n) const
virtual int AnchorCount () const
bool IsLocked () const
void SetRoutable (bool aRoutable)
bool IsRoutable () const
bool IsVirtual () const
void SetIsCompoundShapePrimitive ()
bool IsCompoundShapePrimitive () const

Static Public Member Functions

static bool ClassOf (const ITEM *aItem)

Additional Inherited Members

Public Types inherited from PNS::ITEM
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
}
Static Public Attributes inherited from PNS::ITEM
static const int UnusedNet = INT_MAX
 Supported item types.
Protected Attributes inherited from PNS::ITEM
PnsKind m_kind
const PNS_HORIZON_PARENT_ITEMm_parent
NODEm_owner
LAYER_RANGE m_layers
bool m_movable
int m_net
int m_marker
int m_rank
bool m_routable
bool m_isVirtual
bool m_isCompoundShapePrimitive

Detailed Description

Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads, junctions between multiple traces or two traces different widths and combinations of these).

PNS_LINEs are NOT stored in the model (NODE). Instead, they are assembled on-the-fly, based on a via/pad/segment that belongs to/starts/ends them.

PNS_LINEs can be either loose (consisting of segments that do not belong to any NODE) or owned (with segments taken from a NODE) - these are returned by #NODE::AssembleLine and friends.

A LINE may have a VIA attached at its end (i.e. the last point) - this is used by via dragging/force propagation stuff.

Member Function Documentation

◆ ClipVertexRange()

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

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

We need to figure out which joints to keep after the clip operation, because arcs will have multiple vertices. It is assumed that anything calling this method will have determined the vertex range to clip based on joints, meaning we will never clip in the middle of an arc. Clipping in the middle of an arc would break this and various other things...

◆ Clone()

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

Return a deep copy of the item.

Implements PNS::ITEM.

◆ Mark()

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

Reimplemented from PNS::ITEM.

◆ Marker()

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

Reimplemented from PNS::ITEM.

◆ Rank()

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

Reimplemented from PNS::ITEM.

◆ Reverse()

void PNS::LINE::Reverse ( )

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

Returns the clipped line.

◆ SetRank()

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

Reimplemented from PNS::ITEM.

◆ Shape()

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

Modifiable accessor to the underlying shape.

Reimplemented from PNS::ITEM.

◆ Unmark()

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

Reimplemented from PNS::ITEM.

◆ Walkaround()

bool PNS::LINE::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).

Parameters
aPrePathis the path from origin to the obstacle.
aWalkaroundPathis the path around the obstacle.
aPostPathis the path from obstacle till the end.
aCWdetermines whether to walk around in clockwise or counter-clockwise direction.

The documentation for this class was generated from the following files: