Mapper  0.9.0
API documentation
Public Member Functions | Public Attributes | List of all members
OpenOrienteering::MapCoord::BoundsOffset Struct Reference

Offset and flag for importing and moving out-of-bounds MapCoords. More...

#include <map_coord.h>

Public Member Functions

constexpr bool isZero () const
 Returns true if both x and y are equal to zero. More...
 
void reset (bool check_for_offset)
 Resets x and y to zero, and sets check_for_offset. More...
 

Public Attributes

qint64 x = 0
 
qint64 y = 0
 
bool check_for_offset = false
 

Detailed Description

Offset and flag for importing and moving out-of-bounds MapCoords.

Since reducing MapCoord bits from 60 (64 minus flags) to 32, we need to deal with old files possibly having out-of-bounds coordinates.

In addition, we need to deal with files suffering from out-of-print range coordinates (issue #513). In the print dialog, the printable area is up to 1000 m of paper [!] wide and high. The top left point is allowed to be up 1000 m away from the origin in each direction. Every point to be printed (from the UI) must be within this area.

The idea for correcting maps during loading (where we may hit the out-of-bounds coordinates for the first time) is to look at the first point in the map (the georeferencing reference point or the coordinates of the first object). If this point is more than 500 m of paper [!] from the origin, it is moved to the origin, and the same offset is applied to all other coordinates. After that adjustment, anything up to 1000 m of paper away from the first point will be in the printable area.

The current implementation uses a global variable and thus can handle only one file at the same time. However, the global variables is initially configured to a neutral value. Any code activating the tracking of out-of-bounds coordinates it responsible to rollback this neutral configuration when finished.

Since symbol definitions are stored in MapCoords, too, extra care needs to be taken not to adjust coordinates of the symbols' elements.

See also
XMLFileImporter::import

Member Function Documentation

◆ isZero()

constexpr bool OpenOrienteering::MapCoord::BoundsOffset::isZero ( ) const

Returns true if both x and y are equal to zero.

◆ reset()

void OpenOrienteering::MapCoord::BoundsOffset::reset ( bool  check_for_offset)
inline

Resets x and y to zero, and sets check_for_offset.

Member Data Documentation

◆ check_for_offset

bool OpenOrienteering::MapCoord::BoundsOffset::check_for_offset = false

◆ x

qint64 OpenOrienteering::MapCoord::BoundsOffset::x = 0

◆ y

qint64 OpenOrienteering::MapCoord::BoundsOffset::y = 0

The documentation for this struct was generated from the following file: