|
| 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...
|
|
UnsignedLength | 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...
|
|
bool | isOnGrid (const PositiveLength &gridInterval) const noexcept |
| Check whether the Point lies on the grid. 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 |
| Serialize into librepcb::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 |
|
bool | operator< (const Point &rhs) const noexcept |
| Less/Greater comparison operator overloadings. More...
|
|
bool | operator<= (const Point &rhs) const noexcept |
|
bool | operator> (const Point &rhs) const noexcept |
|
bool | operator>= (const Point &rhs) const noexcept |
|
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.
- Note
- Please note that the origin (0px;0px) of the QGraphics* objects is always at the top left corner, whereas the origin (0mm;0mm) of most CAD programs is at the bottom left corner. As we want to have the origin at the bottom left corner, like every good CAD program, we need to invert the Y-coordinate on every conversion between nanometers/millimeters and pixels (for QGraphics* objects), in both directions. This means, every time you need to convert a position from a QGraphics* object to millimeters (or another unit), you have to create a Point object and set the coordinate with Point::setPointPx() or Point::fromPx(). These methods will invert the Y-coordinate and you will have the right coordinate in the object. On the other hand, if you have to convert a coordinate from millimeters (or another unit) to pixels for a QGraphics* object, you have to use the method Point::toPxQPointF(), which will also invert the Y-coordinate. You should never convert an X and/or Y coordinate with separate Length objects - which would be possible, but then the sign of the Y-coordinate is wrong! It is also not allowed to get the Y-coordinate in pixels with calling Point.getY().toPx(), this way the sign of the value in pixels is also wrong! You should use Point.toPxQPointF().y() instead for this purpose.
- See also
- class Length