KiCad PCB EDA Suite
No Matches
Go to the documentation of this file.
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 *
19 * or you may search the website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
24#ifndef ERC_ITEM_H
25#define ERC_ITEM_H
27#include <optional>
28#include <rc_item.h>
29#include "sch_sheet_path.h"
40 ERC_TREE_MODEL( EDA_DRAW_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
41 RC_TREE_MODEL( aParentFrame, aView )
42 {
43 }
52 void GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
53 unsigned int aCol ) const override;
56class ERC_ITEM : public RC_ITEM
63 static std::shared_ptr<ERC_ITEM> Create( int aErrorCode );
65 static std::shared_ptr<ERC_ITEM> Create( const wxString& aErrorKey )
66 {
67 for( const RC_ITEM& item : allItemTypes )
68 {
69 if( aErrorKey == item.GetSettingsKey() )
70 return std::make_shared<ERC_ITEM>( static_cast<const ERC_ITEM&>( item ) );
71 }
73 return nullptr;
74 }
76 static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
77 {
78 return allItemTypes;
79 }
87 bool IsSheetSpecific() const { return m_sheetSpecificPath.has_value(); }
93 void SetSheetSpecificPath( const SCH_SHEET_PATH& aSpecificSheet )
94 {
95 m_sheetSpecificPath = aSpecificSheet;
96 }
104 {
105 wxASSERT( m_sheetSpecificPath.has_value() );
106 return m_sheetSpecificPath.value();
107 }
115 void SetItemsSheetPaths( const SCH_SHEET_PATH& mainItemSheet )
116 {
117 m_mainItemSheet = mainItemSheet;
118 }
127 void SetItemsSheetPaths( const SCH_SHEET_PATH& mainItemSheet,
128 const SCH_SHEET_PATH& auxItemSheet )
129 {
130 m_mainItemSheet = mainItemSheet;
131 m_auxItemSheet = auxItemSheet;
132 }
139 {
140 wxASSERT( MainItemHasSheetPath() );
141 return m_mainItemSheet.value();
142 }
149 {
150 wxASSERT( AuxItemHasSheetPath() );
151 return m_auxItemSheet.value();
152 }
159 bool MainItemHasSheetPath() { return m_mainItemSheet.has_value(); }
166 bool AuxItemHasSheetPath() { return m_auxItemSheet.has_value(); }
169 ERC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
170 {
171 m_errorCode = aErrorCode;
172 m_errorTitle = aTitle;
173 m_settingsKey = aSettingsKey;
174 }
176 std::optional<SCH_SHEET_PATH> m_mainItemSheet;
177 std::optional<SCH_SHEET_PATH> m_auxItemSheet;
180 static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
226 std::optional<SCH_SHEET_PATH> m_sheetSpecificPath;
230#endif // ERC_ITEM_H
The base class for create windows for drawing purpose.
static ERC_ITEM differentUnitValue
Definition: erc_item.h:221
std::optional< SCH_SHEET_PATH > m_mainItemSheet
Definition: erc_item.h:176
static ERC_ITEM busToBusConflict
Definition: erc_item.h:206
static ERC_ITEM pinTableWarning
Definition: erc_item.h:191
static std::shared_ptr< ERC_ITEM > Create(const wxString &aErrorKey)
Definition: erc_item.h:65
static ERC_ITEM footprintLinkIssues
Definition: erc_item.h:214
const SCH_SHEET_PATH & GetSpecificSheetPath() const
Gets the SCH_SHEET_PATH this ERC item is bound to.
Definition: erc_item.h:103
static ERC_ITEM unresolvedVariable
Definition: erc_item.h:208
static ERC_ITEM duplicateSheetName
Definition: erc_item.h:186
static ERC_ITEM noConnectDangling
Definition: erc_item.h:195
static ERC_ITEM busDefinitionConflict
Definition: erc_item.h:202
static ERC_ITEM libSymbolIssues
Definition: erc_item.h:212
SCH_SHEET_PATH & GetMainItemSheetPath()
Gets the SCH_SHEET_PATH of the main item causing this ERC violation.
Definition: erc_item.h:138
static ERC_ITEM pinNotDriven
Definition: erc_item.h:189
static ERC_ITEM undefinedNetclass
Definition: erc_item.h:209
static ERC_ITEM extraUnits
Definition: erc_item.h:216
bool AuxItemHasSheetPath()
Determines whether the auxiliary item causing this ERC violation has a specific SCH_SHEET_PATH bindin...
Definition: erc_item.h:166
static ERC_ITEM heading_conflicts
Definition: erc_item.h:183
void SetSheetSpecificPath(const SCH_SHEET_PATH &aSpecificSheet)
Sets the SCH_SHEET_PATH this ERC item is bound to.
Definition: erc_item.h:93
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
Definition: erc_item.cpp:247
static ERC_ITEM noConnectConnected
Definition: erc_item.h:194
static ERC_ITEM heading_misc
Definition: erc_item.h:184
static ERC_ITEM endpointOffGrid
Definition: erc_item.h:187
static ERC_ITEM busToNetConflict
Definition: erc_item.h:207
static ERC_ITEM differentUnitFootprint
Definition: erc_item.h:200
bool MainItemHasSheetPath()
Determines whether the main item causing this ERC violation has a specific SCH_SHEET_PATH binding.
Definition: erc_item.h:159
static ERC_ITEM hierLabelMismatch
Definition: erc_item.h:193
static ERC_ITEM heading_connections
Definition: erc_item.h:182
static ERC_ITEM missingUnits
Definition: erc_item.h:217
static ERC_ITEM similarLabels
Definition: erc_item.h:199
static std::vector< std::reference_wrapper< RC_ITEM > > allItemTypes
A list of all ERC_ITEM types which are valid error codes.
Definition: erc_item.h:180
void SetItemsSheetPaths(const SCH_SHEET_PATH &mainItemSheet)
Sets the SCH_SHEET_PATH of the main item causing this ERC violation to (e.g.
Definition: erc_item.h:115
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: erc_item.h:76
static ERC_ITEM globalLabelDangling
Definition: erc_item.h:197
static ERC_ITEM labelDangling
Definition: erc_item.h:196
static ERC_ITEM differentUnitNet
Definition: erc_item.h:201
static ERC_ITEM pinTableError
Definition: erc_item.h:192
static ERC_ITEM netNotBusMember
Definition: erc_item.h:205
static ERC_ITEM wireDangling
Definition: erc_item.h:211
ERC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: erc_item.h:169
static ERC_ITEM powerpinNotDriven
Definition: erc_item.h:190
static ERC_ITEM missingPowerInputPin
Definition: erc_item.h:220
std::optional< SCH_SHEET_PATH > m_sheetSpecificPath
True if this item is specific to a sheet instance (as opposed to applying to all instances)
Definition: erc_item.h:226
static ERC_ITEM missingBidiPin
Definition: erc_item.h:219
bool IsSheetSpecific() const
Determines whether the ERC item is bound to a specific sheet, or is common across multiple sheets (e....
Definition: erc_item.h:87
static ERC_ITEM unannotated
Definition: erc_item.h:215
void SetItemsSheetPaths(const SCH_SHEET_PATH &mainItemSheet, const SCH_SHEET_PATH &auxItemSheet)
Set the SCH_SHEET PATHs of the main and auxiliary items causing this ERC violation to (e....
Definition: erc_item.h:127
static ERC_ITEM missingInputPin
Definition: erc_item.h:218
static ERC_ITEM netclassConflict
Definition: erc_item.h:204
static ERC_ITEM singleGlobalLabel
Definition: erc_item.h:198
static ERC_ITEM busEntryNeeded
Definition: erc_item.h:223
static ERC_ITEM simulationModelIssues
Definition: erc_item.h:210
std::optional< SCH_SHEET_PATH > m_auxItemSheet
Definition: erc_item.h:177
SCH_SHEET_PATH & GetAuxItemSheetPath()
Gets the SCH_SHEET_PATH of the auxillary item causing this ERC violation.
Definition: erc_item.h:148
static ERC_ITEM multipleNetNames
Definition: erc_item.h:203
static ERC_ITEM pinNotConnected
Definition: erc_item.h:188
static ERC_ITEM libSymbolMismatch
Definition: erc_item.h:213
static ERC_ITEM duplicateReference
Definition: erc_item.h:222
A specialisation of the RC_TREE_MODEL class to enable ERC errors / warnings to be resolved in a speci...
Definition: erc_item.h:38
ERC_TREE_MODEL(EDA_DRAW_FRAME *aParentFrame, wxDataViewCtrl *aView)
Definition: erc_item.h:40
void GetValue(wxVariant &aVariant, wxDataViewItem const &aItem, unsigned int aCol) const override
Override of RC_TREE_MODEL::GetValue which returns item descriptions in a specific SCH_SHEET_PATH cont...
Definition: erc_item.cpp:303
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:79
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:187
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:184
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:186
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.