KiCad PCB EDA Suite
Loading...
Searching...
No Matches
easyeda_parser_base.h
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 (C) 2023 Alex Shvartzkop <
[email protected]
>
5
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, you may find one here:
19
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20
* or you may search the http://www.gnu.org website for the version 2 license,
21
* or you may write to the Free Software Foundation, Inc.,
22
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23
*/
24
25
#ifndef EASYEDA_PARSER_BASE_H_
26
#define EASYEDA_PARSER_BASE_H_
27
28
#include <
geometry/shape_poly_set.h
>
29
#include <
math/vector2d.h
>
30
#include <wx/string.h>
31
32
class
EDA_TEXT
;
33
34
class
EASYEDA_PARSER_BASE
35
{
36
public
:
37
static
double
Convert
(
const
wxString& aValue );
38
39
double
ConvertSize
(
const
wxString& aValue ) {
return
ScaleSize
(
Convert
( aValue ) ); }
40
41
virtual
double
ScaleSize
(
double
aValue ) = 0;
42
43
double
ScaleSize
(
const
wxString& aValue ) {
return
ScaleSize
(
Convert
( aValue ) ); }
44
45
template
<
typename
T>
46
VECTOR2<T>
ScalePos
(
const
VECTOR2<T>
& aValue )
47
{
48
return
VECTOR2<T>
(
ScaleSize
( aValue.
x
),
ScaleSize
( aValue.
y
) );
49
}
50
51
double
RelPosX
(
double
aValue );
52
double
RelPosY
(
double
aValue );
53
54
double
RelPosX
(
const
wxString& aValue );
55
double
RelPosY
(
const
wxString& aValue );
56
57
template
<
typename
T>
58
VECTOR2<T>
RelPos
(
const
VECTOR2<T>
& aVec )
59
{
60
return
ScalePos
( aVec -
m_relOrigin
);
61
}
62
63
void
TransformTextToBaseline
(
EDA_TEXT
* textItem,
const
wxString& baselineAlign );
64
65
std::vector<SHAPE_LINE_CHAIN>
ParseLineChains
(
const
wxString& aData,
int
aArcMinSegLen,
66
bool
aForceClosed );
67
68
protected
:
69
VECTOR2D
m_relOrigin
;
70
};
71
72
73
#endif
// EASYEDA_PARSER_BASE_H_
EASYEDA_PARSER_BASE
Definition:
easyeda_parser_base.h:35
EASYEDA_PARSER_BASE::ConvertSize
double ConvertSize(const wxString &aValue)
Definition:
easyeda_parser_base.h:39
EASYEDA_PARSER_BASE::ParseLineChains
std::vector< SHAPE_LINE_CHAIN > ParseLineChains(const wxString &aData, int aArcMinSegLen, bool aForceClosed)
Definition:
easyeda_parser_base.cpp:111
EASYEDA_PARSER_BASE::Convert
static double Convert(const wxString &aValue)
Definition:
easyeda_parser_base.cpp:33
EASYEDA_PARSER_BASE::ScaleSize
double ScaleSize(const wxString &aValue)
Definition:
easyeda_parser_base.h:43
EASYEDA_PARSER_BASE::RelPosX
double RelPosX(double aValue)
Definition:
easyeda_parser_base.cpp:44
EASYEDA_PARSER_BASE::RelPosY
double RelPosY(double aValue)
Definition:
easyeda_parser_base.cpp:51
EASYEDA_PARSER_BASE::RelPos
VECTOR2< T > RelPos(const VECTOR2< T > &aVec)
Definition:
easyeda_parser_base.h:58
EASYEDA_PARSER_BASE::m_relOrigin
VECTOR2D m_relOrigin
Definition:
easyeda_parser_base.h:69
EASYEDA_PARSER_BASE::ScalePos
VECTOR2< T > ScalePos(const VECTOR2< T > &aValue)
Definition:
easyeda_parser_base.h:46
EASYEDA_PARSER_BASE::TransformTextToBaseline
void TransformTextToBaseline(EDA_TEXT *textItem, const wxString &baselineAlign)
Definition:
easyeda_parser_base.cpp:70
EASYEDA_PARSER_BASE::ScaleSize
virtual double ScaleSize(double aValue)=0
EDA_TEXT
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition:
eda_text.h:79
VECTOR2
Define a general 2D-vector/point.
Definition:
vector2d.h:71
VECTOR2::x
T x
Definition:
vector2d.h:79
VECTOR2::y
T y
Definition:
vector2d.h:79
shape_poly_set.h
vector2d.h
src
common
io
easyeda
easyeda_parser_base.h
Generated on Thu Nov 21 2024 00:06:37 for KiCad PCB EDA Suite by
1.9.6