KiCad PCB EDA Suite
MARKER_BASE Class Reference

#include <class_marker_base.h>

Inheritance diagram for MARKER_BASE:
MARKER_PCB SCH_MARKER

Public Types

enum  TYPEMARKER { MARKER_UNSPEC, MARKER_ERC, MARKER_PCB, MARKER_SIMUL }
 
enum  MARKER_SEVERITY { MARKER_SEVERITY_UNSPEC, MARKER_SEVERITY_INFO, MARKER_SEVERITY_WARNING, MARKER_SEVERITY_ERROR }
 

Public Member Functions

 MARKER_BASE ()
 
 MARKER_BASE (int aErrorCode, const wxPoint &aMarkerPos, const wxString &aText, const wxPoint &aPos, const wxString &bText, const wxPoint &bPos)
 Constructor. More...
 
 MARKER_BASE (int aErrorCode, const wxPoint &aMarkerPos, const wxString &aText, const wxPoint &aPos)
 Constructor. More...
 
 MARKER_BASE (const MARKER_BASE &aMarker)
 Contructor makes a copy of aMarker but does not copy the DRC_ITEM. More...
 
 ~MARKER_BASE ()
 
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). More...
 
const wxPointGetPos () const
 Function GetPos returns the position of this MARKER, const. More...
 
void SetColor (COLOR4D aColor)
 Function SetColor Set the color of this marker. More...
 
void SetErrorLevel (MARKER_SEVERITY aErrorLevel)
 accessors to set/get error levels (warning, error, fatal error..) More...
 
MARKER_SEVERITY GetErrorLevel () const
 
void SetMarkerType (enum TYPEMARKER aMarkerType)
 accessors to set/get marker type (DRC, ERC, or other) More...
 
enum TYPEMARKER GetMarkerType () const
 
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. More...
 
void SetData (int aErrorCode, const wxPoint &aMarkerPos, const wxString &aText, const wxPoint &aPos)
 Function SetData fills in all the reportable data associated with a MARKER. More...
 
void SetAuxiliaryData (const wxString &aAuxiliaryText, const wxPoint &aAuxiliaryPos)
 Function SetAuxiliaryData initialize data for the second (auxiliary) item. More...
 
void SetShowNoCoordinate ()
 
const DRC_ITEMGetReporter () const
 Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used. More...
 
void DisplayMarkerInfo (EDA_DRAW_FRAME *aFrame)
 Function DisplayMarkerInfo displays the full info of this marker, in a HTML window. More...
 
bool HitTestMarker (const wxPoint &ref_pos) const
 Function HitTestMarker tests if the given wxPoint is within the bounds of this object. More...
 
EDA_RECT GetBoundingBoxMarker () const
 Function GetBoundingBoxMarker returns the orthogonal, bounding box of this object for display purposes. More...
 

Public Attributes

wxPoint m_Pos
 position of the marker More...
 

Protected Member Functions

void init ()
 

Protected Attributes

TYPEMARKER m_MarkerType
 The type of marker (useful to filter markers) More...
 
MARKER_SEVERITY m_ErrorLevel
 Specify the severity of the error. More...
 
COLOR4D m_Color
 color More...
 
EDA_RECT m_ShapeBoundingBox
 Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests. More...
 
int m_ScalingFactor
 Scaling factor for m_Size and m_Corners (can set the physical size. More...
 
DRC_ITEM m_drc
 

Detailed Description

Definition at line 37 of file class_marker_base.h.

Member Enumeration Documentation

Enumerator
MARKER_SEVERITY_UNSPEC 
MARKER_SEVERITY_INFO 
MARKER_SEVERITY_WARNING 
MARKER_SEVERITY_ERROR 

Definition at line 46 of file class_marker_base.h.

Enumerator
MARKER_UNSPEC 
MARKER_ERC 
MARKER_PCB 
MARKER_SIMUL 

Definition at line 40 of file class_marker_base.h.

40  { // Marker type: can be used to identify the purpose of the marker
42  MARKER_ERC,
43  MARKER_PCB,
45  };

Constructor & Destructor Documentation

MARKER_BASE::MARKER_BASE ( )

Definition at line 101 of file class_marker_base.cpp.

References init(), m_ScalingFactor, and M_SHAPE_SCALE.

102 {
104  init();
105 }
const int M_SHAPE_SCALE
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
MARKER_BASE::MARKER_BASE ( int  aErrorCode,
const wxPoint aMarkerPos,
const wxString &  aText,
const wxPoint aPos,
const wxString &  bText,
const wxPoint bPos 
)

Constructor.

Parameters
aErrorCodeThe categorizing identifier for an error
aMarkerPosThe position of the MARKER on the BOARD
aTextText describing the first of two objects
aPosThe position of the first of two objects
bTextText describing the second of the two conflicting objects
bPosThe position of the second of two objects

Definition at line 108 of file class_marker_base.cpp.

References init(), m_ScalingFactor, M_SHAPE_SCALE, and SetData().

111 {
113  init();
114 
115  SetData( aErrorCode, aMarkerPos,
116  aText, aPos,
117  bText, bPos );
118 }
const int M_SHAPE_SCALE
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.
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
MARKER_BASE::MARKER_BASE ( int  aErrorCode,
const wxPoint aMarkerPos,
const wxString &  aText,
const wxPoint aPos 
)

Constructor.

Parameters
aErrorCodeThe categorizing identifier for an error
aMarkerPosThe position of the MARKER on the BOARD
aTextText describing the object
aPosThe position of the object

Definition at line 121 of file class_marker_base.cpp.

References init(), m_ScalingFactor, M_SHAPE_SCALE, and SetData().

123 {
125  init();
126  SetData( aErrorCode, aMarkerPos, aText, aPos );
127 }
const int M_SHAPE_SCALE
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.
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
MARKER_BASE::MARKER_BASE ( const MARKER_BASE aMarker)

Contructor makes a copy of aMarker but does not copy the DRC_ITEM.

Parameters
aMarkerThe marker to copy.

Definition at line 90 of file class_marker_base.cpp.

References m_Color, m_ErrorLevel, m_MarkerType, m_Pos, m_ScalingFactor, and m_ShapeBoundingBox.

91 {
92  m_Pos = aMarker.m_Pos;
93  m_ErrorLevel = aMarker.m_ErrorLevel;
94  m_MarkerType = aMarker.m_MarkerType;
95  m_Color = aMarker.m_Color;
98 }
MARKER_SEVERITY m_ErrorLevel
Specify the severity of the error.
wxPoint m_Pos
position of the marker
TYPEMARKER m_MarkerType
The type of marker (useful to filter markers)
COLOR4D m_Color
color
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
EDA_RECT m_ShapeBoundingBox
Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests...
MARKER_BASE::~MARKER_BASE ( )

Definition at line 130 of file class_marker_base.cpp.

131 {
132 }

Member Function Documentation

void MARKER_BASE::DisplayMarkerInfo ( EDA_DRAW_FRAME aFrame)

Function DisplayMarkerInfo displays the full info of this marker, in a HTML window.

Definition at line 200 of file class_marker_base.cpp.

References m_drc, DIALOG_DISPLAY_HTML_TEXT_BASE::m_htmlWindow, and DRC_ITEM::ShowHtml().

201 {
202  wxString msg = m_drc.ShowHtml();
203  DIALOG_DISPLAY_HTML_TEXT_BASE infodisplay( (wxWindow*)aFrame, wxID_ANY, _( "Marker Info" ),
204  wxGetMousePosition(), wxSize( 550, 140 ) );
205 
206  infodisplay.m_htmlWindow->SetPage( msg );
207  infodisplay.ShowModal();
208 }
Class DIALOG_DISPLAY_HTML_TEXT_BASE.
wxString ShowHtml() const
Function ShowHtml translates this object into a fragment of HTML suitable for the wxWidget's wxHtmlLi...
void MARKER_BASE::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).

Definition at line 176 of file class_marker_base.cpp.

References CORNERS_COUNT, EDA_DRAW_PANEL::GetClipBox(), GRClosedPoly(), GRSetDrawMode(), m_Color, m_Pos, m_ScalingFactor, wxPoint::x, and wxPoint::y.

Referenced by SCH_MARKER::Draw(), and MARKER_PCB::Draw().

178 {
179  wxPoint corners[CORNERS_COUNT];
180 
181  GRSetDrawMode( aDC, aDrawMode );
182 
183  for( unsigned ii = 0; ii < CORNERS_COUNT; ii++ )
184  {
185  corners[ii] = MarkerShapeCorners[ii];
186  corners[ii].x *= m_ScalingFactor;
187  corners[ii].y *= m_ScalingFactor;
188  corners[ii] += m_Pos + aOffset;
189  }
190 
191  GRClosedPoly( aPanel->GetClipBox(), aDC, CORNERS_COUNT, corners,
192  true, // = Filled
193  0, // outline width
194  m_Color, // outline color
195  m_Color // fill collor
196  );
197 }
const unsigned CORNERS_COUNT
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
wxPoint m_Pos
position of the marker
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:777
COLOR4D m_Color
color
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
EDA_RECT * GetClipBox()
static const wxPoint MarkerShapeCorners[]
EDA_RECT MARKER_BASE::GetBoundingBoxMarker ( ) const

Function GetBoundingBoxMarker returns the orthogonal, bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Definition at line 164 of file class_marker_base.cpp.

References EDA_RECT::GetPosition(), EDA_RECT::GetSize(), m_Pos, m_ScalingFactor, m_ShapeBoundingBox, wxPoint::x, and wxPoint::y.

Referenced by SCH_MARKER::GetBoundingBox().

165 {
166  wxSize realsize = m_ShapeBoundingBox.GetSize();
167  wxPoint realposition = m_ShapeBoundingBox.GetPosition();
168  realsize.x *= m_ScalingFactor;
169  realsize.y *= m_ScalingFactor;
170  realposition.x *= m_ScalingFactor;
171  realposition.y *= m_ScalingFactor;
172  realposition += m_Pos;
173  return EDA_RECT( m_Pos, realsize );
174 }
wxPoint m_Pos
position of the marker
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
EDA_RECT m_ShapeBoundingBox
Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests...
const wxPoint & GetPosition() const
Class EDA_RECT handles the component boundary box.
const wxSize & GetSize() const
MARKER_SEVERITY MARKER_BASE::GetErrorLevel ( ) const
inline

Definition at line 138 of file class_marker_base.h.

References m_ErrorLevel.

Referenced by SCH_MARKER::Draw(), SCH_SCREENS::GetMarkerCount(), and WriteDiagnosticERC().

139  {
140  return m_ErrorLevel;
141  }
MARKER_SEVERITY m_ErrorLevel
Specify the severity of the error.
enum TYPEMARKER MARKER_BASE::GetMarkerType ( ) const
inline

Definition at line 150 of file class_marker_base.h.

References m_MarkerType.

Referenced by SCH_SCREENS::DeleteAllMarkers(), DIALOG_ERC::DisplayERC_MarkersList(), SCH_MARKER::Draw(), SCH_SCREENS::GetMarkerCount(), and WriteDiagnosticERC().

151  {
152  return m_MarkerType;
153  }
TYPEMARKER m_MarkerType
The type of marker (useful to filter markers)
const wxPoint& MARKER_BASE::GetPos ( ) const
inline

Function GetPos returns the position of this MARKER, const.

Definition at line 116 of file class_marker_base.h.

References m_Pos.

Referenced by MARKER_PCB::GetSelectMenuText().

117  {
118  return m_Pos;
119  }
wxPoint m_Pos
position of the marker
const DRC_ITEM& MARKER_BASE::GetReporter ( ) const
inline

Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used.

Returns
const& DRC_ITEM

Definition at line 203 of file class_marker_base.h.

References m_drc.

Referenced by DRC_LIST_MARKERS::GetItem(), SCH_MARKER::GetMsgPanelInfo(), and WriteDiagnosticERC().

204  {
205  return m_drc;
206  }
bool MARKER_BASE::HitTestMarker ( const wxPoint ref_pos) const

Function HitTestMarker tests if the given wxPoint is within the bounds of this object.

Parameters
ref_posA wxPoint to test
Returns
bool - true if a hit, else false

Definition at line 154 of file class_marker_base.cpp.

References EDA_RECT::Contains(), m_Pos, m_ScalingFactor, m_ShapeBoundingBox, wxPoint::x, and wxPoint::y.

Referenced by MARKER_PCB::HitTest(), and SCH_MARKER::HitTest().

155 {
156  wxPoint rel_pos = refPos - m_Pos;
157  rel_pos.x /= m_ScalingFactor;
158  rel_pos.y /= m_ScalingFactor;
159 
160  return m_ShapeBoundingBox.Contains( rel_pos );
161 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
wxPoint m_Pos
position of the marker
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size.
EDA_RECT m_ShapeBoundingBox
Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests...
void MARKER_BASE::init ( )
protected

Definition at line 68 of file class_marker_base.cpp.

References CORNERS_COUNT, m_Color, m_ErrorLevel, m_MarkerType, m_ShapeBoundingBox, MARKER_SEVERITY_UNSPEC, MARKER_UNSPEC, max, min, RED, EDA_RECT::SetEnd(), EDA_RECT::SetOrigin(), wxPoint::x, and wxPoint::y.

Referenced by MARKER_BASE().

69 {
72  m_Color = RED;
73  wxPoint start = MarkerShapeCorners[0];
74  wxPoint end = MarkerShapeCorners[0];
75 
76  for( unsigned ii = 0; ii < CORNERS_COUNT; ii++ )
77  {
78  wxPoint corner = MarkerShapeCorners[ii];
79  start.x = std::min( start.x, corner.x);
80  start.y = std::min( start.y, corner.y);
81  end.x = std::max( end.x, corner.x);
82  end.y = std::max( end.y, corner.y);
83  }
84 
87 }
MARKER_SEVERITY m_ErrorLevel
Specify the severity of the error.
const unsigned CORNERS_COUNT
void SetOrigin(const wxPoint &pos)
TYPEMARKER m_MarkerType
The type of marker (useful to filter markers)
void SetEnd(int x, int y)
COLOR4D m_Color
color
Definition: colors.h:60
EDA_RECT m_ShapeBoundingBox
Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests...
#define max(a, b)
Definition: auxiliary.h:86
static const wxPoint MarkerShapeCorners[]
#define min(a, b)
Definition: auxiliary.h:85
void MARKER_BASE::SetAuxiliaryData ( const wxString &  aAuxiliaryText,
const wxPoint aAuxiliaryPos 
)
inline

Function SetAuxiliaryData initialize data for the second (auxiliary) item.

Parameters
aAuxiliaryText= the second text (main text) concerning the second schematic or board item
aAuxiliaryPos= position the second item

Definition at line 187 of file class_marker_base.h.

References DRC_ITEM::SetAuxiliaryData().

Referenced by Diagnose(), and SimilarLabelsDiagnose().

188  {
189  m_drc.SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
190  }
void SetAuxiliaryData(const wxString &aAuxiliaryText, const wxPoint &aAuxiliaryPos)
Function SetAuxiliaryData initialize data for the second (auxiliary) item.
void MARKER_BASE::SetColor ( COLOR4D  aColor)
inline

Function SetColor Set the color of this marker.

Definition at line 125 of file class_marker_base.h.

126  {
127  m_Color = aColor;
128  }
COLOR4D m_Color
color
void MARKER_BASE::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.

Parameters
aErrorCodeThe categorizing identifier for an error
aMarkerPosThe position of the MARKER on the BOARD
aTextText describing the first of two objects
aPosThe position of the first of two objects
bTextText describing the second of the two conflicting objects
bPosThe position of the second of two objects

Definition at line 135 of file class_marker_base.cpp.

References m_drc, m_Pos, and DRC_ITEM::SetData().

Referenced by Diagnose(), DRC::fillMarker(), MARKER_BASE(), SimilarLabelsDiagnose(), and TestDuplicateSheetNames().

138 {
139  m_Pos = aMarkerPos;
140  m_drc.SetData( aErrorCode,
141  aText, bText, aPos, bPos );
142 }
wxPoint m_Pos
position of the marker
void SetData(int aErrorCode, const wxString &aMainText, const wxPoint &aMainPos)
Function SetData initialize all data in item.
void MARKER_BASE::SetData ( int  aErrorCode,
const wxPoint aMarkerPos,
const wxString &  aText,
const wxPoint aPos 
)

Function SetData fills in all the reportable data associated with a MARKER.

Parameters
aErrorCodeThe categorizing identifier for an error
aMarkerPosThe position of the MARKER on the BOARD
aTextText describing the object
aPosThe position of the object

Definition at line 145 of file class_marker_base.cpp.

References m_drc, m_Pos, and DRC_ITEM::SetData().

147 {
148  m_Pos = aMarkerPos;
149  m_drc.SetData( aErrorCode,
150  aText, aPos );
151 }
wxPoint m_Pos
position of the marker
void SetData(int aErrorCode, const wxString &aMainText, const wxPoint &aMainPos)
Function SetData initialize all data in item.
void MARKER_BASE::SetErrorLevel ( MARKER_SEVERITY  aErrorLevel)
inline

accessors to set/get error levels (warning, error, fatal error..)

Definition at line 133 of file class_marker_base.h.

Referenced by Diagnose(), SimilarLabelsDiagnose(), and TestDuplicateSheetNames().

134  {
135  m_ErrorLevel = aErrorLevel;
136  }
MARKER_SEVERITY m_ErrorLevel
Specify the severity of the error.
void MARKER_BASE::SetMarkerType ( enum TYPEMARKER  aMarkerType)
inline

accessors to set/get marker type (DRC, ERC, or other)

Definition at line 145 of file class_marker_base.h.

Referenced by Diagnose(), SimilarLabelsDiagnose(), and TestDuplicateSheetNames().

146  {
147  m_MarkerType = aMarkerType;
148  }
TYPEMARKER m_MarkerType
The type of marker (useful to filter markers)
void MARKER_BASE::SetShowNoCoordinate ( )
inline

Definition at line 192 of file class_marker_base.h.

References DRC_ITEM::SetShowNoCoordinate().

Referenced by DRC::fillMarker().

193  {
195  }
void SetShowNoCoordinate()

Member Data Documentation

COLOR4D MARKER_BASE::m_Color
protected

color

Definition at line 58 of file class_marker_base.h.

Referenced by SCH_MARKER::Draw(), DrawMarker(), init(), MARKER_BASE(), and MARKER_PCB::MARKER_PCB().

DRC_ITEM MARKER_BASE::m_drc
protected
MARKER_SEVERITY MARKER_BASE::m_ErrorLevel
protected

Specify the severity of the error.

Definition at line 57 of file class_marker_base.h.

Referenced by GetErrorLevel(), init(), and MARKER_BASE().

TYPEMARKER MARKER_BASE::m_MarkerType
protected

The type of marker (useful to filter markers)

Definition at line 56 of file class_marker_base.h.

Referenced by GetMarkerType(), init(), and MARKER_BASE().

int MARKER_BASE::m_ScalingFactor
protected

Scaling factor for m_Size and m_Corners (can set the physical size.

Definition at line 62 of file class_marker_base.h.

Referenced by DrawMarker(), GetBoundingBoxMarker(), HitTestMarker(), MARKER_BASE(), and MARKER_PCB::MARKER_PCB().

EDA_RECT MARKER_BASE::m_ShapeBoundingBox
protected

Bounding box of the graphic symbol, relative to the position of the shape, used for Hit Tests.

Definition at line 59 of file class_marker_base.h.

Referenced by GetBoundingBoxMarker(), HitTestMarker(), init(), and MARKER_BASE().


The documentation for this class was generated from the following files: