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.

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.

## ◆ 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 63 of file transform.h.

## ◆ 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.

## ◆ 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 SCH_SHAPE::Print().

## ◆ operator!=()

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

Definition at line 72 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.

## ◆ 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.

## ◆ x1

 int TRANSFORM::x1

## ◆ x2

 int TRANSFORM::x2

Definition at line 50 of file transform.h.

## ◆ y2

 int TRANSFORM::y2

Definition at line 51 of file transform.h.

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