KiCad PCB EDA Suite
simple_overlay_item.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) 2017 Kicad Developers, see change_log.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef PREVIEW_SIMPLE_OUTLINE_ITEM__H_
25 #define PREVIEW_SIMPLE_OUTLINE_ITEM__H_
26 
27 #include <base_struct.h>
28 
30 #include <gal/color4d.h>
31 
32 namespace KIGFX
33 {
34 
35 class VIEW;
36 class GAL;
37 
38 namespace PREVIEW
39 {
40 
55 {
56 public:
57 
59 
64  void ViewGetLayers( int aLayers[], int& aCount ) const override;
65 
72  void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
73 
74 
75 #if defined(DEBUG)
76  void Show( int x, std::ostream& st ) const override
77  {
78  }
79 #endif
80 
85  virtual wxString GetClass() const override
86  {
87  return "SIMPLE_OVERLAY_ITEM";
88  }
89 
91  void SetStrokeColor( const COLOR4D& aNewColor )
92  {
93  m_strokeColor = aNewColor;
94  }
95 
97  void SetFillColor( const COLOR4D& aNewColor )
98  {
99  m_fillColor = aNewColor;
100  }
101 
103  void SetLineWidth( double aNewWidth )
104  {
105  m_lineWidth = aNewWidth;
106  }
107 
108 private:
109 
117  void setupGal( KIGFX::GAL& aGal ) const;
118 
126  virtual void drawPreviewShape( KIGFX::VIEW* aView ) const { };
127 
128 
131  double m_lineWidth;
132 };
133 
134 } // PREVIEW
135 } // KIGFX
136 
137 #endif // PREVIEW_SIMPLE_OUTLINE_ITEM__H_
void SetLineWidth(double aNewWidth)
Set the line width to set before drawing preview
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
void SetStrokeColor(const COLOR4D &aNewColor)
Set the stroke colour to set before drawing preview
SIMPLE_OVERLAY_ITEM is class that represents a visual area drawn on a canvas, used to temporarily dem...
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draws the preview - this is done by calling the two functions: setupGal() and drawPreviewShape().
virtual wxString GetClass() const override
Get class name.
void SetFillColor(const COLOR4D &aNewColor)
Set the fill colour to set before drawing preview
Board layer functions and definitions.
void ViewGetLayers(int aLayers[], int &aCount) const override
Sets the overlay layer only.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
virtual void drawPreviewShape(KIGFX::VIEW *aView) const
Draw the preview onto the given GAL.
Basic classes for most KiCad items.
Class VIEW.
Definition: view.h:58
void setupGal(KIGFX::GAL &aGal) const
Set up the GAL canvas - this provides a default implementation, that sets fill, stroke and width...
Class GAL is the abstract interface for drawing on a 2D-surface.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39