Libosmium
2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <location.hpp>
Public Types | |
enum | { undefined_coordinate = 2147483647 } |
Public Member Functions | |
constexpr | Location () noexcept |
constexpr | Location (const int32_t x, const int32_t y) noexcept |
constexpr | Location (const int64_t x, const int64_t y) noexcept |
Location (const double lon, const double lat) | |
constexpr | operator bool () const noexcept |
constexpr bool | valid () const noexcept |
constexpr bool | is_defined () const noexcept |
constexpr bool | is_undefined () const noexcept |
constexpr int32_t | x () const noexcept |
constexpr int32_t | y () const noexcept |
Location & | set_x (const int32_t x) noexcept |
Location & | set_y (const int32_t y) noexcept |
double | lon () const |
double | lon_without_check () const noexcept |
double | lat () const |
double | lat_without_check () const noexcept |
Location & | set_lon (double lon) noexcept |
Location & | set_lat (double lat) noexcept |
Location & | set_lon (const char *str) |
Location & | set_lat (const char *str) |
Location & | set_lon_partial (const char **str) |
Location & | set_lat_partial (const char **str) |
template<typename T > | |
T | as_string_without_check (T iterator, const char separator=',') const |
template<typename T > | |
T | as_string (T iterator, const char separator=',') const |
Static Public Member Functions | |
static int32_t | double_to_fix (const double c) noexcept |
static constexpr double | fix_to_double (const int32_t c) noexcept |
Static Private Member Functions | |
static constexpr double | precision () noexcept |
Private Attributes | |
int32_t | m_x |
int32_t | m_y |
Locations define a place on earth.
Locations are stored in 32 bit integers for the x and y coordinates, respectively. This gives you an accuracy of a few centimeters, good enough for OSM use. (The main OSM database uses the same scheme.)
An undefined Location can be created by calling the constructor without parameters.
Coordinates are never checked on whether they are inside bounds. Call valid() to check this.
|
inlineexplicitconstexprnoexcept |
Create undefined Location.
|
inlineconstexprnoexcept |
Create Location with given x and y coordinates. Note that these coordinates are coordinate_precision times larger than the real coordinates.
|
inlineconstexprnoexcept |
Create Location with given x and y coordinates. Note that these coordinates are coordinate_precision times larger than the real coordinates.
|
inline |
Create Location with given longitude and latitude in WGS84 coordinates.
|
inline |
|
inline |
|
inlinestaticnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlineconstexprnoexcept |
Returns true if at least one of the coordinates is defined.
See also is_undefined() and is_valid().
|
inlineconstexprnoexcept |
Returns true if both coordinates are undefined.
See also is_defined() and is_valid().
|
inline |
Get latitude.
invalid_location | if the location is invalid |
|
inlinenoexcept |
Get latitude without checking the validity.
|
inline |
Get longitude.
invalid_location | if the location is invalid |
|
inlinenoexcept |
Get longitude without checking the validity.
|
inlineexplicitconstexprnoexcept |
Check whether the coordinates of this location are defined.
|
inlinestaticconstexprprivatenoexcept |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Check whether the coordinates are inside the usual bounds (-180<=lon<=180, -90<=lat<=90).
See also is_defined() and is_undefined().
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
private |
|
private |