KiCad PCB EDA Suite
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
5  * Copyright (C) 2004-2021 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
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  *
20  * or you may search the 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  */
25 #ifndef TYPE_SCH_MARKER_H_
26 #define TYPE_SCH_MARKER_H_
28 #include <erc_item.h>
29 #include <sch_item.h>
30 #include <marker_base.h>
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 );
38  // Do not create a copy constructor. The one generated by the compiler is adequate.
40  static inline bool ClassOf( const EDA_ITEM* aItem )
41  {
42  return aItem && SCH_MARKER_T == aItem->Type();
43  }
45  wxString GetClass() const override
46  {
47  return wxT( "SCH_MARKER" );
48  }
50  const KIID GetUUID() const override { return m_Uuid; }
52  void SwapData( SCH_ITEM* aItem ) override;
54  wxString Serialize() const;
55  static SCH_MARKER* Deserialize( const wxString& data );
57  void ViewGetLayers( int aLayers[], int& aCount ) const override;
61  void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
63  void Plot( PLOTTER* /* aPlotter */ ) const override
64  {
65  // SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an
66  // assertion if we do not confirm this by locally implementing a no-op
67  // Plot().
68  }
70  EDA_RECT const GetBoundingBox() const override;
72  // Geometric transforms (used in block operations):
74  void Move( const wxPoint& aMoveVector ) override
75  {
76  m_Pos += aMoveVector;
77  }
79  void MirrorHorizontally( int aCenter ) override;
80  void MirrorVertically( int aCenter ) override;
81  void Rotate( const wxPoint& aCenter ) override;
90  bool Matches( const wxFindReplaceData& aSearchData, void* aAuxDat ) const override;
92  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
94  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
95  {
96  return wxString( _( "ERC Marker" ) );
97  }
99  BITMAPS GetMenuImage() const override;
101  wxPoint GetPosition() const override { return m_Pos; }
102  void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; }
104  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
106  EDA_ITEM* Clone() const override;
108 #if defined(DEBUG)
109  void Show( int nestLevel, std::ostream& os ) const override;
110 #endif
112 protected:
113  KIGFX::COLOR4D getColor() const override;
114 };
116 #endif // TYPE_SCH_MARKER_H_
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: sch_marker.cpp:163
EDA_RECT const GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_marker.cpp:157
bool Matches(const wxFindReplaceData &aSearchData, void *aAuxDat) const override
Compare DRC marker main and auxiliary text against search string.
Definition: sch_marker.cpp:151
SCH_LAYER_ID GetColorLayer() const
Definition: sch_marker.cpp:122
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_marker.cpp:60
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
wxPoint GetPosition() const override
Definition: sch_marker.h:101
wxPoint m_Pos
position of the marker
Definition: marker_base.h:124
SCH_MARKER(std::shared_ptr< ERC_ITEM > aItem, const wxPoint &aPos)
Definition: sch_marker.cpp:43
The base class for create windows for drawing purpose.
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
Definition: sch_marker.cpp:145
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_marker.h:74
Definition: kiid.h:44
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_marker.cpp:193
Eeschema drawing layers.
Definition: layer_ids.h:335
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:105
void SetPosition(const wxPoint &aPosition) override
Definition: sch_marker.h:102
void Plot(PLOTTER *) const override
Plot the schematic item to aPlotter.
Definition: sch_marker.h:63
#define _(s)
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: sch_marker.h:94
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_marker.cpp:181
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_marker.cpp:169
wxString Serialize() const
Definition: sch_marker.cpp:66
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_marker.cpp:175
const KIID m_Uuid
Definition: eda_item.h:474
const KIID GetUUID() const override
Definition: sch_marker.h:50
Definition: eda_units.h:38
Base plotter engine class.
Definition: plotter.h:121
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
KIGFX::COLOR4D getColor() const override
Definition: sch_marker.cpp:138
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_marker.cpp:54
Handle the component boundary box.
Definition: eda_rect.h:42
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_marker.cpp:187
wxString GetClass() const override
Return the class name.
Definition: sch_marker.h:45
static SCH_MARKER * Deserialize(const wxString &data)
Definition: sch_marker.cpp:77
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103