KiCad PCB EDA Suite
class_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 _CLASS_MARKER_BASE_H
27 #define _CLASS_MARKER_BASE_H
28 
29 #include <class_drc_item.h>
30 #include <gr_basic.h>
31 
32 
33 /* Marker are mainly used to show a DRC or ERC error or warning
34  */
35 
36 
38 {
39 public:
40  enum TYPEMARKER { // Marker type: can be used to identify the purpose of the marker
45  };
46  enum MARKER_SEVERITY { // Severity of the marker: this is the level of error
51  };
52 
54 
55 protected:
60  int m_ScalingFactor;
65 
66  void init();
67 
68 public:
69 
70  MARKER_BASE();
71 
81  MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
82  const wxString& aText, const wxPoint& aPos,
83  const wxString& bText, const wxPoint& bPos );
84 
92  MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
93  const wxString& aText, const wxPoint& aPos );
94 
101  MARKER_BASE( const MARKER_BASE& aMarker );
102 
103  ~MARKER_BASE();
104 
109  void DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
110  const wxPoint& aOffset );
111 
116  const wxPoint& GetPos() const
117  {
118  return m_Pos;
119  }
120 
125  void SetColor( COLOR4D aColor )
126  {
127  m_Color = aColor;
128  }
129 
133  void SetErrorLevel( MARKER_SEVERITY aErrorLevel )
134  {
135  m_ErrorLevel = aErrorLevel;
136  }
137 
139  {
140  return m_ErrorLevel;
141  }
142 
145  void SetMarkerType( enum TYPEMARKER aMarkerType )
146  {
147  m_MarkerType = aMarkerType;
148  }
149 
151  {
152  return m_MarkerType;
153  }
154 
165  void SetData( int aErrorCode, const wxPoint& aMarkerPos,
166  const wxString& aText, const wxPoint& aPos,
167  const wxString& bText, const wxPoint& bPos );
168 
177  void SetData( int aErrorCode, const wxPoint& aMarkerPos,
178  const wxString& aText, const wxPoint& aPos );
179 
187  void SetAuxiliaryData( const wxString& aAuxiliaryText, const wxPoint& aAuxiliaryPos )
188  {
189  m_drc.SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
190  }
191 
193  {
194  m_drc.SetShowNoCoordinate();
195  }
196 
203  const DRC_ITEM& GetReporter() const
204  {
205  return m_drc;
206  }
207 
212  void DisplayMarkerInfo( EDA_DRAW_FRAME* aFrame );
213 
220  bool HitTestMarker( const wxPoint& ref_pos ) const;
221 
230 };
231 
232 
233 #endif // _CLASS_MARKER_BASE_H
MARKER_SEVERITY m_ErrorLevel
Specify the severity of the error.
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. ...
const wxPoint & GetPos() const
Function GetPos returns the position of this MARKER, const.
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.
void SetShowNoCoordinate()
wxPoint m_Pos
position of the marker
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
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)
void SetData(int aErrorCode, const wxPoint &aMarkerPos, const wxString &aText, const wxPoint &aPos, const wxString &bText, const wxPoint &bPos)
Function SetData fills in all the reportable data associated with a MARKER.
enum TYPEMARKER GetMarkerType() const
void DisplayMarkerInfo(EDA_DRAW_FRAME *aFrame)
Function DisplayMarkerInfo displays the full info of this marker, in a HTML window.
MARKER_SEVERITY GetErrorLevel() const
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
const DRC_ITEM & GetReporter() const
Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used...
COLOR4D m_Color
color
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
void SetMarkerType(enum TYPEMARKER aMarkerType)
accessors to set/get marker type (DRC, ERC, or other)
EDA_RECT m_ShapeBoundingBox
Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests...
void SetShowNoCoordinate()
void SetErrorLevel(MARKER_SEVERITY aErrorLevel)
accessors to set/get error levels (warning, error, fatal error..)
Class EDA_RECT handles the component boundary box.
void SetColor(COLOR4D aColor)
Function SetColor Set the color of this marker.
void SetAuxiliaryData(const wxString &aAuxiliaryText, const wxPoint &aAuxiliaryPos)
Function SetAuxiliaryData initialize data for the second (auxiliary) item.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39