33#include <nlohmann/json.hpp>
39 m_reportUnits( aReportUnits )
46 wxFFile file( aFullFileName, wxT(
"wt" ) );
48 if( !file.IsOpened() )
53 wxString msg = wxString::Format(
_(
"ERC report (%s, Encoding UTF8)\n" ),
56 std::map<KIID, EDA_ITEM*> itemMap;
67 for(
unsigned i = 0; i < sheetList.size(); i++ )
69 msg << wxString::Format(
_(
"\n***** Sheet %s\n" ), sheetList[i].PathHumanReadable() );
89 msg << marker->
GetRCItem()->ShowReport( &unitsProvider, severity, itemMap );
93 msg << wxString::Format(
_(
"\n ** ERC messages: %d Errors %d Warnings %d\n" ), total_count,
94 err_count, warn_count );
109 std::ofstream jsonFileStream( aFullFileName.fn_str() );
112 std::map<KIID, EDA_ITEM*> itemMap;
128 for(
unsigned i = 0; i < sheetList.size(); i++ )
130 RC_JSON::ERC_SHEET jsonSheet;
131 jsonSheet.path = sheetList[i].PathHumanReadable();
132 jsonSheet.uuid_path = sheetList[i].Path().AsString();
153 marker->
GetRCItem()->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
155 jsonSheet.violations.push_back( violation );
158 reportHead.
sheets.push_back( jsonSheet );
162 nlohmann::json saveJson = nlohmann::json( reportHead );
163 jsonFileStream << std::setw( 4 ) << saveJson << std::endl;
164 jsonFileStream.flush();
165 jsonFileStream.close();
constexpr EDA_IU_SCALE schIUScale
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 ...
ERC_REPORT(SCHEMATIC *aSchematic, EDA_UNITS aReportUnits)
bool WriteJsonReport(const wxString &aFullFileName)
bool WriteTextReport(const wxString &aFullFileName)
Container for ERC settings.
SEVERITY GetSeverity(int aErrorCode) const
std::shared_ptr< RC_ITEM > GetRCItem() const
enum TYPEMARKER GetMarkerType() const
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Holds all the data relating to one schematic.
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
ERC_SETTINGS & ErcSettings() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Fill an item cache for temporary use when many items need to be fetched.
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()
std::vector< ERC_SHEET > sheets
wxString coordinate_units