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
25#include <math/vector2d.h>
26#include <wx/string.h>
27
28class EDA_TEXT;
29
31{
32public:
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>
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>
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
63protected:
65};
66
67
68#endif // EASYEDA_PARSER_BASE_H_
double ConvertSize(const wxString &aValue)
static double Convert(const wxString &aValue)
double ScaleSize(const wxString &aValue)
double RelPosX(double aValue)
double RelPosY(double aValue)
VECTOR2< T > RelPos(const VECTOR2< T > &aVec)
VECTOR2< T > ScalePos(const VECTOR2< T > &aValue)
void TransformTextToBaseline(EDA_TEXT *textItem, const wxString &baselineAlign)
std::vector< SHAPE_LINE_CHAIN > ParseLineChains(const wxString &aData, int aMaxError, bool aForceClosed)
virtual double ScaleSize(double aValue)=0
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:89
Define a general 2D-vector/point.
Definition vector2d.h:67
VECTOR2< double > VECTOR2D
Definition vector2d.h:682