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-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 
29 #include <pcad/pcad2kicad_common.h>
30 #include <pcad/pcad_item_types.h>
31 #include <pcad/pcb_callbacks.h>
32 #include <pcad/pcb_footprint.h>
33 
34 #include <map>
35 #include <wx/arrstr.h>
36 
37 class BOARD;
38 class XNODE;
39 class wxStatusBar;
40 class wxString;
41 class wxRealPoint;
42 class wxXmlDocument;
43 
44 namespace PCAD2KICAD {
45 
46 class PCB : public PCB_FOOTPRINT, public PCB_CALLBACKS
47 {
48 public:
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
66  int m_SizeX;
67  int m_SizeY;
68 
69 private:
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  wxArrayString m_layersStackup;
87 };
88 
89 } // namespace PCAD2KICAD
90 
91 #endif // pcb_H_
int m_SizeX
Definition: pcb.h:66
int GetNetCode(const wxString &aNetName) const override
Definition: pcb.cpp:125
LAYER_TYPE_T GetLayerType(int aPCadLayer) const override
Definition: pcb.cpp:57
void ParseBoard(wxStatusBar *aStatusBar, wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcb.cpp:690
int FindOutlinePoint(const VERTICES_ARRAY *aOutline, wxRealPoint aPoint) const
Definition: pcb.cpp:567
PCB_COMPONENTS_ARRAY m_PcbComponents
Definition: pcb.h:62
void SetTextProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aPatGraphRefName, const wxString &aXmlName, const wxString &aActualConversion)
Definition: pcb.cpp:170
int FindLayer(const wxString &aLayerName) const
Definition: pcb.cpp:456
PCB_NETS_ARRAY m_PcbNetlist
Definition: pcb.h:63
PCB(BOARD *aBoard)
Definition: pcb.cpp:79
void ConnectPinToNet(const wxString &aCr, const wxString &aPr, const wxString &aNetName)
Definition: pcb.cpp:428
std::map< int, TLAYER > m_LayersMap
Definition: pcb.h:65
void AddToBoard() override
Definition: pcb.cpp:942
wxString m_DefaultMeasurementUnit
Definition: pcb.h:64
wxArrayString m_layersStackup
Definition: pcb.h:86
void DoPCBComponents(XNODE *aNode, wxXmlDocument *aXmlDoc, const wxString &aActualConversion, wxStatusBar *aStatusBar)
Definition: pcb.cpp:239
int m_SizeY
Definition: pcb.h:67
double GetDistance(const wxRealPoint *aPoint1, const wxRealPoint *aPoint2) const
Definition: pcb.cpp:590
XNODE * FindCompDefName(XNODE *aNode, const wxString &aName) const
Definition: pcb.cpp:142
void GetBoardOutline(wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
Definition: pcb.cpp:596
wxString GetLayerNetNameRef(int aPCadLayer) const override
Definition: pcb.cpp:68
PCB_LAYER_ID GetKiCadLayer() const
Definition: pcb_component.h:56
Hold an XML or S-expression element.
Definition: xnode.h:43
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
void MapLayer(XNODE *aNode)
Definition: pcb.cpp:468
LAYER_TYPE_T
Definition: pcb_callbacks.h:37