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
29#include <math/vector2d.h>
30#include <wx/string.h>
31
32class EDA_TEXT;
33
35{
36public:
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>
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>
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
68protected:
70};
71
72
73#endif // EASYEDA_PARSER_BASE_H_
double ConvertSize(const wxString &aValue)
std::vector< SHAPE_LINE_CHAIN > ParseLineChains(const wxString &aData, int aArcMinSegLen, bool aForceClosed)
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)
virtual double ScaleSize(double aValue)=0
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:83
Define a general 2D-vector/point.
Definition: vector2d.h:70