KiCad PCB EDA Suite
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 <tomasz.wlostowski@cern.ch>
7  * @author Maciej Suminski <maciej.suminski@cern.ch>
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 <view/view_item.h>
32 
33 #include <vector>
34 #include <deque>
35 
37 
38 class SEG;
39 
40 namespace KIGFX
41 {
42 class VIEW;
43 
44 class VIEW_OVERLAY : public VIEW_ITEM
45 {
46 public:
47 
48  VIEW_OVERLAY();
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;
63  struct COMMAND_POINT_POLYGON;
64  struct COMMAND_POLY_POLYGON;
65 
66  struct COMMAND_POLYLINE;
67  struct COMMAND_POINT_POLYLINE;
68 
69  struct COMMAND_GLYPH_SIZE;
70  struct COMMAND_BITMAP_TEXT;
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, double aStartAngle, double aEndAngle );
84  void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
85  void Cross( const VECTOR2D& aP, int aSize );
86 
87  // polygon primitives
88  void Polygon( const std::deque<VECTOR2D>& aPointList );
89  void Polygon( const SHAPE_POLY_SET& aPolySet );
90  void Polyline( const SHAPE_LINE_CHAIN& aPolyLine );
91  void Polygon( const VECTOR2D aPointList[], int aListSize );
92 
93  void BitmapText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle );
94 
95  // Draw settings
96  void SetIsFill( bool aIsFillEnabled );
97  void SetIsStroke( bool aIsStrokeEnabled );
98  void SetFillColor( const COLOR4D& aColor );
99  void SetStrokeColor( const COLOR4D& aColor );
100  void SetGlyphSize( const VECTOR2D& aSize );
101  void SetLineWidth( double aLineWidth );
102 
103  const COLOR4D& GetStrokeColor() const { return m_strokeColor; }
104  const COLOR4D& GetFillColor() const { return m_fillColor; }
105 
106 private:
107  void releaseCommands();
108 
111 
112  std::vector<COMMAND*> m_commands;
113 };
114 
115 } // namespace KIGFX
116 
117 
118 #endif
void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:112
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:236
void Segment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
const COLOR4D & GetStrokeColor() const
Definition: view_overlay.h:103
void SetFillColor(const COLOR4D &aColor)
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:81
void SetIsStroke(bool aIsStrokeEnabled)
void Cross(const VECTOR2D &aP, int aSize)
void Polyline(const SHAPE_LINE_CHAIN &aPolyLine)
void Line(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
void Arc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
void Polygon(const std::deque< VECTOR2D > &aPointList)
VIEW_ITEM class definition.
void SetGlyphSize(const VECTOR2D &aSize)
Represent a set of closed polygons.
const COLOR4D & GetFillColor() const
Definition: view_overlay.h:104
void SetStrokeColor(const COLOR4D &aColor)
void SetIsFill(bool aIsFillEnabled)
Definition: seg.h:40
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void SetLineWidth(double aLineWidth)
Represent a polyline (an zero-thickness chain of connected line segments).
void Circle(const VECTOR2D &aCenterPoint, double aRadius)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
virtual void ViewDraw(int aLayer, VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
void Rectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103