KiCad PCB EDA Suite
EDA_ANGLE_VARIANT_DATA Class Reference

#include <eda_angle_variant.h>

Inheritance diagram for EDA_ANGLE_VARIANT_DATA:

Public Member Functions

 EDA_ANGLE_VARIANT_DATA ()
 
 EDA_ANGLE_VARIANT_DATA (double aAngleDegrees)
 
 EDA_ANGLE_VARIANT_DATA (const EDA_ANGLE &aAngle)
 
bool Eq (wxVariantData &aOther) const override
 
wxString GetType () const override
 
bool Read (wxString &aString) override
 
bool Write (wxString &aString) const override
 
bool GetAsAny (wxAny *aAny) const override
 
const EDA_ANGLEAngle ()
 
void SetAngle (const EDA_ANGLE &aAngle)
 

Static Public Member Functions

static wxVariantData * VariantDataFactory (const wxAny &aAny)
 

Protected Attributes

EDA_ANGLE m_angle
 

Detailed Description

Definition at line 27 of file eda_angle_variant.h.

Constructor & Destructor Documentation

◆ EDA_ANGLE_VARIANT_DATA() [1/3]

EDA_ANGLE_VARIANT_DATA::EDA_ANGLE_VARIANT_DATA ( )

Definition at line 23 of file eda_angle_variant.cpp.

23 :
24 wxVariantData()
25{}

Referenced by VariantDataFactory().

◆ EDA_ANGLE_VARIANT_DATA() [2/3]

EDA_ANGLE_VARIANT_DATA::EDA_ANGLE_VARIANT_DATA ( double  aAngleDegrees)

Definition at line 28 of file eda_angle_variant.cpp.

28 :
29 wxVariantData(),
30 m_angle( aAngleDegrees, DEGREES_T )
31{}
@ DEGREES_T
Definition: eda_angle.h:31

◆ EDA_ANGLE_VARIANT_DATA() [3/3]

EDA_ANGLE_VARIANT_DATA::EDA_ANGLE_VARIANT_DATA ( const EDA_ANGLE aAngle)

Definition at line 34 of file eda_angle_variant.cpp.

34 :
35 wxVariantData(),
36 m_angle( aAngle )
37{}

Member Function Documentation

◆ Angle()

const EDA_ANGLE & EDA_ANGLE_VARIANT_DATA::Angle ( )
inline

Definition at line 48 of file eda_angle_variant.h.

48{ return m_angle; }

References m_angle.

Referenced by PG_UNIT_EDITOR::GetValueFromControl(), PROPERTY_BASE::set(), and PG_UNIT_EDITOR::UpdateControl().

◆ Eq()

bool EDA_ANGLE_VARIANT_DATA::Eq ( wxVariantData &  aOther) const
override

Definition at line 40 of file eda_angle_variant.cpp.

41{
42 try
43 {
44 EDA_ANGLE_VARIANT_DATA& evd = dynamic_cast<EDA_ANGLE_VARIANT_DATA&>( aOther );
45
46 return evd.m_angle == m_angle;
47 }
48 catch( std::bad_cast& )
49 {
50 return false;
51 }
52}

References m_angle.

◆ GetAsAny()

bool EDA_ANGLE_VARIANT_DATA::GetAsAny ( wxAny *  aAny) const
override

Definition at line 74 of file eda_angle_variant.cpp.

75{
76 *aAny = m_angle.AsDegrees();
77 return true;
78}
double AsDegrees() const
Definition: eda_angle.h:149

References EDA_ANGLE::AsDegrees(), and m_angle.

◆ GetType()

wxString EDA_ANGLE_VARIANT_DATA::GetType ( ) const
inlineoverride

Definition at line 38 of file eda_angle_variant.h.

38{ return wxT( "EDA_ANGLE" ); }

◆ Read()

bool EDA_ANGLE_VARIANT_DATA::Read ( wxString &  aString)
override

Definition at line 55 of file eda_angle_variant.cpp.

56{
57 double val;
58
59 if( !aString.ToDouble( &val ) )
60 return false;
61
62 m_angle = EDA_ANGLE( val, DEGREES_T );
63 return true;
64}

References DEGREES_T, and m_angle.

◆ SetAngle()

void EDA_ANGLE_VARIANT_DATA::SetAngle ( const EDA_ANGLE aAngle)
inline

Definition at line 50 of file eda_angle_variant.h.

50{ m_angle = aAngle; }

References m_angle.

Referenced by PG_UNIT_EDITOR::GetValueFromControl().

◆ VariantDataFactory()

static wxAnyToEDA_ANGLE_VARIANTRegistrationImpl s_wxAnyToEDA_ANGLE_VARIANTRegistration & EDA_ANGLE_VARIANT_DATA::VariantDataFactory ( const wxAny &  aAny)
static

Definition at line 81 of file eda_angle_variant.cpp.

82{
83 return new EDA_ANGLE_VARIANT_DATA( aAny.As<EDA_ANGLE>() );
84}

References EDA_ANGLE_VARIANT_DATA().

◆ Write()

bool EDA_ANGLE_VARIANT_DATA::Write ( wxString &  aString) const
override

Definition at line 67 of file eda_angle_variant.cpp.

68{
69 aString = wxString::Format( wxT("%g\u00B0"), m_angle.AsDegrees() );
70 return true;
71}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References EDA_ANGLE::AsDegrees(), Format(), and m_angle.

Member Data Documentation

◆ m_angle

EDA_ANGLE EDA_ANGLE_VARIANT_DATA::m_angle
protected

Definition at line 53 of file eda_angle_variant.h.

Referenced by Angle(), Eq(), GetAsAny(), Read(), SetAngle(), and Write().


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