KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef GRAPHICS_IMPORTER_PCBNEW_H
24#define GRAPHICS_IMPORTER_PCBNEW_H
25
27#include <layer_ids.h>
28#include <map>
29
31
33{
34public:
36
37 void SetLayer( PCB_LAYER_ID aLayer )
38 {
39 m_layer = aLayer;
40 m_defaultLayer = aLayer;
41 }
42
43 PCB_LAYER_ID GetLayer() const { return m_layer; }
44
45 void SetLayerMap( const std::map<wxString, PCB_LAYER_ID>& aLayerMap );
46 void ClearLayerMap();
47
48 bool CanImportSourceLayer( const wxString& aSourceLayer ) const override;
49 void SetCurrentSourceLayer( const wxString& aSourceLayer ) override;
50
51 void AddLine( const VECTOR2D& aStart, const VECTOR2D& aEnd,
52 const IMPORTED_STROKE& aStroke ) override;
53
54 void AddCircle( const VECTOR2D& aCenter, double aRadius, const IMPORTED_STROKE& aStroke,
55 bool aFilled, const COLOR4D& aFillColor = COLOR4D::UNSPECIFIED ) override;
56
57 void AddArc( const VECTOR2D& aCenter, const VECTOR2D& aStart, const EDA_ANGLE& aAngle,
58 const IMPORTED_STROKE& aStroke ) override;
59
60 void AddPolygon( const std::vector<VECTOR2D>& aVertices, const IMPORTED_STROKE& aStroke,
61 bool aFilled, const COLOR4D& aFillColor = COLOR4D::UNSPECIFIED ) override;
62
63 void AddText( const VECTOR2D& aOrigin, const wxString& aText, double aHeight, double aWidth,
64 double aThickness, double aOrientation, GR_TEXT_H_ALIGN_T aHJustify,
65 GR_TEXT_V_ALIGN_T aVJustify,
66 const COLOR4D& aColor = COLOR4D::UNSPECIFIED ) override;
67
68 void AddSpline( const VECTOR2D& aStart, const VECTOR2D& aBezierControl1,
69 const VECTOR2D& aBezierControl2, const VECTOR2D& aEnd,
70 const IMPORTED_STROKE& aStroke ) override;
71
72 void AddEllipse( const VECTOR2D& aCenter, double aMajorRadius, double aMinorRadius, const EDA_ANGLE& aRotation,
73 const IMPORTED_STROKE& aStroke, bool aFilled,
74 const COLOR4D& aFillColor = COLOR4D::UNSPECIFIED ) override;
75
76 void AddEllipseArc( const VECTOR2D& aCenter, double aMajorRadius, double aMinorRadius, const EDA_ANGLE& aRotation,
77 const EDA_ANGLE& aStartAngle, const EDA_ANGLE& aEndAngle,
78 const IMPORTED_STROKE& aStroke ) override;
79
86 VECTOR2I MapCoordinate( const VECTOR2D& aCoordinate );
87
94 int MapLineWidth( double aLineWidth );
95
97
98protected:
104 std::map<wxString, PCB_LAYER_ID> m_layerMap;
105};
106
107
108
109#endif /* GRAPHICS_IMPORTER_PCBNEW_H */
Abstract interface for BOARD_ITEMs capable of storing other items inside.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:398
GRAPHICS_IMPORTER_PCBNEW(BOARD_ITEM_CONTAINER *aParent)
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, const COLOR4D &aColor=COLOR4D::UNSPECIFIED) override
Create an object representing a text.
bool CanImportSourceLayer(const wxString &aSourceLayer) const override
Return true if shapes from a given source layer should be imported.
std::map< wxString, PCB_LAYER_ID > m_layerMap
void AddArc(const VECTOR2D &aCenter, const VECTOR2D &aStart, const EDA_ANGLE &aAngle, const IMPORTED_STROKE &aStroke) override
Create an object representing an arc.
void SetLayerMap(const std::map< wxString, PCB_LAYER_ID > &aLayerMap)
void AddCircle(const VECTOR2D &aCenter, double aRadius, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor=COLOR4D::UNSPECIFIED) override
Create an object representing a circle.
void AddLine(const VECTOR2D &aStart, const VECTOR2D &aEnd, const IMPORTED_STROKE &aStroke) override
Create an object representing a line segment.
void SetLayer(PCB_LAYER_ID aLayer)
void AddEllipse(const VECTOR2D &aCenter, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor=COLOR4D::UNSPECIFIED) override
Create an object representing a closed ellipse.
void AddSpline(const VECTOR2D &aStart, const VECTOR2D &aBezierControl1, const VECTOR2D &aBezierControl2, const VECTOR2D &aEnd, const IMPORTED_STROKE &aStroke) override
Create an object representing an arc.
void AddEllipseArc(const VECTOR2D &aCenter, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, const IMPORTED_STROKE &aStroke) override
Create an object representing an elliptical arc.
int MapLineWidth(double aLineWidth)
If aLineWidth < 0, the default line thickness value is returned.
PCB_LAYER_ID m_layer
< Target layer for the imported shapes.
void AddPolygon(const std::vector< VECTOR2D > &aVertices, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor=COLOR4D::UNSPECIFIED) override
Create an object representing a polygon.
STROKE_PARAMS MapStrokeParams(const IMPORTED_STROKE &aStroke)
void SetCurrentSourceLayer(const wxString &aSourceLayer) override
Set the source layer for the next buffered shape to be imported.
VECTOR2I MapCoordinate(const VECTOR2D &aCoordinate)
Convert an imported coordinate to a board coordinate, according to the internal units,...
A clone of IMPORTED_STROKE, but with floating-point width.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Simple container to manage line stroke parameters.
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682