![]() |
LibrePCB Developers Documentation
|
The Path class represents a list of vertices connected by straight lines or circular arc segments. More...
#include <path.h>
Public Member Functions | |
Path () noexcept | |
Path (const Path &other) noexcept | |
Path (const QVector< Vertex > &vertices) noexcept | |
Path (const SExpression &node) | |
~Path () noexcept | |
bool | isClosed () const noexcept |
bool | isCurved () const noexcept |
bool | isZeroLength () const noexcept |
QVector< Vertex > & | getVertices () noexcept |
const QVector< Vertex > & | getVertices () const noexcept |
UnsignedLength | getTotalStraightLength () const noexcept |
qreal | calcAreaOfStraightSegments () const noexcept |
Point | calcNearestPointBetweenVertices (const Point &p) const noexcept |
Path | cleaned () const noexcept |
Path | toClosedPath () const noexcept |
Path | toOpenPath () const noexcept |
QVector< Path > | toOutlineStrokes (const PositiveLength &width) const noexcept |
const QPainterPath & | toQPainterPathPx () const noexcept |
QString | toSvgPathMm () const noexcept |
Path & | translate (const Point &offset) noexcept |
Path | translated (const Point &offset) const noexcept |
Path & | mapToGrid (const PositiveLength &gridInterval) noexcept |
Path | mappedToGrid (const PositiveLength &gridInterval) const noexcept |
Path & | rotate (const Angle &angle, const Point ¢er=Point(0, 0)) noexcept |
Path | rotated (const Angle &angle, const Point ¢er=Point(0, 0)) const noexcept |
Path & | mirror (Qt::Orientation orientation, const Point ¢er=Point(0, 0)) noexcept |
Path | mirrored (Qt::Orientation orientation, const Point ¢er=Point(0, 0)) const noexcept |
Path & | reverse () noexcept |
Path | reversed () const noexcept |
Path & | flattenArcs (const PositiveLength &maxTolerance) noexcept |
Path | flattenedArcs (const PositiveLength &maxTolerance) const noexcept |
void | addVertex (const Vertex &vertex) noexcept |
void | addVertex (const Point &pos, const Angle &angle=Angle::deg0()) noexcept |
void | insertVertex (int index, const Vertex &vertex) noexcept |
void | insertVertex (int index, const Point &pos, const Angle &angle=Angle::deg0()) noexcept |
bool | clean () noexcept |
bool | close () noexcept |
bool | open () noexcept |
void | serialize (SExpression &root) const |
Serialize into librepcb::SExpression node. | |
Path & | operator= (const Path &rhs) noexcept |
bool | operator== (const Path &rhs) const noexcept |
bool | operator!= (const Path &rhs) const noexcept |
bool | operator< (const Path &rhs) const noexcept |
The "<" operator to compare two librepcb::Path objects. | |
Static Public Member Functions | |
static Path | line (const Point &p1, const Point &p2, const Angle &angle=Angle::deg0()) noexcept |
static Path | circle (const PositiveLength &diameter) noexcept |
static Path | donut (const PositiveLength &outerDiameter, const PositiveLength &innerDiameter) noexcept |
static Path | obround (const PositiveLength &width, const PositiveLength &height) noexcept |
static Path | obround (const Point &p1, const Point &p2, const PositiveLength &width) noexcept |
static Path | arcObround (const Point &p1, const Point &p2, const Angle &angle, const PositiveLength &width) noexcept |
static Path | rect (const Point &p1, const Point &p2) noexcept |
static Path | centeredRect (const PositiveLength &width, const PositiveLength &height, const UnsignedLength &cornerRadius=UnsignedLength(0)) noexcept |
static Path | chamferedRect (const PositiveLength &width, const PositiveLength &height, const UnsignedLength &chamferSize, bool topLeft, bool topRight, bool bottomLeft, bool bottomRight) noexcept |
static Path | trapezoid (const PositiveLength &width, const PositiveLength &height, const Length &dw, const Length dh) noexcept |
static Path | octagon (const PositiveLength &width, const PositiveLength &height, const UnsignedLength &cornerRadius=UnsignedLength(0)) noexcept |
static Path | flatArc (const Point &p1, const Point &p2, const Angle &angle, const PositiveLength &maxTolerance) noexcept |
static QPainterPath | toQPainterPathPx (const QVector< Path > &paths, bool area) noexcept |
Convert multiple librepcb::Path objects to a QPainterPath. | |
Private Member Functions | |
void | invalidatePainterPath () const noexcept |
Private Attributes | |
QVector< Vertex > | mVertices |
QPainterPath | mPainterPathPx |
The Path class represents a list of vertices connected by straight lines or circular arc segments.
This class is similar to a polygon or polyline, but it doesn't have properties like width or layer. It's only a list of coordinates which are connected together by straight lines or circular arc segments.
A path may be closed (first point == last point) or open (first point != last point).
For a valid path, minimum two vertices are required. Paths with less than two vertices are useless and thus considered as invalid.
|
inlinenoexcept |
|
explicit |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
void serialize | ( | SExpression & | root | ) | const |
Serialize into librepcb::SExpression node.
root | Root node to serialize into. |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
The "<" operator to compare two librepcb::Path objects.
Useful for sorting path lists/sets (e.g. to for canonical order in files), or to store them in a QMap.
rhs | The right hand side object. |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
Convert multiple librepcb::Path objects to a QPainterPath.
The paths are united, so you get the union of all the passed paths.
paths | The paths to convert. |
area | Whether the passed paths should be interpreted as areas (true) or strokes (false). |
|
inlineprivatenoexcept |
|
private |
|
mutableprivate |