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
33{
34public:
35 static double Convert( const wxString& aValue );
36
37 double ConvertSize( const wxString& aValue ) { return ScaleSize( Convert( aValue ) ); }
38
39 virtual double ScaleSize( double aValue ) = 0;
40
41 double ScaleSize( const wxString& aValue ) { return ScaleSize( Convert( aValue ) ); }
42
43 template <typename T>
45 {
46 return VECTOR2<T>( ScaleSize( aValue.x ), ScaleSize( aValue.y ) );
47 }
48
49 double RelPosX( double aValue );
50 double RelPosY( double aValue );
51
52 double RelPosX( const wxString& aValue );
53 double RelPosY( const wxString& aValue );
54
55 template <typename T>
57 {
58 return ScalePos( aVec - m_relOrigin );
59 }
60
61 std::vector<SHAPE_LINE_CHAIN> ParseLineChains( const wxString& aData, int aArcMinSegLen,
62 bool aForceClosed );
63
64protected:
66};
67
68
69#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)
virtual double ScaleSize(double aValue)=0
Define a general 2D-vector/point.
Definition: vector2d.h:70