|
| Transform (const Point &position=Point(0, 0), const Angle &rotation=Angle(0), bool mirrored=false) noexcept |
| (Default) construdtor
|
|
template<typename T > |
| Transform (const T &obj) |
| Constructor to copy the transformation of an object.
|
|
| Transform (const Transform &other) noexcept |
| Copy constructor.
|
|
| ~Transform () noexcept |
| Destructor.
|
|
const Point & | getPosition () const noexcept |
|
const Angle & | getRotation () const noexcept |
|
bool | getMirrored () const noexcept |
|
void | setPosition (const Point &position) noexcept |
|
void | setRotation (const Angle &rotation) noexcept |
|
void | setMirrored (bool mirrored) noexcept |
|
bool | map (bool mirror) const noexcept |
| Map a given mirror state to the transformed coordinate system.
|
|
Angle | mapMirrorable (const Angle &angle) const noexcept |
| Map a given angle to the transformed coordinate system.
|
|
Angle | mapNonMirrorable (const Angle &angle) const noexcept |
| Map a given angle to the transformed coordinate system.
|
|
Point | map (const Point &point) const noexcept |
| Map a given point to the transformed coordinate system.
|
|
Path | map (const Path &path) const noexcept |
| Map a given path to the transformed coordinate system.
|
|
NonEmptyPath | map (const NonEmptyPath &path) const noexcept |
| Map a given path to the transformed coordinate system.
|
|
const Layer & | map (const Layer &layer) const noexcept |
| Map a given layer to the transformed coordinate system.
|
|
template<typename T > |
T | map (const T &container) const noexcept |
| Map all items of a container to the transformed coordinate system.
|
|
template<typename T > |
T | mapPx (const T &obj) const noexcept |
| Map a given Qt object in pixels to the transformed coordinate system.
|
|
bool | operator== (const Transform &rhs) const noexcept |
|
bool | operator!= (const Transform &rhs) const noexcept |
|
Transform & | operator= (const Transform &rhs) noexcept |
|
Helper class to perform coordinate transformation with various types.
The class is similar to QTransform
, but with the following differences:
- It transforms mainly LibrePCB types instead of Qt types (e.g. librepcb::Point instead of
QPointF
).
- It does not allow arbitrary transformations, but only mirror, rotate and translate. The order of the transformation is not configurable, it is hardcoded to the order of transformations applied to symbols within a schematic, and to footprints within a board. This order is: mirror horizontally (negating X-coordinate) -> rotate CCW -> translate.
Long story short, this class converts symbol- or footprint coordinates into schematic- resp. board coordinates.