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 <drc/drc_item.h>
36 #include <marker_base.h>
37 
38 class DRC_ITEM;
39 
40 // Coordinates count for the basic shape marker
41 #define MARKER_SHAPE_POINT_COUNT 9
42 
43 class MSG_PANEL_ITEM;
44 
45 
46 class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE
47 {
48 public:
49  MARKER_PCB( std::shared_ptr<RC_ITEM> aItem, const wxPoint& aPosition );
50  ~MARKER_PCB();
51 
52  static inline bool ClassOf( const EDA_ITEM* aItem )
53  {
54  return aItem && PCB_MARKER_T == aItem->Type();
55  }
56 
57  const KIID GetUUID() const override { return m_Uuid; }
58 
59  wxString Serialize() const;
60 
61  static MARKER_PCB* Deserialize( const wxString& data );
62 
63  void Move(const wxPoint& aMoveVector) override
64  {
65  m_Pos += aMoveVector;
66  }
67 
68  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
69 
70  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
71 
72  wxPoint GetPosition() const override { return m_Pos; }
73  void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
74 
75  wxPoint GetCenter() const override
76  {
77  return GetPosition();
78  }
79 
80  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override
81  {
82  return HitTestMarker( aPosition, aAccuracy );
83  }
84 
86 
87  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
88 
89  bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override
90  {
91  return BOARD_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData );
92  }
93 
94  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
95 
96  BITMAP_DEF GetMenuImage() const override;
97 
98  const BOX2I ViewBBox() const override;
99 
100  const EDA_RECT GetBoundingBox() const override;
101 
102  void ViewGetLayers( int aLayers[], int& aCount ) const override;
103 
104 #if defined(DEBUG)
105  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
106 #endif
107 
111  virtual wxString GetClass() const override
112  {
113  return wxT( "MARKER_PCB" );
114  }
115 
116 protected:
117  KIGFX::COLOR4D getColor() const override;
118 };
119 
120 #endif // CLASS_MARKER_PCB_H
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
wxPoint GetCenter() const override
Function GetCenter()
const KIID GetUUID() const override
PNG memory record (file in memory).
Definition: bitmap_def.h:29
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.
GAL_LAYER_ID GetColorLayer() const
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:61
wxPoint GetPosition() const override
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
The base class for create windows for drawing purpose.
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.
Definition: kiid.h:44
bool HitTestMarker(const wxPoint &aHitPosition, int aAccuracy) const
Tests if the given wxPoint is within the bounds of this object.
Definition: marker_base.cpp:89
std::shared_ptr< RC_ITEM > m_rcItem
Definition: marker_base.h:66
KIGFX::COLOR4D getColor() const override
const KIID m_Uuid
Definition: eda_item.h:151
EDA_UNITS
Definition: eda_units.h:38
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:99
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
static MARKER_PCB * Deserialize(const wxString &data)
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
MARKER_PCB(std::shared_ptr< RC_ITEM > aItem, const wxPoint &aPosition)
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: eda_item.h:148
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
wxString Serialize() const
static bool ClassOf(const EDA_ITEM *aItem)
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:54
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData)
Function Matches compares the item against the search criteria in aSearchData.
Definition: eda_item.h:447
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
void SetPosition(const wxPoint &aPos) override
KICAD_T Type() const
Function Type()
Definition: eda_item.h:182
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100