KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-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
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
33class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
34{
35public:
36 SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const VECTOR2I& aPos );
37
39
40 // Do not create a copy constructor. The one generated by the compiler is adequate.
41
42 static inline bool ClassOf( const EDA_ITEM* aItem )
43 {
44 return aItem && SCH_MARKER_T == aItem->Type();
45 }
46
47 wxString GetClass() const override
48 {
49 return wxT( "SCH_MARKER" );
50 }
51
52 const KIID GetUUID() const override { return m_Uuid; }
53
54 void SwapData( SCH_ITEM* aItem ) override;
55
56 wxString Serialize() const;
57 static SCH_MARKER* Deserialize( SCHEMATIC* schematic, const wxString& data );
58
59 void ViewGetLayers( int aLayers[], int& aCount ) const override;
60
62
63 SEVERITY GetSeverity() const override;
64
65 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
66
67 void Plot( PLOTTER* /* aPlotter */, bool /* aBackground */,
68 const SCH_PLOT_SETTINGS& /* aPlotSettings */ ) const override
69 {
70 // SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an assertion if we
71 // do not confirm this by locally implementing a no-op Plot().
72 }
73
74 BOX2I const GetBoundingBox() const override;
75
76 // Geometric transforms (used in block operations):
77
78 void Move( const VECTOR2I& aMoveVector ) override
79 {
80 m_Pos += aMoveVector;
81 }
82
83 void MirrorHorizontally( int aCenter ) override;
84 void MirrorVertically( int aCenter ) override;
85 void Rotate( const VECTOR2I& aCenter ) override;
86
94 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxDat ) const override;
95
96 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
97
98 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override
99 {
100 return wxString( _( "ERC Marker" ) );
101 }
102
103 BITMAPS GetMenuImage() const override;
104
105 VECTOR2I GetPosition() const override { return m_Pos; }
106 void SetPosition( const VECTOR2I& aPosition ) override { m_Pos = aPosition; }
107
108 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
109
110 EDA_ITEM* Clone() const override;
111
116 void SetIsLegacyMarker( bool isLegacyMarker = true ) { m_isLegacyMarker = isLegacyMarker; }
117
122 bool IsLegacyMarker() const { return m_isLegacyMarker; }
123
124 double Similarity( const SCH_ITEM& aOther ) const override
125 {
126 return 0.0;
127 }
128
129 bool operator==( const SCH_ITEM& aOther ) const override
130 {
131 return false;
132 }
133
134#if defined(DEBUG)
135 void Show( int nestLevel, std::ostream& os ) const override;
136#endif
137
138protected:
139 KIGFX::COLOR4D getColor() const override;
140
142};
143
144#endif // TYPE_SCH_MARKER_H_
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
const KIID m_Uuid
Definition: eda_item.h:482
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Definition: kiid.h:49
VECTOR2I m_Pos
position of the marker
Definition: marker_base.h:128
Base plotter engine class.
Definition: plotter.h:104
Holds all the data relating to one schematic.
Definition: schematic.h:75
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:151
SEVERITY GetSeverity() const override
Definition: sch_marker.cpp:232
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:175
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxDat) const override
Compare DRC marker main and auxiliary text against search string.
Definition: sch_marker.cpp:249
bool operator==(const SCH_ITEM &aOther) const override
Definition: sch_marker.h:129
wxString Serialize() const
Definition: sch_marker.cpp:78
wxString GetClass() const override
Return the class name.
Definition: sch_marker.h:47
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_marker.cpp:267
const KIID GetUUID() const override
Definition: sch_marker.h:52
bool m_isLegacyMarker
Definition: sch_marker.h:141
void SetIsLegacyMarker(bool isLegacyMarker=true)
Sets this marker as a legacy artifact.
Definition: sch_marker.h:116
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_marker.cpp:66
SCH_LAYER_ID GetColorLayer() const
Definition: sch_marker.cpp:209
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_marker.cpp:279
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a schematic item.
Definition: sch_marker.cpp:243
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: sch_marker.h:124
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_marker.cpp:291
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_marker.h:78
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_marker.cpp:273
void Plot(PLOTTER *, bool, const SCH_PLOT_SETTINGS &) const override
Plot the schematic item to aPlotter.
Definition: sch_marker.h:67
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_marker.cpp:72
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_marker.cpp:285
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:261
KIGFX::COLOR4D getColor() const override
Definition: sch_marker.cpp:225
BOX2I const GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_marker.cpp:255
bool IsLegacyMarker() const
Determines if this marker is legacy (i.e.
Definition: sch_marker.h:122
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_marker.h:106
static SCH_MARKER * Deserialize(SCHEMATIC *schematic, const wxString &data)
Definition: sch_marker.cpp:99
VECTOR2I GetPosition() const override
Definition: sch_marker.h:105
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_marker.h:98
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_marker.h:42
#define _(s)
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:346
SEVERITY
@ SCH_MARKER_T
Definition: typeinfo.h:141