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  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
6  * @author Maciej Suminski <maciej.suminski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #ifndef __VIEW_OVERLAY_H
27 #define __VIEW_OVERLAY_H
28 
29 #include <view/view_item.h>
31 
32 #include <vector>
33 #include <deque>
34 
36 
37 class SEG;
38 
39 namespace KIGFX
40 {
41 class VIEW;
42 
43 class VIEW_OVERLAY : public VIEW_ITEM
44 {
45 public:
46 
47  VIEW_OVERLAY();
48  virtual ~VIEW_OVERLAY();
49 
50  struct COMMAND;
51  struct COMMAND_ARC;
52  struct COMMAND_LINE;
53  struct COMMAND_CIRCLE;
54  struct COMMAND_RECTANGLE;
55 
56  struct COMMAND_SET_STROKE;
57  struct COMMAND_SET_FILL;
58  struct COMMAND_SET_COLOR;
59  struct COMMAND_SET_WIDTH;
60 
61  struct COMMAND_POLYGON;
62  struct COMMAND_POINT_POLYGON;
63  struct COMMAND_POLY_POLYGON;
64 
65  struct COMMAND_POLYLINE;
66  struct COMMAND_POINT_POLYLINE;
67 
68  struct COMMAND_GLYPH_SIZE;
69  struct COMMAND_BITMAP_TEXT;
70 
71  void Clear();
72 
73  virtual const BOX2I ViewBBox() const override;
74  virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
75  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
76 
77  // Basic shape primitives
78  void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
79  void Line( const SEG& aSeg );
80  void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
81  void Circle( const VECTOR2D& aCenterPoint, double aRadius );
82  void Arc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle );
83  void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
84  void Cross( const VECTOR2D& aP, int aSize );
85 
86  // polygon primitives
87  void Polygon( const std::deque<VECTOR2D>& aPointList );
88  void Polygon( const SHAPE_POLY_SET& aPolySet );
89  void Polyline( const SHAPE_LINE_CHAIN& aPolyLine );
90  void Polygon( const VECTOR2D aPointList[], int aListSize );
91 
92  void BitmapText( const wxString& aText, const VECTOR2D& aPosition,
93  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 
102  void SetLineWidth( double aLineWidth );
103 
104 private:
105  void releaseCommands();
106 
107  std::vector<COMMAND*> m_commands;
108 };
109 
110 } // namespace KIGFX
111 
112 
113 #endif
void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:107
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
void Segment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
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.
Represent a set of closed polygons.
void SetStrokeColor(const COLOR4D &aColor)
void SetIsFill(bool aIsFillEnabled)
Definition: seg.h:41
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void SetLineWidth(double aLineWidth)
SHAPE_LINE_CHAIN.
void SetGlyphSize(const VECTOR2D aSize)
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:67
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:98