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 170 of file sch_text.cpp.

171 {
172  SPIN newSpin = m_spin;
173 
174  switch( m_spin )
175  {
176  case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
177  case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::UP; break;
178  case LABEL_SPIN_STYLE::LEFT: break;
179  case LABEL_SPIN_STYLE::RIGHT: break;
180  default: wxLogWarning( "MirrorX encountered unknown current spin style" ); break;
181  }
182 
183  return LABEL_SPIN_STYLE( newSpin );
184 }
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 187 of file sch_text.cpp.

188 {
189  SPIN newSpin = m_spin;
190 
191  switch( m_spin )
192  {
193  case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
194  case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::LEFT; break;
195  case LABEL_SPIN_STYLE::UP: break;
196  case LABEL_SPIN_STYLE::BOTTOM: break;
197  default: wxLogWarning( "MirrorY encountered unknown current spin style" ); break;
198  }
199 
200  return LABEL_SPIN_STYLE( newSpin );
201 }
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 153 of file sch_text.cpp.

154 {
155  SPIN newSpin = m_spin;
156 
157  switch( m_spin )
158  {
159  case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
160  case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
161  case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::UP; break;
162  case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::LEFT; break;
163  default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); break;
164  }
165 
166  return LABEL_SPIN_STYLE( newSpin );
167 }
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 136 of file sch_text.cpp.

137 {
138  SPIN newSpin = m_spin;
139 
140  switch( m_spin )
141  {
142  case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::UP; break;
143  case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
144  case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
145  case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::LEFT; break;
146  default: wxLogWarning( "RotateCW encountered unknown current spin style" ); break;
147  }
148 
149  return LABEL_SPIN_STYLE( newSpin );
150 }
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: