libdballe  7.7
Public Member Functions | Data Fields
dballe::Coords Struct Reference

Coordinates. More...

#include <types.h>

Public Member Functions

 Coords ()
 Construct a missing Coords.
 
 Coords (int lat, int lon)
 Construct a coords from integers in 1/100000 of a degree.
 
 Coords (double lat, double lon)
 Construct a coords from values in degrees.
 
bool is_missing () const
 Check if these coordinates are undefined.
 
void set (int lat, int lon)
 Set from integers in 1/100000 of a degree.
 
void set (double lat, double lon)
 Set from values in degrees.
 
double dlat () const
 Get the latitude in degrees.
 
double dlon () const
 Get the longitude in degrees.
 
int compare (const Coords &o) const
 Compare two Coords strutures, for use in sorting. More...
 
bool operator== (const Coords &dt) const
 
bool operator!= (const Coords &dt) const
 
bool operator< (const Coords &dt) const
 
bool operator> (const Coords &dt) const
 
bool operator<= (const Coords &dt) const
 
bool operator>= (const Coords &dt) const
 
void print (FILE *out, const char *end="\n") const
 Print to an output stream.
 

Data Fields

int lat
 Latitude in 1/100000 of a degree (5 significant digits preserved)
 
int lon
 Longitude in 1/100000 of a degree (5 significant digits preserved) and normalised between -180.0 and 180.0.
 

Detailed Description

Coordinates.

When given as an integer, a latitude/longitude value is intended in 1/100000 of a degree, which is the maximum resolution supported by DB-All.e.

When given as a double a latitude/longitude value is intended to be in degrees.

Longitude values are normalized between -180.0 and 180.0.

Member Function Documentation

int dballe::Coords::compare ( const Coords o) const

Compare two Coords strutures, for use in sorting.

Sorting happens by latitude first, then by longitude. It is implemented mainly for the purpose of being able to use Coords as a key in a sorted container.

Returns
-1 if *this < o, 0 if *this == o, 1 if *this > o

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