KiCad PCB EDA Suite
LABEL_SPIN_STYLE Class Reference

#include <sch_text.h>

Public Types

enum  SPIN : int { LEFT = 0, UP = 1, RIGHT = 2, BOTTOM = 3 }
 

Public Member Functions

 LABEL_SPIN_STYLE ()=default
 
constexpr LABEL_SPIN_STYLE (SPIN aSpin)
 
constexpr bool operator== (SPIN a) const
 
constexpr bool operator!= (SPIN a) const
 
 operator int () const
 
LABEL_SPIN_STYLE RotateCW ()
 
LABEL_SPIN_STYLE RotateCCW ()
 
LABEL_SPIN_STYLE MirrorX ()
 Mirror the label spin style across the X axis or simply swaps up and bottom. More...
 
LABEL_SPIN_STYLE MirrorY ()
 Mirror the label spin style across the Y axis or simply swaps left and right. More...
 

Private Attributes

SPIN m_spin
 

Detailed Description

Definition at line 42 of file sch_text.h.

Member Enumeration Documentation

◆ SPIN

Enumerator
LEFT 
UP 
RIGHT 
BOTTOM 

Definition at line 45 of file sch_text.h.

45  : int
46  {
47  LEFT = 0,
48  UP = 1,
49  RIGHT = 2,
50  BOTTOM = 3
51  };

Constructor & Destructor Documentation

◆ LABEL_SPIN_STYLE() [1/2]

LABEL_SPIN_STYLE::LABEL_SPIN_STYLE ( )
default

Referenced by MirrorX(), MirrorY(), RotateCCW(), and RotateCW().

◆ LABEL_SPIN_STYLE() [2/2]

constexpr LABEL_SPIN_STYLE::LABEL_SPIN_STYLE ( SPIN  aSpin)
inline

Definition at line 55 of file sch_text.h.

55  : m_spin( aSpin )
56  {
57  }

Member Function Documentation

◆ MirrorX()

LABEL_SPIN_STYLE LABEL_SPIN_STYLE::MirrorX ( )

Mirror the label spin style across the X axis or simply swaps up and bottom.

Definition at line 181 of file sch_text.cpp.

182 {
183  SPIN newSpin = m_spin;
184 
185  switch( m_spin )
186  {
187  case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
188  case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::UP; break;
189  case LABEL_SPIN_STYLE::LEFT: break;
190  case LABEL_SPIN_STYLE::RIGHT: break;
191  default: wxLogWarning( wxT( "MirrorX encountered unknown current spin style" ) ); break;
192  }
193 
194  return LABEL_SPIN_STYLE( newSpin );
195 }
LABEL_SPIN_STYLE()=default

References BOTTOM, LABEL_SPIN_STYLE(), LEFT, m_spin, RIGHT, and UP.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), and orientLabel().

◆ MirrorY()

LABEL_SPIN_STYLE LABEL_SPIN_STYLE::MirrorY ( )

Mirror the label spin style across the Y axis or simply swaps left and right.

Definition at line 198 of file sch_text.cpp.

199 {
200  SPIN newSpin = m_spin;
201 
202  switch( m_spin )
203  {
204  case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
205  case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::LEFT; break;
206  case LABEL_SPIN_STYLE::UP: break;
207  case LABEL_SPIN_STYLE::BOTTOM: break;
208  default: wxLogWarning( wxT( "MirrorY encountered unknown current spin style" ) ); break;
209  }
210 
211  return LABEL_SPIN_STYLE( newSpin );
212 }
LABEL_SPIN_STYLE()=default

References BOTTOM, LABEL_SPIN_STYLE(), LEFT, m_spin, RIGHT, and UP.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), and orientLabel().

◆ operator int()

LABEL_SPIN_STYLE::operator int ( ) const
inline

Definition at line 69 of file sch_text.h.

70  {
71  return static_cast<int>( m_spin );
72  }

References m_spin.

◆ operator!=()

constexpr bool LABEL_SPIN_STYLE::operator!= ( SPIN  a) const
inline

Definition at line 64 of file sch_text.h.

65  {
66  return m_spin != a;
67  }

References m_spin.

◆ operator==()

constexpr bool LABEL_SPIN_STYLE::operator== ( SPIN  a) const
inline

Definition at line 59 of file sch_text.h.

60  {
61  return m_spin == a;
62  }

References m_spin.

◆ RotateCCW()

LABEL_SPIN_STYLE LABEL_SPIN_STYLE::RotateCCW ( )

Definition at line 164 of file sch_text.cpp.

165 {
166  SPIN newSpin = m_spin;
167 
168  switch( m_spin )
169  {
170  case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
171  case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
172  case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::UP; break;
173  case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::LEFT; break;
174  default: wxLogWarning( wxT( "RotateCCW encountered unknown current spin style" ) ); break;
175  }
176 
177  return LABEL_SPIN_STYLE( newSpin );
178 }
LABEL_SPIN_STYLE()=default

References BOTTOM, LABEL_SPIN_STYLE(), LEFT, m_spin, RIGHT, and UP.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle(), and orientLabel().

◆ RotateCW()

LABEL_SPIN_STYLE LABEL_SPIN_STYLE::RotateCW ( )

Definition at line 147 of file sch_text.cpp.

148 {
149  SPIN newSpin = m_spin;
150 
151  switch( m_spin )
152  {
153  case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::UP; break;
154  case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
155  case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
156  case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::LEFT; break;
157  default: wxLogWarning( wxT( "RotateCW encountered unknown current spin style" ) ); break;
158  }
159 
160  return LABEL_SPIN_STYLE( newSpin );
161 }
LABEL_SPIN_STYLE()=default

References BOTTOM, LABEL_SPIN_STYLE(), LEFT, m_spin, RIGHT, and UP.

Member Data Documentation

◆ m_spin

SPIN LABEL_SPIN_STYLE::m_spin
private

Definition at line 89 of file sch_text.h.

Referenced by MirrorX(), MirrorY(), operator int(), operator!=(), operator==(), RotateCCW(), and RotateCW().


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