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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef TYPE_SCH_MARKER_H_
22#define TYPE_SCH_MARKER_H_
23
24#include <erc/erc_item.h>
25#include <sch_item.h>
26#include <marker_base.h>
27
28
29class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
30{
31public:
32 SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const VECTOR2I& aPos );
33
35
36 // Do not create a copy constructor. The one generated by the compiler is adequate.
37
38 static inline bool ClassOf( const EDA_ITEM* aItem )
39 {
40 return aItem && SCH_MARKER_T == aItem->Type();
41 }
42
43 wxString GetClass() const override
44 {
45 return wxT( "SCH_MARKER" );
46 }
47
48 const KIID GetUUID() const override { return m_Uuid; }
49
50 wxString SerializeToString() const;
51 static SCH_MARKER* DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
52 const wxString& data );
53
54 std::vector<int> ViewGetLayers() const override;
55
57
58 SEVERITY GetSeverity() const override;
59
60 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
61 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override
62 {
63 // SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an assertion if we
64 // do not confirm this by locally implementing a no-op Plot().
65 }
66
67 BOX2I const GetBoundingBox() const override;
68
69 // Geometric transforms (used in block operations):
70
71 void Move( const VECTOR2I& aMoveVector ) override
72 {
73 m_Pos += aMoveVector;
74 }
75
76 void MirrorHorizontally( int aCenter ) override;
77 void MirrorVertically( int aCenter ) override;
78 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
79
87 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxDat ) const override;
88
89 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
90
91 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
92 {
93 return wxString( _( "ERC Marker" ) );
94 }
95
96 BITMAPS GetMenuImage() const override;
97
98 VECTOR2I GetPosition() const override { return m_Pos; }
99 void SetPosition( const VECTOR2I& aPosition ) override { m_Pos = aPosition; }
100
101 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
102
103 EDA_ITEM* Clone() const override;
104
110 void SetIsLegacyMarker( bool isLegacyMarker = true ) { m_isLegacyMarker = isLegacyMarker; }
111
117 bool IsLegacyMarker() const { return m_isLegacyMarker; }
118
119 double Similarity( const SCH_ITEM& aOther ) const override
120 {
121 return 0.0;
122 }
123
124 bool operator==( const SCH_ITEM& aOther ) const override
125 {
126 return false;
127 }
128
129#if defined(DEBUG)
130 void Show( int nestLevel, std::ostream& os ) const override;
131#endif
132
133protected:
134 void swapData( SCH_ITEM* aItem ) override;
135
136 KIGFX::COLOR4D getColor() const override;
137
139};
140
141#endif // TYPE_SCH_MARKER_H_
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
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:96
const KIID m_Uuid
Definition eda_item.h:531
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Definition kiid.h:44
VECTOR2I m_Pos
Position of the marker.
MARKER_BASE(int aScalingFactor, std::shared_ptr< RC_ITEM > aItem, MARKER_T aType=MARKER_UNSPEC)
Base plotter engine class.
Definition plotter.h:133
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:52
SEVERITY GetSeverity() const override
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition sch_marker.h:91
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
Definition sch_marker.h:60
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxDat) const override
Compare DRC marker main and auxiliary text against search string.
bool operator==(const SCH_ITEM &aOther) const override
Definition sch_marker.h:124
wxString GetClass() const override
Return the class name.
Definition sch_marker.h:43
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
const KIID GetUUID() const override
Definition sch_marker.h:48
static SCH_MARKER * DeserializeFromString(const SCH_SHEET_LIST &aSheetList, const wxString &data)
bool m_isLegacyMarker
True if marker was deserialized from a file version < 20230121.
Definition sch_marker.h:138
void SetIsLegacyMarker(bool isLegacyMarker=true)
Set this marker as a legacy artifact.
Definition sch_marker.h:110
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
SCH_LAYER_ID GetColorLayer() const
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
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:119
wxString SerializeToString() const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition sch_marker.h:71
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
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.
KIGFX::COLOR4D getColor() const override
BOX2I const GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool IsLegacyMarker() const
Determine if this marker is legacy (i.e.
Definition sch_marker.h:117
void SetPosition(const VECTOR2I &aPosition) override
Definition sch_marker.h:99
SCH_MARKER(std::shared_ptr< ERC_ITEM > aItem, const VECTOR2I &aPos)
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
VECTOR2I GetPosition() const override
Definition sch_marker.h:98
static bool ClassOf(const EDA_ITEM *aItem)
Definition sch_marker.h:38
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
#define _(s)
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:447
SEVERITY
@ SCH_MARKER_T
Definition typeinfo.h:155
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683