KiCad PCB EDA Suite
class_marker_pcb.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) 2009-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
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 
30 #ifndef CLASS_MARKER_PCB_H
31 #define CLASS_MARKER_PCB_H
32 
33 
34 #include <class_board_item.h>
35 #include <class_marker_base.h>
36 
37 
38 class MSG_PANEL_ITEM;
39 
40 
41 class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE
42 {
43 
44 public:
45 
46  MARKER_PCB( BOARD_ITEM* aParent );
47 
57  MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
58  const wxString& aText, const wxPoint& aPos,
59  const wxString& bText, const wxPoint& bPos );
60 
68  MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
69  const wxString& aText, const wxPoint& aPos );
70 
71  ~MARKER_PCB();
72 
73  void Move(const wxPoint& aMoveVector) override
74  {
75  m_Pos += aMoveVector;
76  }
77 
78  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
79 
80  void Flip( const wxPoint& aCentre ) override;
81 
82  void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
83  GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ) override
84  {
85  DrawMarker( aPanel, aDC, aDrawMode, aOffset );
86  }
87 
88  const wxPoint& GetPosition() const override { return m_Pos; }
89  void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
90 
91  void SetItem( const BOARD_ITEM* aItem )
92  {
93  m_item = aItem;
94  }
95 
96  const BOARD_ITEM* GetItem() const
97  {
98  return m_item;
99  }
100 
101  bool HitTest( const wxPoint& aPosition ) const override
102  {
103  return HitTestMarker( aPosition );
104  }
105 
106  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
107 
108  void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
109 
110  wxString GetSelectMenuText() const override;
111 
112  BITMAP_DEF GetMenuImage() const override;
113 
114  const BOX2I ViewBBox() const override
115  {
116  // The following is based on the PCB_PAINTER::draw( const MARKER_PCB* )
117  return BOX2I( m_Pos, VECTOR2I( 1300000, 1300000 ) );
118  }
119 
120  const EDA_RECT GetBoundingBox() const override;
121 
122  void ViewGetLayers( int aLayers[], int& aCount ) const override;
123 
124 #if defined(DEBUG)
125  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
126 #endif
127 
131  virtual wxString GetClass() const override
132  {
133  return wxT( "MARKER_PCB" );
134  }
135 
136 protected:
139 };
140 
141 #endif // CLASS_MARKER_PCB_H
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
bool HitTestMarker(const wxPoint &ref_pos) const
Function HitTestMarker tests if the given wxPoint is within the bounds of this object.
PNG memory record (file in memory).
Definition: bitmap_types.h:38
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
wxPoint m_Pos
position of the marker
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
const BOARD_ITEM * GetItem() const
void DrawMarker(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset)
Function DrawMarker draws the shape is the polygon defined in m_Corners (array of wxPoints)...
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
virtual wxString GetClass() const override
Get class name.
const wxPoint & GetPosition() const override
void SetItem(const BOARD_ITEM *aItem)
const BOARD_ITEM * m_item
Pointer to BOARD_ITEM that causes DRC error.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Function IsOnLayer tests to see if this object is on the given layer.
PCB_LAYER_ID
A quick note on layer IDs:
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
MARKER_PCB(BOARD_ITEM *aParent)
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Class EDA_RECT handles the component boundary box.
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on...
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
void SetPosition(const wxPoint &aPos) override