KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcad_pcb.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) 2007, 2008 Lubo Racko <[email protected]>
5 * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <[email protected]>
6 * Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.TXT for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#ifndef PCB_H_
27#define PCB_H_
28
31#include <pcad/pcad_callbacks.h>
32#include <pcad/pcad_footprint.h>
33
34#include <map>
35#include <wx/arrstr.h>
36
37class BOARD;
38class XNODE;
39class wxStatusBar;
40class wxString;
41class wxRealPoint;
42class wxXmlDocument;
43
44namespace PCAD2KICAD {
45
47{
48public:
49 PCAD_PCB( BOARD* aBoard );
50 ~PCAD_PCB();
51
52 PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) const override;
53 LAYER_TYPE_T GetLayerType( int aPCadLayer ) const override;
54 wxString GetLayerNetNameRef( int aPCadLayer ) const override;
55 int GetNetCode( const wxString& aNetName ) const override;
56
57 void ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
58 const wxString& aActualConversion );
59
60 void AddToBoard( FOOTPRINT* aFootprint = nullptr ) override;
61
62private:
63 XNODE* FindCompDefName( XNODE* aNode, const wxString& aName ) const;
64
65 void SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue, const wxString& aPatGraphRefName,
66 const wxString& aXmlName, const wxString& aActualConversion );
67
68 void DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxString& aActualConversion,
69 wxStatusBar* aStatusBar );
70
71 void ConnectPinToNet( const wxString& aCr, const wxString& aPr, const wxString& aNetName );
72
73 int FindLayer( const wxString& aLayerName ) const;
74 void MapLayer( XNODE* aNode );
75 int FindOutlinePoint( const VERTICES_ARRAY* aOutline, wxRealPoint aPoint ) const;
76 double GetDistance( const wxRealPoint* aPoint1, const wxRealPoint* aPoint2 ) const;
77 void GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion );
78
79public:
80 PCAD_COMPONENTS_ARRAY m_PcbComponents; // PCB footprints,Lines,Routes,Texts, .... and so on
81 PCAD_NETS_ARRAY m_PcbNetlist; // net objects collection
83 std::map<int, TLAYER> m_LayersMap; // flexible layers mapping
86
87private:
88 std::vector<std::pair<wxString, long>> m_layersStackup;
89};
90
91} // namespace PCAD2KICAD
92
93#endif // pcb_H_
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
PCB_LAYER_ID GetKiCadLayer() const
wxString m_DefaultMeasurementUnit
Definition: pcad_pcb.h:82
void SetTextProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aPatGraphRefName, const wxString &aXmlName, const wxString &aActualConversion)
Definition: pcad_pcb.cpp:166
void DoPCBComponents(XNODE *aNode, wxXmlDocument *aXmlDoc, const wxString &aActualConversion, wxStatusBar *aStatusBar)
Definition: pcad_pcb.cpp:235
LAYER_TYPE_T GetLayerType(int aPCadLayer) const override
Definition: pcad_pcb.cpp:54
int GetNetCode(const wxString &aNetName) const override
Definition: pcad_pcb.cpp:121
std::map< int, TLAYER > m_LayersMap
Definition: pcad_pcb.h:83
void MapLayer(XNODE *aNode)
Definition: pcad_pcb.cpp:464
wxString GetLayerNetNameRef(int aPCadLayer) const override
Definition: pcad_pcb.cpp:65
PCAD_NETS_ARRAY m_PcbNetlist
Definition: pcad_pcb.h:81
int FindOutlinePoint(const VERTICES_ARRAY *aOutline, wxRealPoint aPoint) const
Definition: pcad_pcb.cpp:559
PCAD_COMPONENTS_ARRAY m_PcbComponents
Definition: pcad_pcb.h:80
std::vector< std::pair< wxString, long > > m_layersStackup
Definition: pcad_pcb.h:88
void ParseBoard(wxStatusBar *aStatusBar, wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcad_pcb.cpp:673
XNODE * FindCompDefName(XNODE *aNode, const wxString &aName) const
Definition: pcad_pcb.cpp:138
int FindLayer(const wxString &aLayerName) const
Definition: pcad_pcb.cpp:452
void ConnectPinToNet(const wxString &aCr, const wxString &aPr, const wxString &aNetName)
Definition: pcad_pcb.cpp:424
void AddToBoard(FOOTPRINT *aFootprint=nullptr) override
Definition: pcad_pcb.cpp:941
void GetBoardOutline(wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcad_pcb.cpp:579
double GetDistance(const wxRealPoint *aPoint1, const wxRealPoint *aPoint2) const
Definition: pcad_pcb.cpp:573
Hold an XML or S-expression element.
Definition: xnode.h:43
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
LAYER_TYPE_T