KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_io_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 PCB_IO_EASYEDA_PARSER_H_
26#define PCB_IO_EASYEDA_PARSER_H_
27
29
30#include <cstdint>
31#include <cstring>
32#include <memory>
33#include <vector>
34#include <map>
35#include <optional>
36
37#include <wx/string.h>
38#include <wx/arrstr.h>
39
40#include <nlohmann/json.hpp>
42
43class BOARD;
45
47{
48public:
49 explicit PCB_IO_EASYEDA_PARSER( PROGRESS_REPORTER* aProgressReporter );
51
52 PCB_LAYER_ID LayerToKi( const wxString& aLayer );
53
54 double ScaleSize( double aValue ) override
55 { //
56 return KiROUND( ( aValue * 254000 ) / 100 ) * 100;
57 }
58
59 void ParseBoard( BOARD* aBoard, const VECTOR2D& aOrigin,
60 std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
61 wxArrayString aShapes );
62
63 FOOTPRINT* ParseFootprint( const VECTOR2D& aOrigin, const EDA_ANGLE& aOrientation, int aLayer,
64 BOARD* aParent, std::map<wxString, wxString> aParams,
65 std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
66 wxArrayString aShapes );
67
68 void ParseToBoardItemContainer( BOARD_ITEM_CONTAINER* aContainer, BOARD* aParent,
69 std::map<wxString, wxString> paramMap,
70 std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
71 wxArrayString shapes );
72};
73
74
75#endif // PCB_IO_EASYEDA_PARSER_H_
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
void ParseToBoardItemContainer(BOARD_ITEM_CONTAINER *aContainer, BOARD *aParent, std::map< wxString, wxString > paramMap, std::map< wxString, std::unique_ptr< FOOTPRINT > > &aFootprintMap, wxArrayString shapes)
FOOTPRINT * ParseFootprint(const VECTOR2D &aOrigin, const EDA_ANGLE &aOrientation, int aLayer, BOARD *aParent, std::map< wxString, wxString > aParams, std::map< wxString, std::unique_ptr< FOOTPRINT > > &aFootprintMap, wxArrayString aShapes)
double ScaleSize(double aValue) override
void ParseBoard(BOARD *aBoard, const VECTOR2D &aOrigin, std::map< wxString, std::unique_ptr< FOOTPRINT > > &aFootprintMap, wxArrayString aShapes)
PCB_LAYER_ID LayerToKi(const wxString &aLayer)
A progress reporter interface for use in multi-threaded environments.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
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:118