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, 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/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 wxString SerializeToString() const;
55 static SCH_MARKER* DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
56 const wxString& data );
57
58 std::vector<int> ViewGetLayers() const override;
59
61
62 SEVERITY GetSeverity() const override;
63
64 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
65 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override
66 {
67 // SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an assertion if we
68 // do not confirm this by locally implementing a no-op Plot().
69 }
70
71 BOX2I const GetBoundingBox() const override;
72
73 // Geometric transforms (used in block operations):
74
75 void Move( const VECTOR2I& aMoveVector ) override
76 {
77 m_Pos += aMoveVector;
78 }
79
80 void MirrorHorizontally( int aCenter ) override;
81 void MirrorVertically( int aCenter ) override;
82 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
83
91 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxDat ) const override;
92
93 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
94
95 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
96 {
97 return wxString( _( "ERC Marker" ) );
98 }
99
100 BITMAPS GetMenuImage() const override;
101
102 VECTOR2I GetPosition() const override { return m_Pos; }
103 void SetPosition( const VECTOR2I& aPosition ) override { m_Pos = aPosition; }
104
105 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
106
107 EDA_ITEM* Clone() const override;
108
114 void SetIsLegacyMarker( bool isLegacyMarker = true ) { m_isLegacyMarker = isLegacyMarker; }
115
121 bool IsLegacyMarker() const { return m_isLegacyMarker; }
122
123 double Similarity( const SCH_ITEM& aOther ) const override
124 {
125 return 0.0;
126 }
127
128 bool operator==( const SCH_ITEM& aOther ) const override
129 {
130 return false;
131 }
132
133#if defined(DEBUG)
134 void Show( int nestLevel, std::ostream& os ) const override;
135#endif
136
137protected:
138 void swapData( SCH_ITEM* aItem ) override;
139
140 KIGFX::COLOR4D getColor() const override;
141
143};
144
145#endif // TYPE_SCH_MARKER_H_
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
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:98
const KIID m_Uuid
Definition eda_item.h:516
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:104
Definition kiid.h:49
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:121
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:167
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:51
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:95
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:64
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:128
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.
const KIID GetUUID() const override
Definition sch_marker.h:52
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:142
void SetIsLegacyMarker(bool isLegacyMarker=true)
Set this marker as a legacy artifact.
Definition sch_marker.h:114
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:123
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:75
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:121
void SetPosition(const VECTOR2I &aPosition) override
Definition sch_marker.h:103
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:102
static bool ClassOf(const EDA_ITEM *aItem)
Definition sch_marker.h:42
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
#define _(s)
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:448
SEVERITY
@ SCH_MARKER_T
Definition typeinfo.h:160
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695