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 The 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, see <https://www.gnu.org/licenses/>.
19
*/
20
21
#ifndef EASYEDA_PARSER_BASE_H_
22
#define EASYEDA_PARSER_BASE_H_
23
24
#include <
geometry/shape_poly_set.h
>
25
#include <
math/vector2d.h
>
26
#include <wx/string.h>
27
28
class
EDA_TEXT
;
29
30
class
EASYEDA_PARSER_BASE
31
{
32
public
:
33
static
double
Convert
(
const
wxString& aValue );
34
35
double
ConvertSize
(
const
wxString& aValue ) {
return
ScaleSize
(
Convert
( aValue ) ); }
36
37
virtual
double
ScaleSize
(
double
aValue ) = 0;
38
39
double
ScaleSize
(
const
wxString& aValue ) {
return
ScaleSize
(
Convert
( aValue ) ); }
40
41
template
<
typename
T>
42
VECTOR2<T>
ScalePos
(
const
VECTOR2<T>
& aValue )
43
{
44
return
VECTOR2<T>
(
ScaleSize
( aValue.
x
),
ScaleSize
( aValue.
y
) );
45
}
46
47
double
RelPosX
(
double
aValue );
48
double
RelPosY
(
double
aValue );
49
50
double
RelPosX
(
const
wxString& aValue );
51
double
RelPosY
(
const
wxString& aValue );
52
53
template
<
typename
T>
54
VECTOR2<T>
RelPos
(
const
VECTOR2<T>
& aVec )
55
{
56
return
ScalePos
( aVec -
m_relOrigin
);
57
}
58
59
void
TransformTextToBaseline
(
EDA_TEXT
* textItem,
const
wxString& baselineAlign );
60
61
std::vector<SHAPE_LINE_CHAIN>
ParseLineChains
(
const
wxString& aData,
int
aMaxError,
bool
aForceClosed );
62
63
protected
:
64
VECTOR2D
m_relOrigin
;
65
};
66
67
68
#endif
// EASYEDA_PARSER_BASE_H_
EASYEDA_PARSER_BASE
Definition
easyeda_parser_base.h:31
EASYEDA_PARSER_BASE::ConvertSize
double ConvertSize(const wxString &aValue)
Definition
easyeda_parser_base.h:35
EASYEDA_PARSER_BASE::Convert
static double Convert(const wxString &aValue)
Definition
easyeda_parser_base.cpp:29
EASYEDA_PARSER_BASE::ScaleSize
double ScaleSize(const wxString &aValue)
Definition
easyeda_parser_base.h:39
EASYEDA_PARSER_BASE::RelPosX
double RelPosX(double aValue)
Definition
easyeda_parser_base.cpp:40
EASYEDA_PARSER_BASE::RelPosY
double RelPosY(double aValue)
Definition
easyeda_parser_base.cpp:47
EASYEDA_PARSER_BASE::RelPos
VECTOR2< T > RelPos(const VECTOR2< T > &aVec)
Definition
easyeda_parser_base.h:54
EASYEDA_PARSER_BASE::m_relOrigin
VECTOR2D m_relOrigin
Definition
easyeda_parser_base.h:64
EASYEDA_PARSER_BASE::ScalePos
VECTOR2< T > ScalePos(const VECTOR2< T > &aValue)
Definition
easyeda_parser_base.h:42
EASYEDA_PARSER_BASE::TransformTextToBaseline
void TransformTextToBaseline(EDA_TEXT *textItem, const wxString &baselineAlign)
Definition
easyeda_parser_base.cpp:66
EASYEDA_PARSER_BASE::ParseLineChains
std::vector< SHAPE_LINE_CHAIN > ParseLineChains(const wxString &aData, int aMaxError, bool aForceClosed)
Definition
easyeda_parser_base.cpp:107
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:89
VECTOR2
Define a general 2D-vector/point.
Definition
vector2d.h:67
VECTOR2::x
T x
Definition
vector2d.h:75
VECTOR2::y
T y
Definition
vector2d.h:75
shape_poly_set.h
vector2d.h
VECTOR2D
VECTOR2< double > VECTOR2D
Definition
vector2d.h:682
src
common
io
easyeda
easyeda_parser_base.h
Generated on Fri Jun 26 2026 00:05:32 for KiCad PCB EDA Suite by
1.13.2