olp-cpp-sdk
1.22.0
|
A geographic location that uses the WGS84 Coordinate System. More...
#include <GeoCoordinates.h>
Public Member Functions | |
GeoCoordinates () | |
Creates a GeoCoordinates instance with invalid coordinates. | |
GeoCoordinates (double latitude_radians, double longitude_radians) | |
Creates a GeoCoordinates instance from latitude and longitude. More... | |
GeoCoordinates (double latitude_degrees, double longitude_degrees, DegreeType degrees) | |
Creates a GeoCoordinates instance from latitude and longitude. More... | |
GeoPoint | ToGeoPoint () const |
Converts the current coordinates to a geo point. More... | |
double | GetLatitude () const |
Gets the WGS84 latitude in radians. More... | |
void | SetLatitude (double latitude_radians) |
Sets the latitude in radians. More... | |
double | GetLongitude () const |
Gets the WGS84 longitude in radians. More... | |
void | SetLongitude (double longitude_radians) |
Sets the longitude in radians. More... | |
double | GetLatitudeDegrees () const |
Gets the WGS84 latitude in degrees. More... | |
void | SetLatitudeDegrees (double latitude_degrees) |
Sets the latitude in degrees. More... | |
double | GetLongitudeDegrees () const |
Gets the WGS84 longitude in degrees. More... | |
void | SetLongitudeDegrees (double longitude_degrees) |
Sets the longitude in degrees. More... | |
GeoCoordinates | Normalized () const |
Normalizes the latitude and longitude to the [-pi/2, pi/2] and [-pi, pi] ranges correspondingly. | |
operator bool () const | |
Overloads the bool operator. More... | |
bool | IsValid () const |
Checks whether the radian values of latitude and longitude are valid double numbers. More... | |
Static Public Member Functions | |
static GeoCoordinates | FromDegrees (double latitude_degrees, double longitude_degrees) |
Creates a GeoCoordinates instance from latitude and longitude. More... | |
static GeoCoordinates | FromGeoPoint (const GeoPoint &geo_point) |
Creates a GeoCoordinates instance from a geo point. More... | |
A geographic location that uses the WGS84 Coordinate System.
Latitude values range from 0 at the equator to 90 degrees north and -90 degrees south. Longitude values range from 0 at the prime meridian to 180 degrees east and -180 degrees west.
Internal representation of angles is radians.
olp::geo::GeoCoordinates::GeoCoordinates | ( | double | latitude_radians, |
double | longitude_radians | ||
) |
Creates a GeoCoordinates
instance from latitude and longitude.
Normalized()
to put a coordinate in a valid range.latitude_radians | The WGS84 latitude in radians. Valid values are in the [-pi/2, pi/2] range. |
longitude_radians | The WGS84 longitude in radians. Valid values are in the [-pi, pi] range. |
olp::geo::GeoCoordinates::GeoCoordinates | ( | double | latitude_degrees, |
double | longitude_degrees, | ||
DegreeType | degrees | ||
) |
Creates a GeoCoordinates
instance from latitude and longitude.
Normalized()
to put a coordinate in a valid range.latitude_degrees | The WGS84 latitude in degrees. Valid values are in the [-90, 90] range. |
longitude_degrees | The WGS84 longitude in degrees. Valid values are in the [-180, 180] range. |
degrees | The dispatch tag for coordinates in degrees. |
|
static |
Creates a GeoCoordinates
instance from latitude and longitude.
Normalized()
to put a value in a valid range.latitude_degrees | The WGS84 latitude in degrees. Valid values are in the [-90, 90] range. |
longitude_degrees | The WGS84 longitude in degrees. Valid values are in the [-180, 180] range. |
GeoCoordinates
instance based on the specified latitude and longitude.
|
static |
Creates a GeoCoordinates
instance from a geo point.
geo_point | The geo point. |
GeoCoordinates
instance based on the specified geo point. double olp::geo::GeoCoordinates::GetLatitude | ( | ) | const |
Gets the WGS84 latitude in radians.
double olp::geo::GeoCoordinates::GetLatitudeDegrees | ( | ) | const |
Gets the WGS84 latitude in degrees.
double olp::geo::GeoCoordinates::GetLongitude | ( | ) | const |
Gets the WGS84 longitude in radians.
double olp::geo::GeoCoordinates::GetLongitudeDegrees | ( | ) | const |
Gets the WGS84 longitude in degrees.
bool olp::geo::GeoCoordinates::IsValid | ( | ) | const |
Checks whether the radian values of latitude and longitude are valid double numbers.
The check happens with the help of math::isnan
.
|
explicit |
Overloads the bool operator.
IsValid
void olp::geo::GeoCoordinates::SetLatitude | ( | double | latitude_radians | ) |
Sets the latitude in radians.
latitude_radians | The WGS84 latitude in radians. Valid values are in the [-pi/2, pi/2] range. |
void olp::geo::GeoCoordinates::SetLatitudeDegrees | ( | double | latitude_degrees | ) |
Sets the latitude in degrees.
latitude_degrees | The WGS84 latitude in degrees. Valid values are in the [-90, 90] range. |
void olp::geo::GeoCoordinates::SetLongitude | ( | double | longitude_radians | ) |
Sets the longitude in radians.
longitude_radians | The WGS84 longitude in radians. Valid values are in the [-pi, pi] range. |
void olp::geo::GeoCoordinates::SetLongitudeDegrees | ( | double | longitude_degrees | ) |
Sets the longitude in degrees.
longitude_degrees | The WGS84 longitude in degrees. Valid values are in the [-180, 180] range. |
GeoPoint olp::geo::GeoCoordinates::ToGeoPoint | ( | ) | const |
Converts the current coordinates to a geo point.