OSM::Coordinate

Search for usage in LXR

OSM::Coordinate Class Reference

#include <datatypes.h>

Public Member Functions

constexpr Coordinate (double lat, double lon)
 
constexpr Coordinate (uint32_t lat, uint32_t lon)
 
constexpr Coordinate (uint64_t z)
 
constexpr bool isValid () const
 
constexpr double latF () const
 
constexpr double lonF () const
 
constexpr bool operator== (Coordinate other) const
 
constexpr uint64_t z () const
 

Public Attributes

uint32_t latitude = std::numeric_limits<uint32_t>::max()
 
uint32_t longitude = std::numeric_limits<uint32_t>::max()
 

Detailed Description

Coordinate, stored as 1e7 * degree to avoid floating point precision issues, and offset to unsigned values to make the z-order curve work.

Can be in an invalid state with coordinates out of range, see isValid().

See also
https://en.wikipedia.org/wiki/Z-order_curve for the z-order curve stuff

Definition at line 37 of file datatypes.h.

Constructor & Destructor Documentation

◆ Coordinate() [1/3]

OSM::Coordinate::Coordinate ( double lat,
double lon )
inlineexplicitconstexpr

Definition at line 40 of file datatypes.h.

◆ Coordinate() [2/3]

OSM::Coordinate::Coordinate ( uint32_t lat,
uint32_t lon )
inlineexplicitconstexpr

Definition at line 44 of file datatypes.h.

◆ Coordinate() [3/3]

OSM::Coordinate::Coordinate ( uint64_t z)
inlineexplicitconstexpr

Create a coordinate from a z-order curve index.

Definition at line 50 of file datatypes.h.

Member Function Documentation

◆ isValid()

bool OSM::Coordinate::isValid ( ) const
inlinenodiscardconstexpr

Definition at line 60 of file datatypes.h.

◆ latF()

double OSM::Coordinate::latF ( ) const
inlinenodiscardconstexpr

Definition at line 80 of file datatypes.h.

◆ lonF()

double OSM::Coordinate::lonF ( ) const
inlinenodiscardconstexpr

Definition at line 84 of file datatypes.h.

◆ operator==()

bool OSM::Coordinate::operator== ( Coordinate other) const
inlinenodiscardconstexpr

Definition at line 64 of file datatypes.h.

◆ z()

uint64_t OSM::Coordinate::z ( ) const
inlinenodiscardconstexpr

Z-order curve value for this coordinate.

Definition at line 70 of file datatypes.h.

Member Data Documentation

◆ latitude

uint32_t OSM::Coordinate::latitude = std::numeric_limits<uint32_t>::max()

Definition at line 89 of file datatypes.h.

◆ longitude

uint32_t OSM::Coordinate::longitude = std::numeric_limits<uint32_t>::max()

Definition at line 90 of file datatypes.h.


The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.