LibrePCB Developers Documentation

The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5.6mm) for X=1.2mm and Y=5.6mm. More...
#include <point.h>
Public Member Functions  
Point () noexcept  
Default Constructor. More...  
Point (const Point &point) noexcept  
Copy Constructor. More...  
Point (const Length &x, const Length &y) noexcept  
Constructor for passing two Length objects. More...  
Point (const SExpression &node)  
~Point () noexcept  
Destructor. More...  
void  setX (const Length &x) noexcept 
Set the X coordinate. More...  
void  setY (const Length &y) noexcept 
Set the Y coordinate. More...  
void  setXmm (const QString &mm) 
Set the X coordinate from a string in millimeters. More...  
void  setYmm (const QString &mm) 
Set the Y coordinate from a string in millimeters. More...  
void  setPointNm (LengthBase_t nmX, LengthBase_t nmY) noexcept 
void  setPointMm (const QPointF &millimeters) 
void  setPointInch (const QPointF &inches) 
void  setPointMil (const QPointF &mils) 
void  setPointPx (const QPointF &pixels) 
const Length &  getX () const noexcept 
Get the X coordinate. More...  
const Length &  getY () const noexcept 
Get the Y coordinate. More...  
Length  getLength () const noexcept 
Get the length of the vector if X and Y represents a vector (e.g. the distance of this Point from the origin) More...  
bool  isOrigin () const noexcept 
Check if the position represents the origin (X == 0 and Y == 0) More...  
QPointF  toMmQPointF () const noexcept 
Get the point as a QPointF object in millimeters. More...  
QPointF  toInchQPointF () const noexcept 
Get the point as a QPointF object in inches. More...  
QPointF  toMilQPointF () const noexcept 
Get the point as a QPointF object in mils (1/1000 inches) More...  
QPointF  toPxQPointF () const noexcept 
Get the point as a QPointF object in pixels (for QGraphics* objects) More...  
Point  abs () const noexcept 
Get a Point object with both coordinates in absolute values (X,Y >= 0) More...  
Point &  makeAbs () noexcept 
Make both coordinates absolute (X,Y >= 0) More...  
Point  mappedToGrid (const PositiveLength &gridInterval) const noexcept 
Get a Point object which is mapped to a specific grid interval. More...  
Point &  mapToGrid (const PositiveLength &gridInterval) noexcept 
Map this Point object to a specific grid interval. More...  
Point  rotated (const Angle &angle, const Point ¢er=Point(0, 0)) const noexcept 
Get the point rotated by a specific angle with respect to a specific center. More...  
Point &  rotate (const Angle &angle, const Point ¢er=Point(0, 0)) noexcept 
Rotate the point by a specific angle with respect to a specific center. More...  
Point  mirrored (Qt::Orientation orientation, const Point ¢er=Point(0, 0)) const noexcept 
Get the point mirrored horizontally or vertically around a specific center. More...  
Point &  mirror (Qt::Orientation orientation, const Point ¢er=Point(0, 0)) noexcept 
Mirror the point horizontally or vertically around a specific center. More...  
void  serialize (SExpression &root) const override 
Serialize the object into an existing SExpression node. More...  
Point &  operator= (const Point &rhs) 
Point &  operator+= (const Point &rhs) 
Point &  operator= (const Point &rhs) 
Point &  operator*= (const Point &rhs) 
Point &  operator*= (LengthBase_t rhs) 
Point &  operator/= (const Point &rhs) 
Point &  operator/= (LengthBase_t rhs) 
Point  operator+ (const Point &rhs) const 
Point  operator () const 
Point  operator (const Point &rhs) const 
Point  operator* (const Length &rhs) const 
Point  operator* (LengthBase_t rhs) const 
Point  operator/ (const Length &rhs) const 
Point  operator/ (LengthBase_t rhs) const 
Point  operator% (const Length &rhs) const 
bool  operator== (const Point &rhs) const 
bool  operator!= (const Point &rhs) const 
Public Member Functions inherited from SerializableObject  
SerializableObject () noexcept  
virtual  ~SerializableObject () noexcept 
SExpression  serializeToDomElement (const QString &name) const 
Serialize the object to a new SExpression node. More...  
Static Public Member Functions  
static Point  fromMm (qreal millimetersX, qreal millimetersY) 
static Point  fromMm (const QPointF &millimeters) 
static Point  fromInch (qreal inchesX, qreal inchesY) 
static Point  fromInch (const QPointF &inches) 
static Point  fromMil (qreal milsX, qreal milsY) 
static Point  fromMil (const QPointF &mils) 
static Point  fromPx (qreal pixelsX, qreal pixelsY) 
static Point  fromPx (const QPointF &pixels) 
Static Public Member Functions inherited from SerializableObject  
template<typename T >  
static void  serializeObjectContainer (SExpression &root, const T &container, const QString &itemName) 
template<typename T >  
static void  serializePointerContainer (SExpression &root, const T &container, const QString &itemName) 
template<typename T >  
static void  serializePointerContainerUuidSorted (SExpression &root, const T &container, const QString &itemName) 
Private Attributes  
Length  mX 
the X coordinate More...  
Length  mY 
the Y coordinate More...  
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5.6mm) for X=1.2mm and Y=5.6mm.
This class is used to represent ALL coordinates in Symbols, Schematics, Footprints, Layouts and so on. You should never use another coordinate type, like QPoint or QPointF! It's very important to have a consistent coordinate type over the whole project.
A Point object consists always of two Length objects. Basically, this is the only goal of this class, but it will provide also some useful addidional methods.

inlinenoexcept 
Default Constructor.
The object will be initialized with X=Length(0) and Y=Length(0).

explicit 

inlinenoexcept 
Destructor.

inlinenoexcept 
Set the X coordinate.
x  The new X coordinate as a Length object 

inlinenoexcept 
Set the Y coordinate.
y  The new Y coordinate as a Length object 

inline 
Set the X coordinate from a string in millimeters.
mm  A string with the new X coordinate in millimeters 
Exception  If the string is not valid, an exception will be thrown. 

inline 
Set the Y coordinate from a string in millimeters.
mm  A string with the new Y coordinate in millimeters 
Exception  If the string is not valid, an exception will be thrown. 

inlinenoexcept 

inline 

inline 

inline 

inline 

inlinenoexcept 
Get the X coordinate.

inlinenoexcept 
Get the Y coordinate.

inlinenoexcept 

inlinenoexcept 
Check if the position represents the origin (X == 0 and Y == 0)

inlinenoexcept 
Get the point as a QPointF object in millimeters.

inlinenoexcept 
Get the point as a QPointF object in inches.

inlinenoexcept 
Get the point as a QPointF object in mils (1/1000 inches)

inlinenoexcept 
Get the point as a QPointF object in pixels (for QGraphics* objects)

noexcept 
Get a Point object with both coordinates in absolute values (X,Y >= 0)

noexcept 
Make both coordinates absolute (X,Y >= 0)

noexcept 
Get a Point object which is mapped to a specific grid interval.
gridInterval  See Length::mappedToGrid() 

noexcept 
Map this Point object to a specific grid interval.
gridInterval  See Length::mapToGrid() 
Get the point rotated by a specific angle with respect to a specific center.
angle  The angle to rotate (CCW) 
center  The center of the rotation 
Rotate the point by a specific angle with respect to a specific center.
angle  The angle to rotate (CCW) 
center  The center of the rotation 
Get the point mirrored horizontally or vertically around a specific center.
orientation  Qt::Horizontal = mirror X axis; Qt::Vertical = mirror Y axis 
center  The center of the mirror operation 
Mirror the point horizontally or vertically around a specific center.
orientation  Qt::Horizontal = mirror X axis; Qt::Vertical = mirror Y axis 
center  The center of the mirror operation 

overridevirtual 
Serialize the object into an existing SExpression node.
This method inserts/appends all attributes and childs of the object to an existing SExpression node. The content which already exists in the given SExpression node will not be removed.
root  The target DOM root node 
Exception  This method throws an exception if an error occurs. 
Implements SerializableObject.

static 

static 

static 

static 

static 

static 

static 

static 

inline 

inline 

inline 

inline 

inline 

inline 

inline 

private 
the X coordinate

private 
the Y coordinate