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 <wx/wx.h>
34 #include <xnode.h>
35 
36 #include <pcb_module.h>
37 #include <pcb_net.h>
38 
39 namespace PCAD2KICAD {
40 
41 #define MAX_PCAD_LAYER_QTY 32
42 
43 class PCB : public PCB_MODULE, public PCB_CALLBACKS
44 {
45 public:
46  PCB_COMPONENTS_ARRAY m_pcbComponents; // PCB Modules,Lines,Routes,Texts, .... and so on
47  PCB_NETS_ARRAY m_pcbNetlist; // net objects collection
49  TLAYER m_layersMap[MAX_PCAD_LAYER_QTY]; // flexible layers mapping
50  int m_sizeX;
51  int m_sizeY;
52 
53  PCB( BOARD* aBoard );
54  ~PCB();
55 
56  PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override;
57  LAYER_TYPE_T GetLayerType( int aPCadLayer ) override;
58  wxString GetLayerNetNameRef( int aPCadLayer ) override;
59  int GetNewTimestamp() override;
60  int GetNetCode( wxString aNetName ) override;
61 
62  void Parse( wxStatusBar* aStatusBar,
63  wxXmlDocument* aXmlDoc,
64  wxString aActualConversion );
65 
66  void AddToBoard() override;
67 
68 private:
70  wxArrayString m_layersStackup;
71 
72  XNODE* FindCompDefName( XNODE* aNode, wxString aName );
73  void SetTextProperty( XNODE* aNode,
74  TTEXTVALUE* aTextValue,
75  wxString aPatGraphRefName,
76  wxString aXmlName,
77  wxString aActualConversion );
78  void DoPCBComponents( XNODE* aNode,
79  wxXmlDocument* aXmlDoc,
80  wxString aActualConversion,
81  wxStatusBar* aStatusBar );
82  void ConnectPinToNet( wxString aCr, wxString aPr, wxString aNetName );
83  int FindLayer( wxString aLayerName );
84  void MapLayer( XNODE* aNode );
85  int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint );
86  double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 );
87  void GetBoardOutline( wxXmlDocument* aXmlDoc, wxString aActualConversion );
88 };
89 
90 } // namespace PCAD2KICAD
91 
92 #endif // pcb_H_
void ConnectPinToNet(wxString aCr, wxString aPr, wxString aNetName)
Definition: pcb.cpp:423
XNODE * FindCompDefName(XNODE *aNode, wxString aName)
Definition: pcb.cpp:136
void Parse(wxStatusBar *aStatusBar, wxXmlDocument *aXmlDoc, wxString aActualConversion)
Definition: pcb.cpp:669
int m_sizeX
Definition: pcb.h:50
void GetBoardOutline(wxXmlDocument *aXmlDoc, wxString aActualConversion)
Definition: pcb.cpp:578
PCB_NETS_ARRAY m_pcbNetlist
Definition: pcb.h:47
#define MAX_PCAD_LAYER_QTY
Definition: pcb.h:41
TLAYER m_layersMap[MAX_PCAD_LAYER_QTY]
Definition: pcb.h:49
PCB_LAYER_ID GetKiCadLayer()
Definition: pcb_component.h:73
LAYER_TYPE_T GetLayerType(int aPCadLayer) override
Definition: pcb.cpp:57
PCB(BOARD *aBoard)
Definition: pcb.cpp:69
void DoPCBComponents(XNODE *aNode, wxXmlDocument *aXmlDoc, wxString aActualConversion, wxStatusBar *aStatusBar)
Definition: pcb.cpp:234
PCB_LAYER_ID
A quick note on layer IDs:
void AddToBoard() override
Definition: pcb.cpp:917
wxArrayString m_layersStackup
Definition: pcb.h:70
int m_sizeY
Definition: pcb.h:51
int FindOutlinePoint(VERTICES_ARRAY *aOutline, wxRealPoint aPoint)
Definition: pcb.cpp:552
void SetTextProperty(XNODE *aNode, TTEXTVALUE *aTextValue, wxString aPatGraphRefName, wxString aXmlName, wxString aActualConversion)
Definition: pcb.cpp:164
int FindLayer(wxString aLayerName)
Definition: pcb.cpp:450
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
int m_timestamp_cnt
Definition: pcb.h:69
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
double GetDistance(wxRealPoint *aPoint1, wxRealPoint *aPoint2)
Definition: pcb.cpp:570
void MapLayer(XNODE *aNode)
Definition: pcb.cpp:480
PCB_COMPONENTS_ARRAY m_pcbComponents
Definition: pcb.h:46
wxString GetLayerNetNameRef(int aPCadLayer) override
Definition: pcb.cpp:63
int GetNewTimestamp() override
Definition: pcb.cpp:114
LAYER_TYPE_T
Definition: pcb_callbacks.h:36
int GetNetCode(wxString aNetName) override
Definition: pcb.cpp:119
wxString m_defaultMeasurementUnit
Definition: pcb.h:48