KiCad PCB EDA Suite
origin_viewitem.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-2016 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef __ORIGIN_VIEWITEM_H
26 #define __ORIGIN_VIEWITEM_H
27 
28 #include <math/box2.h>
29 #include <view/view.h>
30 #include <class_board_item.h>
32 #include <gal/color4d.h>
33 
39 namespace KIGFX {
40 
41 class ORIGIN_VIEWITEM : public EDA_ITEM
42 {
43 public:
46 
47  ORIGIN_VIEWITEM( const COLOR4D& aColor = COLOR4D( 1.0, 1.0, 1.0, 1.0 ),
48  MARKER_STYLE aStyle = CIRCLE_X, int aSize = 16,
49  const VECTOR2D& aPosition = VECTOR2D( 0, 0 ) );
50 
51  const BOX2I ViewBBox() const override;
52 
53  void ViewDraw( int aLayer, VIEW* aView ) const override;
54 
55  void ViewGetLayers( int aLayers[], int& aCount ) const override
56  {
57  aLayers[0] = LAYER_GP_OVERLAY;
58  aCount = 1;
59  }
60 
61 #if defined(DEBUG)
62  void Show( int x, std::ostream& st ) const override
63  {
64  }
65 #endif
66 
70  wxString GetClass() const override
71  {
72  return wxT( "ORIGIN_VIEWITEM" );
73  }
74 
81  inline void SetDrawAtZero( bool aDrawFlag )
82  {
83  m_drawAtZero = aDrawFlag;
84  }
85 
86  inline void SetPosition( const VECTOR2D& aPosition )
87  {
88  m_position = aPosition;
89  }
90 
91  inline const VECTOR2D& GetPosition() const
92  {
93  return m_position;
94  }
95 
96  inline void SetSize( int aSize )
97  {
98  m_size = aSize;
99  }
100 
101  inline int GetSize() const
102  {
103  return m_size;
104  }
105 
106  inline void SetColor( const KIGFX::COLOR4D& aColor )
107  {
108  m_color = aColor;
109  }
110 
111  inline const KIGFX::COLOR4D& GetColor() const
112  {
113  return m_color;
114  }
115 
116  inline void SetStyle( MARKER_STYLE aStyle )
117  {
118  m_style = aStyle;
119  }
120 
121  inline MARKER_STYLE GetStyle() const
122  {
123  return m_style;
124  }
125 
126 protected:
129 
131  int m_size;
132 
135 
138 
141 };
142 
143 } // namespace KIGFX
144 
145 #endif
const KIGFX::COLOR4D & GetColor() const
ORIGIN_VIEWITEM(const COLOR4D &aColor=COLOR4D(1.0, 1.0, 1.0, 1.0), MARKER_STYLE aStyle=CIRCLE_X, int aSize=16, const VECTOR2D &aPosition=VECTOR2D(0, 0))
COLOR4D m_color
Marker color.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
VECTOR2D m_position
Marker coordinates.
wxString GetClass() const override
Get class name.
void ViewDraw(int aLayer, VIEW *aView) const override
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
MARKER_STYLE m_style
Marker symbol.
const VECTOR2D & GetPosition() const
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on...
void SetPosition(const VECTOR2D &aPosition)
void SetSize(int aSize)
void SetDrawAtZero(bool aDrawFlag)
Function SetDrawAtZero() Set the draw at zero flag.
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
general purpose overlay
Board layer functions and definitions.
int m_size
Marker size (in pixels).
void SetColor(const KIGFX::COLOR4D &aColor)
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
bool m_drawAtZero
If set, the marker will be drawn even if its position is 0,0
MARKER_STYLE GetStyle() const
Class VIEW.
Definition: view.h:58
void SetStyle(MARKER_STYLE aStyle)
MARKER_STYLE
Marker symbol styles
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39