KiCad PCB EDA Suite
graphics_importer_pcbnew.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) 2016 CERN
5 * Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef GRAPHICS_IMPORTER_PCBNEW_H
28#define GRAPHICS_IMPORTER_PCBNEW_H
29
30#include "graphics_importer.h"
31
32#include <layer_ids.h>
33
34class BOARD_ITEM;
35class BOARD;
36class FOOTPRINT;
37class PCB_SHAPE;
38class EDA_TEXT;
39
41{
42public:
44
50 void SetLayer( PCB_LAYER_ID aLayer )
51 {
52 m_layer = aLayer;
53 }
54
59 {
60 return m_layer;
61 }
62
63 void AddLine( const VECTOR2D& aOrigin, const VECTOR2D& aEnd, double aWidth ) override;
64
65 void AddCircle( const VECTOR2D& aOrigin, double aRadius, double aWidth, bool aFilled ) override;
66
67 void AddArc( const VECTOR2D& aCenter, const VECTOR2D& aStart, const EDA_ANGLE& aAngle,
68 double aWidth ) override;
69
70 void AddPolygon( const std::vector< VECTOR2D >& aVertices, double aWidth ) override;
71
72 void AddText( const VECTOR2D& aOrigin, const wxString& aText, double aHeight, double aWidth,
73 double aThickness, double aOrientation, GR_TEXT_H_ALIGN_T aHJustify,
74 GR_TEXT_V_ALIGN_T aVJustify ) override;
75
76 void AddSpline( const VECTOR2D& aStart, const VECTOR2D& aBezierControl1,
77 const VECTOR2D& aBezierControl2, const VECTOR2D& aEnd,
78 double aWidth ) override;
79
86 wxPoint MapCoordinate( const VECTOR2D& aCoordinate );
87
94 int MapLineWidth( double aLineWidth );
95
96protected:
98 virtual std::unique_ptr<PCB_SHAPE> createDrawing() = 0;
99
102 virtual std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() = 0;
103
106};
107
108
110{
111public:
113 : m_board( aBoard )
114 {
115 }
116
117protected:
118 std::unique_ptr<PCB_SHAPE> createDrawing() override;
119 std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() override;
120
122};
123
124
126{
127public:
129 : m_footprint( aFootprint )
130 {
131 }
132
133protected:
134 std::unique_ptr<PCB_SHAPE> createDrawing() override;
135 std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() override;
136
138};
139
140#endif /* GRAPHICS_IMPORTER_PCBNEW */
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
std::pair< std::unique_ptr< BOARD_ITEM >, EDA_TEXT * > createText() override
Target layer for the imported shapes.
std::unique_ptr< PCB_SHAPE > createDrawing() override
< Create an object representing a graphical shape.
std::pair< std::unique_ptr< BOARD_ITEM >, EDA_TEXT * > createText() override
Target layer for the imported shapes.
GRAPHICS_IMPORTER_FOOTPRINT(FOOTPRINT *aFootprint)
std::unique_ptr< PCB_SHAPE > createDrawing() override
< Create an object representing a graphical shape.
wxPoint MapCoordinate(const VECTOR2D &aCoordinate)
Convert an imported coordinate to a board coordinate, according to the internal units,...
void AddArc(const VECTOR2D &aCenter, const VECTOR2D &aStart, const EDA_ANGLE &aAngle, double aWidth) override
Create an object representing an arc.
void AddText(const VECTOR2D &aOrigin, const wxString &aText, double aHeight, double aWidth, double aThickness, double aOrientation, GR_TEXT_H_ALIGN_T aHJustify, GR_TEXT_V_ALIGN_T aVJustify) override
Create an object representing a text.
void AddSpline(const VECTOR2D &aStart, const VECTOR2D &aBezierControl1, const VECTOR2D &aBezierControl2, const VECTOR2D &aEnd, double aWidth) override
Create an object representing an arc.
void SetLayer(PCB_LAYER_ID aLayer)
Set the target layer for the imported shapes.
void AddLine(const VECTOR2D &aOrigin, const VECTOR2D &aEnd, double aWidth) override
Create an object representing a line segment.
void AddPolygon(const std::vector< VECTOR2D > &aVertices, double aWidth) override
void AddCircle(const VECTOR2D &aOrigin, double aRadius, double aWidth, bool aFilled) override
Create an object representing a circle.
virtual std::unique_ptr< PCB_SHAPE > createDrawing()=0
< Create an object representing a graphical shape.
virtual std::pair< std::unique_ptr< BOARD_ITEM >, EDA_TEXT * > createText()=0
Target layer for the imported shapes.
int MapLineWidth(double aLineWidth)
If aLineWidth < 0, the default line thickness value is returned.
PCB_LAYER_ID GetLayer() const
Return the target layer for the imported shapes.
Interface that creates objects representing shapes for a given data model.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
GR_TEXT_H_ALIGN_T
GR_TEXT_V_ALIGN_T