KiCad PCB EDA Suite
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-2020 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/pcb_callbacks.h>
32#include <pcad/pcb_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
46class PCB : public PCB_FOOTPRINT, public PCB_CALLBACKS
47{
48public:
49 PCB( BOARD* aBoard );
50 ~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() override;
61
62 PCB_COMPONENTS_ARRAY m_PcbComponents; // PCB footprints,Lines,Routes,Texts, .... and so on
63 PCB_NETS_ARRAY m_PcbNetlist; // net objects collection
65 std::map<int, TLAYER> m_LayersMap; // flexible layers mapping
68
69private:
70 XNODE* FindCompDefName( XNODE* aNode, const wxString& aName ) const;
71
72 void SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue, const wxString& aPatGraphRefName,
73 const wxString& aXmlName, const wxString& aActualConversion );
74
75 void DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxString& aActualConversion,
76 wxStatusBar* aStatusBar );
77
78 void ConnectPinToNet( const wxString& aCr, const wxString& aPr, const wxString& aNetName );
79
80 int FindLayer( const wxString& aLayerName ) const;
81 void MapLayer( XNODE* aNode );
82 int FindOutlinePoint( const VERTICES_ARRAY* aOutline, wxRealPoint aPoint ) const;
83 double GetDistance( const wxRealPoint* aPoint1, const wxRealPoint* aPoint2 ) const;
84 void GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion );
85
86 std::vector<std::pair<wxString, long>> m_layersStackup;
87};
88
89} // namespace PCAD2KICAD
90
91#endif // pcb_H_
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
PCB_LAYER_ID GetKiCadLayer() const
Definition: pcb_component.h:56
void SetTextProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aPatGraphRefName, const wxString &aXmlName, const wxString &aActualConversion)
Definition: pcb.cpp:169
wxString GetLayerNetNameRef(int aPCadLayer) const override
Definition: pcb.cpp:67
int FindLayer(const wxString &aLayerName) const
Definition: pcb.cpp:455
void ParseBoard(wxStatusBar *aStatusBar, wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcb.cpp:676
int FindOutlinePoint(const VERTICES_ARRAY *aOutline, wxRealPoint aPoint) const
Definition: pcb.cpp:562
void ConnectPinToNet(const wxString &aCr, const wxString &aPr, const wxString &aNetName)
Definition: pcb.cpp:427
int m_SizeY
Definition: pcb.h:67
void AddToBoard() override
Definition: pcb.cpp:944
int GetNetCode(const wxString &aNetName) const override
Definition: pcb.cpp:124
double GetDistance(const wxRealPoint *aPoint1, const wxRealPoint *aPoint2) const
Definition: pcb.cpp:576
void DoPCBComponents(XNODE *aNode, wxXmlDocument *aXmlDoc, const wxString &aActualConversion, wxStatusBar *aStatusBar)
Definition: pcb.cpp:238
void GetBoardOutline(wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcb.cpp:582
void MapLayer(XNODE *aNode)
Definition: pcb.cpp:467
std::vector< std::pair< wxString, long > > m_layersStackup
Definition: pcb.h:86
PCB_NETS_ARRAY m_PcbNetlist
Definition: pcb.h:63
wxString m_DefaultMeasurementUnit
Definition: pcb.h:64
XNODE * FindCompDefName(XNODE *aNode, const wxString &aName) const
Definition: pcb.cpp:141
std::map< int, TLAYER > m_LayersMap
Definition: pcb.h:65
PCB(BOARD *aBoard)
Definition: pcb.cpp:78
PCB_COMPONENTS_ARRAY m_PcbComponents
Definition: pcb.h:62
int m_SizeX
Definition: pcb.h:66
LAYER_TYPE_T GetLayerType(int aPCadLayer) const override
Definition: pcb.cpp:56
Hold an XML or S-expression element.
Definition: xnode.h:44
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
LAYER_TYPE_T
Definition: pcb_callbacks.h:38