Loading...
Searching...
No Matches
osmium::geom::Coordinates Struct Reference

`#include <coordinates.hpp>`

## Public Member Functions

| Coordinates () noexcept
| Coordinates (double cx, double cy) noexcept
| Coordinates (const osmium::Location &location)
bool | valid () const noexcept
void | append_to_string (std::string &s, const char infix, int precision) const
void | append_to_string (std::string &s, const char prefix, const char infix, const char suffix, int precision) const

## Public Attributes

double | x
double | y

## Constructor & Destructor Documentation

## Coordinates() [1/3]

osmium::geom::Coordinates::Coordinates | ( |  | ) |

inlinenoexcept

Default constructor creates invalid coordinates.

## Coordinates() [2/3]

osmium::geom::Coordinates::Coordinates | ( | double | cx,
|  | double | cy )

inlineexplicitnoexcept

Create Coordinates from doubles. If any of them is NaN, the coordinates are invalid.

## Coordinates() [3/3]

osmium::geom::Coordinates::Coordinates | ( | const osmium::Location & | location | ) |

inline

Create Coordinates from a Location. Will throw osmium::invalid_location if the location is not valid.

This constructor is not explicit on purpose allowing use of a Location everywhere a Coordinates object is needed.

## Member Function Documentation

## append_to_string() [1/2]

void osmium::geom::Coordinates::append_to_string | ( | std::string & | s,
|  | const char | infix,
|  | int | precision ) const

inline

Convert coordinates to text and append to given string. If the coordinate is invalid, the fixed string "invalid" will be added to the string.

Parameters

  s | String to append the coordinates to.
  infix | Character to print between the two coordinates.
  precision | Number of digits after the decimal point the coordinate will be rounded to.

## append_to_string() [2/2]

void osmium::geom::Coordinates::append_to_string | ( | std::string & | s,
|  | const char | prefix,
|  | const char | infix,
|  | const char | suffix,
|  | int | precision ) const

inline

Convert coordinates to text and append to given string. If the coordinate is invalid, the fixed string "invalid" will be added to the string between the prefix and suffix characters.

Parameters

  s | String to append the coordinates to.
  prefix | Character to print before the first coordinate.
  infix | Character to print between the two coordinates.
  suffix | Character to print after the second coordinate.
  precision | Number of digits after the decimal point the coordinate will be rounded to.

## valid()

bool osmium::geom::Coordinates::valid | ( |  | ) | const

inlinenoexcept

Coordinates are invalid if they have been default constructed.

## Member Data Documentation

## x

double osmium::geom::Coordinates::x

## y

double osmium::geom::Coordinates::y

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

- include/osmium/geom/coordinates.hpp