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, see <https://www.gnu.org/licenses/>.
21 */
22
23#pragma once
24
25#include <gal/color4d.h>
26#include <gal/gal.h>
27#include <view/view_item.h>
28#include <vector>
29#include <deque>
30
31class SEG;
33class SHAPE_POLY_SET;
34
35namespace KIGFX
36{
37class VIEW;
38
40{
41public:
42
44 virtual ~VIEW_OVERLAY();
45
46 // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that
47 // will only land us in trouble.
48 VIEW_OVERLAY( const VIEW_OVERLAY& ) = delete;
49 VIEW_OVERLAY& operator=( const VIEW_OVERLAY& ) = delete;
50
51 wxString GetClass() const override;
52
53 struct COMMAND;
54 struct COMMAND_ARC;
55 struct COMMAND_LINE;
56 struct COMMAND_CIRCLE;
57 struct COMMAND_RECTANGLE;
58
59 struct COMMAND_SET_STROKE;
60 struct COMMAND_SET_FILL;
61 struct COMMAND_SET_COLOR;
62 struct COMMAND_SET_WIDTH;
63
64 struct COMMAND_POLYGON;
67
68 struct COMMAND_POLYLINE;
69 struct COMMAND_POINT_POLYLINE;
70
71 struct COMMAND_GLYPH_SIZE;
73
74 void Clear();
75
76 virtual const BOX2I ViewBBox() const override;
77 virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
78 virtual std::vector<int> ViewGetLayers() const override;
79
80 // Basic shape primitives
81 void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
82 void Line( const SEG& aSeg );
83 void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
84 void Circle( const VECTOR2D& aCenterPoint, double aRadius );
85 void Arc( const VECTOR2D& aCenterPoint, double aRadius, const EDA_ANGLE& aStartAngle,
86 const EDA_ANGLE& aEndAngle );
87 void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
88 void Cross( const VECTOR2D& aP, int aSize );
89
90 // polygon primitives
91 void Polygon( const std::deque<VECTOR2D>& aPointList );
92 void Polygon( const SHAPE_POLY_SET& aPolySet );
93 void Polyline( const SHAPE_LINE_CHAIN& aPolyLine );
94 void Polygon( const VECTOR2D aPointList[], int aListSize );
95
96 void BitmapText( const wxString& aText, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle );
97
98 // Draw settings
99 void SetIsFill( bool aIsFillEnabled );
100 void SetIsStroke( bool aIsStrokeEnabled );
101 void SetFillColor( const COLOR4D& aColor );
102 void SetStrokeColor( const COLOR4D& aColor );
103 void SetGlyphSize( const VECTOR2I& aSize );
104 void SetLineWidth( double aLineWidth );
105
106 const COLOR4D& GetStrokeColor() const { return m_strokeColor; }
107 const COLOR4D& GetFillColor() const { return m_fillColor; }
108
109private:
110 void releaseCommands();
111
112private:
115 std::vector<COMMAND*> m_commands;
116};
117
118} // namespace KIGFX
119
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
VIEW_ITEM(bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition view_item.h:84
friend class VIEW
Definition view_item.h:201
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:63
Definition seg.h:38
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:27
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682