Horizon
|
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>
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 LINE * | Clone () const override |
Return a deep copy of the item. | |
LINE & | operator= (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 SHAPE * | Shape () const override |
Modifiable accessor to the underlying shape. | |
SHAPE_LINE_CHAIN & | Line () |
const SHAPE_LINE_CHAIN & | CLine () 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 VIA & | Via () 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) |
ITEM * | GetBlockingObstacle () 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 |
![]() | |
LINK_HOLDER (PnsKind aKind) | |
Add a reference to an item registered in a #NODE that is a part of this line. | |
void | Link (LINKED_ITEM *aLink) |
Return the list of links from the owning node that constitute this line (or NULL if the line is not linked). | |
LINKS & | Links () |
const LINKS & | Links () const |
bool | IsLinked () const |
Check if the segment aLink is a part of the line. | |
bool | ContainsLink (const LINKED_ITEM *aItem) const |
LINKED_ITEM * | GetLink (int aIndex) const |
Erase the linking information. Used to detach the line from the owning node. | |
virtual void | ClearLinks () |
Return the number of segments that were assembled together to form this line. | |
int | LinkCount () const |
void | ShowLinks () const |
![]() | |
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_ITEM * | Parent () const |
void | SetNet (int aNet) |
int | Net () const |
const LAYER_RANGE & | Layers () 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. | |
NODE * | Owner () 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 SHAPE * | Hole () 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 | |
![]() | |
typedef std::vector< LINKED_ITEM * > | LINKS |
![]() | |
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 const int | UnusedNet = INT_MAX |
Supported item types. | |
![]() | |
void | copyLinks (const LINK_HOLDER *aParent) |
< Copy m_links from the line aParent. | |
![]() | |
LINKS | m_links |
![]() | |
PnsKind | m_kind |
const PNS_HORIZON_PARENT_ITEM * | m_parent |
NODE * | m_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 |
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.
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...
|
overridevirtual |
Return a deep copy of the item.
Implements PNS::ITEM.
|
overridevirtual |
Reimplemented from PNS::ITEM.
|
overridevirtual |
Reimplemented from PNS::ITEM.
|
overridevirtual |
Reimplemented from PNS::ITEM.
void PNS::LINE::Reverse | ( | ) |
Clip the line to the nearest obstacle, traversing from the line's start vertex (0).
Returns the clipped line.
|
overridevirtual |
Reimplemented from PNS::ITEM.
|
inlineoverridevirtual |
Modifiable accessor to the underlying shape.
Reimplemented from PNS::ITEM.
|
overridevirtual |
Reimplemented from PNS::ITEM.
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).
aPrePath | is the path from origin to the obstacle. |
aWalkaroundPath | is the path around the obstacle. |
aPostPath | is the path from obstacle till the end. |
aCW | determines whether to walk around in clockwise or counter-clockwise direction. |