KiCad PCB EDA Suite
PCB_ORIGIN_TRANSFORMS Class Reference

#include <pcb_origin_transforms.h>

Inheritance diagram for PCB_ORIGIN_TRANSFORMS:
ORIGIN_TRANSFORMS

Public Types

enum  COORD_TYPES_T {
  NOT_A_COORD, ABS_X_COORD, ABS_Y_COORD, REL_X_COORD,
  REL_Y_COORD
}
 The supported Display Origin Transform types. More...
 

Public Member Functions

 PCB_ORIGIN_TRANSFORMS (PCB_BASE_FRAME &aPcbBaseFrame)
 
virtual ~PCB_ORIGIN_TRANSFORMS () override
 
virtual long long int ToDisplay (long long int aValue, COORD_TYPES_T aCoordType) const override
 
virtual double ToDisplay (double aValue, COORD_TYPES_T aCoordType) const override
 
virtual long long int FromDisplay (long long int aValue, COORD_TYPES_T aCoordType) const override
 
virtual double FromDisplay (double aValue, COORD_TYPES_T aCoordType) const override
 
template<typename T >
ToDisplayRelX (T aInternalValue) const
 Transform a 2-D coordinate point referenced to the internal origin to the equivalent point referenced to the user-selected display origin. More...
 
template<typename T >
ToDisplayRelY (T aInternalValue) const
 
template<typename T >
FromDisplayRelX (T aDisplayValue) const
 
template<typename T >
FromDisplayRelY (T aDisplayValue) const
 
template<typename T >
ToDisplayAbsX (T aInternalValue) const
 
template<typename T >
ToDisplayAbsY (T aInternalValue) const
 
template<typename T >
FromDisplayAbsX (T aDisplayValue) const
 
template<typename T >
FromDisplayAbsY (T aDisplayValue) const
 
template<typename T >
ToDisplayAbs (T aInternalValue) const
 
template<typename T >
FromDisplayAbs (T aDisplayValue) const
 
template<typename T >
ToDisplayRel (T aInternalValue) const
 
template<typename T >
FromDisplayRel (T aDisplayValue) const
 
virtual int ToDisplay (int aValue, COORD_TYPES_T aCoordType) const
 
virtual long long int ToDisplay (long long int aValue, COORD_TYPES_T aCoordType) const
 
virtual double ToDisplay (double aValue, COORD_TYPES_T aCoordType) const
 
virtual int FromDisplay (int aValue, COORD_TYPES_T aCoordType) const
 
virtual long long int FromDisplay (long long int aValue, COORD_TYPES_T aCoordType) const
 
virtual double FromDisplay (double aValue, COORD_TYPES_T aCoordType) const
 
virtual int ToDisplay (int aValue, COORD_TYPES_T aCoordType) const
 
virtual int FromDisplay (int aValue, COORD_TYPES_T aCoordType) const
 
template<class T >
ToDisplayAbs (const T &aValue) const
 
template<class T >
ToDisplayRel (const T &aValue) const
 
template<class T >
FromDisplayAbs (const T &aValue) const
 
template<class T >
FromDisplayRel (const T &aValue) const
 

Protected Member Functions

int GetUserXOrigin () const
 
int GetUserYOrigin () const
 

Static Protected Member Functions

template<class T >
static T ToDisplayAbs (T aInternalValue, int aUserOrigin, bool aInvertAxis)
 
template<class T >
static T ToDisplayRel (T aInternalValue, bool aInvertAxis)
 
template<class T >
static T FromDisplayAbs (T aDisplayValue, int aUserOrigin, bool aInvertAxis)
 
template<class T >
static T FromDisplayRel (T aDisplayValue, bool aInvertAxis)
 

Protected Attributes

const PCB_BASE_FRAMEm_pcbBaseFrame
 
const bool & m_invertXAxis
 
const bool & m_invertYAxis
 

Detailed Description

Definition at line 32 of file pcb_origin_transforms.h.

Member Enumeration Documentation

◆ COORD_TYPES_T

The supported Display Origin Transform types.

Absolute coordinates require both translation and direction inversion. Relative coordinates require only direction inversion.

Enumerator
NOT_A_COORD 
ABS_X_COORD 
ABS_Y_COORD 
REL_X_COORD 
REL_Y_COORD 

Definition at line 48 of file origin_transforms.h.

48  {
49  NOT_A_COORD, //< A non-coordinate value, never transformed
50  ABS_X_COORD, //< An absolute X coordinate
51  ABS_Y_COORD, //< An absolute Y coordinate
52  REL_X_COORD, //< A relative X coordinate
53  REL_Y_COORD, //< A relative Y coordinate
54  };

Constructor & Destructor Documentation

◆ PCB_ORIGIN_TRANSFORMS()

PCB_ORIGIN_TRANSFORMS::PCB_ORIGIN_TRANSFORMS ( PCB_BASE_FRAME aPcbBaseFrame)

Definition at line 32 of file pcb_origin_transforms.cpp.

33  : m_pcbBaseFrame( aPcbBaseFrame ),
36 {}
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
const PCB_BASE_FRAME & m_pcbBaseFrame

◆ ~PCB_ORIGIN_TRANSFORMS()

PCB_ORIGIN_TRANSFORMS::~PCB_ORIGIN_TRANSFORMS ( )
overridevirtual

Definition at line 38 of file pcb_origin_transforms.cpp.

39 {}

Member Function Documentation

◆ FromDisplay() [1/6]

int ORIGIN_TRANSFORMS::FromDisplay

Definition at line 53 of file origin_transforms.cpp.

55 {
56  return static_cast<int>( FromDisplay( static_cast<long long int>( aValue ), aCoordType ) );
57 }
virtual long long int FromDisplay(long long int aValue, COORD_TYPES_T aCoordType) const override

◆ FromDisplay() [2/6]

long long int ORIGIN_TRANSFORMS::FromDisplay

Definition at line 59 of file origin_transforms.cpp.

61 {
62  return aValue;
63 }

◆ FromDisplay() [3/6]

double ORIGIN_TRANSFORMS::FromDisplay

Definition at line 65 of file origin_transforms.cpp.

67 {
68  return aValue;
69 }

◆ FromDisplay() [4/6]

long long int PCB_ORIGIN_TRANSFORMS::FromDisplay ( long long int  aValue,
COORD_TYPES_T  aCoordType 
) const
overridevirtual

Reimplemented from ORIGIN_TRANSFORMS.

Definition at line 77 of file pcb_origin_transforms.cpp.

79 {
80  long long value = aValue;
81 
82  switch( aCoordType )
83  {
84  case COORD_TYPE::ABS_X_COORD: value = FromDisplayAbsX( value ); break;
85  case COORD_TYPE::ABS_Y_COORD: value = FromDisplayAbsY( value ); break;
86  case COORD_TYPE::REL_X_COORD: value = FromDisplayRelX( value ); break;
87  case COORD_TYPE::REL_Y_COORD: value = FromDisplayRelY( value ); break;
88  case COORD_TYPE::NOT_A_COORD: /* do nothing */ ; break;
89  default: wxASSERT( false ); break;
90  };
91 
92  return value;
93 }
T FromDisplayRelY(T aDisplayValue) const
T FromDisplayAbsX(T aDisplayValue) const
T FromDisplayAbsY(T aDisplayValue) const
T FromDisplayRelX(T aDisplayValue) const

References FromDisplayAbsX(), FromDisplayAbsY(), FromDisplayRelX(), and FromDisplayRelY().

◆ FromDisplay() [5/6]

double PCB_ORIGIN_TRANSFORMS::FromDisplay ( double  aValue,
COORD_TYPES_T  aCoordType 
) const
overridevirtual

Reimplemented from ORIGIN_TRANSFORMS.

Definition at line 95 of file pcb_origin_transforms.cpp.

97 {
98  double value = aValue;
99 
100  switch( aCoordType )
101  {
102  case COORD_TYPE::ABS_X_COORD: value = FromDisplayAbsX( value ); break;
103  case COORD_TYPE::ABS_Y_COORD: value = FromDisplayAbsY( value ); break;
104  case COORD_TYPE::REL_X_COORD: value = FromDisplayRelX( value ); break;
105  case COORD_TYPE::REL_Y_COORD: value = FromDisplayRelY( value ); break;
106  case COORD_TYPE::NOT_A_COORD: /* do nothing */ ; break;
107  default: wxASSERT( false ); break;
108  };
109 
110  return value;
111 }
T FromDisplayRelY(T aDisplayValue) const
T FromDisplayAbsX(T aDisplayValue) const
T FromDisplayAbsY(T aDisplayValue) const
T FromDisplayRelX(T aDisplayValue) const

References FromDisplayAbsX(), FromDisplayAbsY(), FromDisplayRelX(), and FromDisplayRelY().

◆ FromDisplay() [6/6]

int ORIGIN_TRANSFORMS::FromDisplay ( int  aValue,
COORD_TYPES_T  aCoordType 
) const
virtualinherited

Definition at line 53 of file origin_transforms.cpp.

55 {
56  return static_cast<int>( FromDisplay( static_cast<long long int>( aValue ), aCoordType ) );
57 }
virtual int FromDisplay(int aValue, COORD_TYPES_T aCoordType) const

Referenced by ORIGIN_TRANSFORMS::FromDisplayAbs(), ORIGIN_TRANSFORMS::FromDisplayRel(), UNIT_BINDER::GetDoubleValue(), and UNIT_BINDER::GetValue().

◆ FromDisplayAbs() [1/3]

template<class T >
T ORIGIN_TRANSFORMS::FromDisplayAbs ( const T &  aValue) const
inlineinherited

Definition at line 101 of file origin_transforms.h.

102  {
103  T displayValue;
104 
105  displayValue.x = FromDisplay( aValue.x, ABS_X_COORD );
106  displayValue.y = FromDisplay( aValue.y, ABS_Y_COORD );
107  return displayValue;
108  }
virtual int FromDisplay(int aValue, COORD_TYPES_T aCoordType) const

References ORIGIN_TRANSFORMS::ABS_X_COORD, ORIGIN_TRANSFORMS::ABS_Y_COORD, and ORIGIN_TRANSFORMS::FromDisplay().

Referenced by FromDisplayAbsX(), and FromDisplayAbsY().

◆ FromDisplayAbs() [2/3]

template<typename T >
T PCB_ORIGIN_TRANSFORMS::FromDisplayAbs ( aDisplayValue) const
inline

Definition at line 160 of file pcb_origin_transforms.h.

161  {
162  T internalValue;
163 
164  internalValue.x = FromDisplayAbsX( aDisplayValue.x );
165  internalValue.y = FromDisplayAbsY( aDisplayValue.y );
166 
167  return internalValue;
168  }
T FromDisplayAbsX(T aDisplayValue) const
T FromDisplayAbsY(T aDisplayValue) const

References FromDisplayAbsX(), and FromDisplayAbsY().

◆ FromDisplayAbs() [3/3]

template<class T >
static T ORIGIN_TRANSFORMS::FromDisplayAbs ( aDisplayValue,
int  aUserOrigin,
bool  aInvertAxis 
)
inlinestaticprotectedinherited

Definition at line 167 of file origin_transforms.h.

170  {
171  T internalValue = aDisplayValue;
172 
173  // Invert the direction if needed
174  if( aInvertAxis && (internalValue != static_cast<T>(0)) )
175  internalValue = -internalValue;
176 
177  // Make the value relative to the internal origin
178  internalValue += aUserOrigin;
179 
180  return internalValue;
181  }

◆ FromDisplayAbsX()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::FromDisplayAbsX ( aDisplayValue) const
inline

Definition at line 134 of file pcb_origin_transforms.h.

135  {
137  }
T FromDisplayAbs(const T &aValue) const

References ORIGIN_TRANSFORMS::FromDisplayAbs(), GetUserXOrigin(), and m_invertXAxis.

Referenced by FromDisplay(), and FromDisplayAbs().

◆ FromDisplayAbsY()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::FromDisplayAbsY ( aDisplayValue) const
inline

Definition at line 140 of file pcb_origin_transforms.h.

141  {
143  }
T FromDisplayAbs(const T &aValue) const

References ORIGIN_TRANSFORMS::FromDisplayAbs(), GetUserYOrigin(), and m_invertYAxis.

Referenced by FromDisplay(), and FromDisplayAbs().

◆ FromDisplayRel() [1/3]

template<class T >
T ORIGIN_TRANSFORMS::FromDisplayRel ( const T &  aValue) const
inlineinherited

Definition at line 111 of file origin_transforms.h.

112  {
113  T displayValue;
114 
115  displayValue.x = FromDisplay( aValue.x, REL_X_COORD );
116  displayValue.y = FromDisplay( aValue.y, REL_Y_COORD );
117  return displayValue;
118  }
virtual int FromDisplay(int aValue, COORD_TYPES_T aCoordType) const

References ORIGIN_TRANSFORMS::FromDisplay(), ORIGIN_TRANSFORMS::REL_X_COORD, and ORIGIN_TRANSFORMS::REL_Y_COORD.

Referenced by FromDisplayRelX(), and FromDisplayRelY().

◆ FromDisplayRel() [2/3]

template<class T >
static T ORIGIN_TRANSFORMS::FromDisplayRel ( aDisplayValue,
bool  aInvertAxis 
)
inlinestaticprotectedinherited

Definition at line 137 of file origin_transforms.h.

139  {
140  T internalValue = aDisplayValue;
141 
142  // Invert the direction if needed
143  if( aInvertAxis && (internalValue != static_cast<T>(0)) )
144  internalValue = -internalValue;
145 
146  return internalValue;
147  }

◆ FromDisplayRel() [3/3]

template<typename T >
T PCB_ORIGIN_TRANSFORMS::FromDisplayRel ( aDisplayValue) const
inline

Definition at line 182 of file pcb_origin_transforms.h.

183  {
184  T internalValue;
185 
186  internalValue.x = FromDisplayRelX( aDisplayValue.x );
187  internalValue.y = FromDisplayRelY( aDisplayValue.y );
188 
189  return internalValue;
190  }
T FromDisplayRelY(T aDisplayValue) const
T FromDisplayRelX(T aDisplayValue) const

References FromDisplayRelX(), and FromDisplayRelY().

◆ FromDisplayRelX()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::FromDisplayRelX ( aDisplayValue) const
inline

Definition at line 107 of file pcb_origin_transforms.h.

108  {
109  return ORIGIN_TRANSFORMS::FromDisplayRel( aDisplayValue, m_invertXAxis );
110  }
T FromDisplayRel(const T &aValue) const

References ORIGIN_TRANSFORMS::FromDisplayRel(), and m_invertXAxis.

Referenced by FromDisplay(), and FromDisplayRel().

◆ FromDisplayRelY()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::FromDisplayRelY ( aDisplayValue) const
inline

Definition at line 113 of file pcb_origin_transforms.h.

114  {
115  return ORIGIN_TRANSFORMS::FromDisplayRel( aDisplayValue, m_invertYAxis );
116  }
T FromDisplayRel(const T &aValue) const

References ORIGIN_TRANSFORMS::FromDisplayRel(), and m_invertYAxis.

Referenced by FromDisplay(), and FromDisplayRel().

◆ GetUserXOrigin()

int PCB_ORIGIN_TRANSFORMS::GetUserXOrigin ( ) const
protected

Definition at line 114 of file pcb_origin_transforms.cpp.

115 {
116  return m_pcbBaseFrame.GetUserOrigin().x;
117 }
const wxPoint GetUserOrigin() const
const PCB_BASE_FRAME & m_pcbBaseFrame

References PCB_BASE_FRAME::GetUserOrigin(), and m_pcbBaseFrame.

Referenced by FromDisplayAbsX(), and ToDisplayAbsX().

◆ GetUserYOrigin()

int PCB_ORIGIN_TRANSFORMS::GetUserYOrigin ( ) const
protected

Definition at line 119 of file pcb_origin_transforms.cpp.

120 {
121  return m_pcbBaseFrame.GetUserOrigin().y;
122 }
const wxPoint GetUserOrigin() const
const PCB_BASE_FRAME & m_pcbBaseFrame

References PCB_BASE_FRAME::GetUserOrigin(), and m_pcbBaseFrame.

Referenced by FromDisplayAbsY(), and ToDisplayAbsY().

◆ ToDisplay() [1/6]

int ORIGIN_TRANSFORMS::ToDisplay

Definition at line 35 of file origin_transforms.cpp.

37 {
38  return static_cast<int>( ToDisplay( static_cast<long long int>( aValue ), aCoordType ) );
39 }
virtual long long int ToDisplay(long long int aValue, COORD_TYPES_T aCoordType) const override

◆ ToDisplay() [2/6]

long long int ORIGIN_TRANSFORMS::ToDisplay

Definition at line 41 of file origin_transforms.cpp.

43 {
44  return aValue;
45 }

◆ ToDisplay() [3/6]

double ORIGIN_TRANSFORMS::ToDisplay

Definition at line 47 of file origin_transforms.cpp.

49 {
50  return aValue;
51 }

◆ ToDisplay() [4/6]

long long int PCB_ORIGIN_TRANSFORMS::ToDisplay ( long long int  aValue,
COORD_TYPES_T  aCoordType 
) const
overridevirtual

Reimplemented from ORIGIN_TRANSFORMS.

Definition at line 41 of file pcb_origin_transforms.cpp.

43 {
44  long long int value = aValue;
45 
46  switch( aCoordType )
47  {
48  case COORD_TYPE::ABS_X_COORD: value = ToDisplayAbsX( value ); break;
49  case COORD_TYPE::ABS_Y_COORD: value = ToDisplayAbsY( value ); break;
50  case COORD_TYPE::REL_X_COORD: value = ToDisplayRelX( value ); break;
51  case COORD_TYPE::REL_Y_COORD: value = ToDisplayRelY( value ); break;
52  case COORD_TYPE::NOT_A_COORD: /* do nothing */ ; break;
53  default: wxASSERT( false ); break;
54  };
55 
56  return value;
57 }
T ToDisplayRelX(T aInternalValue) const
Transform a 2-D coordinate point referenced to the internal origin to the equivalent point referenced...
T ToDisplayAbsY(T aInternalValue) const
T ToDisplayRelY(T aInternalValue) const
T ToDisplayAbsX(T aInternalValue) const

References ToDisplayAbsX(), ToDisplayAbsY(), ToDisplayRelX(), and ToDisplayRelY().

◆ ToDisplay() [5/6]

double PCB_ORIGIN_TRANSFORMS::ToDisplay ( double  aValue,
COORD_TYPES_T  aCoordType 
) const
overridevirtual

Reimplemented from ORIGIN_TRANSFORMS.

Definition at line 59 of file pcb_origin_transforms.cpp.

61 {
62  double value = aValue;
63 
64  switch( aCoordType )
65  {
66  case COORD_TYPE::ABS_X_COORD: value = ToDisplayAbsX( value ); break;
67  case COORD_TYPE::ABS_Y_COORD: value = ToDisplayAbsY( value ); break;
68  case COORD_TYPE::REL_X_COORD: value = ToDisplayRelX( value ); break;
69  case COORD_TYPE::REL_Y_COORD: value = ToDisplayRelY( value ); break;
70  case COORD_TYPE::NOT_A_COORD: /* do nothing */ ; break;
71  default: wxASSERT( false ); break;
72  };
73 
74  return value;
75 }
T ToDisplayRelX(T aInternalValue) const
Transform a 2-D coordinate point referenced to the internal origin to the equivalent point referenced...
T ToDisplayAbsY(T aInternalValue) const
T ToDisplayRelY(T aInternalValue) const
T ToDisplayAbsX(T aInternalValue) const

References ToDisplayAbsX(), ToDisplayAbsY(), ToDisplayRelX(), and ToDisplayRelY().

◆ ToDisplay() [6/6]

int ORIGIN_TRANSFORMS::ToDisplay ( int  aValue,
COORD_TYPES_T  aCoordType 
) const
virtualinherited

Definition at line 35 of file origin_transforms.cpp.

37 {
38  return static_cast<int>( ToDisplay( static_cast<long long int>( aValue ), aCoordType ) );
39 }
virtual int ToDisplay(int aValue, COORD_TYPES_T aCoordType) const

Referenced by UNIT_BINDER::ChangeValue(), UNIT_BINDER::SetDoubleValue(), UNIT_BINDER::SetValue(), ORIGIN_TRANSFORMS::ToDisplayAbs(), and ORIGIN_TRANSFORMS::ToDisplayRel().

◆ ToDisplayAbs() [1/3]

template<class T >
T ORIGIN_TRANSFORMS::ToDisplayAbs ( const T &  aValue) const
inlineinherited

Definition at line 80 of file origin_transforms.h.

81  {
82  T displayValue;
83 
84  displayValue.x = ToDisplay( aValue.x, ABS_X_COORD );
85  displayValue.y = ToDisplay( aValue.y, ABS_Y_COORD );
86  return displayValue;
87  }
virtual int ToDisplay(int aValue, COORD_TYPES_T aCoordType) const

References ORIGIN_TRANSFORMS::ABS_X_COORD, ORIGIN_TRANSFORMS::ABS_Y_COORD, and ORIGIN_TRANSFORMS::ToDisplay().

Referenced by DIMENSION_BASE::GetMsgPanelInfo(), LEADER::GetMsgPanelInfo(), ToDisplayAbsX(), and ToDisplayAbsY().

◆ ToDisplayAbs() [2/3]

template<typename T >
T PCB_ORIGIN_TRANSFORMS::ToDisplayAbs ( aInternalValue) const
inline

Definition at line 149 of file pcb_origin_transforms.h.

150  {
151  T displayValue;
152 
153  displayValue.x = ToDisplayAbsX( aInternalValue.x );
154  displayValue.y = ToDisplayAbsY( aInternalValue.y );
155 
156  return displayValue;
157  }
T ToDisplayAbsY(T aInternalValue) const
T ToDisplayAbsX(T aInternalValue) const

References ToDisplayAbsX(), and ToDisplayAbsY().

◆ ToDisplayAbs() [3/3]

template<class T >
static T ORIGIN_TRANSFORMS::ToDisplayAbs ( aInternalValue,
int  aUserOrigin,
bool  aInvertAxis 
)
inlinestaticprotectedinherited

Definition at line 150 of file origin_transforms.h.

153  {
154  T displayValue = aInternalValue;
155 
156  // Make the value relative to the internal origin
157  displayValue -= aUserOrigin;
158 
159  // Invert the direction if needed
160  if( aInvertAxis && (displayValue != static_cast<T>(0)) )
161  displayValue = -displayValue;
162 
163  return displayValue;
164  }

◆ ToDisplayAbsX()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::ToDisplayAbsX ( aInternalValue) const
inline

Definition at line 122 of file pcb_origin_transforms.h.

123  {
124  return ORIGIN_TRANSFORMS::ToDisplayAbs( aInternalValue, GetUserXOrigin(), m_invertXAxis );
125  }
T ToDisplayAbs(const T &aValue) const

References GetUserXOrigin(), m_invertXAxis, and ORIGIN_TRANSFORMS::ToDisplayAbs().

Referenced by ToDisplay(), ToDisplayAbs(), and PCB_BASE_FRAME::UpdateStatusBar().

◆ ToDisplayAbsY()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::ToDisplayAbsY ( aInternalValue) const
inline

Definition at line 128 of file pcb_origin_transforms.h.

129  {
130  return ORIGIN_TRANSFORMS::ToDisplayAbs( aInternalValue, GetUserYOrigin(), m_invertYAxis );
131  }
T ToDisplayAbs(const T &aValue) const

References GetUserYOrigin(), m_invertYAxis, and ORIGIN_TRANSFORMS::ToDisplayAbs().

Referenced by ToDisplay(), ToDisplayAbs(), and PCB_BASE_FRAME::UpdateStatusBar().

◆ ToDisplayRel() [1/3]

template<class T >
T ORIGIN_TRANSFORMS::ToDisplayRel ( const T &  aValue) const
inlineinherited

Definition at line 90 of file origin_transforms.h.

91  {
92  T displayValue;
93 
94  displayValue.x = ToDisplay( aValue.x, REL_X_COORD );
95  displayValue.y = ToDisplay( aValue.y, REL_Y_COORD );
96  return displayValue;
97  }
virtual int ToDisplay(int aValue, COORD_TYPES_T aCoordType) const

References ORIGIN_TRANSFORMS::REL_X_COORD, ORIGIN_TRANSFORMS::REL_Y_COORD, and ORIGIN_TRANSFORMS::ToDisplay().

Referenced by ToDisplayRelX(), and ToDisplayRelY().

◆ ToDisplayRel() [2/3]

template<class T >
static T ORIGIN_TRANSFORMS::ToDisplayRel ( aInternalValue,
bool  aInvertAxis 
)
inlinestaticprotectedinherited

Definition at line 123 of file origin_transforms.h.

125  {
126  T displayValue = aInternalValue;
127 
128  // Invert the direction if needed
129  if( aInvertAxis && (displayValue != static_cast<T>(0)) )
130  displayValue = -displayValue;
131 
132  return displayValue;
133  }

◆ ToDisplayRel() [3/3]

template<typename T >
T PCB_ORIGIN_TRANSFORMS::ToDisplayRel ( aInternalValue) const
inline

Definition at line 171 of file pcb_origin_transforms.h.

172  {
173  T displayValue;
174 
175  displayValue.x = ToDisplayRelX( aInternalValue.x );
176  displayValue.y = ToDisplayRelY( aInternalValue.y );
177 
178  return displayValue;
179  }
T ToDisplayRelX(T aInternalValue) const
Transform a 2-D coordinate point referenced to the internal origin to the equivalent point referenced...
T ToDisplayRelY(T aInternalValue) const

References ToDisplayRelX(), and ToDisplayRelY().

◆ ToDisplayRelX()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::ToDisplayRelX ( aInternalValue) const
inline

Transform a 2-D coordinate point referenced to the internal origin to the equivalent point referenced to the user-selected display origin.

Parameters
aValuea point referenced to the internal origin
Returns
the point re-referenced to the user-selected display originTransform a 2-D coordinate point referenced to the user-selected display origin to the equivalent point referenced to the internal origin.
Parameters
aValuea point referenced to the user-selected display origin
Returns
the point re-referenced to the internal originTransform a relative 2-D coordinate delta referenced to the user-selected display origin to the equivalent delta referenced to the internal origin.

This is initially intended to handle axis inversion of a delta between two display points, but could be extended to handle other transforms.

Parameters
aValuea delta referenced to the internal origin
Returns
the delta re-referenced to the user-selected display originTransform a relative 2-D coordinate delta referenced to the user-selected display origin to the equivalent delta referenced to the internal origin.

This is initially intended to handle axis inversion of a delta between two display points, but could be extended to handle other transforms.

Parameters
aValuea delta referenced to the user-selected display origin
Returns
the delta re-referenced to the internal origin

Definition at line 95 of file pcb_origin_transforms.h.

96  {
97  return ORIGIN_TRANSFORMS::ToDisplayRel( aInternalValue, m_invertXAxis );
98  }
T ToDisplayRel(const T &aValue) const

References m_invertXAxis, and ORIGIN_TRANSFORMS::ToDisplayRel().

Referenced by ToDisplay(), ToDisplayRel(), and PCB_BASE_FRAME::UpdateStatusBar().

◆ ToDisplayRelY()

template<typename T >
T PCB_ORIGIN_TRANSFORMS::ToDisplayRelY ( aInternalValue) const
inline

Definition at line 101 of file pcb_origin_transforms.h.

102  {
103  return ORIGIN_TRANSFORMS::ToDisplayRel( aInternalValue, m_invertYAxis );
104  }
T ToDisplayRel(const T &aValue) const

References m_invertYAxis, and ORIGIN_TRANSFORMS::ToDisplayRel().

Referenced by ToDisplay(), ToDisplayRel(), and PCB_BASE_FRAME::UpdateStatusBar().

Member Data Documentation

◆ m_invertXAxis

const bool& PCB_ORIGIN_TRANSFORMS::m_invertXAxis
protected

◆ m_invertYAxis

const bool& PCB_ORIGIN_TRANSFORMS::m_invertYAxis
protected

◆ m_pcbBaseFrame

const PCB_BASE_FRAME& PCB_ORIGIN_TRANSFORMS::m_pcbBaseFrame
protected

Definition at line 197 of file pcb_origin_transforms.h.

Referenced by GetUserXOrigin(), and GetUserYOrigin().


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