KiCad PCB EDA Suite
RC_ITEM Class Referenceabstract

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

#include <rc_item.h>

Inheritance diagram for RC_ITEM:
DRC_ITEM ERC_ITEM

Public Member Functions

 RC_ITEM ()
 
 RC_ITEM (RC_ITEM *aItem)
 
virtual ~RC_ITEM ()
 
void SetErrorMessage (const wxString &aMessage)
 
void SetItems (EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr)
 
void SetItems (const KIID &aItem, const KIID &bItem=niluuid)
 
KIID GetMainItemID () const
 
KIID GetAuxItemID () const
 
void SetParent (MARKER_BASE *aMarker)
 
MARKER_BASEGetParent () const
 
virtual wxString ShowReport (EDA_UNITS aUnits, const std::map< KIID, EDA_ITEM * > &aItemMap) const
 Function ShowReport translates this object into a text string suitable for saving to disk in a report. More...
 
int GetErrorCode () const
 
void SetErrorCode (int aCode)
 
virtual wxString GetErrorText (int aCode=-1, bool aTranslate=true) const =0
 Function GetErrorText returns the string form of a RC error code. More...
 
virtual wxString GetErrorMessage () const
 Function GetErrorMessage returns the error message of a RC_ITEM. More...
 

Static Public Member Functions

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

Protected Attributes

int m_errorCode
 
wxString m_errorMessage
 
MARKER_BASEm_parent
 
KIID m_mainItemUuid
 
KIID m_auxItemUuid
 

Detailed Description

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

RC_ITEMs can have zero, one, or two related EDA_ITEMs.

Definition at line 77 of file rc_item.h.

Constructor & Destructor Documentation

◆ RC_ITEM() [1/2]

RC_ITEM::RC_ITEM ( )
inline

Definition at line 88 of file rc_item.h.

89  {
90  m_errorCode = 0;
91  m_parent = nullptr;
94  }
KIID m_auxItemUuid
Definition: rc_item.h:84
int m_errorCode
Definition: rc_item.h:80
KIID niluuid(0)
MARKER_BASE * m_parent
Definition: rc_item.h:82
KIID m_mainItemUuid
Definition: rc_item.h:83

References m_auxItemUuid, m_errorCode, m_mainItemUuid, m_parent, and niluuid.

◆ RC_ITEM() [2/2]

RC_ITEM::RC_ITEM ( RC_ITEM aItem)
inline

Definition at line 96 of file rc_item.h.

97  {
98  m_errorCode = aItem->m_errorCode;
100  m_parent = aItem->m_parent;
102  m_auxItemUuid = aItem->m_auxItemUuid;
103  }
KIID m_auxItemUuid
Definition: rc_item.h:84
int m_errorCode
Definition: rc_item.h:80
wxString m_errorMessage
Definition: rc_item.h:81
MARKER_BASE * m_parent
Definition: rc_item.h:82
KIID m_mainItemUuid
Definition: rc_item.h:83

References m_auxItemUuid, m_errorCode, m_errorMessage, m_mainItemUuid, and m_parent.

◆ ~RC_ITEM()

virtual RC_ITEM::~RC_ITEM ( )
inlinevirtual

Definition at line 105 of file rc_item.h.

105 { }

Member Function Documentation

◆ GetAuxItemID()

◆ GetErrorCode()

◆ GetErrorMessage()

wxString RC_ITEM::GetErrorMessage ( ) const
virtual

Function GetErrorMessage returns the error message of a RC_ITEM.

Definition at line 36 of file rc_item.cpp.

37 {
38  if( m_errorMessage.IsEmpty() )
39  return GetErrorText( m_errorCode );
40  else
41  return m_errorMessage;
42 }
int m_errorCode
Definition: rc_item.h:80
wxString m_errorMessage
Definition: rc_item.h:81
virtual wxString GetErrorText(int aCode=-1, bool aTranslate=true) const =0
Function GetErrorText returns the string form of a RC error code.

References GetErrorText(), m_errorCode, and m_errorMessage.

Referenced by MARKER_PCB::GetMsgPanelInfo(), SCH_MARKER::GetMsgPanelInfo(), RC_TREE_MODEL::GetValue(), MARKER_PCB::Matches(), SCH_MARKER::Matches(), and ShowReport().

◆ GetErrorText()

virtual wxString RC_ITEM::GetErrorText ( int  aCode = -1,
bool  aTranslate = true 
) const
pure virtual

◆ GetMainItemID()

◆ GetParent()

MARKER_BASE* RC_ITEM::GetParent ( void  ) const
inline

◆ SetErrorCode()

void RC_ITEM::SetErrorCode ( int  aCode)
inline

Definition at line 139 of file rc_item.h.

139 { m_errorCode = aCode; }
int m_errorCode
Definition: rc_item.h:80

References m_errorCode.

◆ SetErrorMessage()

◆ SetItems() [1/2]

void RC_ITEM::SetItems ( EDA_ITEM aItem,
EDA_ITEM bItem = nullptr 
)
inline

Definition at line 109 of file rc_item.h.

110  {
111  m_mainItemUuid = aItem->m_Uuid;
112 
113  if( bItem )
114  m_auxItemUuid = bItem->m_Uuid;
115  }
KIID m_auxItemUuid
Definition: rc_item.h:84
const KIID m_Uuid
Definition: base_struct.h:166
KIID m_mainItemUuid
Definition: rc_item.h:83

References m_auxItemUuid, m_mainItemUuid, and EDA_ITEM::m_Uuid.

Referenced by DRC_KEEPOUT_TESTER::checkDrawings(), DRC_KEEPOUT_TESTER::checkFootprints(), DRC_DRILLED_HOLE_TESTER::checkHoles(), DRC_DRILLED_HOLE_TESTER::checkMicroVia(), DRC_DRILLED_HOLE_TESTER::checkPad(), DRC_KEEPOUT_TESTER::checkPads(), DRC_KEEPOUT_TESTER::checkTracksAndVias(), DRC_DRILLED_HOLE_TESTER::checkVia(), TRACKS_CLEANER::cleanupSegments(), TRACKS_CLEANER::cleanupVias(), TRACKS_CLEANER::deleteDanglingTracks(), TRACKS_CLEANER::deleteNullSegments(), TRACKS_CLEANER::deleteTracksInPads(), MARKER_PCB::Deserialize(), Diagnose(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), TRACKS_CLEANER::mergeCollinearSegments(), TRACKS_CLEANER::removeBadTrackSegments(), CONNECTION_SUBGRAPH::ResolveDrivers(), DRC_COURTYARD_TESTER::RunDRC(), DRC_TEXTVAR_TESTER::RunDRC(), SimilarLabelsDiagnose(), DRC::testCopperDrawItem(), DRC::testDisabledLayers(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), TestFootprints(), TestMultiunitFootprints(), DRC::testOutline(), DRC::testPadClearances(), TestTextVars(), DRC::testTracks(), DRC::testUnconnected(), and DRC::testZones().

◆ SetItems() [2/2]

void RC_ITEM::SetItems ( const KIID aItem,
const KIID bItem = niluuid 
)
inline

Definition at line 117 of file rc_item.h.

118  {
119  m_mainItemUuid = aItem;
120  m_auxItemUuid = bItem;
121  }
KIID m_auxItemUuid
Definition: rc_item.h:84
KIID m_mainItemUuid
Definition: rc_item.h:83

References m_auxItemUuid, and m_mainItemUuid.

◆ SetParent()

void RC_ITEM::SetParent ( MARKER_BASE aMarker)
inline

Definition at line 126 of file rc_item.h.

126 { m_parent = aMarker; }
MARKER_BASE * m_parent
Definition: rc_item.h:82

References m_parent.

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

◆ ShowCoord()

wxString RC_ITEM::ShowCoord ( EDA_UNITS  aUnits,
const wxPoint aPos 
)
static

Function ShowCoord formats a coordinate or position to text.

Definition at line 45 of file rc_item.cpp.

46 {
47  return wxString::Format( "@(%s, %s)",
48  MessageTextFromValue( aUnits, aPos.x ),
49  MessageTextFromValue( aUnits, aPos.y ) );
50 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
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

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

Referenced by ShowReport().

◆ ShowReport()

wxString RC_ITEM::ShowReport ( EDA_UNITS  aUnits,
const std::map< KIID, EDA_ITEM * > &  aItemMap 
) const
virtual

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 53 of file rc_item.cpp.

54 {
55  EDA_ITEM* mainItem = nullptr;
56  EDA_ITEM* auxItem = nullptr;
57 
58  if( m_mainItemUuid != niluuid )
59  mainItem = aItemMap.at( m_mainItemUuid );
60 
61  if( m_auxItemUuid != niluuid )
62  auxItem = aItemMap.at( m_auxItemUuid );
63 
64  if( mainItem && auxItem )
65  {
66  return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
67  GetErrorCode(),
69  ShowCoord( aUnits, mainItem->GetPosition() ),
70  mainItem->GetSelectMenuText( aUnits ),
71  ShowCoord( aUnits, auxItem->GetPosition() ),
72  auxItem->GetSelectMenuText( aUnits ) );
73  }
74  else if( mainItem )
75  {
76  return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
77  GetErrorCode(),
79  ShowCoord( aUnits, mainItem->GetPosition() ),
80  mainItem->GetSelectMenuText( aUnits ) );
81  }
82  else
83  {
84  return wxString::Format( wxT( "ErrType(%d): %s\n" ),
85  GetErrorCode(),
86  GetErrorMessage() );
87  }
88 }
KIID m_auxItemUuid
Definition: rc_item.h:84
virtual const wxPoint GetPosition() const
Definition: base_struct.h:344
static wxString ShowCoord(EDA_UNITS aUnits, const wxPoint &aPos)
Function ShowCoord formats a coordinate or position to text.
Definition: rc_item.cpp:45
KIID niluuid(0)
int GetErrorCode() const
Definition: rc_item.h:138
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
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
KIID m_mainItemUuid
Definition: rc_item.h:83
virtual wxString GetErrorMessage() const
Function GetErrorMessage returns the error message of a RC_ITEM.
Definition: rc_item.cpp:36

References Format(), GetErrorCode(), GetErrorMessage(), EDA_ITEM::GetPosition(), EDA_ITEM::GetSelectMenuText(), m_auxItemUuid, m_mainItemUuid, niluuid, and ShowCoord().

Referenced by DIALOG_DRC::writeReport(), and DIALOG_ERC::writeReport().

Member Data Documentation

◆ m_auxItemUuid

KIID RC_ITEM::m_auxItemUuid
protected

Definition at line 84 of file rc_item.h.

Referenced by GetAuxItemID(), RC_ITEM(), SetItems(), DRC_ITEM::ShowHtml(), and ShowReport().

◆ m_errorCode

◆ m_errorMessage

wxString RC_ITEM::m_errorMessage
protected

Definition at line 81 of file rc_item.h.

Referenced by GetErrorMessage(), RC_ITEM(), SetErrorMessage(), and DRC_ITEM::ShowHtml().

◆ m_mainItemUuid

KIID RC_ITEM::m_mainItemUuid
protected

Definition at line 83 of file rc_item.h.

Referenced by GetMainItemID(), RC_ITEM(), SetItems(), DRC_ITEM::ShowHtml(), and ShowReport().

◆ m_parent

MARKER_BASE* RC_ITEM::m_parent
protected

Definition at line 82 of file rc_item.h.

Referenced by GetParent(), RC_ITEM(), and SetParent().


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