KiCad PCB EDA Suite
DRC_ITEM Class Reference

#include <drc_item.h>

Inheritance diagram for DRC_ITEM:
RC_ITEM

Public Types

typedef std::vector< KIIDKIIDS
 

Public Member Functions

void SetViolatingRule (DRC_RULE *aRule)
 
DRC_RULEGetViolatingRule () const
 
void SetViolatingTest (DRC_TEST_PROVIDER *aProvider)
 
DRC_TEST_PROVIDERGetViolatingTest () const
 
void SetErrorMessage (const wxString &aMessage)
 
void SetItems (const KIIDS &aIds)
 
void SetItems (const EDA_ITEM *aItem, const EDA_ITEM *bItem=nullptr, const EDA_ITEM *cItem=nullptr, const EDA_ITEM *dItem=nullptr)
 
void SetItems (const KIID &aItem, const KIID &bItem=niluuid, const KIID &cItem=niluuid, const KIID &dItem=niluuid)
 
void AddItem (EDA_ITEM *aItem)
 
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, SEVERITY aSeverity, const std::map< KIID, EDA_ITEM * > &aItemMap) const
 Translate 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
 Return the error message of a RC_ITEM. More...
 
wxString GetErrorText () const
 
wxString GetSettingsKey () const
 

Static Public Member Functions

static std::shared_ptr< DRC_ITEMCreate (int aErrorCode)
 Constructs a DRC_ITEM for the given error code. More...
 
static std::shared_ptr< DRC_ITEMCreate (const wxString &aErrorKey)
 Constructs a DRC item from a given error settings key. More...
 
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities ()
 
static wxString ShowCoord (EDA_UNITS aUnits, const wxPoint &aPos)
 Format a coordinate or position to text. More...
 

Protected Attributes

int m_errorCode
 The error code's numeric value. More...
 
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
 The marker this item belongs to, if any. More...
 
KIIDS m_ids
 

Private Member Functions

 DRC_ITEM (int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
 

Private Attributes

DRC_RULEm_violatingRule = nullptr
 
DRC_TEST_PROVIDERm_violatingTest = nullptr
 

Static Private Attributes

static std::vector< std::reference_wrapper< RC_ITEM > > allItemTypes
 A list of all DRC_ITEM types which are valid error codes. More...
 
static DRC_ITEM heading_electrical
 
static DRC_ITEM heading_DFM
 
static DRC_ITEM heading_schematic_parity
 
static DRC_ITEM heading_signal_integrity
 
static DRC_ITEM heading_misc
 
static DRC_ITEM unconnectedItems
 
static DRC_ITEM shortingItems
 
static DRC_ITEM itemsNotAllowed
 
static DRC_ITEM clearance
 
static DRC_ITEM tracksCrossing
 
static DRC_ITEM copperEdgeClearance
 
static DRC_ITEM zonesIntersect
 
static DRC_ITEM zoneHasEmptyNet
 
static DRC_ITEM viaDangling
 
static DRC_ITEM trackDangling
 
static DRC_ITEM holeNearHole
 
static DRC_ITEM holeClearance
 
static DRC_ITEM trackWidth
 
static DRC_ITEM annularWidth
 
static DRC_ITEM drillTooSmall
 
static DRC_ITEM viaDiameter
 
static DRC_ITEM padstack
 
static DRC_ITEM microviaDrillTooSmall
 
static DRC_ITEM courtyardsOverlap
 
static DRC_ITEM missingCourtyard
 
static DRC_ITEM malformedCourtyard
 
static DRC_ITEM pthInsideCourtyard
 
static DRC_ITEM npthInsideCourtyard
 
static DRC_ITEM itemOnDisabledLayer
 
static DRC_ITEM invalidOutline
 
static DRC_ITEM duplicateFootprints
 
static DRC_ITEM missingFootprint
 
static DRC_ITEM extraFootprint
 
static DRC_ITEM netConflict
 
static DRC_ITEM unresolvedVariable
 
static DRC_ITEM silkMaskClearance
 
static DRC_ITEM silkOverlaps
 
static DRC_ITEM lengthOutOfRange
 
static DRC_ITEM skewOutOfRange
 
static DRC_ITEM tooManyVias
 
static DRC_ITEM diffPairGapOutOfRange
 
static DRC_ITEM diffPairUncoupledLengthTooLong
 

Detailed Description

Definition at line 83 of file drc_item.h.

Member Typedef Documentation

◆ KIIDS

typedef std::vector<KIID> RC_ITEM::KIIDS
inherited

Definition at line 75 of file rc_item.h.

Constructor & Destructor Documentation

◆ DRC_ITEM()

DRC_ITEM::DRC_ITEM ( int  aErrorCode = 0,
const wxString &  aTitle = "",
const wxString &  aSettingsKey = "" 
)
inlineprivate

Definition at line 112 of file drc_item.h.

113  {
114  m_errorCode = aErrorCode;
115  m_errorTitle = aTitle;
116  m_settingsKey = aSettingsKey;
117  }
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:179
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:176
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:178

References RC_ITEM::m_errorCode, RC_ITEM::m_errorTitle, and RC_ITEM::m_settingsKey.

Member Function Documentation

◆ AddItem()

void RC_ITEM::AddItem ( EDA_ITEM aItem)
inlineinherited

Definition at line 102 of file rc_item.h.

103  {
104  m_ids.push_back( aItem->m_Uuid );
105  }
KIIDS m_ids
Definition: rc_item.h:182
const KIID m_Uuid
Definition: eda_item.h:524

References RC_ITEM::m_ids, and EDA_ITEM::m_Uuid.

◆ Create() [1/2]

std::shared_ptr< DRC_ITEM > DRC_ITEM::Create ( int  aErrorCode)
static

Constructs a DRC_ITEM for the given error code.

See also
DRCE_T

Definition at line 245 of file drc_item.cpp.

246 {
247  switch( aErrorCode )
248  {
249  case DRCE_UNCONNECTED_ITEMS: return std::make_shared<DRC_ITEM>( unconnectedItems );
250  case DRCE_SHORTING_ITEMS: return std::make_shared<DRC_ITEM>( shortingItems );
251  case DRCE_ALLOWED_ITEMS: return std::make_shared<DRC_ITEM>( itemsNotAllowed );
252  case DRCE_CLEARANCE: return std::make_shared<DRC_ITEM>( clearance );
253  case DRCE_TRACKS_CROSSING: return std::make_shared<DRC_ITEM>( tracksCrossing );
254  case DRCE_COPPER_EDGE_CLEARANCE: return std::make_shared<DRC_ITEM>( copperEdgeClearance );
255  case DRCE_ZONES_INTERSECT: return std::make_shared<DRC_ITEM>( zonesIntersect );
256  case DRCE_ZONE_HAS_EMPTY_NET: return std::make_shared<DRC_ITEM>( zoneHasEmptyNet );
257  case DRCE_DANGLING_VIA: return std::make_shared<DRC_ITEM>( viaDangling );
258  case DRCE_DANGLING_TRACK: return std::make_shared<DRC_ITEM>( trackDangling );
259  case DRCE_DRILLED_HOLES_TOO_CLOSE: return std::make_shared<DRC_ITEM>( holeNearHole );
260  case DRCE_HOLE_CLEARANCE: return std::make_shared<DRC_ITEM>( holeClearance );
261  case DRCE_TRACK_WIDTH: return std::make_shared<DRC_ITEM>( trackWidth );
262  case DRCE_ANNULAR_WIDTH: return std::make_shared<DRC_ITEM>( annularWidth );
263  case DRCE_DRILL_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( drillTooSmall );
264  case DRCE_VIA_DIAMETER: return std::make_shared<DRC_ITEM>( viaDiameter );
265  case DRCE_PADSTACK: return std::make_shared<DRC_ITEM>( padstack );
266  case DRCE_MICROVIA_DRILL_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( microviaDrillTooSmall );
267  case DRCE_OVERLAPPING_FOOTPRINTS: return std::make_shared<DRC_ITEM>( courtyardsOverlap );
268  case DRCE_MISSING_COURTYARD: return std::make_shared<DRC_ITEM>( missingCourtyard );
269  case DRCE_MALFORMED_COURTYARD: return std::make_shared<DRC_ITEM>( malformedCourtyard );
270  case DRCE_PTH_IN_COURTYARD: return std::make_shared<DRC_ITEM>( pthInsideCourtyard );
271  case DRCE_NPTH_IN_COURTYARD: return std::make_shared<DRC_ITEM>( npthInsideCourtyard );
272  case DRCE_DISABLED_LAYER_ITEM: return std::make_shared<DRC_ITEM>( itemOnDisabledLayer );
273  case DRCE_INVALID_OUTLINE: return std::make_shared<DRC_ITEM>( invalidOutline );
274  case DRCE_MISSING_FOOTPRINT: return std::make_shared<DRC_ITEM>( missingFootprint );
275  case DRCE_DUPLICATE_FOOTPRINT: return std::make_shared<DRC_ITEM>( duplicateFootprints );
276  case DRCE_NET_CONFLICT: return std::make_shared<DRC_ITEM>( netConflict );
277  case DRCE_EXTRA_FOOTPRINT: return std::make_shared<DRC_ITEM>( extraFootprint );
278  case DRCE_UNRESOLVED_VARIABLE: return std::make_shared<DRC_ITEM>( unresolvedVariable );
279  case DRCE_OVERLAPPING_SILK: return std::make_shared<DRC_ITEM>( silkOverlaps );
280  case DRCE_SILK_MASK_CLEARANCE: return std::make_shared<DRC_ITEM>( silkMaskClearance );
281  case DRCE_LENGTH_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( lengthOutOfRange );
282  case DRCE_SKEW_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( skewOutOfRange );
283  case DRCE_TOO_MANY_VIAS: return std::make_shared<DRC_ITEM>( tooManyVias );
284  case DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( diffPairGapOutOfRange );
285  case DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG: return std::make_shared<DRC_ITEM>( diffPairUncoupledLengthTooLong );
286  default:
287  wxFAIL_MSG( "Unknown DRC error code" );
288  return nullptr;
289  }
290 
291  return nullptr;
292 }
static DRC_ITEM extraFootprint
Definition: drc_item.h:155
static DRC_ITEM copperEdgeClearance
Definition: drc_item.h:133
static DRC_ITEM itemOnDisabledLayer
Definition: drc_item.h:151
static DRC_ITEM missingCourtyard
Definition: drc_item.h:147
static DRC_ITEM invalidOutline
Definition: drc_item.h:152
static DRC_ITEM holeNearHole
Definition: drc_item.h:138
static DRC_ITEM silkMaskClearance
Definition: drc_item.h:158
static DRC_ITEM clearance
Definition: drc_item.h:131
static DRC_ITEM unconnectedItems
Definition: drc_item.h:128
static DRC_ITEM missingFootprint
Definition: drc_item.h:154
static DRC_ITEM itemsNotAllowed
Definition: drc_item.h:130
static DRC_ITEM microviaDrillTooSmall
Definition: drc_item.h:145
static DRC_ITEM diffPairUncoupledLengthTooLong
Definition: drc_item.h:164
static DRC_ITEM tracksCrossing
Definition: drc_item.h:132
static DRC_ITEM npthInsideCourtyard
Definition: drc_item.h:150
static DRC_ITEM malformedCourtyard
Definition: drc_item.h:148
static DRC_ITEM courtyardsOverlap
Definition: drc_item.h:146
static DRC_ITEM shortingItems
Definition: drc_item.h:129
static DRC_ITEM diffPairGapOutOfRange
Definition: drc_item.h:163
static DRC_ITEM drillTooSmall
Definition: drc_item.h:142
static DRC_ITEM duplicateFootprints
Definition: drc_item.h:153
static DRC_ITEM zoneHasEmptyNet
Definition: drc_item.h:135
static DRC_ITEM zonesIntersect
Definition: drc_item.h:134
static DRC_ITEM viaDangling
Definition: drc_item.h:136
static DRC_ITEM trackWidth
Definition: drc_item.h:140
static DRC_ITEM annularWidth
Definition: drc_item.h:141
static DRC_ITEM silkOverlaps
Definition: drc_item.h:159
static DRC_ITEM holeClearance
Definition: drc_item.h:139
static DRC_ITEM trackDangling
Definition: drc_item.h:137
static DRC_ITEM lengthOutOfRange
Definition: drc_item.h:160
static DRC_ITEM tooManyVias
Definition: drc_item.h:162
static DRC_ITEM unresolvedVariable
Definition: drc_item.h:157
static DRC_ITEM viaDiameter
Definition: drc_item.h:143
static DRC_ITEM skewOutOfRange
Definition: drc_item.h:161
static DRC_ITEM netConflict
Definition: drc_item.h:156
static DRC_ITEM pthInsideCourtyard
Definition: drc_item.h:149
static DRC_ITEM padstack
Definition: drc_item.h:144

References annularWidth, clearance, copperEdgeClearance, courtyardsOverlap, diffPairGapOutOfRange, diffPairUncoupledLengthTooLong, DRCE_ALLOWED_ITEMS, DRCE_ANNULAR_WIDTH, DRCE_CLEARANCE, DRCE_COPPER_EDGE_CLEARANCE, DRCE_DANGLING_TRACK, DRCE_DANGLING_VIA, DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE, DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG, DRCE_DISABLED_LAYER_ITEM, DRCE_DRILL_OUT_OF_RANGE, DRCE_DRILLED_HOLES_TOO_CLOSE, DRCE_DUPLICATE_FOOTPRINT, DRCE_EXTRA_FOOTPRINT, DRCE_HOLE_CLEARANCE, DRCE_INVALID_OUTLINE, DRCE_LENGTH_OUT_OF_RANGE, DRCE_MALFORMED_COURTYARD, DRCE_MICROVIA_DRILL_OUT_OF_RANGE, DRCE_MISSING_COURTYARD, DRCE_MISSING_FOOTPRINT, DRCE_NET_CONFLICT, DRCE_NPTH_IN_COURTYARD, DRCE_OVERLAPPING_FOOTPRINTS, DRCE_OVERLAPPING_SILK, DRCE_PADSTACK, DRCE_PTH_IN_COURTYARD, DRCE_SHORTING_ITEMS, DRCE_SILK_MASK_CLEARANCE, DRCE_SKEW_OUT_OF_RANGE, DRCE_TOO_MANY_VIAS, DRCE_TRACK_WIDTH, DRCE_TRACKS_CROSSING, DRCE_UNCONNECTED_ITEMS, DRCE_UNRESOLVED_VARIABLE, DRCE_VIA_DIAMETER, DRCE_ZONE_HAS_EMPTY_NET, DRCE_ZONES_INTERSECT, drillTooSmall, duplicateFootprints, extraFootprint, holeClearance, holeNearHole, invalidOutline, itemOnDisabledLayer, itemsNotAllowed, lengthOutOfRange, malformedCourtyard, microviaDrillTooSmall, missingCourtyard, missingFootprint, netConflict, npthInsideCourtyard, padstack, pthInsideCourtyard, shortingItems, silkMaskClearance, silkOverlaps, skewOutOfRange, tooManyVias, trackDangling, tracksCrossing, trackWidth, unconnectedItems, unresolvedVariable, viaDangling, viaDiameter, zoneHasEmptyNet, and zonesIntersect.

Referenced by DRC_TEST_PROVIDER_MATCHED_LENGTH::checkLengthViolations(), DRC_TEST_PROVIDER_HOLE_SIZE::checkPad(), DRC_TEST_PROVIDER_MATCHED_LENGTH::checkSkewViolations(), DRC_TEST_PROVIDER_HOLE_SIZE::checkVia(), DRC_TEST_PROVIDER_MATCHED_LENGTH::checkViaCountViolations(), PCB_MARKER::Deserialize(), BOARD_DESIGN_SETTINGS::LoadFromFile(), DRC_TEST_PROVIDER_VIA_DIAMETER::Run(), DRC_TEST_PROVIDER_DISALLOW::Run(), DRC_TEST_PROVIDER_TRACK_WIDTH::Run(), DRC_TEST_PROVIDER_ANNULUS::Run(), DRC_TEST_PROVIDER_CONNECTIVITY::Run(), DRC_TEST_PROVIDER_SILK_TO_MASK::Run(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DIALOG_FOOTPRINT_CHECKER::runChecks(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions(), DRC_TEST_PROVIDER_LVS::testFootprints(), DRC_TEST_PROVIDER_HOLE_CLEARANCE::testHoleAgainstHole(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_MISC::testOutline(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_MISC::testTextVars(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones().

◆ Create() [2/2]

std::shared_ptr< DRC_ITEM > DRC_ITEM::Create ( const wxString &  aErrorKey)
static

Constructs a DRC item from a given error settings key.

Parameters
aErrorKeyis a settings key for an error code (the untranslated string that is used to represent a given error code in settings files and for storing ignored DRC items)
Returns
the created item

Definition at line 295 of file drc_item.cpp.

296 {
297  for( const RC_ITEM& item : allItemTypes )
298  {
299  if( aErrorKey == item.GetSettingsKey() )
300  return std::make_shared<DRC_ITEM>( static_cast<const DRC_ITEM&>( item ) );
301  }
302 
303  // This can happen if a project has old-format exclusions. Just drop these items.
304  return nullptr;
305 }
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:72
static std::vector< std::reference_wrapper< RC_ITEM > > allItemTypes
A list of all DRC_ITEM types which are valid error codes.
Definition: drc_item.h:120

References allItemTypes.

◆ GetAuxItem2ID()

KIID RC_ITEM::GetAuxItem2ID ( ) const
inlineinherited

Definition at line 137 of file rc_item.h.

137 { return m_ids.size() > 2 ? m_ids[2] : niluuid;; }
KIIDS m_ids
Definition: rc_item.h:182
KIID niluuid(0)

References RC_ITEM::m_ids, and niluuid.

◆ GetAuxItem3ID()

KIID RC_ITEM::GetAuxItem3ID ( ) const
inlineinherited

Definition at line 138 of file rc_item.h.

138 { return m_ids.size() > 3 ? m_ids[3] : niluuid;; }
KIIDS m_ids
Definition: rc_item.h:182
KIID niluuid(0)

References RC_ITEM::m_ids, and niluuid.

◆ GetAuxItemID()

KIID RC_ITEM::GetAuxItemID ( ) const
inlineinherited

Definition at line 136 of file rc_item.h.

136 { return m_ids.size() > 1 ? m_ids[1] : niluuid;; }
KIIDS m_ids
Definition: rc_item.h:182
KIID niluuid(0)

References RC_ITEM::m_ids, and niluuid.

Referenced by RC_ITEM::ShowReport().

◆ GetErrorCode()

int RC_ITEM::GetErrorCode ( ) const
inlineinherited

◆ GetErrorMessage()

wxString RC_ITEM::GetErrorMessage ( ) const
virtualinherited

Return the error message of a RC_ITEM.

Definition at line 37 of file rc_item.cpp.

38 {
39  if( m_errorMessage.IsEmpty() )
40  return GetErrorText();
41  else
42  return m_errorMessage;
43 }
wxString GetErrorText() const
Definition: rc_item.h:160
wxString m_errorMessage
A message describing the details of this specific error.
Definition: rc_item.h:177

References RC_ITEM::GetErrorText(), and RC_ITEM::m_errorMessage.

Referenced by RC_ITEM::ShowReport().

◆ GetErrorText()

wxString RC_ITEM::GetErrorText ( ) const
inlineinherited

Definition at line 160 of file rc_item.h.

161  {
162  return wxGetTranslation( m_errorTitle );
163  }
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:178

References RC_ITEM::m_errorTitle.

Referenced by CLEANUP_ITEM::CLEANUP_ITEM(), RC_ITEM::GetErrorMessage(), and PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES().

◆ GetItemsWithSeverities()

static std::vector<std::reference_wrapper<RC_ITEM> > DRC_ITEM::GetItemsWithSeverities ( )
inlinestatic

Definition at line 100 of file drc_item.h.

101  {
102  return allItemTypes;
103  }
static std::vector< std::reference_wrapper< RC_ITEM > > allItemTypes
A list of all DRC_ITEM types which are valid error codes.
Definition: drc_item.h:120

References allItemTypes.

Referenced by BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), and DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP().

◆ GetMainItemID()

KIID RC_ITEM::GetMainItemID ( ) const
inlineinherited

Definition at line 135 of file rc_item.h.

135 { return m_ids.size() > 0 ? m_ids[0] : niluuid; }
KIIDS m_ids
Definition: rc_item.h:182
KIID niluuid(0)

References RC_ITEM::m_ids, and niluuid.

Referenced by RC_ITEM::ShowReport().

◆ GetParent()

MARKER_BASE* RC_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 141 of file rc_item.h.

141 { return m_parent; }
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:180

References RC_ITEM::m_parent.

◆ GetSettingsKey()

wxString RC_ITEM::GetSettingsKey ( ) const
inlineinherited

Definition at line 165 of file rc_item.h.

166  {
167  return m_settingsKey;
168  }
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:179

References RC_ITEM::m_settingsKey.

Referenced by RC_ITEM::ShowReport().

◆ GetViolatingRule()

DRC_RULE* DRC_ITEM::GetViolatingRule ( ) const
inline

Definition at line 106 of file drc_item.h.

106 { return m_violatingRule; }
DRC_RULE * m_violatingRule
Definition: drc_item.h:167

References m_violatingRule.

◆ GetViolatingTest()

DRC_TEST_PROVIDER* DRC_ITEM::GetViolatingTest ( ) const
inline

Definition at line 109 of file drc_item.h.

109 { return m_violatingTest; }
DRC_TEST_PROVIDER * m_violatingTest
Definition: drc_item.h:168

References m_violatingTest.

◆ SetErrorCode()

void RC_ITEM::SetErrorCode ( int  aCode)
inlineinherited

Definition at line 153 of file rc_item.h.

153 { m_errorCode = aCode; }
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:176

References RC_ITEM::m_errorCode.

◆ SetErrorMessage()

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

Definition at line 95 of file rc_item.h.

95 { m_errorMessage = aMessage; }
wxString m_errorMessage
A message describing the details of this specific error.
Definition: rc_item.h:177

References RC_ITEM::m_errorMessage.

◆ SetItems() [1/3]

void RC_ITEM::SetItems ( const KIIDS aIds)
inlineinherited

Definition at line 97 of file rc_item.h.

98  {
99  m_ids = aIds;
100  }
KIIDS m_ids
Definition: rc_item.h:182

References RC_ITEM::m_ids.

◆ SetItems() [2/3]

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

Definition at line 107 of file rc_item.h.

109  {
110  m_ids.clear();
111 
112  m_ids.push_back( aItem->m_Uuid );
113 
114  if( bItem )
115  m_ids.push_back( bItem->m_Uuid );
116 
117  if( cItem )
118  m_ids.push_back( cItem->m_Uuid );
119 
120  if( dItem )
121  m_ids.push_back( dItem->m_Uuid );
122  }
KIIDS m_ids
Definition: rc_item.h:182
const KIID m_Uuid
Definition: eda_item.h:524

References RC_ITEM::m_ids, and EDA_ITEM::m_Uuid.

◆ SetItems() [3/3]

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

Definition at line 124 of file rc_item.h.

126  {
127  m_ids.clear();
128 
129  m_ids.push_back( aItem );
130  m_ids.push_back( bItem );
131  m_ids.push_back( cItem );
132  m_ids.push_back( dItem );
133  }
KIIDS m_ids
Definition: rc_item.h:182

References RC_ITEM::m_ids.

◆ SetParent()

void RC_ITEM::SetParent ( MARKER_BASE aMarker)
inlineinherited

Definition at line 140 of file rc_item.h.

140 { m_parent = aMarker; }
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:180

References RC_ITEM::m_parent.

◆ SetViolatingRule()

void DRC_ITEM::SetViolatingRule ( DRC_RULE aRule)
inline

Definition at line 105 of file drc_item.h.

105 { m_violatingRule = aRule; }
DRC_RULE * m_violatingRule
Definition: drc_item.h:167

References m_violatingRule.

◆ SetViolatingTest()

void DRC_ITEM::SetViolatingTest ( DRC_TEST_PROVIDER aProvider)
inline

Definition at line 108 of file drc_item.h.

108 { m_violatingTest = aProvider; }
DRC_TEST_PROVIDER * m_violatingTest
Definition: drc_item.h:168

References m_violatingTest.

◆ ShowCoord()

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

Format a coordinate or position to text.

Definition at line 46 of file rc_item.cpp.

47 {
48  return wxString::Format( "@(%s, %s)",
49  MessageTextFromValue( aUnits, aPos.x ),
50  MessageTextFromValue( aUnits, aPos.y ) );
51 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Definition: base_units.cpp:123
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format(), and MessageTextFromValue().

Referenced by RC_ITEM::ShowReport().

◆ ShowReport()

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

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

56 {
57  wxString severity;
58 
59  switch( aSeverity )
60  {
61  case RPT_SEVERITY_ERROR: severity = wxT( "Severity: error" ); break;
62  case RPT_SEVERITY_WARNING: severity = wxT( "Severity: warning" ); break;
63  case RPT_SEVERITY_ACTION: severity = wxT( "Severity: action" ); break;
64  case RPT_SEVERITY_INFO: severity = wxT( "Severity: info" ); break;
65  default: ;
66  };
67 
68  if( m_parent && m_parent->IsExcluded() )
69  severity += wxT( " (excluded)" );
70 
71  EDA_ITEM* mainItem = nullptr;
72  EDA_ITEM* auxItem = nullptr;
73 
74  auto ii = aItemMap.find( GetMainItemID() );
75 
76  if( ii != aItemMap.end() )
77  mainItem = ii->second;
78 
79  ii = aItemMap.find( GetAuxItemID() );
80 
81  if( ii != aItemMap.end() )
82  auxItem = ii->second;
83 
84  // Note: some customers machine-process these. So:
85  // 1) don't translate
86  // 2) try not to re-order or change syntax
87  // 3) report numeric error code (which should be more stable) in addition to message
88 
89  if( mainItem && auxItem )
90  {
91  return wxString::Format( wxT( "[%s]: %s %s\n %s: %s\n %s: %s\n" ),
94  severity,
95  ShowCoord( aUnits, mainItem->GetPosition() ),
96  mainItem->GetSelectMenuText( aUnits ),
97  ShowCoord( aUnits, auxItem->GetPosition() ),
98  auxItem->GetSelectMenuText( aUnits ) );
99  }
100  else if( mainItem )
101  {
102  return wxString::Format( wxT( "[%s]: %s %s\n %s: %s\n" ),
103  GetSettingsKey(),
104  GetErrorMessage(),
105  severity,
106  ShowCoord( aUnits, mainItem->GetPosition() ),
107  mainItem->GetSelectMenuText( aUnits ) );
108  }
109  else
110  {
111  return wxString::Format( wxT( "[%s]: %s %s\n" ),
112  GetSettingsKey(),
113  GetErrorMessage(),
114  severity );
115  }
116 }
virtual wxPoint GetPosition() const
Definition: eda_item.h:301
static wxString ShowCoord(EDA_UNITS aUnits, const wxPoint &aPos)
Format a coordinate or position to text.
Definition: rc_item.cpp:46
KIID GetAuxItemID() const
Definition: rc_item.h:136
bool IsExcluded() const
Definition: marker_base.h:94
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:180
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: eda_item.cpp:123
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
wxString GetSettingsKey() const
Definition: rc_item.h:165
KIID GetMainItemID() const
Definition: rc_item.h:135
virtual wxString GetErrorMessage() const
Return the error message of a RC_ITEM.
Definition: rc_item.cpp:37

References Format(), RC_ITEM::GetAuxItemID(), RC_ITEM::GetErrorMessage(), RC_ITEM::GetMainItemID(), EDA_ITEM::GetPosition(), EDA_ITEM::GetSelectMenuText(), RC_ITEM::GetSettingsKey(), MARKER_BASE::IsExcluded(), RC_ITEM::m_parent, RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, RPT_SEVERITY_WARNING, and RC_ITEM::ShowCoord().

Member Data Documentation

◆ allItemTypes

std::vector< std::reference_wrapper< RC_ITEM > > DRC_ITEM::allItemTypes
staticprivate

A list of all DRC_ITEM types which are valid error codes.

Definition at line 120 of file drc_item.h.

Referenced by Create(), and GetItemsWithSeverities().

◆ annularWidth

DRC_ITEM DRC_ITEM::annularWidth
staticprivate

Definition at line 141 of file drc_item.h.

Referenced by Create().

◆ clearance

DRC_ITEM DRC_ITEM::clearance
staticprivate

Definition at line 131 of file drc_item.h.

Referenced by Create().

◆ copperEdgeClearance

DRC_ITEM DRC_ITEM::copperEdgeClearance
staticprivate

Definition at line 133 of file drc_item.h.

Referenced by Create().

◆ courtyardsOverlap

DRC_ITEM DRC_ITEM::courtyardsOverlap
staticprivate

Definition at line 146 of file drc_item.h.

Referenced by Create().

◆ diffPairGapOutOfRange

DRC_ITEM DRC_ITEM::diffPairGapOutOfRange
staticprivate

Definition at line 163 of file drc_item.h.

Referenced by Create().

◆ diffPairUncoupledLengthTooLong

DRC_ITEM DRC_ITEM::diffPairUncoupledLengthTooLong
staticprivate

Definition at line 164 of file drc_item.h.

Referenced by Create().

◆ drillTooSmall

DRC_ITEM DRC_ITEM::drillTooSmall
staticprivate

Definition at line 142 of file drc_item.h.

Referenced by Create().

◆ duplicateFootprints

DRC_ITEM DRC_ITEM::duplicateFootprints
staticprivate

Definition at line 153 of file drc_item.h.

Referenced by Create().

◆ extraFootprint

DRC_ITEM DRC_ITEM::extraFootprint
staticprivate

Definition at line 155 of file drc_item.h.

Referenced by Create().

◆ heading_DFM

DRC_ITEM DRC_ITEM::heading_DFM
staticprivate

Definition at line 123 of file drc_item.h.

◆ heading_electrical

DRC_ITEM DRC_ITEM::heading_electrical
staticprivate

Definition at line 122 of file drc_item.h.

◆ heading_misc

DRC_ITEM DRC_ITEM::heading_misc
staticprivate

Definition at line 126 of file drc_item.h.

◆ heading_schematic_parity

DRC_ITEM DRC_ITEM::heading_schematic_parity
staticprivate

Definition at line 124 of file drc_item.h.

◆ heading_signal_integrity

DRC_ITEM DRC_ITEM::heading_signal_integrity
staticprivate

Definition at line 125 of file drc_item.h.

◆ holeClearance

DRC_ITEM DRC_ITEM::holeClearance
staticprivate

Definition at line 139 of file drc_item.h.

Referenced by Create().

◆ holeNearHole

DRC_ITEM DRC_ITEM::holeNearHole
staticprivate

Definition at line 138 of file drc_item.h.

Referenced by Create().

◆ invalidOutline

DRC_ITEM DRC_ITEM::invalidOutline
staticprivate

Definition at line 152 of file drc_item.h.

Referenced by Create().

◆ itemOnDisabledLayer

DRC_ITEM DRC_ITEM::itemOnDisabledLayer
staticprivate

Definition at line 151 of file drc_item.h.

Referenced by Create().

◆ itemsNotAllowed

DRC_ITEM DRC_ITEM::itemsNotAllowed
staticprivate

Definition at line 130 of file drc_item.h.

Referenced by Create().

◆ lengthOutOfRange

DRC_ITEM DRC_ITEM::lengthOutOfRange
staticprivate

Definition at line 160 of file drc_item.h.

Referenced by Create().

◆ m_errorCode

int RC_ITEM::m_errorCode
protectedinherited

◆ m_errorMessage

wxString RC_ITEM::m_errorMessage
protectedinherited

A message describing the details of this specific error.

Definition at line 177 of file rc_item.h.

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

◆ m_errorTitle

wxString RC_ITEM::m_errorTitle
protectedinherited

The string describing the type of error.

Definition at line 178 of file rc_item.h.

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

◆ m_ids

◆ m_parent

MARKER_BASE* RC_ITEM::m_parent
protectedinherited

The marker this item belongs to, if any.

Definition at line 180 of file rc_item.h.

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

◆ m_settingsKey

wxString RC_ITEM::m_settingsKey
protectedinherited

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

Definition at line 179 of file rc_item.h.

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

◆ m_violatingRule

DRC_RULE* DRC_ITEM::m_violatingRule = nullptr
private

Definition at line 167 of file drc_item.h.

Referenced by GetViolatingRule(), and SetViolatingRule().

◆ m_violatingTest

DRC_TEST_PROVIDER* DRC_ITEM::m_violatingTest = nullptr
private

Definition at line 168 of file drc_item.h.

Referenced by GetViolatingTest(), and SetViolatingTest().

◆ malformedCourtyard

DRC_ITEM DRC_ITEM::malformedCourtyard
staticprivate

Definition at line 148 of file drc_item.h.

Referenced by Create().

◆ microviaDrillTooSmall

DRC_ITEM DRC_ITEM::microviaDrillTooSmall
staticprivate

Definition at line 145 of file drc_item.h.

Referenced by Create().

◆ missingCourtyard

DRC_ITEM DRC_ITEM::missingCourtyard
staticprivate

Definition at line 147 of file drc_item.h.

Referenced by Create().

◆ missingFootprint

DRC_ITEM DRC_ITEM::missingFootprint
staticprivate

Definition at line 154 of file drc_item.h.

Referenced by Create().

◆ netConflict

DRC_ITEM DRC_ITEM::netConflict
staticprivate

Definition at line 156 of file drc_item.h.

Referenced by Create().

◆ npthInsideCourtyard

DRC_ITEM DRC_ITEM::npthInsideCourtyard
staticprivate

Definition at line 150 of file drc_item.h.

Referenced by Create().

◆ padstack

DRC_ITEM DRC_ITEM::padstack
staticprivate

Definition at line 144 of file drc_item.h.

Referenced by Create().

◆ pthInsideCourtyard

DRC_ITEM DRC_ITEM::pthInsideCourtyard
staticprivate

Definition at line 149 of file drc_item.h.

Referenced by Create().

◆ shortingItems

DRC_ITEM DRC_ITEM::shortingItems
staticprivate

Definition at line 129 of file drc_item.h.

Referenced by Create().

◆ silkMaskClearance

DRC_ITEM DRC_ITEM::silkMaskClearance
staticprivate

Definition at line 158 of file drc_item.h.

Referenced by Create().

◆ silkOverlaps

DRC_ITEM DRC_ITEM::silkOverlaps
staticprivate

Definition at line 159 of file drc_item.h.

Referenced by Create().

◆ skewOutOfRange

DRC_ITEM DRC_ITEM::skewOutOfRange
staticprivate

Definition at line 161 of file drc_item.h.

Referenced by Create().

◆ tooManyVias

DRC_ITEM DRC_ITEM::tooManyVias
staticprivate

Definition at line 162 of file drc_item.h.

Referenced by Create().

◆ trackDangling

DRC_ITEM DRC_ITEM::trackDangling
staticprivate

Definition at line 137 of file drc_item.h.

Referenced by Create().

◆ tracksCrossing

DRC_ITEM DRC_ITEM::tracksCrossing
staticprivate

Definition at line 132 of file drc_item.h.

Referenced by Create().

◆ trackWidth

DRC_ITEM DRC_ITEM::trackWidth
staticprivate

Definition at line 140 of file drc_item.h.

Referenced by Create().

◆ unconnectedItems

DRC_ITEM DRC_ITEM::unconnectedItems
staticprivate

Definition at line 128 of file drc_item.h.

Referenced by Create().

◆ unresolvedVariable

DRC_ITEM DRC_ITEM::unresolvedVariable
staticprivate

Definition at line 157 of file drc_item.h.

Referenced by Create().

◆ viaDangling

DRC_ITEM DRC_ITEM::viaDangling
staticprivate

Definition at line 136 of file drc_item.h.

Referenced by Create().

◆ viaDiameter

DRC_ITEM DRC_ITEM::viaDiameter
staticprivate

Definition at line 143 of file drc_item.h.

Referenced by Create().

◆ zoneHasEmptyNet

DRC_ITEM DRC_ITEM::zoneHasEmptyNet
staticprivate

Definition at line 135 of file drc_item.h.

Referenced by Create().

◆ zonesIntersect

DRC_ITEM DRC_ITEM::zonesIntersect
staticprivate

Definition at line 134 of file drc_item.h.

Referenced by Create().


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