35 std::shared_ptr<RC_ITEMS_PROVIDER> aMarkersProvider,
36 std::shared_ptr<RC_ITEMS_PROVIDER> aRatsnestProvider,
37 std::shared_ptr<RC_ITEMS_PROVIDER> aFpWarningsProvider) :
39 m_reportUnits( aReportUnits ),
40 m_markersProvider(
std::
move( aMarkersProvider ) ),
41 m_ratsnestProvider(
std::
move( aRatsnestProvider ) ),
42 m_fpWarningsProvider(
std::
move( aFpWarningsProvider ) )
53 FILE* fp = wxFopen( aFullFileName, wxT(
"w" ) );
58 std::map<KIID, EDA_ITEM*> itemMap;
66 fprintf( fp,
"** Drc report for %s **\n",
TO_UTF8( fn.GetFullName() ) );
72 fprintf( fp,
"\n** Found %d DRC violations **\n", count );
74 for(
int i = 0; i < count; ++i )
77 SEVERITY severity = item->GetParent()->GetSeverity();
82 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
87 fprintf( fp,
"\n** Found %d unconnected pads **\n", count );
89 for(
int i = 0; i < count; ++i )
94 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
99 fprintf( fp,
"\n** Found %d Footprint errors **\n", count );
101 for(
int i = 0; i < count; ++i )
106 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
110 fprintf( fp,
"\n** End of Report **\n" );
123 std::ofstream jsonFileStream( aFullFileName.fn_str() );
127 std::map<KIID, EDA_ITEM*> itemMap;
133 reportHead.
$schema =
"https://schemas.kicad.org/drc.v1.json";
134 reportHead.
source = fn.GetFullName();
142 SEVERITY severity = item->GetParent()->GetSeverity();
145 severity = bds.
GetSeverity( item->GetErrorCode() );
148 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
159 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
171 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
177 nlohmann::json saveJson = nlohmann::json( reportHead );
178 jsonFileStream << std::setw( 4 ) << saveJson << std::endl;
179 jsonFileStream.flush();
180 jsonFileStream.close();
constexpr EDA_IU_SCALE pcbIUScale
wxString GetMajorMinorPatchVersion()
Get the major, minor and patch version in a string major.minor.patch This is extracted by CMake from ...
Container for design settings for a BOARD object.
SEVERITY GetSeverity(int aDRCErrorCode)
Information pertinent to a Pcbnew printed circuit board.
const wxString & GetFileName() const
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::shared_ptr< RC_ITEMS_PROVIDER > m_ratsnestProvider
bool WriteJsonReport(const wxString &aFullFileName)
std::shared_ptr< RC_ITEMS_PROVIDER > m_markersProvider
bool WriteTextReport(const wxString &aFullFileName)
DRC_REPORT(BOARD *aBoard, EDA_UNITS aReportUnits, std::shared_ptr< RC_ITEMS_PROVIDER > aMarkersProvider, std::shared_ptr< RC_ITEMS_PROVIDER > aRatsnestProvider, std::shared_ptr< RC_ITEMS_PROVIDER > aFpWarningsProvider)
std::shared_ptr< RC_ITEMS_PROVIDER > m_fpWarningsProvider
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::vector< VIOLATION > unconnected_items
std::vector< VIOLATION > violations
std::vector< VIOLATION > schematic_parity
wxString coordinate_units