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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef PREVIEW_SIMPLE_OUTLINE_ITEM__H_
21#define PREVIEW_SIMPLE_OUTLINE_ITEM__H_
22
23#include <eda_item.h>
24
25#include <layer_ids.h>
26#include <gal/color4d.h>
27
28namespace KIGFX
29{
30
31class VIEW;
32class GAL;
33
34namespace PREVIEW
35{
36
51{
52public:
53
55
60 std::vector<int> ViewGetLayers() const override;
61
68 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
69
70
71#if defined(DEBUG)
72 void Show( int x, std::ostream& st ) const override
73 {
74 }
75#endif
76
81 virtual wxString GetClass() const override
82 {
83 return "SIMPLE_OVERLAY_ITEM";
84 }
85
87 void SetStrokeColor( const COLOR4D& aNewColor )
88 {
89 m_strokeColor = aNewColor;
90 }
91
93 void SetFillColor( const COLOR4D& aNewColor )
94 {
95 m_fillColor = aNewColor;
96 }
97
99 void SetLineWidth( double aNewWidth )
100 {
101 m_lineWidth = aNewWidth;
102 }
103
104private:
105
114 void setupGal( KIGFX::GAL& aGal ) const;
115
122 virtual void drawPreviewShape( KIGFX::VIEW* aView ) const { };
123
124
128};
129
130} // PREVIEW
131} // KIGFX
132
133#endif // PREVIEW_SIMPLE_OUTLINE_ITEM__H_
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Abstract interface for drawing on a 2D-surface.
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.
virtual wxString GetClass() const override
Get class name.
std::vector< int > ViewGetLayers() const override
Set the overlay layer only.
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:63
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29