diff --git a/src/fileformats/file_import_export.cpp b/src/fileformats/file_import_export.cpp index 8583ea3c8..d0dec615d 100644 --- a/src/fileformats/file_import_export.cpp +++ b/src/fileformats/file_import_export.cpp @@ -1,7 +1,7 @@ /* * Copyright 2012, 2013 Pete Curtis * Copyright 2013, 2014 Thomas Schöps - * Copyright 2013-2020 Kai Pastor + * Copyright 2013-2020, 2024 Kai Pastor * * This file is part of OpenOrienteering. * @@ -21,6 +21,7 @@ #include "file_import_export.h" +#include #include #include #include @@ -84,6 +85,13 @@ void ImportExport::setOption(const QString& name, const QVariant& value) } +void ImportExport::addWarningOnce(const QString& str) +{ + if (std::find(warnings_.begin(), warnings_.end(), str) == warnings_.end()) + warnings_.emplace_back(str); +} + + // ### Importer ### Importer::~Importer() = default; diff --git a/src/fileformats/file_import_export.h b/src/fileformats/file_import_export.h index 6097f8fa7..9dc388c8d 100644 --- a/src/fileformats/file_import_export.h +++ b/src/fileformats/file_import_export.h @@ -1,6 +1,6 @@ /* * Copyright 2012, 2013 Pete Curtis - * Copyright 2018 Kai Pastor + * Copyright 2018, 2024 Kai Pastor * * This file is part of OpenOrienteering. * @@ -112,6 +112,13 @@ class ImportExport */ void addWarning(const QString& str) { warnings_.emplace_back(str); } + /** + * Adds a string to the current list of warnings if not yet in the list. + * + * The provided message should be translated. + */ + void addWarningOnce(const QString& str); + /** * Returns the current list of warnings collected by this object. */ diff --git a/src/fileformats/ocd_file_import.cpp b/src/fileformats/ocd_file_import.cpp index 0fac5b1c2..788d56b0f 100644 --- a/src/fileformats/ocd_file_import.cpp +++ b/src/fileformats/ocd_file_import.cpp @@ -2163,6 +2163,16 @@ void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area, { object->coords[i] = convertOcdPoint(ocd_points[i]); setPointFlags(object, i, is_area, ocd_points[i]); + if (ocd_points[i].x & Ocd::OcdPoint32::FlagGap) + { + // Virtual gaps are not supported + addWarningOnce(tr("Virtual gaps in line objects are not supported.")); + } + if (ocd_points[i].x & Ocd::OcdPoint32::FlagLeft || ocd_points[i].y & Ocd::OcdPoint32::FlagRight) + { + // Double line gaps are not supported + addWarningOnce(tr("Gaps in double line objects are not supported.")); + } } // For path objects, create closed parts where the position of the last point is equal to that of the first point diff --git a/src/fileformats/ocd_types.h b/src/fileformats/ocd_types.h index f872e9a39..b3da02e41 100644 --- a/src/fileformats/ocd_types.h +++ b/src/fileformats/ocd_types.h @@ -1,5 +1,5 @@ /* - * Copyright 2013, 2015-2019 Kai Pastor + * Copyright 2013, 2015-2019, 2024 Kai Pastor * * This file is part of OpenOrienteering. * @@ -231,7 +231,8 @@ namespace Ocd { FlagCtl1 = 0x01, FlagCtl2 = 0x02, - FlagLeft = 0x04 + FlagLeft = 0x04, + FlagGap = 0x08 }; // Flags in Y coordinate