KiCad PCB EDA Suite
RC_ITEM Class Reference

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:
CLEANUP_ITEM DRC_ITEM ERC_ITEM test::DRC_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, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
 
void SetItems (const KIID &aItem, const KIID &bItem=niluuid, const KIID &cItem=niluuid, const KIID &dItem=niluuid)
 
KIID GetMainItemID () const
 
KIID GetAuxItemID () const
 
KIID GetAuxItem2ID () const
 
KIID GetAuxItem3ID () 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 GetErrorMessage () const
 Function GetErrorMessage returns the error message of a RC_ITEM. More...
 
wxString GetErrorText () const
 
wxString GetSettingsKey () const
 

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
 A message describing the details of this specific error. More...
 
wxString m_errorTitle
 The string describing the type of error. More...
 
wxString m_settingsKey
 The key used to describe this type of error in settings. More...
 
MARKER_BASEm_parent
 
KIID m_mainItemUuid
 
KIID m_auxItemUuid
 
KIID m_auxItem2Uuid
 
KIID m_auxItem3Uuid
 

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 73 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.

88  :
89  m_errorCode( 0 ),
90  m_parent( nullptr ),
95  {
96  }
KIID & NilUuid()
Definition: common.cpp:57
KIID m_auxItemUuid
Definition: rc_item.h:82
int m_errorCode
Definition: rc_item.h:76
MARKER_BASE * m_parent
Definition: rc_item.h:80
KIID m_auxItem3Uuid
Definition: rc_item.h:84
KIID m_mainItemUuid
Definition: rc_item.h:81
KIID m_auxItem2Uuid
Definition: rc_item.h:83

◆ RC_ITEM() [2/2]

RC_ITEM::RC_ITEM ( RC_ITEM aItem)
inline

Definition at line 98 of file rc_item.h.

99  {
100  m_errorCode = aItem->m_errorCode;
102  m_errorTitle = aItem->m_errorTitle;
103  m_settingsKey = aItem->m_settingsKey;
104  m_parent = aItem->m_parent;
106  m_auxItemUuid = aItem->m_auxItemUuid;
109  }
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:79
KIID m_auxItemUuid
Definition: rc_item.h:82
int m_errorCode
Definition: rc_item.h:76
wxString m_errorMessage
A message describing the details of this specific error.
Definition: rc_item.h:77
MARKER_BASE * m_parent
Definition: rc_item.h:80
KIID m_auxItem3Uuid
Definition: rc_item.h:84
KIID m_mainItemUuid
Definition: rc_item.h:81
KIID m_auxItem2Uuid
Definition: rc_item.h:83
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:78

References m_auxItem2Uuid, m_auxItem3Uuid, m_auxItemUuid, m_errorCode, m_errorMessage, m_errorTitle, m_mainItemUuid, m_parent, and m_settingsKey.

◆ ~RC_ITEM()

virtual RC_ITEM::~RC_ITEM ( )
inlinevirtual

Definition at line 111 of file rc_item.h.

111 { }

Member Function Documentation

◆ GetAuxItem2ID()

KIID RC_ITEM::GetAuxItem2ID ( ) const
inline

Definition at line 141 of file rc_item.h.

141 { return m_auxItem2Uuid; }
KIID m_auxItem2Uuid
Definition: rc_item.h:83

References m_auxItem2Uuid.

Referenced by RC_TREE_MODEL::GetValue(), RC_TREE_MODEL::rebuildModel(), and RC_TREE_MODEL::ToUUID().

◆ GetAuxItem3ID()

KIID RC_ITEM::GetAuxItem3ID ( ) const
inline

Definition at line 142 of file rc_item.h.

142 { return m_auxItem3Uuid; }
KIID m_auxItem3Uuid
Definition: rc_item.h:84

References m_auxItem3Uuid.

Referenced by RC_TREE_MODEL::GetValue(), RC_TREE_MODEL::rebuildModel(), and RC_TREE_MODEL::ToUUID().

◆ 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();
40  else
41  return m_errorMessage;
42 }
wxString GetErrorText() const
Definition: rc_item.h:165
wxString m_errorMessage
A message describing the details of this specific error.
Definition: rc_item.h:77

References GetErrorText(), and m_errorMessage.

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

◆ GetErrorText()

wxString RC_ITEM::GetErrorText ( ) const
inline

◆ GetMainItemID()

◆ GetParent()

MARKER_BASE* RC_ITEM::GetParent ( void  ) const
inline

◆ GetSettingsKey()

wxString RC_ITEM::GetSettingsKey ( ) const
inline

Definition at line 170 of file rc_item.h.

171  {
172  return m_settingsKey;
173  }
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:79

References m_settingsKey.

Referenced by BOARD_DESIGN_SETTINGS::LoadFromFile(), and MARKER_PCB::Serialize().

◆ SetErrorCode()

void RC_ITEM::SetErrorCode ( int  aCode)
inline

Definition at line 157 of file rc_item.h.

157 { m_errorCode = aCode; }
int m_errorCode
Definition: rc_item.h:76

References m_errorCode.

◆ SetErrorMessage()

void RC_ITEM::SetErrorMessage ( const wxString &  aMessage)
inline

◆ SetItems() [1/2]

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

Definition at line 115 of file rc_item.h.

117  {
118  m_mainItemUuid = aItem->m_Uuid;
119 
120  if( bItem )
121  m_auxItemUuid = bItem->m_Uuid;
122 
123  if( cItem )
124  m_auxItem2Uuid = cItem->m_Uuid;
125 
126  if( dItem )
127  m_auxItem3Uuid = dItem->m_Uuid;
128  }
KIID m_auxItemUuid
Definition: rc_item.h:82
const KIID m_Uuid
Definition: base_struct.h:162
KIID m_auxItem3Uuid
Definition: rc_item.h:84
KIID m_mainItemUuid
Definition: rc_item.h:81
KIID m_auxItem2Uuid
Definition: rc_item.h:83

References m_auxItem2Uuid, m_auxItem3Uuid, 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(), test::DRC_TEST_PROVIDER_HOLE_SIZE::checkPad(), DRC_KEEPOUT_TESTER::checkPads(), DRC_KEEPOUT_TESTER::checkTracksAndVias(), DRC_DRILLED_HOLE_TESTER::checkVia(), test::DRC_TEST_PROVIDER_HOLE_SIZE::checkVia(), GRAPHICS_CLEANER::cleanupSegments(), TRACKS_CLEANER::cleanupSegments(), TRACKS_CLEANER::cleanupVias(), TRACKS_CLEANER::deleteDanglingTracks(), TRACKS_CLEANER::deleteNullSegments(), TRACKS_CLEANER::deleteTracksInPads(), MARKER_PCB::Deserialize(), ERC_TESTER::diagnose(), test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), DRC::doPadToPadsDrc(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), TRACKS_CLEANER::mergeCollinearSegments(), GRAPHICS_CLEANER::mergeRects(), TRACKS_CLEANER::removeBadTrackSegments(), CONNECTION_SUBGRAPH::ResolveDrivers(), DRC_COURTYARD_TESTER::RunDRC(), DRC_TEXTVAR_TESTER::RunDRC(), SimilarLabelsDiagnose(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), DRC::testDisabledLayers(), ERC_TESTER::TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), TestFootprints(), test::DRC_TEST_PROVIDER_HOLE_CLEARANCE::testHoles2Holes(), ERC_TESTER::TestMultiunitFootprints(), ERC_TESTER::TestNoConnectPins(), DRC::testOutline(), DRC::testPadClearances(), ERC_TESTER::TestTextVars(), DRC::testTracks(), DRC::testUnconnected(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), and DRC::testZones().

◆ SetItems() [2/2]

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

Definition at line 130 of file rc_item.h.

132  {
133  m_mainItemUuid = aItem;
134  m_auxItemUuid = bItem;
135  m_auxItem2Uuid = cItem;
136  m_auxItem3Uuid = dItem;
137  }
KIID m_auxItemUuid
Definition: rc_item.h:82
KIID m_auxItem3Uuid
Definition: rc_item.h:84
KIID m_mainItemUuid
Definition: rc_item.h:81
KIID m_auxItem2Uuid
Definition: rc_item.h:83

References m_auxItem2Uuid, m_auxItem3Uuid, m_auxItemUuid, and m_mainItemUuid.

◆ SetParent()

void RC_ITEM::SetParent ( MARKER_BASE aMarker)
inline

Definition at line 144 of file rc_item.h.

144 { m_parent = aMarker; }
MARKER_BASE * m_parent
Definition: rc_item.h:80

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:82
virtual wxPoint GetPosition() const
Definition: base_struct.h:337
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:156
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:159
KIID m_mainItemUuid
Definition: rc_item.h:81
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_auxItem2Uuid

KIID RC_ITEM::m_auxItem2Uuid
protected

Definition at line 83 of file rc_item.h.

Referenced by GetAuxItem2ID(), RC_ITEM(), and SetItems().

◆ m_auxItem3Uuid

KIID RC_ITEM::m_auxItem3Uuid
protected

Definition at line 84 of file rc_item.h.

Referenced by GetAuxItem3ID(), RC_ITEM(), and SetItems().

◆ m_auxItemUuid

KIID RC_ITEM::m_auxItemUuid
protected

Definition at line 82 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

A message describing the details of this specific error.

Definition at line 77 of file rc_item.h.

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

◆ m_errorTitle

wxString RC_ITEM::m_errorTitle
protected

The string describing the type of error.

Definition at line 78 of file rc_item.h.

Referenced by CLEANUP_ITEM::CLEANUP_ITEM(), DRC_ITEM::DRC_ITEM(), test::DRC_ITEM::DRC_ITEM(), ERC_ITEM::ERC_ITEM(), GetErrorText(), and RC_ITEM().

◆ m_mainItemUuid

KIID RC_ITEM::m_mainItemUuid
protected

Definition at line 81 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 80 of file rc_item.h.

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

◆ m_settingsKey

wxString RC_ITEM::m_settingsKey
protected

The key used to describe this type of error in settings.

Definition at line 79 of file rc_item.h.

Referenced by DRC_ITEM::DRC_ITEM(), test::DRC_ITEM::DRC_ITEM(), ERC_ITEM::ERC_ITEM(), GetSettingsKey(), and RC_ITEM().


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