KiCad PCB EDA Suite
Loading...
Searching...
No Matches
marker_base.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-2014 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
22#ifndef MARKER_BASE_H
23#define MARKER_BASE_H
24
25#include <memory>
26
27#include <rc_item.h>
28#include <gr_basic.h>
29
30
32
33namespace KIGFX
34{
35 class RENDER_SETTINGS;
36}
37
39
40
45{
46public:
57
58 MARKER_BASE( int aScalingFactor, std::shared_ptr<RC_ITEM> aItem,
59 MARKER_T aType = MARKER_UNSPEC );
60 virtual ~MARKER_BASE() {};
61
65 int MarkerScale() const { return m_scalingFactor; }
66 void SetMarkerScale( int aScale ) const { m_scalingFactor = aScale; }
67
74 void ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale = -1 ) const;
75
79 const VECTOR2I& GetPos() const { return m_Pos; }
80
81 virtual const KIID GetUUID() const = 0;
82
86 void SetMarkerType( enum MARKER_T aMarkerType ) { m_markerType = aMarkerType; }
87 enum MARKER_T GetMarkerType() const { return m_markerType; }
88
89 bool IsExcluded() const { return m_excluded; }
90 void SetExcluded( bool aExcluded, const wxString& aComment = wxEmptyString )
91 {
92 m_excluded = aExcluded;
93 m_comment = aComment;
94 }
95
96 wxString GetComment() const { return m_comment; }
97
98 virtual SEVERITY GetSeverity() const { return RPT_SEVERITY_UNDEFINED; }
99
105 {
107 }
108
112 std::shared_ptr<RC_ITEM> GetRCItem() const { return m_rcItem; }
113
120 bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const;
121
125 bool HitTestMarker( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const;
126
130 bool HitTestMarker( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const;
131
140
141protected:
142 virtual KIGFX::COLOR4D getColor() const = 0;
143
144public:
146
147protected:
150 wxString m_comment;
151 std::shared_ptr<RC_ITEM> m_rcItem;
152
153 mutable int m_scalingFactor;
157};
158
159
160#endif // MARKER_BASE_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Definition kiid.h:44
virtual ~MARKER_BASE()
Definition marker_base.h:60
virtual SEVERITY GetSeverity() const
Definition marker_base.h:98
void SetMarkerScale(int aScale) const
Definition marker_base.h:66
bool IsExcluded() const
Definition marker_base.h:89
bool HitTestMarker(const VECTOR2I &aHitPosition, int aAccuracy) const
Test if the given VECTOR2I is within the bounds of this object.
virtual KIGFX::COLOR4D getColor() const =0
std::shared_ptr< RC_ITEM > GetRCItem() const
int m_scalingFactor
Scaling factor to convert corners coordinates to internal units.
wxString m_comment
User supplied comment.
int MarkerScale() const
The scaling factor to convert polygonal shape coordinates to internal units.
Definition marker_base.h:65
const VECTOR2I & GetPos() const
Definition marker_base.h:79
VECTOR2I m_Pos
Position of the marker.
bool IsTreatedAsExcluded() const
A marker is treated as excluded when the user has dismissed it through the DRC UI (m_excluded) or whe...
@ MARKER_DRAWING_SHEET
Definition marker_base.h:52
void SetExcluded(bool aExcluded, const wxString &aComment=wxEmptyString)
Definition marker_base.h:90
virtual const KIID GetUUID() const =0
void SetMarkerType(enum MARKER_T aMarkerType)
Accessors to set/get marker type (DRC, ERC, or other)
Definition marker_base.h:86
MARKER_T m_markerType
The type of marker.
bool m_excluded
User has excluded this specific error.
std::shared_ptr< RC_ITEM > m_rcItem
enum MARKER_T GetMarkerType() const
Definition marker_base.h:87
BOX2I m_shapeBoundingBox
Bounding box of the graphic symbol relative to the position of the shape in marker shape units.
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
MARKER_BASE(int aScalingFactor, std::shared_ptr< RC_ITEM > aItem, MARKER_T aType=MARKER_UNSPEC)
wxString GetComment() const
Definition marker_base.h:96
BOX2I GetBoundingBoxMarker() const
Return the orthogonal, bounding box of this object for display purposes.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
SEVERITY
@ RPT_SEVERITY_UNDEFINED
@ RPT_SEVERITY_EXCLUSION
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683