KiCad PCB EDA Suite
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 (C) 1992-2014 KiCad Developers, see CHANGELOG.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 
26 #ifndef MARKER_BASE_H
27 #define MARKER_BASE_H
28 
29 #include <drc_item.h>
30 #include <gr_basic.h>
31 #include <eda_rect.h>
32 
33 
34 /* Marker are mainly used to show a DRC or ERC error or warning
35  */
36 
37 
39 {
40 public:
41  enum TYPEMARKER { // Marker type: can be used to identify the purpose of the marker
46  };
47  enum MARKER_SEVERITY { // Severity of the marker: this is the level of error
52  };
53 
56 
58 protected:
66 
67  void init();
68 
69 public:
70 
71  MARKER_BASE();
72 
82  MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
83  EDA_ITEM* aItem, const wxPoint& aPos,
84  EDA_ITEM* bItem, const wxPoint& bPos );
85 
95  MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
96  const wxString& aText, const wxPoint& aPos,
97  const wxString& bText, const wxPoint& bPos );
98 
106  MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
107  const wxString& aText, const wxPoint& aPos );
108 
115  MARKER_BASE( const MARKER_BASE& aMarker );
116 
117  ~MARKER_BASE();
118 
123  void DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
124  const wxPoint& aOffset );
125 
130  const wxPoint& GetPos() const
131  {
132  return m_Pos;
133  }
134 
139  void SetColor( COLOR4D aColor )
140  {
141  m_Color = aColor;
142  }
143 
147  void SetErrorLevel( MARKER_SEVERITY aErrorLevel )
148  {
149  m_ErrorLevel = aErrorLevel;
150  }
151 
153  {
154  return m_ErrorLevel;
155  }
156 
159  void SetMarkerType( enum TYPEMARKER aMarkerType )
160  {
161  m_MarkerType = aMarkerType;
162  }
163 
165  {
166  return m_MarkerType;
167  }
168 
179  void SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
180  EDA_ITEM* aItem, const wxPoint& aPos,
181  EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
182 
193  void SetData( int aErrorCode, const wxPoint& aMarkerPos,
194  const wxString& aText, const wxPoint& aPos,
195  const wxString& bText = wxEmptyString, const wxPoint& bPos = wxPoint() );
196 
204  void SetAuxiliaryData( const wxString& aAuxiliaryText, const wxPoint& aAuxiliaryPos )
205  {
206  m_drc.SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
207  }
208 
210  {
211  m_drc.SetShowNoCoordinate();
212  }
213 
220  const DRC_ITEM& GetReporter() const
221  {
222  return m_drc;
223  }
224 
229  void DisplayMarkerInfo( EDA_DRAW_FRAME* aFrame );
230 
237  bool HitTestMarker( const wxPoint& ref_pos ) const;
238 
247 };
248 
249 
250 #endif // MARKER_BASE_H
MARKER_SEVERITY m_ErrorLevel
Specify the severity of the error.
Definition: marker_base.h:60
bool HitTestMarker(const wxPoint &ref_pos) const
Function HitTestMarker tests if the given wxPoint is within the bounds of this object.
Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item. ...
Definition: drc_item.h:48
const wxPoint & GetPos() const
Function GetPos returns the position of this MARKER, const.
Definition: marker_base.h:130
EDA_RECT GetBoundingBoxMarker() const
Function GetBoundingBoxMarker returns the orthogonal, bounding box of this object for display purpose...
void SetAuxiliaryData(const wxString &aAuxiliaryText, const wxPoint &aAuxiliaryPos)
Function SetAuxiliaryData initialize data for the second (auxiliary) item.
Definition: drc_item.h:142
void SetShowNoCoordinate()
Definition: marker_base.h:209
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
void SetData(EDA_UNITS_T aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
void DrawMarker(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset)
Function DrawMarker draws the shape is the polygon defined in m_Corners (array of wxPoints)...
TYPEMARKER m_MarkerType
The type of marker (useful to filter markers)
Definition: marker_base.h:59
enum TYPEMARKER GetMarkerType() const
Definition: marker_base.h:164
void DisplayMarkerInfo(EDA_DRAW_FRAME *aFrame)
Function DisplayMarkerInfo displays the full info of this marker, in a HTML window.
MARKER_SEVERITY GetErrorLevel() const
Definition: marker_base.h:152
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
const DRC_ITEM & GetReporter() const
Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used...
Definition: marker_base.h:220
COLOR4D m_Color
color
Definition: marker_base.h:61
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size)
Definition: marker_base.h:55
void SetMarkerType(enum TYPEMARKER aMarkerType)
accessors to set/get marker type (DRC, ERC, or other)
Definition: marker_base.h:159
EDA_RECT m_ShapeBoundingBox
Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests...
Definition: marker_base.h:62
void SetShowNoCoordinate()
Definition: drc_item.h:157
void SetErrorLevel(MARKER_SEVERITY aErrorLevel)
accessors to set/get error levels (warning, error, fatal error..)
Definition: marker_base.h:147
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
void SetColor(COLOR4D aColor)
Function SetColor Set the color of this marker.
Definition: marker_base.h:139
DRC_ITEM m_drc
Definition: marker_base.h:65
EDA_UNITS_T
Definition: common.h:159
void SetAuxiliaryData(const wxString &aAuxiliaryText, const wxPoint &aAuxiliaryPos)
Function SetAuxiliaryData initialize data for the second (auxiliary) item.
Definition: marker_base.h:204
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39