KiCad PCB EDA Suite
Loading...
Searching...
No Matches
TRANSFORM Class Reference

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.
 
 TRANSFORM (int ax1, int ay1, int ax2, int ay2)
 
bool operator== (const TRANSFORM &aTransform) const
 
bool operator!= (const TRANSFORM &aTransform) const
 
VECTOR2I TransformCoordinate (const VECTOR2I &aPoint) const
 Calculate a new coordinate according to the mirror/rotation transform.
 
BOX2I TransformCoordinate (const BOX2I &aRect) const
 Calculate a new rect according to the mirror/rotation transform.
 
TRANSFORM InverseTransform () const
 Calculate the Inverse mirror/rotation transform.
 
bool MapAngles (EDA_ANGLE *aAngle1, EDA_ANGLE *aAngle2) const
 Calculate new angles according to the transform.
 

Public Attributes

int x1
 
int y1
 
int x2
 
int y2
 

Detailed Description

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 transform.

Definition at line 45 of file transform.h.

Constructor & Destructor Documentation

◆ TRANSFORM() [1/2]

TRANSFORM::TRANSFORM ( )
inline

The default construct creates a transform that draws object is the normal orientation.

Definition at line 56 of file transform.h.

◆ TRANSFORM() [2/2]

TRANSFORM::TRANSFORM ( int  ax1,
int  ay1,
int  ax2,
int  ay2 
)
inline

Definition at line 58 of file transform.h.

Member Function Documentation

◆ InverseTransform()

TRANSFORM TRANSFORM::InverseTransform ( ) const

Calculate the Inverse mirror/rotation transform.

Useful to calculate coordinates relative to a symbol, which must be for a non-rotated, non-mirrored item from the actual coordinate.

Returns
The inverse transform.

Definition at line 59 of file transform.cpp.

References x1, x2, y1, and y2.

Referenced by SCH_SYMBOL::doIsConnected(), GetRelativePosition(), SCH_MOVE_TOOL::moveItem(), and SCH_FIELD::SetPosition().

◆ MapAngles()

bool TRANSFORM::MapAngles ( EDA_ANGLE aAngle1,
EDA_ANGLE aAngle2 
) const

Calculate new angles according to the transform.

Parameters
aAngle1= The first angle to transform
aAngle2= The second angle to transform
Returns
True if the angles were swapped during the transform.

Definition at line 81 of file transform.cpp.

References ANGLE_0, ANGLE_360, EDA_ANGLE::Cos(), DEGREES_T, delta, epsilon, EDA_ANGLE::Normalize(), EDA_ANGLE::Sin(), swap, x1, x2, y1, and y2.

Referenced by LIB_SHAPE::Print().

◆ operator!=()

bool TRANSFORM::operator!= ( const TRANSFORM aTransform) const
inline

Definition at line 62 of file transform.h.

◆ operator==()

bool TRANSFORM::operator== ( const TRANSFORM aTransform) const

Definition at line 35 of file transform.cpp.

References x1, x2, y1, and y2.

◆ TransformCoordinate() [1/2]

BOX2I TRANSFORM::TransformCoordinate ( const BOX2I aRect) const

Calculate a new rect according to the mirror/rotation transform.

Useful to calculate actual coordinates of a point from coordinates relative to a symbol, which are given for a non-rotated,-non mirrored item.

Parameters
aRect= The rectangle to transform
Returns
The transformed rectangle.

Definition at line 50 of file transform.cpp.

References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::SetEnd(), BOX2< Vec >::SetOrigin(), and TransformCoordinate().

◆ TransformCoordinate() [2/2]

VECTOR2I TRANSFORM::TransformCoordinate ( const VECTOR2I 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 symbol, which are given for a non-rotated,-non mirrored item.

Parameters
aPoint= The position to transform
Returns
The transformed coordinate.

Definition at line 44 of file transform.cpp.

References VECTOR2< T >::x, x1, x2, VECTOR2< T >::y, y1, and y2.

Referenced by SCH_SYMBOL::doIsConnected(), SCH_FIELD::GetBoundingBox(), SCH_PIN::GetBoundingBox(), SCH_SYMBOL::GetConnectionPoints(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), GetRelativePosition(), SCH_PIN::GetTransformedPosition(), LIB_SHAPE::HitTest(), LIB_TEXT::HitTest(), SCH_MOVE_TOOL::moveItem(), LIB_PIN::PinDrawOrient(), LIB_SHAPE::Print(), LIB_TEXT::Print(), LIB_TEXTBOX::Print(), SCH_FIELD::SetPosition(), TransformCoordinate(), SCH_RENDER_SETTINGS::TransformCoordinate(), and SCH_SYMBOL::UpdateDanglingState().

Member Data Documentation

◆ x1

◆ x2

◆ y1

◆ y2


The documentation for this class was generated from the following files: