Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/fileformats/file_import_export.cpp
Original file line number Diff line number Diff line change
@@ -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.
*
Expand All @@ -21,6 +21,7 @@

#include "file_import_export.h"

#include <algorithm>
#include <exception>
#include <memory>
#include <utility>
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion src/fileformats/file_import_export.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2012, 2013 Pete Curtis
* Copyright 2018 Kai Pastor
* Copyright 2018, 2024 Kai Pastor
*
* This file is part of OpenOrienteering.
*
Expand Down Expand Up @@ -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.
*/
Expand Down
10 changes: 10 additions & 0 deletions src/fileformats/ocd_file_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/fileformats/ocd_types.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013, 2015-2019 Kai Pastor
* Copyright 2013, 2015-2019, 2024 Kai Pastor
*
* This file is part of OpenOrienteering.
*
Expand Down Expand Up @@ -231,7 +231,8 @@ namespace Ocd
{
FlagCtl1 = 0x01,
FlagCtl2 = 0x02,
FlagLeft = 0x04
FlagLeft = 0x04,
FlagGap = 0x08
};

// Flags in Y coordinate
Expand Down