KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_easyeda_parser.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 SCH_EASYEDA_PARSER_H_
26#define SCH_EASYEDA_PARSER_H_
27
30
31#include <sch_io_mgr.h>
32#include <pin_type.h>
33#include <layer_ids.h>
34#include <wx/filename.h>
35#include <plotters/plotter.h>
36
37
38class EDA_TEXT;
39class LIB_SHAPE;
40class LIB_PIN;
41class SCH_LABEL_BASE;
42class SCH_SYMBOL;
43class SCH_TEXT;
44class SCH_SHAPE;
45
47{
48public:
49 explicit SCH_EASYEDA_PARSER( SCHEMATIC* aSchematic, PROGRESS_REPORTER* aProgressReporter );
51
52 double ScaleSize( double aValue ) override
53 {
54 return KiROUND( schIUScale.MilsToIU( aValue * 10 ) );
55 }
56
57 template <typename T>
59 {
60 return VECTOR2<T>( RelPosX( aVec.x ), -RelPosY( aVec.y ) );
61 }
62
63 std::pair<LIB_SYMBOL*, bool> MakePowerSymbol( const wxString& aFlagTypename,
64 const wxString& aNetname );
65
66 void ParseSymbolShapes( LIB_SYMBOL* aContainer, std::map<wxString, wxString> paramMap,
67 wxArrayString aShapes );
68
69 LIB_SYMBOL* ParseSymbol( const VECTOR2D& aOrigin, std::map<wxString, wxString> aParams,
70 wxArrayString aShapes );
71
72 void ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aRootSheet, const wxString& aFileName,
73 wxArrayString aShapes );
74
75private:
77};
78
79
80#endif // SCH_EASYEDA_PARSER_H_
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
double RelPosX(double aValue)
double RelPosY(double aValue)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
Define a library symbol object.
Definition: lib_symbol.h:99
A progress reporter interface for use in multi-threaded environments.
Holds all the data relating to one schematic.
Definition: schematic.h:75
void ParseSymbolShapes(LIB_SYMBOL *aContainer, std::map< wxString, wxString > paramMap, wxArrayString aShapes)
std::pair< LIB_SYMBOL *, bool > MakePowerSymbol(const wxString &aFlagTypename, const wxString &aNetname)
double ScaleSize(double aValue) override
void ParseSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName, wxArrayString aShapes)
VECTOR2< T > RelPosSym(const VECTOR2< T > &aVec)
LIB_SYMBOL * ParseSymbol(const VECTOR2D &aOrigin, std::map< wxString, wxString > aParams, wxArrayString aShapes)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
Schematic symbol object.
Definition: sch_symbol.h:81
Define a general 2D-vector/point.
Definition: vector2d.h:70
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85