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-2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 1992-2018 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 <marker_base.h>
36 
37 // Coordinates count for the basic shape marker
38 #define MARKER_SHAPE_POINT_COUNT 9
39 
40 class MSG_PANEL_ITEM;
41 
42 
43 class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE
44 {
45 public:
46 
47  MARKER_PCB( BOARD_ITEM* aParent );
48 
58  MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, BOARD_ITEM* aItem,
59  const wxPoint& aPos, BOARD_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
60 
70  MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
71  const wxString& aText, const wxPoint& aPos,
72  const wxString& bText = wxEmptyString, const wxPoint& bPos = wxPoint() );
73 
74  ~MARKER_PCB();
75 
76  static inline bool ClassOf( const EDA_ITEM* aItem )
77  {
78  return aItem && PCB_MARKER_T == aItem->Type();
79  }
80 
81  void Move(const wxPoint& aMoveVector) override
82  {
83  m_Pos += aMoveVector;
84  }
85 
86  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
87 
88  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
89 
90  void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override
91  {
92  PrintMarker( aDC, aOffset );
93  }
94 
95  const wxPoint GetPosition() const override { return m_Pos; }
96  void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
97 
98  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override
99  {
100  return HitTestMarker( aPosition, aAccuracy );
101  }
102 
103  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
104 
105  void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
106 
107  bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override
108  {
109  return BOARD_ITEM::Matches( m_drc.GetErrorText(), aSearchData );
110  }
111 
112  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
113 
114  BITMAP_DEF GetMenuImage() const override;
115 
116  const BOX2I ViewBBox() const override;
117 
118  const EDA_RECT GetBoundingBox() const override;
119 
120  void ViewGetLayers( int aLayers[], int& aCount ) const override;
121 
122 #if defined(DEBUG)
123  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
124 #endif
125 
129  virtual wxString GetClass() const override
130  {
131  return wxT( "MARKER_PCB" );
132  }
133 
134 protected:
137 };
138 
139 #endif // CLASS_MARKER_PCB_H
EDA_UNITS
Definition: common.h:72
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
wxString GetErrorText() const
Function GetErrorText returns the string form of a drc error code.
const wxPoint GetPosition() const override
PNG memory record (file in memory).
Definition: bitmap_def.h:29
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
bool Matches(wxFindReplaceData &aSearchData, void *aAuxData) override
Function Matches compares the item against the search criteria in aSearchData.
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
Definition: marker_base.h:54
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
virtual wxString GetClass() const override
Get class name.
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.
bool HitTestMarker(const wxPoint &aHitPosition, int aAccuracy) const
Tests if the given wxPoint is within the bounds of this object.
PCB_LAYER_ID
A quick note on layer IDs:
MARKER_PCB(BOARD_ITEM *aParent)
void PrintMarker(wxDC *aDC, const wxPoint &aOffset)
Function PrintMarker Prints the shape is the polygon defined in m_Corners (array of wxPoints).
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
static bool ClassOf(const EDA_ITEM *aItem)
void Print(PCB_BASE_FRAME *aFrame, wxDC *aDC, const wxPoint &aOffset=ZeroOffset) override
Function Print BOARD_ITEMs have their own color information.
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:471
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
DRC_ITEM m_drc
Definition: marker_base.h:64
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void SetPosition(const wxPoint &aPos) override
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207