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;
67  struct COMMAND_POLY_POLYLINE;
68 
69  void Clear();
70 
71  virtual const BOX2I ViewBBox() const override;
72  virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
73  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
74 
75  // Basic shape primitives
76  void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
77  void Line( const SEG& aSeg );
78  void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
79  void Circle( const VECTOR2D& aCenterPoint, double aRadius );
80  void Arc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle );
81  void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
82 
83  // Polyline primitives
84  void Polyline( std::deque<VECTOR2D>& aPointList );
85  void Polyline( const VECTOR2D aPointList[], int aListSize );
86  void Polyline( const SHAPE_LINE_CHAIN& aLineChain );
87 
88  // polygon primitives
89  void Polygon( const std::deque<VECTOR2D>& aPointList );
90  void Polygon( const SHAPE_POLY_SET& aPolySet );
91  void Polygon( const VECTOR2D aPointList[], int aListSize );
92 
93  // Draw settings
94  void SetIsFill( bool aIsFillEnabled );
95  void SetIsStroke( bool aIsStrokeEnabled );
96  void SetFillColor( const COLOR4D& aColor );
97  void SetStrokeColor( const COLOR4D& aColor );
98 
99  void SetLineWidth( double aLineWidth );
100 
101 private:
102  void releaseCommands();
103 
104  std::vector<COMMAND*> m_commands;
105 };
106 
107 } // namespace KIGFX
108 
109 
110 #endif
void Polyline(std::deque< VECTOR2D > &aPointList)
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:57
void Segment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
void SetFillColor(const COLOR4D &aColor)
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
Class VIEW_ITEM - is an abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:84
void SetIsStroke(bool aIsStrokeEnabled)
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.
Class SHAPE_POLY_SET.
void SetStrokeColor(const COLOR4D &aColor)
void SetIsFill(bool aIsFillEnabled)
Definition: seg.h:36
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
void SetLineWidth(double aLineWidth)
Class SHAPE_LINE_CHAIN.
void Circle(const VECTOR2D &aCenterPoint, double aRadius)
Class VIEW.
Definition: view.h:61
virtual void ViewDraw(int aLayer, VIEW *aView) const override
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
void Rectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39