KiCad PCB EDA Suite
Loading...
Searching...
No Matches
view_overlay.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) 2013-2017 CERN
5 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Tomasz Wlostowski <[email protected]>
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 __VIEW_OVERLAY_H
28#define __VIEW_OVERLAY_H
29
30#include <gal/gal.h>
31#include <view/view_item.h>
32
33#include <vector>
34#include <deque>
35
36class SEG;
38class SHAPE_POLY_SET;
39
40namespace KIGFX
41{
42class VIEW;
43
45{
46public:
47
49 virtual ~VIEW_OVERLAY();
50
51 struct COMMAND;
52 struct COMMAND_ARC;
53 struct COMMAND_LINE;
54 struct COMMAND_CIRCLE;
55 struct COMMAND_RECTANGLE;
56
57 struct COMMAND_SET_STROKE;
58 struct COMMAND_SET_FILL;
59 struct COMMAND_SET_COLOR;
60 struct COMMAND_SET_WIDTH;
61
62 struct COMMAND_POLYGON;
65
66 struct COMMAND_POLYLINE;
67 struct COMMAND_POINT_POLYLINE;
68
69 struct COMMAND_GLYPH_SIZE;
71
72 void Clear();
73
74 virtual const BOX2I ViewBBox() const override;
75 virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
76 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
77
78 // Basic shape primitives
79 void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
80 void Line( const SEG& aSeg );
81 void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
82 void Circle( const VECTOR2D& aCenterPoint, double aRadius );
83 void Arc( const VECTOR2D& aCenterPoint, double aRadius, const EDA_ANGLE& aStartAngle,
84 const EDA_ANGLE& aEndAngle );
85 void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
86 void Cross( const VECTOR2D& aP, int aSize );
87
88 // polygon primitives
89 void Polygon( const std::deque<VECTOR2D>& aPointList );
90 void Polygon( const SHAPE_POLY_SET& aPolySet );
91 void Polyline( const SHAPE_LINE_CHAIN& aPolyLine );
92 void Polygon( const VECTOR2D aPointList[], int aListSize );
93
94 void BitmapText( const wxString& aText, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle );
95
96 // Draw settings
97 void SetIsFill( bool aIsFillEnabled );
98 void SetIsStroke( bool aIsStrokeEnabled );
99 void SetFillColor( const COLOR4D& aColor );
100 void SetStrokeColor( const COLOR4D& aColor );
101 void SetGlyphSize( const VECTOR2I& aSize );
102 void SetLineWidth( double aLineWidth );
103
104 const COLOR4D& GetStrokeColor() const { return m_strokeColor; }
105 const COLOR4D& GetFillColor() const { return m_fillColor; }
106
107private:
108 void releaseCommands();
109
112
113 std::vector<COMMAND*> m_commands;
114};
115
116} // namespace KIGFX
117
118
119#endif
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:84
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:113
const COLOR4D & GetFillColor() const
Definition: view_overlay.h:105
const COLOR4D & GetStrokeColor() const
Definition: view_overlay.h:104
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
Definition: seg.h:42
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
#define GAL_API
Definition: gal.h:28
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247