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/color4d.h>
30#include <gal/gal.h>
31#include <view/view_item.h>
32#include <vector>
33#include <deque>
34
35class SEG;
37class SHAPE_POLY_SET;
38
39namespace KIGFX
40{
41class VIEW;
42
44{
45public:
46
48 virtual ~VIEW_OVERLAY();
49
50 // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that
51 // will only land us in trouble.
52 VIEW_OVERLAY( const VIEW_OVERLAY& ) = delete;
53 VIEW_OVERLAY& operator=( const VIEW_OVERLAY& ) = delete;
54
55 wxString GetClass() const override;
56
57 struct COMMAND;
58 struct COMMAND_ARC;
59 struct COMMAND_LINE;
60 struct COMMAND_CIRCLE;
61 struct COMMAND_RECTANGLE;
62
63 struct COMMAND_SET_STROKE;
64 struct COMMAND_SET_FILL;
65 struct COMMAND_SET_COLOR;
66 struct COMMAND_SET_WIDTH;
67
68 struct COMMAND_POLYGON;
71
72 struct COMMAND_POLYLINE;
73 struct COMMAND_POINT_POLYLINE;
74
75 struct COMMAND_GLYPH_SIZE;
77
78 void Clear();
79
80 virtual const BOX2I ViewBBox() const override;
81 virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
82 virtual std::vector<int> ViewGetLayers() const override;
83
84 // Basic shape primitives
85 void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
86 void Line( const SEG& aSeg );
87 void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
88 void Circle( const VECTOR2D& aCenterPoint, double aRadius );
89 void Arc( const VECTOR2D& aCenterPoint, double aRadius, const EDA_ANGLE& aStartAngle,
90 const EDA_ANGLE& aEndAngle );
91 void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
92 void Cross( const VECTOR2D& aP, int aSize );
93
94 // polygon primitives
95 void Polygon( const std::deque<VECTOR2D>& aPointList );
96 void Polygon( const SHAPE_POLY_SET& aPolySet );
97 void Polyline( const SHAPE_LINE_CHAIN& aPolyLine );
98 void Polygon( const VECTOR2D aPointList[], int aListSize );
99
100 void BitmapText( const wxString& aText, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle );
101
102 // Draw settings
103 void SetIsFill( bool aIsFillEnabled );
104 void SetIsStroke( bool aIsStrokeEnabled );
105 void SetFillColor( const COLOR4D& aColor );
106 void SetStrokeColor( const COLOR4D& aColor );
107 void SetGlyphSize( const VECTOR2I& aSize );
108 void SetLineWidth( double aLineWidth );
109
110 const COLOR4D& GetStrokeColor() const { return m_strokeColor; }
111 const COLOR4D& GetFillColor() const { return m_fillColor; }
112
113private:
114 void releaseCommands();
115
116private:
119 std::vector<COMMAND*> m_commands;
120};
121
122} // namespace KIGFX
123
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
VIEW_ITEM(bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition view_item.h:88
friend class VIEW
Definition view_item.h:205
void SetGlyphSize(const VECTOR2I &aSize)
void SetLineWidth(double aLineWidth)
void Polygon(const std::deque< VECTOR2D > &aPointList)
VIEW_OVERLAY(const VIEW_OVERLAY &)=delete
std::vector< COMMAND * > m_commands
const COLOR4D & GetFillColor() const
void Segment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
void Rectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
void Polyline(const SHAPE_LINE_CHAIN &aPolyLine)
VIEW_OVERLAY & operator=(const VIEW_OVERLAY &)=delete
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
const COLOR4D & GetStrokeColor() const
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
void BitmapText(const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
void SetIsFill(bool aIsFillEnabled)
virtual void ViewDraw(int aLayer, VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
void SetFillColor(const COLOR4D &aColor)
void Line(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
void Circle(const VECTOR2D &aCenterPoint, double aRadius)
void Cross(const VECTOR2D &aP, int aSize)
void Arc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle)
void SetIsStroke(bool aIsStrokeEnabled)
void SetStrokeColor(const COLOR4D &aColor)
wxString GetClass() const override
Return the class name.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:67
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
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
VECTOR2< double > VECTOR2D
Definition vector2d.h:694