KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcad_keepout.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_keepout.h>
22
23#include <common.h>
24#include <xnode.h>
25
26#include <wx/string.h>
27
28namespace PCAD2KICAD {
29
30PCAD_KEEPOUT::PCAD_KEEPOUT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
31 PCAD_POLYGON( aCallbacks, aBoard, aPCadLayer )
32{
33 m_ObjType = wxT( 'K' );
34}
35
36
40
41
43 const wxString& aDefaultMeasurementUnit,
44 const wxString& aActualConversion )
45{
46 XNODE* lNode;
47
48 lNode = FindNode( aNode, wxT( "pcbPoly" ) );
49
50 if( lNode )
51 {
52 // retrieve keepOut outline
53 FormPolygon( lNode, &m_Outline, aDefaultMeasurementUnit, aActualConversion );
54
55 m_PositionX = m_Outline[0]->x;
56 m_PositionY = m_Outline[0]->y;
57 }
58 else
59 {
60 return false;
61 }
62
63 return true;
64}
65
66} // namespace PCAD2KICAD
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
virtual bool Parse(XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion) override
PCAD_KEEPOUT(PCAD_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
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.
XNODE * FindNode(XNODE *aChild, const wxString &aTag)