KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2021 KiCad Developers, see AUTHORS.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 <eda_item.h>
28
29#include <layer_ids.h>
30#include <gal/color4d.h>
31
32namespace KIGFX
33{
34
35class VIEW;
36class GAL;
37
38namespace PREVIEW
39{
40
55{
56public:
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
108private:
109
118 void setupGal( KIGFX::GAL& aGal ) const;
119
126 virtual void drawPreviewShape( KIGFX::VIEW* aView ) const { };
127
128
132};
133
134} // PREVIEW
135} // KIGFX
136
137#endif // PREVIEW_SIMPLE_OUTLINE_ITEM__H_
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:88
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Abstract interface for drawing on a 2D-surface.
SIMPLE_OVERLAY_ITEM is class that represents a visual area drawn on a canvas, used to temporarily dem...
void setupGal(KIGFX::GAL &aGal) const
Set up the GAL canvas - this provides a default implementation, that sets fill, stroke and width.
void SetFillColor(const COLOR4D &aNewColor)
Set the line width to set before drawing preview.
void ViewGetLayers(int aLayers[], int &aCount) const override
Set the overlay layer only.
virtual wxString GetClass() const override
Get class name.
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the preview - this is done by calling the two functions: setupGal() and drawPreviewShape().
void SetStrokeColor(const COLOR4D &aNewColor)
Set the fill color to set before drawing preview.
virtual void drawPreviewShape(KIGFX::VIEW *aView) const
Draw the preview onto the given GAL.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247