Import: DXF parser/imported improve unsupported features count

Classify unsupported features by type, and report on
the breakdown.
This commit is contained in:
Furgo
2025-06-18 09:22:03 +02:00
parent ef0dd661a3
commit bf0c8f24fa
3 changed files with 8 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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;
};