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 <developer@lura.sk>
5  * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
6  * Copyright (C) 2012 KiCad Developers, see CHANGELOG.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 
30 #ifndef pcb_H_
31 #define pcb_H_
32 
33 #include <map>
34 #include <wx/wx.h>
35 #include <xnode.h>
36 
37 #include <pcb_module.h>
38 #include <pcb_net.h>
39 
40 namespace PCAD2KICAD {
41 
42 class PCB : public PCB_MODULE, public PCB_CALLBACKS
43 {
44 public:
45  PCB_COMPONENTS_ARRAY m_pcbComponents; // PCB Modules,Lines,Routes,Texts, .... and so on
46  PCB_NETS_ARRAY m_pcbNetlist; // net objects collection
48  std::map<int, TLAYER> m_layersMap; // flexible layers mapping
49  int m_sizeX;
50  int m_sizeY;
51 
52  PCB( BOARD* aBoard );
53  ~PCB();
54 
55  PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override;
56  LAYER_TYPE_T GetLayerType( int aPCadLayer ) override;
57  wxString GetLayerNetNameRef( int aPCadLayer ) override;
58  int GetNetCode( wxString aNetName ) override;
59 
60  void ParseBoard( wxStatusBar* aStatusBar,
61  wxXmlDocument* aXmlDoc,
62  const wxString& aActualConversion );
63 
64  void AddToBoard() override;
65 
66 private:
67  wxArrayString m_layersStackup;
68 
69  XNODE* FindCompDefName( XNODE* aNode, const wxString& aName );
70  void SetTextProperty( XNODE* aNode,
71  TTEXTVALUE* aTextValue,
72  const wxString& aPatGraphRefName,
73  const wxString& aXmlName,
74  const wxString& aActualConversion );
75  void DoPCBComponents( XNODE* aNode,
76  wxXmlDocument* aXmlDoc,
77  const wxString& aActualConversion,
78  wxStatusBar* aStatusBar );
79  void ConnectPinToNet( const wxString& aCr,
80  const wxString& aPr,
81  const wxString& aNetName );
82  int FindLayer( const wxString& aLayerName );
83  void MapLayer( XNODE* aNode );
84  int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint );
85  double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 );
86  void GetBoardOutline( wxXmlDocument* aXmlDoc,
87  const wxString& aActualConversion );
88 };
89 
90 } // namespace PCAD2KICAD
91 
92 #endif // pcb_H_
std::map< int, TLAYER > m_layersMap
Definition: pcb.h:48
void ParseBoard(wxStatusBar *aStatusBar, wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcb.cpp:681
int m_sizeX
Definition: pcb.h:49
PCB_NETS_ARRAY m_pcbNetlist
Definition: pcb.h:46
void SetTextProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aPatGraphRefName, const wxString &aXmlName, const wxString &aActualConversion)
Definition: pcb.cpp:170
PCB_LAYER_ID GetKiCadLayer()
Definition: pcb_component.h:73
LAYER_TYPE_T GetLayerType(int aPCadLayer) override
Definition: pcb.cpp:60
PCB(BOARD *aBoard)
Definition: pcb.cpp:80
void ConnectPinToNet(const wxString &aCr, const wxString &aPr, const wxString &aNetName)
Definition: pcb.cpp:430
PCB_LAYER_ID
A quick note on layer IDs:
void AddToBoard() override
Definition: pcb.cpp:932
wxArrayString m_layersStackup
Definition: pcb.h:67
int m_sizeY
Definition: pcb.h:50
int FindOutlinePoint(VERTICES_ARRAY *aOutline, wxRealPoint aPoint)
Definition: pcb.cpp:564
void DoPCBComponents(XNODE *aNode, wxXmlDocument *aXmlDoc, const wxString &aActualConversion, wxStatusBar *aStatusBar)
Definition: pcb.cpp:241
void GetBoardOutline(wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcb.cpp:590
XNODE * FindCompDefName(XNODE *aNode, const wxString &aName)
Definition: pcb.cpp:142
XNODE holds an XML or S-expression element.
Definition: xnode.h:43
int FindLayer(const wxString &aLayerName)
Definition: pcb.cpp:459
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:181
double GetDistance(wxRealPoint *aPoint1, wxRealPoint *aPoint2)
Definition: pcb.cpp:582
void MapLayer(XNODE *aNode)
Definition: pcb.cpp:489
PCB_COMPONENTS_ARRAY m_pcbComponents
Definition: pcb.h:45
wxString GetLayerNetNameRef(int aPCadLayer) override
Definition: pcb.cpp:70
LAYER_TYPE_T
Definition: pcb_callbacks.h:36
int GetNetCode(wxString aNetName) override
Definition: pcb.cpp:125
wxString m_defaultMeasurementUnit
Definition: pcb.h:47