KiCad PCB EDA Suite
sch_marker.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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2019 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 
25 #ifndef TYPE_SCH_MARKER_H_
26 #define TYPE_SCH_MARKER_H_
27 
28 #include <erc_item.h>
29 #include <sch_item.h>
30 #include <marker_base.h>
31 
32 
33 class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
34 {
35 public:
36  SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const wxPoint& aPos );
37 
38  // Do not create a copy constructor. The one generated by the compiler is adequate.
39 
40  static inline bool ClassOf( const EDA_ITEM* aItem )
41  {
42  return aItem && SCH_MARKER_T == aItem->Type();
43  }
44 
45  wxString GetClass() const override
46  {
47  return wxT( "SCH_MARKER" );
48  }
49 
50  const KIID GetUUID() const override { return m_Uuid; }
51 
52  void SwapData( SCH_ITEM* aItem ) override;
53 
54  void ViewGetLayers( int aLayers[], int& aCount ) const override;
55 
57 
58  void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
59 
60  void Plot( PLOTTER* aPlotter ) override
61  {
62  // SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an
63  // assertion if we do not confirm this by locally implementing a no-op
64  // Plot().
65  (void) aPlotter;
66  }
67 
68  EDA_RECT const GetBoundingBox() const override;
69 
70  // Geometric transforms (used in block operations):
71 
72  void Move( const wxPoint& aMoveVector ) override
73  {
74  m_Pos += aMoveVector;
75  }
76 
77  void MirrorY( int aYaxis_position ) override;
78  void MirrorX( int aXaxis_position ) override;
79  void Rotate( wxPoint aPosition ) override;
80 
90  bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override;
91 
92  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
93 
94  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
95  {
96  return wxString( _( "ERC Marker" ) );
97  }
98 
99  BITMAP_DEF GetMenuImage() const override;
100 
101  wxPoint GetPosition() const override { return m_Pos; }
102  void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; }
103 
104  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
105 
106  EDA_ITEM* Clone() const override;
107 
108 #if defined(DEBUG)
109  void Show( int nestLevel, std::ostream& os ) const override;
110 #endif
111 
112 protected:
113  KIGFX::COLOR4D getColor() const override;
114 };
115 
116 #endif // TYPE_SCH_MARKER_H_
EDA_UNITS
Definition: common.h:198
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...
Definition: sch_marker.cpp:136
void MirrorX(int aXaxis_position) override
Mirror item relative to the X axis about aXaxis_position.
Definition: sch_marker.cpp:155
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_marker.cpp:130
PNG memory record (file in memory).
Definition: bitmap_def.h:29
SCH_LAYER_ID GetColorLayer() const
Definition: sch_marker.cpp:95
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_marker.cpp:61
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
wxPoint GetPosition() const override
Definition: sch_marker.h:101
wxPoint m_Pos
position of the marker
Definition: marker_base.h:61
SCH_MARKER(std::shared_ptr< ERC_ITEM > aItem, const wxPoint &aPos)
Definition: sch_marker.cpp:44
The base class for create windows for drawing purpose.
void MirrorY(int aYaxis_position) override
Mirror item relative to the Y axis about aYaxis_position.
Definition: sch_marker.cpp:163
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_marker.h:72
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: sch_marker.cpp:143
bool Matches(wxFindReplaceData &aSearchData, void *aAuxDat) override
Compare DRC marker main and auxiliary text against search string.
Definition: sch_marker.cpp:124
Definition: common.h:68
void Plot(PLOTTER *aPlotter) override
Plot the schematic item to aPlotter.
Definition: sch_marker.h:60
void Print(RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
Definition: sch_marker.cpp:118
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.
Definition: sch_marker.cpp:171
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_marker.h:40
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_marker.cpp:78
void SetPosition(const wxPoint &aPosition) override
Definition: sch_marker.h:102
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_marker.h:94
SCH_LAYER_ID
Eeschema drawing layers.
const KIID m_Uuid
Definition: base_struct.h:162
const KIID GetUUID() const override
Definition: sch_marker.h:50
Base plotter engine class.
Definition: plotter.h:114
void Rotate(wxPoint aPosition) override
Rotate the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_marker.cpp:149
KIGFX::COLOR4D getColor() const override
Definition: sch_marker.cpp:111
#define _(s)
Definition: 3d_actions.cpp:33
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: sch_marker.cpp:55
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:159
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_marker.h:45
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99