KiCad PCB EDA Suite
DRC_ITEM Class Reference

Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item. More...

#include <drc_item.h>

Public Member Functions

 DRC_ITEM ()
 
 DRC_ITEM (EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM *aMainItem, const wxPoint &aMainPos, EDA_ITEM *bAuxiliaryItem, const wxPoint &bAuxiliaryPos)
 
void SetData (EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM *aMainItem, const wxPoint &aMainPos, EDA_ITEM *bAuxiliaryItem=nullptr, const wxPoint &bAuxiliaryPos=wxPoint())
 Function SetData initialize all data in item. More...
 
void SetData (int aErrorCode, const wxString &aMainText, const wxPoint &aMainPos, const wxString &bAuxiliaryText=wxEmptyString, const wxPoint &bAuxiliaryPos=wxPoint())
 Function SetData initialize all data in item. More...
 
void SetAuxiliaryData (const wxString &aAuxiliaryText, const wxPoint &aAuxiliaryPos)
 Function SetAuxiliaryData initialize data for the second (auxiliary) item. More...
 
void SetParent (MARKER_BASE *aMarker)
 
MARKER_BASEGetParent () const
 
bool HasSecondItem () const
 
void SetShowNoCoordinate ()
 
wxString GetMainText () const
 Access to A and B texts. More...
 
wxString GetAuxiliaryText () const
 
BOARD_ITEMGetMainItem (BOARD *aBoard) const
 Access to A and B items for BOARDs. More...
 
BOARD_ITEMGetAuxiliaryItem (BOARD *aBoard) const
 
wxString ShowHtml (EDA_UNITS_T aUnits) const
 Function ShowHtml translates this object into a fragment of HTML suitable for the wxWidget's wxHtmlListBox class. More...
 
wxString ShowReport (EDA_UNITS_T aUnits) const
 Function ShowReport translates this object into a text string suitable for saving to disk in a report. More...
 
int GetErrorCode () const
 Function GetErrorCode returns the error code. More...
 
wxString GetErrorText () const
 Function GetErrorText returns the string form of a drc error code. More...
 
const wxString & GetTextA () const
 
const wxString & GetTextB () const
 
const wxPointGetPointA () const
 
const wxPointGetPointB () const
 

Static Public Member Functions

static wxString ShowCoord (EDA_UNITS_T aUnits, const wxPoint &aPos)
 Function ShowCoord formats a coordinate or position to text. More...
 

Protected Attributes

int m_ErrorCode
 
wxString m_MainText
 
wxString m_AuxiliaryText
 
wxPoint m_MainPosition
 
wxPoint m_AuxiliaryPosition
 
bool m_hasSecondItem
 
bool m_noCoordinate
 
MARKER_BASEm_parent
 
void * m_mainItemWeakRef
 
void * m_auxItemWeakRef
 

Detailed Description

Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.

It is generated when two objects are too close (DRC) or two connected objects (pins) have incompatible electrical types (ERC). There are holders for information on two items. The information held is the board coordinate and the MenuText for each item. Also held is the type of error by number and the location of the MARKER. A function is provided to translate that number into text. Some errors involve only one item (item with an incorrect param) so m_hasSecondItem is set to false in this case.

Definition at line 48 of file drc_item.h.

Constructor & Destructor Documentation

DRC_ITEM::DRC_ITEM ( )
inline

Definition at line 65 of file drc_item.h.

66  {
67  m_ErrorCode = 0;
68  m_hasSecondItem = false;
69  m_noCoordinate = false;
70  m_parent = nullptr;
71  m_mainItemWeakRef = nullptr;
72  m_auxItemWeakRef = nullptr;
73  }
bool m_hasSecondItem
Definition: drc_item.h:56
void * m_auxItemWeakRef
Definition: drc_item.h:61
void * m_mainItemWeakRef
Definition: drc_item.h:60
MARKER_BASE * m_parent
Definition: drc_item.h:59
bool m_noCoordinate
Definition: drc_item.h:57
int m_ErrorCode
Definition: drc_item.h:51
DRC_ITEM::DRC_ITEM ( EDA_UNITS_T  aUnits,
int  aErrorCode,
EDA_ITEM aMainItem,
const wxPoint aMainPos,
EDA_ITEM bAuxiliaryItem,
const wxPoint bAuxiliaryPos 
)
inline

Definition at line 75 of file drc_item.h.

References SetData().

77  {
78  SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxiliaryItem, bAuxiliaryPos );
79  }
void SetData(EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM *aMainItem, const wxPoint &aMainPos, EDA_ITEM *bAuxiliaryItem=nullptr, const wxPoint &bAuxiliaryPos=wxPoint())
Function SetData initialize all data in item.
Definition: drc_item.h:91

Member Function Documentation

BOARD_ITEM * DRC_ITEM::GetAuxiliaryItem ( BOARD aBoard) const

Definition at line 230 of file drc_item.cpp.

References BOARD::GetItem(), and m_auxItemWeakRef.

Referenced by DIALOG_DRC_CONTROL::doSelectionMenu(), and GetAuxiliaryText().

231 {
232  return aBoard->GetItem( m_auxItemWeakRef );
233 }
void * m_auxItemWeakRef
Definition: drc_item.h:61
BOARD_ITEM * GetItem(void *aWeakReference)
wxString DRC_ITEM::GetAuxiliaryText ( ) const
inline

Definition at line 163 of file drc_item.h.

References GetAuxiliaryItem(), GetMainItem(), m_AuxiliaryText, ShowHtml(), and ShowReport().

Referenced by SCH_MARKER::Matches().

163 { return m_AuxiliaryText; }
wxString m_AuxiliaryText
Definition: drc_item.h:53
int DRC_ITEM::GetErrorCode ( ) const
inline

Function GetErrorCode returns the error code.

Definition at line 191 of file drc_item.h.

References GetErrorText(), and m_ErrorCode.

Referenced by MARKER_PCB::GetMsgPanelInfo().

192  {
193  return m_ErrorCode;
194  }
int m_ErrorCode
Definition: drc_item.h:51
wxString DRC_ITEM::GetErrorText ( ) const

Function GetErrorText returns the string form of a drc error code.

Definition at line 36 of file drc_item.cpp.

References DRCE_BURIED_VIA_NOT_ALLOWED, DRCE_DISABLED_LAYER_ITEM, DRCE_DRILLED_HOLES_TOO_CLOSE, DRCE_ENDS_PROBLEM1, DRCE_ENDS_PROBLEM2, DRCE_ENDS_PROBLEM3, DRCE_ENDS_PROBLEM4, DRCE_ENDS_PROBLEM5, DRCE_HOLE_NEAR_PAD, DRCE_HOLE_NEAR_TRACK, DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT, DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR, DRCE_MICRO_VIA_NOT_ALLOWED, DRCE_MISSING_COURTYARD_IN_FOOTPRINT, DRCE_NETCLASS_CLEARANCE, DRCE_NETCLASS_TRACKWIDTH, DRCE_NETCLASS_uVIADRILLSIZE, DRCE_NETCLASS_uVIASIZE, DRCE_NETCLASS_VIADRILLSIZE, DRCE_NETCLASS_VIASIZE, DRCE_OVERLAPPING_FOOTPRINTS, DRCE_PAD_INSIDE_KEEPOUT, DRCE_PAD_NEAR_COPPER, DRCE_PAD_NEAR_PAD1, DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE, DRCE_TOO_SMALL_MICROVIA, DRCE_TOO_SMALL_MICROVIA_DRILL, DRCE_TOO_SMALL_TRACK_WIDTH, DRCE_TOO_SMALL_VIA, DRCE_TOO_SMALL_VIA_DRILL, DRCE_TRACK_ENDS1, DRCE_TRACK_ENDS2, DRCE_TRACK_ENDS3, DRCE_TRACK_ENDS4, DRCE_TRACK_INSIDE_KEEPOUT, DRCE_TRACK_NEAR_COPPER, DRCE_TRACK_NEAR_PAD, DRCE_TRACK_NEAR_THROUGH_HOLE, DRCE_TRACK_NEAR_VIA, DRCE_TRACK_NEAR_ZONE, DRCE_TRACK_SEGMENTS_TOO_CLOSE, DRCE_TRACKS_CROSSING, DRCE_UNCONNECTED_ITEMS, DRCE_VIA_HOLE_BIGGER, DRCE_VIA_INSIDE_KEEPOUT, DRCE_VIA_NEAR_COPPER, DRCE_VIA_NEAR_TRACK, DRCE_VIA_NEAR_VIA, DRCE_ZONES_INTERSECT, DRCE_ZONES_TOO_CLOSE, Format(), and m_ErrorCode.

Referenced by GetErrorCode(), MARKER_PCB::GetMsgPanelInfo(), SCH_MARKER::Matches(), ShowHtml(), and ShowReport().

37 {
38  switch( m_ErrorCode )
39  {
41  return wxString( _( "Unconnected items" ) );
43  return wxString( _( "Track too close to thru-hole" ) );
45  return wxString( _( "Track too close to pad" ) );
47  return wxString( _( "Track too close to via" ) );
48  case DRCE_VIA_NEAR_VIA:
49  return wxString( _( "Via too close to via" ) );
51  return wxString( _( "Via too close to track" ) );
52  case DRCE_TRACK_ENDS1:
53  case DRCE_TRACK_ENDS2:
54  case DRCE_TRACK_ENDS3:
55  case DRCE_TRACK_ENDS4:
56  case DRCE_ENDS_PROBLEM1:
57  case DRCE_ENDS_PROBLEM2:
58  case DRCE_ENDS_PROBLEM3:
59  case DRCE_ENDS_PROBLEM4:
60  case DRCE_ENDS_PROBLEM5:
61  return wxString( _( "Two track ends too close" ) );
63  return wxString( _( "Two parallel track segments too close" ) );
65  return wxString( _( "Tracks crossing" ) );
67  return wxString( _( "Track too close to copper area" ) );
68  case DRCE_PAD_NEAR_PAD1:
69  return wxString( _( "Pad too close to pad" ) );
71  return wxString( _( "Via hole > diameter" ) );
73  return wxString( _( "Micro Via: incorrect layer pairs (not adjacent)" ) );
75  return wxString( _( "Micro Via: not allowed" ) );
77  return wxString( _( "Buried Via: not allowed" ) );
79  return wxString( _( "Item on a disabled layer" ) );
81  return wxString( _( "Copper area inside copper area" ) );
83  return wxString( _( "Copper areas intersect or are too close" ) );
84 
86  return wxString( _( "Copper area belongs to a net which has no pads" ) );
87 
88  case DRCE_HOLE_NEAR_PAD:
89  return wxString( _( "Hole too close to pad" ) );
91  return wxString( _( "Hole too close to track" ) );
93  return wxString( _( "Track width too small" ) );
94  case DRCE_TOO_SMALL_VIA:
95  return wxString( _( "Via size too small" ) );
97  return wxString( _( "Micro via size too small" ) );
99  return wxString( _( "Via drill too small" ) );
101  return wxString( _( "Micro via drill too small" ) );
103  return wxString( _( "Drilled holes too close together" ) );
104 
105  // use &lt; since this is text ultimately embedded in HTML
107  return wxString( _( "NetClass Track Width &lt; global limit" ) );
109  return wxString( _( "NetClass Clearance &lt; global limit" ) );
111  return wxString( _( "NetClass Via Dia &lt; global limit" ) );
113  return wxString( _( "NetClass Via Drill &lt; global limit" ) );
115  return wxString( _( "NetClass uVia Dia &lt; global limit" ) );
117  return wxString( _( "NetClass uVia Drill &lt; global limit" ) );
118 
120  return wxString( _( "Via inside keepout area" ) );
122  return wxString( _( "Track inside keepout area" ) );
124  return wxString( _( "Pad inside keepout area" ) );
125 
127  return wxString( _( "Via too close to copper item" ) );
129  return wxString( _( "Track too close to copper item" ) );
131  return wxString( _( "Pad too close to copper item" ) );
132 
134  return wxString( _( "Courtyards overlap" ) );
135 
137  return wxString( _( "Footprint has no courtyard defined" ) );
138 
140  return wxString( _( "Footprint has incorrect courtyard (not a closed shape)" ) );
141 
142  default:
143  return wxString::Format( _( "Unknown DRC error code %d" ), m_ErrorCode );
144  }
145 }
#define DRCE_DISABLED_LAYER_ITEM
item on a disabled layer
Definition: drc.h:95
#define DRCE_TOO_SMALL_MICROVIA_DRILL
Too small micro via drill.
Definition: drc.h:75
#define DRCE_TOO_SMALL_VIA
Too small via size.
Definition: drc.h:72
#define DRCE_PAD_NEAR_PAD1
pad too close to pad
Definition: drc.h:63
#define DRCE_NETCLASS_TRACKWIDTH
netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth
Definition: drc.h:76
#define DRCE_HOLE_NEAR_PAD
hole too close to pad
Definition: drc.h:69
#define DRCE_TRACK_ENDS4
2 parallel track segments too close: fine end point test
Definition: drc.h:55
#define DRCE_DRILLED_HOLES_TOO_CLOSE
overlapping drilled holes break drill bits
Definition: drc.h:96
#define DRCE_VIA_INSIDE_KEEPOUT
Via in inside a keepout area.
Definition: drc.h:82
#define DRCE_TRACK_NEAR_PAD
pad too close to track
Definition: drc.h:48
#define DRCE_NETCLASS_CLEARANCE
netclass has Clearance < board.m_designSettings->m_TrackClearance
Definition: drc.h:77
#define DRCE_ZONES_INTERSECT
copper area outlines intersect
Definition: drc.h:66
#define DRCE_VIA_NEAR_COPPER
via and copper graphic collide or are too close
Definition: drc.h:86
#define DRCE_UNCONNECTED_ITEMS
items are unconnected
Definition: drc.h:46
#define DRCE_TRACK_ENDS2
2 parallel track segments too close: fine start point test
Definition: drc.h:53
#define DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE
copper area has a net but no pads in nets, which is suspicious
Definition: drc.h:68
#define DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT
footprint has a courtyard but malformed
Definition: drc.h:91
#define DRCE_TRACK_SEGMENTS_TOO_CLOSE
2 parallel track segments too close: segm ends between segref ends
Definition: drc.h:56
#define DRCE_MISSING_COURTYARD_IN_FOOTPRINT
footprint has no courtyard defined
Definition: drc.h:90
#define DRCE_BURIED_VIA_NOT_ALLOWED
buried vias are not allowed
Definition: drc.h:94
#define DRCE_TRACK_NEAR_VIA
track too close to via
Definition: drc.h:49
#define DRCE_TOO_SMALL_MICROVIA
Too small micro via size.
Definition: drc.h:73
#define DRCE_PAD_INSIDE_KEEPOUT
Pad in inside a keepout area.
Definition: drc.h:84
#define DRCE_VIA_HOLE_BIGGER
via&#39;s hole is bigger than its diameter
Definition: drc.h:64
#define DRCE_TRACK_NEAR_COPPER
track & copper graphic collide or are too close
Definition: drc.h:85
#define DRCE_NETCLASS_uVIADRILLSIZE
netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill
Definition: drc.h:81
#define DRCE_NETCLASS_VIASIZE
netclass has ViaSize < board.m_designSettings->m_ViasMinSize
Definition: drc.h:78
#define DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR
micro via&#39;s layer pair incorrect (layers must be adjacent)
Definition: drc.h:65
#define DRCE_TRACK_ENDS1
2 parallel track segments too close: fine start point test
Definition: drc.h:52
#define DRCE_TRACK_ENDS3
2 parallel track segments too close: fine end point test
Definition: drc.h:54
#define DRCE_ENDS_PROBLEM2
track ends are too close
Definition: drc.h:59
#define DRCE_TRACK_NEAR_ZONE
track & zone collide or are too close together
Definition: drc.h:88
#define DRCE_ENDS_PROBLEM3
track ends are too close
Definition: drc.h:60
#define DRCE_OVERLAPPING_FOOTPRINTS
footprint courtyards overlap
Definition: drc.h:89
#define DRCE_NETCLASS_VIADRILLSIZE
netclass has ViaDrillSize < board.m_designSettings->m_ViasMinDrill
Definition: drc.h:79
#define DRCE_HOLE_NEAR_TRACK
hole too close to track
Definition: drc.h:70
#define DRCE_ENDS_PROBLEM4
track ends are too close
Definition: drc.h:61
#define DRCE_VIA_NEAR_VIA
via too close to via
Definition: drc.h:50
#define DRCE_TRACKS_CROSSING
tracks are crossing
Definition: drc.h:57
#define DRCE_ENDS_PROBLEM5
track ends are too close
Definition: drc.h:62
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define DRCE_TRACK_INSIDE_KEEPOUT
Track in inside a keepout area.
Definition: drc.h:83
#define DRCE_VIA_NEAR_TRACK
via too close to track
Definition: drc.h:51
#define DRCE_ZONES_TOO_CLOSE
copper area outlines are too close
Definition: drc.h:67
#define DRCE_PAD_NEAR_COPPER
pad and copper graphic collide or are too close
Definition: drc.h:87
#define DRCE_MICRO_VIA_NOT_ALLOWED
micro vias are not allowed
Definition: drc.h:93
#define DRCE_ENDS_PROBLEM1
track ends are too close
Definition: drc.h:58
#define DRCE_NETCLASS_uVIASIZE
netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize
Definition: drc.h:80
#define DRCE_TOO_SMALL_VIA_DRILL
Too small via drill.
Definition: drc.h:74
int m_ErrorCode
Definition: drc_item.h:51
#define DRCE_TRACK_NEAR_THROUGH_HOLE
thru hole is too close to track
Definition: drc.h:47
#define DRCE_TOO_SMALL_TRACK_WIDTH
Too small track width.
Definition: drc.h:71
BOARD_ITEM * DRC_ITEM::GetMainItem ( BOARD aBoard) const

Access to A and B items for BOARDs.

Definition at line 224 of file drc_item.cpp.

References BOARD::GetItem(), and m_mainItemWeakRef.

Referenced by DIALOG_DRC_CONTROL::doSelectionMenu(), and GetAuxiliaryText().

225 {
226  return aBoard->GetItem( m_mainItemWeakRef );
227 }
void * m_mainItemWeakRef
Definition: drc_item.h:60
BOARD_ITEM * GetItem(void *aWeakReference)
wxString DRC_ITEM::GetMainText ( ) const
inline

Access to A and B texts.

Definition at line 162 of file drc_item.h.

References m_MainText.

Referenced by SCH_MARKER::Matches().

162 { return m_MainText; }
wxString m_MainText
Definition: drc_item.h:52
MARKER_BASE* DRC_ITEM::GetParent ( void  ) const
inline

Definition at line 153 of file drc_item.h.

References m_parent.

Referenced by DIALOG_DRC_CONTROL::OnLeftDClickClearance(), and DIALOG_DRC_CONTROL::OnMarkerSelectionEvent().

153 { return m_parent; }
MARKER_BASE * m_parent
Definition: drc_item.h:59
const wxPoint& DRC_ITEM::GetPointB ( ) const
inline

Definition at line 220 of file drc_item.h.

References m_AuxiliaryPosition, and ShowCoord().

Referenced by MARKER_PCB::GetMsgPanelInfo().

221  {
222  return m_AuxiliaryPosition;
223  }
wxPoint m_AuxiliaryPosition
Definition: drc_item.h:55
const wxString& DRC_ITEM::GetTextA ( ) const
inline

Definition at line 202 of file drc_item.h.

References m_MainText.

Referenced by MARKER_PCB::GetMsgPanelInfo().

203  {
204  return m_MainText;
205  }
wxString m_MainText
Definition: drc_item.h:52
const wxString& DRC_ITEM::GetTextB ( ) const
inline

Definition at line 208 of file drc_item.h.

References m_AuxiliaryText.

Referenced by MARKER_PCB::GetMsgPanelInfo().

209  {
210  return m_AuxiliaryText;
211  }
wxString m_AuxiliaryText
Definition: drc_item.h:53
bool DRC_ITEM::HasSecondItem ( ) const
inline

Definition at line 155 of file drc_item.h.

References m_hasSecondItem.

Referenced by DIALOG_DRC_CONTROL::doSelectionMenu(), and MARKER_PCB::GetMsgPanelInfo().

155 { return m_hasSecondItem; }
bool m_hasSecondItem
Definition: drc_item.h:56
void DRC_ITEM::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 142 of file drc_item.h.

Referenced by MARKER_BASE::SetAuxiliaryData().

143  {
144  m_AuxiliaryText = aAuxiliaryText;
145  m_AuxiliaryPosition = aAuxiliaryPos;
146  m_hasSecondItem = true;
147 
148  m_auxItemWeakRef = nullptr;
149  }
bool m_hasSecondItem
Definition: drc_item.h:56
void * m_auxItemWeakRef
Definition: drc_item.h:61
wxPoint m_AuxiliaryPosition
Definition: drc_item.h:55
wxString m_AuxiliaryText
Definition: drc_item.h:53
void DRC_ITEM::SetData ( EDA_UNITS_T  aUnits,
int  aErrorCode,
EDA_ITEM aMainItem,
const wxPoint aMainPos,
EDA_ITEM bAuxiliaryItem = nullptr,
const wxPoint bAuxiliaryPos = wxPoint() 
)
inline

Function SetData initialize all data in item.

Parameters
aErrorCode= error code
aMainItem= the first (main) schematic or board item
bAuxiliaryItem= the second schematic or board item
aMainPos= position the first item and therefore of this issue
bAuxiliaryPos= position the second item

Definition at line 91 of file drc_item.h.

References EDA_ITEM::GetSelectMenuText().

Referenced by DRC_ITEM(), and MARKER_BASE::SetData().

93  {
94  m_ErrorCode = aErrorCode;
95  m_MainText = aMainItem->GetSelectMenuText( aUnits );
96  m_AuxiliaryText = wxEmptyString;
97  m_MainPosition = aMainPos;
98  m_AuxiliaryPosition = bAuxiliaryPos;
99  m_hasSecondItem = bAuxiliaryItem != nullptr;
100  m_noCoordinate = false;
101  m_parent = nullptr;
102 
103  if( m_hasSecondItem )
104  m_AuxiliaryText = bAuxiliaryItem->GetSelectMenuText( aUnits );
105 
106  // Weak references (void*). One must search the BOARD_ITEMS or SCH_ITEMS for a match.
107  m_mainItemWeakRef = aMainItem;
108  m_auxItemWeakRef = bAuxiliaryItem;
109  }
bool m_hasSecondItem
Definition: drc_item.h:56
void * m_auxItemWeakRef
Definition: drc_item.h:61
wxPoint m_MainPosition
Definition: drc_item.h:54
wxPoint m_AuxiliaryPosition
Definition: drc_item.h:55
virtual wxString GetSelectMenuText(EDA_UNITS_T aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
void * m_mainItemWeakRef
Definition: drc_item.h:60
wxString m_MainText
Definition: drc_item.h:52
MARKER_BASE * m_parent
Definition: drc_item.h:59
bool m_noCoordinate
Definition: drc_item.h:57
wxString m_AuxiliaryText
Definition: drc_item.h:53
int m_ErrorCode
Definition: drc_item.h:51
void DRC_ITEM::SetData ( int  aErrorCode,
const wxString &  aMainText,
const wxPoint aMainPos,
const wxString &  bAuxiliaryText = wxEmptyString,
const wxPoint bAuxiliaryPos = wxPoint() 
)
inline

Function SetData initialize all data in item.

Parameters
aErrorCode= error code
aMainItem= the first (main) schematic or board item
bAuxiliaryItem= the second schematic or board item
aMainPos= position the first item and therefore of this issue
bAuxiliaryPos= position the second item

Definition at line 120 of file drc_item.h.

122  {
123  m_ErrorCode = aErrorCode;
124  m_MainText = aMainText;
125  m_AuxiliaryText = bAuxiliaryText;
126  m_MainPosition = aMainPos;
127  m_AuxiliaryPosition = bAuxiliaryPos;
128  m_hasSecondItem = bAuxiliaryText.Length();
129  m_noCoordinate = false;
130  m_parent = nullptr;
131 
132  m_mainItemWeakRef = nullptr;
133  m_auxItemWeakRef = nullptr;
134  }
bool m_hasSecondItem
Definition: drc_item.h:56
void * m_auxItemWeakRef
Definition: drc_item.h:61
wxPoint m_MainPosition
Definition: drc_item.h:54
wxPoint m_AuxiliaryPosition
Definition: drc_item.h:55
void * m_mainItemWeakRef
Definition: drc_item.h:60
wxString m_MainText
Definition: drc_item.h:52
MARKER_BASE * m_parent
Definition: drc_item.h:59
bool m_noCoordinate
Definition: drc_item.h:57
wxString m_AuxiliaryText
Definition: drc_item.h:53
int m_ErrorCode
Definition: drc_item.h:51
void DRC_ITEM::SetParent ( MARKER_BASE aMarker)
inline

Definition at line 151 of file drc_item.h.

Referenced by MARKER_BASE::SetData().

151 { m_parent = aMarker; }
MARKER_BASE * m_parent
Definition: drc_item.h:59
void DRC_ITEM::SetShowNoCoordinate ( )
inline

Definition at line 157 of file drc_item.h.

Referenced by MARKER_BASE::SetShowNoCoordinate().

157 { m_noCoordinate = true; }
bool m_noCoordinate
Definition: drc_item.h:57
wxString DRC_ITEM::ShowCoord ( EDA_UNITS_T  aUnits,
const wxPoint aPos 
)
static

Function ShowCoord formats a coordinate or position to text.

Parameters
aPosThe position to format
Returns
wxString - The formated string

Definition at line 148 of file drc_item.cpp.

References Format(), MessageTextFromValue(), wxPoint::x, and wxPoint::y.

Referenced by MARKER_PCB::GetMsgPanelInfo(), GetPointB(), ShowHtml(), and ShowReport().

149 {
150  return wxString::Format( wxT( "@(%s, %s)" ),
151  MessageTextFromValue( aUnits, aPos.x ),
152  MessageTextFromValue( aUnits, aPos.y ) );
153 }
wxString MessageTextFromValue(EDA_UNITS_T aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:125
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxString DRC_ITEM::ShowHtml ( EDA_UNITS_T  aUnits) const

Function ShowHtml translates this object into a fragment of HTML suitable for the wxWidget's wxHtmlListBox class.

Returns
wxString - the html text.

Definition at line 156 of file drc_item.cpp.

References Format(), GetErrorText(), m_AuxiliaryPosition, m_AuxiliaryText, m_hasSecondItem, m_MainPosition, m_MainText, m_noCoordinate, and ShowCoord().

Referenced by MARKER_BASE::DisplayMarkerInfo(), GetAuxiliaryText(), and DRCLISTBOX::OnGetItem().

157 {
158  wxString mainText = m_MainText;
159  // a wxHtmlWindows does not like < and > in the text to display
160  // because these chars have a special meaning in html
161  mainText.Replace( wxT("<"), wxT("&lt;") );
162  mainText.Replace( wxT(">"), wxT("&gt;") );
163 
164  wxString errText = GetErrorText();
165  errText.Replace( wxT("<"), wxT("&lt;") );
166  errText.Replace( wxT(">"), wxT("&gt;") );
167 
168 
169  if( m_noCoordinate )
170  {
171  // omit the coordinate, a NETCLASS has no location
172  return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s" ),
173  errText,
174  mainText );
175  }
176  else if( m_hasSecondItem )
177  {
178  wxString auxText = m_AuxiliaryText;
179  auxText.Replace( wxT("<"), wxT("&lt;") );
180  auxText.Replace( wxT(">"), wxT("&gt;") );
181 
182  // an html fragment for the entire message in the listbox. feel free
183  // to add color if you want:
184  return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s: %s<br>&nbsp;&nbsp; %s: %s" ),
185  errText,
186  ShowCoord( aUnits, m_MainPosition ),
187  mainText,
188  ShowCoord( aUnits, m_AuxiliaryPosition ),
189  auxText );
190  }
191  else
192  {
193  return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s: %s" ),
194  errText,
195  ShowCoord( aUnits, m_MainPosition ),
196  mainText );
197  }
198 }
wxString GetErrorText() const
Function GetErrorText returns the string form of a drc error code.
Definition: drc_item.cpp:36
bool m_hasSecondItem
Definition: drc_item.h:56
wxPoint m_MainPosition
Definition: drc_item.h:54
wxPoint m_AuxiliaryPosition
Definition: drc_item.h:55
wxString m_MainText
Definition: drc_item.h:52
static wxString ShowCoord(EDA_UNITS_T aUnits, const wxPoint &aPos)
Function ShowCoord formats a coordinate or position to text.
Definition: drc_item.cpp:148
bool m_noCoordinate
Definition: drc_item.h:57
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxString m_AuxiliaryText
Definition: drc_item.h:53
wxString DRC_ITEM::ShowReport ( EDA_UNITS_T  aUnits) const

Function ShowReport translates this object into a text string suitable for saving to disk in a report.

Returns
wxString - the simple multi-line report text.

Definition at line 201 of file drc_item.cpp.

References Format(), GetErrorText(), m_AuxiliaryPosition, m_AuxiliaryText, m_ErrorCode, m_hasSecondItem, m_MainPosition, m_MainText, and ShowCoord().

Referenced by GetAuxiliaryText(), WriteDiagnosticERC(), and DIALOG_DRC_CONTROL::writeReport().

202 {
203  if( m_hasSecondItem )
204  {
205  return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
206  m_ErrorCode,
207  GetErrorText(),
208  ShowCoord( aUnits, m_MainPosition ),
209  m_MainText,
210  ShowCoord( aUnits, m_AuxiliaryPosition ),
211  m_AuxiliaryText );
212  }
213  else
214  {
215  return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
216  m_ErrorCode,
217  GetErrorText(),
218  ShowCoord( aUnits, m_MainPosition ),
219  m_MainText );
220  }
221 }
wxString GetErrorText() const
Function GetErrorText returns the string form of a drc error code.
Definition: drc_item.cpp:36
bool m_hasSecondItem
Definition: drc_item.h:56
wxPoint m_MainPosition
Definition: drc_item.h:54
wxPoint m_AuxiliaryPosition
Definition: drc_item.h:55
wxString m_MainText
Definition: drc_item.h:52
static wxString ShowCoord(EDA_UNITS_T aUnits, const wxPoint &aPos)
Function ShowCoord formats a coordinate or position to text.
Definition: drc_item.cpp:148
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxString m_AuxiliaryText
Definition: drc_item.h:53
int m_ErrorCode
Definition: drc_item.h:51

Member Data Documentation

wxPoint DRC_ITEM::m_AuxiliaryPosition
protected

Definition at line 55 of file drc_item.h.

Referenced by GetPointB(), ShowHtml(), and ShowReport().

wxString DRC_ITEM::m_AuxiliaryText
protected

Definition at line 53 of file drc_item.h.

Referenced by GetAuxiliaryText(), GetTextB(), ShowHtml(), and ShowReport().

void* DRC_ITEM::m_auxItemWeakRef
protected

Definition at line 61 of file drc_item.h.

Referenced by GetAuxiliaryItem().

int DRC_ITEM::m_ErrorCode
protected

Definition at line 51 of file drc_item.h.

Referenced by GetErrorCode(), GetErrorText(), and ShowReport().

bool DRC_ITEM::m_hasSecondItem
protected

Definition at line 56 of file drc_item.h.

Referenced by HasSecondItem(), ShowHtml(), and ShowReport().

void* DRC_ITEM::m_mainItemWeakRef
protected

Definition at line 60 of file drc_item.h.

Referenced by GetMainItem().

wxPoint DRC_ITEM::m_MainPosition
protected

Definition at line 54 of file drc_item.h.

Referenced by GetPointA(), ShowHtml(), and ShowReport().

wxString DRC_ITEM::m_MainText
protected

Definition at line 52 of file drc_item.h.

Referenced by GetMainText(), GetTextA(), ShowHtml(), and ShowReport().

bool DRC_ITEM::m_noCoordinate
protected

Definition at line 57 of file drc_item.h.

Referenced by ShowHtml().

MARKER_BASE* DRC_ITEM::m_parent
protected

Definition at line 59 of file drc_item.h.

Referenced by GetParent().


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