KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_angle_variant.cpp
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <
properties/eda_angle_variant.h
>
21
22
23
EDA_ANGLE_VARIANT_DATA::EDA_ANGLE_VARIANT_DATA
() :
24
wxVariantData()
25
{}
26
27
28
EDA_ANGLE_VARIANT_DATA::EDA_ANGLE_VARIANT_DATA
(
double
aAngleDegrees ) :
29
wxVariantData(),
30
m_angle
( aAngleDegrees,
DEGREES_T
)
31
{}
32
33
34
EDA_ANGLE_VARIANT_DATA::EDA_ANGLE_VARIANT_DATA
(
const
EDA_ANGLE
& aAngle ) :
35
wxVariantData(),
36
m_angle
( aAngle )
37
{}
38
39
40
bool
EDA_ANGLE_VARIANT_DATA::Eq
( wxVariantData& aOther )
const
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
}
53
54
55
bool
EDA_ANGLE_VARIANT_DATA::Read
( wxString& aString )
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
}
65
66
67
bool
EDA_ANGLE_VARIANT_DATA::Write
( wxString& aString )
const
68
{
69
aString = wxString::Format( wxT(
"%g\u00B0"
),
m_angle
.AsDegrees() );
70
return
true
;
71
}
72
73
74
bool
EDA_ANGLE_VARIANT_DATA::GetAsAny
( wxAny* aAny )
const
75
{
76
*aAny =
m_angle
.AsDegrees();
77
return
true
;
78
}
79
80
81
wxVariantData*
EDA_ANGLE_VARIANT_DATA::VariantDataFactory
(
const
wxAny& aAny )
82
{
83
return
new
EDA_ANGLE_VARIANT_DATA
( aAny.As<
EDA_ANGLE
>() );
84
}
85
86
EDA_ANGLE_VARIANT_DATA::Read
bool Read(wxString &aString) override
Definition
eda_angle_variant.cpp:55
EDA_ANGLE_VARIANT_DATA::VariantDataFactory
static wxVariantData * VariantDataFactory(const wxAny &aAny)
Definition
eda_angle_variant.cpp:81
EDA_ANGLE_VARIANT_DATA::m_angle
EDA_ANGLE m_angle
Definition
eda_angle_variant.h:53
EDA_ANGLE_VARIANT_DATA::Eq
bool Eq(wxVariantData &aOther) const override
Definition
eda_angle_variant.cpp:40
EDA_ANGLE_VARIANT_DATA::EDA_ANGLE_VARIANT_DATA
EDA_ANGLE_VARIANT_DATA()
Definition
eda_angle_variant.cpp:23
EDA_ANGLE_VARIANT_DATA::GetAsAny
bool GetAsAny(wxAny *aAny) const override
Definition
eda_angle_variant.cpp:74
EDA_ANGLE_VARIANT_DATA::Write
bool Write(wxString &aString) const override
Definition
eda_angle_variant.cpp:67
EDA_ANGLE
Definition
eda_angle.h:37
DEGREES_T
@ DEGREES_T
Definition
eda_angle.h:31
eda_angle_variant.h
src
common
properties
eda_angle_variant.cpp
Generated on Sun Sep 21 2025 01:05:21 for KiCad PCB EDA Suite by
1.13.2