Libosmium
2.9.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <location.hpp>
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) | |
Location (const Location &)=default | |
Location (Location &&)=default | |
Location & | operator= (const Location &)=default |
Location & | operator= (Location &&)=default |
~Location ()=default | |
constexpr | operator bool () const noexcept |
constexpr bool | valid () 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 |
double | lat () const |
double | lat_without_check () const |
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 Public Attributes | |
static constexpr int32_t | undefined_coordinate = 2147483647 |
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.
|
inlineexplicitnoexcept |
Create undefined Location.
|
inlinenoexcept |
Create Location with given x and y coordinates. Note that these coordinates are coordinate_precision times larger than the real coordinates.
|
inlinenoexcept |
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.
|
default |
|
default |
|
default |
|
inline |
|
inline |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inline |
Get latitude.
invalid_location | if the location is invalid |
|
inline |
Get latitude without checking the validity.
|
inline |
Get longitude.
invalid_location | if the location is invalid |
|
inline |
Get longitude without checking the validity.
|
inlineexplicitnoexcept |
Check whether the coordinates of this location are defined.
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Check whether the coordinates are inside the usual bounds (-180<=lon<=180, -90<=lat<=90).
|
inlinenoexcept |
|
inlinenoexcept |
|
private |
|
private |
|
static |