Import: DXF parser/imported improve unsupported features count
Classify unsupported features by type, and report on the breakdown.
This commit is contained in:
@@ -1384,7 +1384,6 @@ Py::Object ImpExpDxfRead::getStatsAsPyObject()
|
||||
statsDict.setItem("finalScalingFactor", Py::Float(m_stats.finalScalingFactor));
|
||||
statsDict.setItem("importTimeSeconds", Py::Float(m_stats.importTimeSeconds));
|
||||
statsDict.setItem("totalEntitiesCreated", Py::Long(m_stats.totalEntitiesCreated));
|
||||
statsDict.setItem("unsupportedFeaturesCount", Py::Long(m_stats.unsupportedFeaturesCount));
|
||||
|
||||
Py::Dict entityCountsDict;
|
||||
for (const auto& pair : m_stats.entityCounts) {
|
||||
@@ -1398,5 +1397,11 @@ Py::Object ImpExpDxfRead::getStatsAsPyObject()
|
||||
}
|
||||
statsDict.setItem("importSettings", importSettingsDict);
|
||||
|
||||
Py::Dict unsupportedFeaturesDict;
|
||||
for (const auto& pair : m_stats.unsupportedFeatures) {
|
||||
unsupportedFeaturesDict.setItem(pair.first.c_str(), Py::Long(pair.second));
|
||||
}
|
||||
statsDict.setItem("unsupportedFeatures", unsupportedFeaturesDict);
|
||||
|
||||
return statsDict;
|
||||
}
|
||||
|
||||
@@ -2397,9 +2397,9 @@ bool CDxfRead::SkipBlockContents()
|
||||
template<typename... args>
|
||||
void CDxfRead::UnsupportedFeature(const char* format, args&&... argValuess)
|
||||
{
|
||||
m_stats.unsupportedFeaturesCount++;
|
||||
// NOLINTNEXTLINE(runtime/printf)
|
||||
std::string formattedMessage = fmt::sprintf(format, std::forward<args>(argValuess)...);
|
||||
m_stats.unsupportedFeatures[formattedMessage]++;
|
||||
// We place these formatted messages in a map, count their occurrences and not their first
|
||||
// occurrence.
|
||||
if (m_unsupportedFeaturesNoted[formattedMessage].first++ == 0) {
|
||||
|
||||
@@ -187,8 +187,8 @@ struct DxfImportStats
|
||||
double finalScalingFactor = 1.0;
|
||||
std::map<std::string, int> entityCounts;
|
||||
std::map<std::string, std::string> importSettings;
|
||||
std::map<std::string, int> unsupportedFeatures;
|
||||
int totalEntitiesCreated = 0;
|
||||
int unsupportedFeaturesCount = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user