![]() |
KiCad PCB EDA Suite
|
for transforming drawing coordinates for a wxDC device context. More...
#include <transform.h>
Public Member Functions | |
TRANSFORM () | |
The default construct creates a transform that draws object is the normal orientation. More... | |
TRANSFORM (int ax1, int ay1, int ax2, int ay2) | |
bool | operator== (const TRANSFORM &aTransform) const |
bool | operator!= (const TRANSFORM &aTransform) const |
wxPoint | TransformCoordinate (const wxPoint &aPoint) const |
Calculate a new coordinate according to the mirror/rotation transform. More... | |
EDA_RECT | TransformCoordinate (const EDA_RECT &aRect) const |
Calculate a new rect according to the mirror/rotation transform. More... | |
TRANSFORM | InverseTransform () const |
Calculate the Inverse mirror/rotation transform. More... | |
bool | MapAngles (int *aAngle1, int *aAngle2) const |
Calculate new angles according to the transform. More... | |
Public Attributes | |
int | x1 |
int | y1 |
int | x2 |
int | y2 |
for transforming drawing coordinates for a wxDC device context.
This probably should be a base class with all pure virtual methods and a WXDC_TRANSFORM derived class. Then in the future if some new device context is used, a new transform could be derived from the base class and all the drawable objects would have to do is provide overloaded draw methods to use the new transorm.
Definition at line 45 of file transform.h.
|
inline |
The default construct creates a transform that draws object is the normal orientation.
Definition at line 56 of file transform.h.
|
inline |
Definition at line 58 of file transform.h.
TRANSFORM TRANSFORM::InverseTransform | ( | ) | const |
Calculate the Inverse mirror/rotation transform.
Useful to calculate coordinates relative to a component which must be for a non rotated, non mirrored item from the actual coordinate.
Definition at line 59 of file transform.cpp.
References x1, x2, y1, and y2.
Referenced by SCH_COMPONENT::doIsConnected(), GetRelativePosition(), and SCH_MOVE_TOOL::moveItem().
bool TRANSFORM::MapAngles | ( | int * | aAngle1, |
int * | aAngle2 | ||
) | const |
Calculate new angles according to the transform.
aAngle1 | = The first angle to transform |
aAngle2 | = The second angle to transform |
Definition at line 81 of file transform.cpp.
References DECIDEG2RAD(), KiROUND(), NORMALIZE_ANGLE_POS(), NULL, RAD2DECIDEG(), x1, x2, y1, and y2.
Referenced by KIGFX::SCH_PAINTER::draw(), LIB_ARC::GetBoundingBox(), LIB_ARC::Plot(), and LIB_ARC::print().
|
inline |
Definition at line 62 of file transform.h.
bool TRANSFORM::operator== | ( | const TRANSFORM & | aTransform | ) | const |
Definition at line 33 of file transform.cpp.
wxPoint TRANSFORM::TransformCoordinate | ( | const wxPoint & | aPoint | ) | const |
Calculate a new coordinate according to the mirror/rotation transform.
Useful to calculate actual coordinates of a point from coordinates relative to a component which are given for a non rotated, non mirrored item
aPoint | = The position to transform |
Definition at line 42 of file transform.cpp.
References x1, x2, y1, and y2.
Referenced by SCH_COMPONENT::doIsConnected(), SCH_EDITOR_CONTROL::FindComponentAndItem(), LIB_ARC::GetBoundingBox(), SCH_PIN::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_COMPONENT::GetConnectionPoints(), SCH_COMPONENT::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), GetRelativePosition(), SCH_PIN::GetTransformedPosition(), LIB_CIRCLE::HitTest(), LIB_RECTANGLE::HitTest(), LIB_TEXT::HitTest(), LIB_BEZIER::HitTest(), LIB_ARC::HitTest(), LIB_POLYLINE::HitTest(), LIB_FIELD::HitTest(), SCH_MOVE_TOOL::moveItem(), LIB_PIN::PinDrawOrient(), LIB_CIRCLE::Plot(), LIB_RECTANGLE::Plot(), LIB_BEZIER::Plot(), LIB_TEXT::Plot(), LIB_ARC::Plot(), LIB_POLYLINE::Plot(), LIB_FIELD::Plot(), LIB_PIN::Plot(), LIB_POLYLINE::print(), LIB_RECTANGLE::print(), LIB_TEXT::print(), LIB_ARC::print(), LIB_FIELD::print(), LIB_BEZIER::print(), LIB_CIRCLE::print(), LIB_PIN::print(), SCH_FIELD::SetPosition(), ERC_TESTER::TestTextVars(), TransformCoordinate(), and SCH_COMPONENT::UpdateDanglingState().
Calculate a new rect according to the mirror/rotation transform.
Useful to calculate actual coordinates of a point from coordinates relative to a component which are given for a non rotated, non mirrored item
aRect | = The rectangle to transform |
Definition at line 48 of file transform.cpp.
References EDA_RECT::GetEnd(), EDA_RECT::GetOrigin(), EDA_RECT::SetEnd(), EDA_RECT::SetOrigin(), and TransformCoordinate().
int TRANSFORM::x1 |
Definition at line 48 of file transform.h.
Referenced by SCH_COMPONENT::GetBodyBoundingBox(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), InverseTransform(), SCH_LEGACY_PLUGIN::loadComponent(), MapAngles(), operator==(), LIB_TEXT::Plot(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_COMPONENT::SetOrientation(), and TransformCoordinate().
int TRANSFORM::x2 |
Definition at line 50 of file transform.h.
Referenced by SCH_COMPONENT::GetBodyBoundingBox(), InverseTransform(), SCH_LEGACY_PLUGIN::loadComponent(), MapAngles(), operator==(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_COMPONENT::SetOrientation(), and TransformCoordinate().
int TRANSFORM::y1 |
Definition at line 49 of file transform.h.
Referenced by AUTOPLACER::computeFBoxSize(), SCH_COMPONENT::GetBodyBoundingBox(), InverseTransform(), SCH_LEGACY_PLUGIN::loadComponent(), MapAngles(), operator==(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), LIB_TEXT::print(), SCH_FIELD::Print(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_COMPONENT::SetOrientation(), and TransformCoordinate().
int TRANSFORM::y2 |
Definition at line 51 of file transform.h.
Referenced by SCH_COMPONENT::GetBodyBoundingBox(), InverseTransform(), SCH_LEGACY_PLUGIN::loadComponent(), MapAngles(), operator==(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_COMPONENT::SetOrientation(), and TransformCoordinate().