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 The 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#pragma once
28
29#include <gal/gal.h>
30#include <view/view_item.h>
31#include <vector>
32#include <deque>
33
34class SEG;
36class SHAPE_POLY_SET;
37
38namespace KIGFX
39{
40class VIEW;
41
43{
44public:
45
47 virtual ~VIEW_OVERLAY();
48
49 // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that
50 // will only land us in trouble.
51 VIEW_OVERLAY( const VIEW_OVERLAY& ) = delete;
52 VIEW_OVERLAY& operator=( const VIEW_OVERLAY& ) = delete;
53
54 wxString GetClass() const override;
55
56 struct COMMAND;
57 struct COMMAND_ARC;
58 struct COMMAND_LINE;
59 struct COMMAND_CIRCLE;
60 struct COMMAND_RECTANGLE;
61
62 struct COMMAND_SET_STROKE;
63 struct COMMAND_SET_FILL;
64 struct COMMAND_SET_COLOR;
65 struct COMMAND_SET_WIDTH;
66
67 struct COMMAND_POLYGON;
70
71 struct COMMAND_POLYLINE;
72 struct COMMAND_POINT_POLYLINE;
73
74 struct COMMAND_GLYPH_SIZE;
76
77 void Clear();
78
79 virtual const BOX2I ViewBBox() const override;
80 virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
81 virtual std::vector<int> ViewGetLayers() const override;
82
83 // Basic shape primitives
84 void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
85 void Line( const SEG& aSeg );
86 void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
87 void Circle( const VECTOR2D& aCenterPoint, double aRadius );
88 void Arc( const VECTOR2D& aCenterPoint, double aRadius, const EDA_ANGLE& aStartAngle,
89 const EDA_ANGLE& aEndAngle );
90 void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
91 void Cross( const VECTOR2D& aP, int aSize );
92
93 // polygon primitives
94 void Polygon( const std::deque<VECTOR2D>& aPointList );
95 void Polygon( const SHAPE_POLY_SET& aPolySet );
96 void Polyline( const SHAPE_LINE_CHAIN& aPolyLine );
97 void Polygon( const VECTOR2D aPointList[], int aListSize );
98
99 void BitmapText( const wxString& aText, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle );
100
101 // Draw settings
102 void SetIsFill( bool aIsFillEnabled );
103 void SetIsStroke( bool aIsStrokeEnabled );
104 void SetFillColor( const COLOR4D& aColor );
105 void SetStrokeColor( const COLOR4D& aColor );
106 void SetGlyphSize( const VECTOR2I& aSize );
107 void SetLineWidth( double aLineWidth );
108
109 const COLOR4D& GetStrokeColor() const { return m_strokeColor; }
110 const COLOR4D& GetFillColor() const { return m_fillColor; }
111
112private:
113 void releaseCommands();
114
115private:
118 std::vector<COMMAND*> m_commands;
119};
120
121} // namespace KIGFX
122
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:86
VIEW_OVERLAY(const VIEW_OVERLAY &)=delete
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:118
const COLOR4D & GetFillColor() const
Definition: view_overlay.h:110
VIEW_OVERLAY & operator=(const VIEW_OVERLAY &)=delete
const COLOR4D & GetStrokeColor() const
Definition: view_overlay.h:109
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:66
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: eda_group.h:33