|
wiRedPanda
Logic Circuit Simulator
|
Owns the rotation angle and flip flags of a GraphicElement, and the transform math that applies them to the item and its ports. More...
#include <ElementOrientation.h>
Public Member Functions | |
| qreal | angle () const |
| Returns the current rotation angle in degrees. | |
| void | applyLoadedOrientation () |
| ElementOrientation (GraphicElement *owner) | |
| Constructs the orientation state bound to its owning owner element. | |
| bool | isFlippedX () const |
Returns true if this element is mirrored along the X axis (horizontal flip). | |
| bool | isFlippedY () const |
Returns true if this element is mirrored along the Y axis (vertical flip). | |
| void | orientPort (Port *port) |
| Orients port for the current rotation + flip state. | |
| void | rotatePorts () |
| void | setAngleRaw (qreal angle) |
| Sets the angle without re-applying the transform. Load-time only. | |
| void | setFlippedX (bool flipped) |
| Sets the horizontal mirror state and updates the item transform. | |
| void | setFlippedXRaw (bool flipped) |
| Sets the horizontal flip flag without re-applying the transform. Load-time only. | |
| void | setFlippedY (bool flipped) |
| Sets the vertical mirror state and updates the item transform. | |
| void | setFlippedYRaw (bool flipped) |
| Sets the vertical flip flag without re-applying the transform. Load-time only. | |
| void | setRotation (qreal angle) |
| Rotates to angle degrees (normalised to [0, 360)) and updates port positions. | |
Owns the rotation angle and flip flags of a GraphicElement, and the transform math that applies them to the item and its ports.
Extracted from GraphicElement, mirroring the ElementAppearance / ElementSimState pattern (owner back-pointer, used through the element's public interface). Rotatable elements rotate the whole QGraphicsItem; non-rotatable elements keep their pixmap fixed and instead re-transform each port individually — both paths are implemented here.
Definition at line 25 of file ElementOrientation.h.
|
inlineexplicit |
Constructs the orientation state bound to its owning owner element.
Definition at line 29 of file ElementOrientation.h.
|
inline |
Returns the current rotation angle in degrees.
Definition at line 35 of file ElementOrientation.h.
Referenced by setAngleRaw(), and setRotation().
|
inline |
Applies the raw-loaded angle/flip state to the item, reproducing the historical setRotation()+applyFlipTransform() load sequence byte-for-byte.
Definition at line 77 of file ElementOrientation.h.
References setRotation().
Referenced by GraphicElementSerializer::load().
|
inline |
Returns true if this element is mirrored along the X axis (horizontal flip).
Definition at line 41 of file ElementOrientation.h.
|
inline |
Returns true if this element is mirrored along the Y axis (vertical flip).
Definition at line 44 of file ElementOrientation.h.
| void ElementOrientation::orientPort | ( | Port * | port | ) |
Orients port for the current rotation + flip state.
Used by non-rotatable elements, which keep their pixmap fixed. Applies Rotate(centre, angle) then Flip about the pixmap centre to the port, so the port moves to the mirrored/rotated side while the element graphic stays upright. Recomputed from the flags each call, so it is involutive.
Definition at line 34 of file ElementOrientation.cpp.
References Port::updateConnections().
Referenced by rotatePorts().
| void ElementOrientation::rotatePorts | ( | ) |
Re-applies the combined rotation + flip orientation to every port. Used by non-rotatable elements, which keep their pixmap fixed and move only their ports around the centre.
Definition at line 27 of file ElementOrientation.cpp.
References orientPort().
Referenced by setRotation().
|
inline |
Sets the angle without re-applying the transform. Load-time only.
Definition at line 69 of file ElementOrientation.h.
References angle().
| void ElementOrientation::setFlippedX | ( | bool | flipped | ) |
Sets the horizontal mirror state and updates the item transform.
Definition at line 58 of file ElementOrientation.cpp.
|
inline |
Sets the horizontal flip flag without re-applying the transform. Load-time only.
Definition at line 71 of file ElementOrientation.h.
| void ElementOrientation::setFlippedY | ( | bool | flipped | ) |
Sets the vertical mirror state and updates the item transform.
Definition at line 64 of file ElementOrientation.cpp.
|
inline |
Sets the vertical flip flag without re-applying the transform. Load-time only.
Definition at line 73 of file ElementOrientation.h.
| void ElementOrientation::setRotation | ( | qreal | angle | ) |
Rotates to angle degrees (normalised to [0, 360)) and updates port positions.
Definition at line 11 of file ElementOrientation.cpp.
References angle(), and rotatePorts().
Referenced by applyLoadedOrientation().