KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcad_plane.cpp
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, 2012 Alexander Lunev <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <pcad/pcad_plane.h>
22
23#include <common.h>
24#include <xnode.h>
25
26#include <wx/string.h>
27
28namespace PCAD2KICAD {
29
30PCAD_PLANE::PCAD_PLANE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
31 PCAD_POLYGON( aCallbacks, aBoard, aPCadLayer )
32{
33 m_Priority = 1;
34}
35
36
40
41
42bool PCAD_PLANE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
43 const wxString& aActualConversion )
44{
45 XNODE* lNode;
46 wxString pourType, str, propValue;
47
48 lNode = FindNode( aNode, wxT( "netNameRef" ) );
49
50 if( lNode )
51 {
52 lNode->GetAttribute( wxT( "Name" ), &propValue );
53 propValue.Trim( false );
54 propValue.Trim( true );
55 m_Net = propValue;
57 }
58
59 if( FindNode( aNode, wxT( "width" ) ) )
60 {
61 SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_Width,
62 aActualConversion );
63 }
64
65 lNode = FindNode( aNode, wxT( "pcbPoly" ) );
66
67 if( !lNode )
68 lNode = FindNode( aNode, wxT( "planeOutline" ) );
69
70 if( lNode )
71 {
72 // retrieve plane outline
73 FormPolygon( lNode, &m_Outline, aDefaultUnits, aActualConversion );
74
75 m_PositionX = m_Outline[0]->x;
76 m_PositionY = m_Outline[0]->y;
77 }
78 else
79 {
80 return false;
81 }
82
83 return true;
84}
85
86} // namespace PCAD2KICAD
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
int GetNetCode(const wxString &aNetName) const
PCAD_PLANE(PCAD_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
virtual bool Parse(XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion) override
VERTICES_ARRAY m_Outline
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultUnits, const wxString &actualConversion)
PCAD_POLYGON(PCAD_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
An extension of wxXmlNode that can format its contents as KiCad-style s-expressions.
Definition xnode.h:67
The common library.
void SetWidth(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aWidth, const wxString &aActualConversion)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)