KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_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) 2009-2018 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-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 PCB_MARKER_H
26#define PCB_MARKER_H
27
28
29#include <board_item.h>
30#include <rc_item.h>
31#include <marker_base.h>
32
33class DRC_ITEM;
34
35// Coordinates count for the basic shape marker
36#define MARKER_SHAPE_POINT_COUNT 9
37
38class MSG_PANEL_ITEM;
39
40
41class PCB_MARKER : public BOARD_ITEM, public MARKER_BASE
42{
43public:
44 PCB_MARKER( std::shared_ptr<RC_ITEM> aItem, const VECTOR2I& aPos, int aLayer = F_Cu );
45
47
48 static inline bool ClassOf( const EDA_ITEM* aItem )
49 {
50 return aItem && PCB_MARKER_T == aItem->Type();
51 }
52
53 const KIID GetUUID() const override { return m_Uuid; }
54
55 wxString SerializeToString() const;
56
57 static PCB_MARKER* DeserializeFromString( const wxString& data );
58
59 void Move( const VECTOR2I& aMoveVector ) override
60 {
61 m_Pos += aMoveVector;
62 }
63
64 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
65
66 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
67
68 VECTOR2I GetPosition() const override { return m_Pos; }
69 void SetPosition( const VECTOR2I& aPos ) override { m_Pos = aPos; }
70
71 VECTOR2I GetCenter() const override
72 {
73 return GetPosition();
74 }
75
76 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
77 {
79 return false;
80 else
81 return HitTestMarker( aPosition, aAccuracy );
82 }
83
84 EDA_ITEM* Clone() const override
85 {
86 return new PCB_MARKER( *this );
87 }
88
90
91 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer,
92 FLASHING aFlash = FLASHING::DEFAULT ) const override;
93
94 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
95
96 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
97 {
98 return BOARD_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData );
99 }
100
101 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
102
103 BITMAPS GetMenuImage() const override;
104
105 void SetZoom( double aZoomFactor );
106
107 const BOX2I ViewBBox() const override;
108
109 const BOX2I GetBoundingBox() const override;
110
111 void ViewGetLayers( int aLayers[], int& aCount ) const override;
112
113 SEVERITY GetSeverity() const override;
114
115 double Similarity( const BOARD_ITEM& aBoardItem ) const override
116 {
117 return 0.0;
118 }
119
120 bool operator==( const BOARD_ITEM& aBoardItem ) const override
121 {
122 return false;
123 }
124
125#if defined(DEBUG)
126 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
127#endif
128
132 virtual wxString GetClass() const override
133 {
134 return wxT( "PCB_MARKER" );
135 }
136
137protected:
138 KIGFX::COLOR4D getColor() const override;
139};
140
141#endif // PCB_MARKER_H
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
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:88
const KIID m_Uuid
Definition: eda_item.h:485
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:375
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Definition: kiid.h:49
bool HitTestMarker(const VECTOR2I &aHitPosition, int aAccuracy) const
Test if the given VECTOR2I is within the bounds of this object.
Definition: marker_base.cpp:90
VECTOR2I m_Pos
position of the marker
Definition: marker_base.h:135
std::shared_ptr< RC_ITEM > m_rcItem
Definition: marker_base.h:141
enum MARKER_T GetMarkerType() const
Definition: marker_base.h:96
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
const KIID GetUUID() const override
Definition: pcb_marker.h:53
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: pcb_marker.cpp:192
bool operator==(const BOARD_ITEM &aBoardItem) const override
Definition: pcb_marker.h:120
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_marker.cpp:249
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pcb_marker.cpp:255
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_marker.cpp:271
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_marker.h:59
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_marker.cpp:345
virtual wxString GetClass() const override
Get class name.
Definition: pcb_marker.h:132
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_marker.cpp:339
SEVERITY GetSeverity() const override
Definition: pcb_marker.cpp:277
static PCB_MARKER * DeserializeFromString(const wxString &data)
Definition: pcb_marker.cpp:140
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_marker.h:71
wxString SerializeToString() const
Definition: pcb_marker.cpp:96
GAL_LAYER_ID GetColorLayer() const
Definition: pcb_marker.cpp:314
VECTOR2I GetPosition() const override
Definition: pcb_marker.h:68
KIGFX::COLOR4D getColor() const override
Definition: pcb_marker.cpp:326
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_marker.h:48
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: pcb_marker.cpp:263
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_marker.h:115
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: pcb_marker.h:96
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_marker.h:84
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_marker.cpp:292
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: pcb_marker.h:76
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_marker.cpp:243
void SetZoom(double aZoomFactor)
Definition: pcb_marker.cpp:333
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_marker.h:69
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:149
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:194
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ F_Cu
Definition: layer_ids.h:64
SEVERITY
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:99