MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLLatLongCoord Class Reference
Inheritance diagram for TSLLatLongCoord:

Detailed Description

This class represents a single geodetic coordinate.

It allows changes to the coordinate, through its latitude and longitude, as well as providing relational operators for coordinates.

Public Member Functions

 TSLLatLongCoord ()
 
 TSLLatLongCoord (double lat, double lon)
 
double latitude () const
 
void latitude (double latitude)
 
double longitude () const
 
void longitude (double longitude)
 
TSLLatLongCoord operator+ (const TSLLatLongCoord &anotherLatLongCoord) const
 
TSLLatLongCoord operator- (const TSLLatLongCoord &anotherLatLongCoord) const
 
TSLLatLongCoordoperator+= (const TSLLatLongCoord &delta)
 
TSLLatLongCoordoperator-= (const TSLLatLongCoord &delta)
 
TSLLatLongCoordoperator= (const TSLLatLongCoord &anotherLatLongCoord)
 
bool operator> (const TSLLatLongCoord &anotherLatLongCoord) const
 
bool operator< (const TSLLatLongCoord &anotherLatLongCoord) const
 
bool operator== (const TSLLatLongCoord &anotherLatLongCoord) const
 
bool operator!= (const TSLLatLongCoord &anotherLatLongCoord) const
 
double distance (const TSLLatLongCoord &anotherCoord) const
 
double squareDistance (const TSLLatLongCoord &anotherCoord) const
 
void translate (double dlat, double dlon)
 
void translate (const TSLLatLongCoord &delta)
 
void setVal (double lat, double lon)
 

Static Public Member Functions

static void clampByWrapping (const double latIn, const double lonIn, double &latOut, double &lonOut)
 
static void clampByWrapping (double &lat, double &lon)
 
static TSLLatLongCoord createWrapped (double lat, double lon)
 

Protected Attributes

double m_latitude
 
double m_longitude
 

Constructor & Destructor Documentation

◆ TSLLatLongCoord() [1/2]

TSLLatLongCoord::TSLLatLongCoord ( )
inline

◆ TSLLatLongCoord() [2/2]

TSLLatLongCoord::TSLLatLongCoord ( double lat,
double lon )
inline

Construct a TSLLatLongCoord object from a latitude and a longitude.

Parameters
latThe latitude
lonThe longitude

Member Function Documentation

◆ clampByWrapping() [1/2]

static void TSLLatLongCoord::clampByWrapping ( const double latIn,
const double lonIn,
double & latOut,
double & lonOut )
inlinestatic

Clamp (by wrapping, not saturation) a latitude and a longitude to the range [-90,90]x[-180,180].

◆ clampByWrapping() [2/2]

static void TSLLatLongCoord::clampByWrapping ( double & lat,
double & lon )
inlinestatic

Clamp (by wrapping, not saturation) a latitude and a longitude to the range [-90,90]x[-180,180].

◆ createWrapped()

static TSLLatLongCoord TSLLatLongCoord::createWrapped ( double lat,
double lon )
inlinestatic

Construct a TSLLatLongCoord where the lat and lon are adjusted (by wrapping, not saturation) to be in the range [-90,90]x[-180,180].

◆ distance()

double TSLLatLongCoord::distance ( const TSLLatLongCoord & anotherCoord) const
inline

Calculate the distance between this coordinate and another.

This assumes that the latitude and longitude form a regular planar grid, nominally in degrees.

◆ latitude() [1/2]

double TSLLatLongCoord::latitude ( ) const
inline

Query the latitude.

◆ latitude() [2/2]

void TSLLatLongCoord::latitude ( double latitude)
inline

Set the latitude.

If the new latitude value is greater than 90 degrees or less than -90 degrees, then it will be clamped into range.

Parameters
latitudeNew value

◆ longitude() [1/2]

double TSLLatLongCoord::longitude ( ) const
inline

Query the longitude.

◆ longitude() [2/2]

void TSLLatLongCoord::longitude ( double longitude)
inline

Set the longitude.

If the new longitude value is greater than 180 degrees or less than -180 degrees, then the value will be clamped.

Parameters
longitudeNew value

◆ operator!=()

bool TSLLatLongCoord::operator!= ( const TSLLatLongCoord & anotherLatLongCoord) const
inline

Compares two coordinates.

Parameters
anotherLatLongCoordSource comparison.
Returns
true if one or both of the longitude and the latitude values are different.

◆ operator+()

TSLLatLongCoord TSLLatLongCoord::operator+ ( const TSLLatLongCoord & anotherLatLongCoord) const
inline

Adds two geodetic coordinates.

Translates the coordinates by the specified delta coordinate.

Parameters
anotherLatLongCoordDelta coordinate.
Returns
a TSLLatLongCoord containing the summed value. If the result would be outside [-90,90]x[-180,180], it will be clamped to that range.

◆ operator+=()

TSLLatLongCoord & TSLLatLongCoord::operator+= ( const TSLLatLongCoord & delta)
inline

Translates the LHS geodetic coordinate by the RHS.

Parameters
deltaDelta coordinate.
Returns
the LHS TSLLatLongCoord, which contains the summed value. If the result would be outside [-90,90]x[-180,180], it will be clamped to that range.

◆ operator-()

TSLLatLongCoord TSLLatLongCoord::operator- ( const TSLLatLongCoord & anotherLatLongCoord) const
inline

Subtracts two geodetic coordinates.

Translates the coordinate by the negative of the specified delta coordinate.

Parameters
anotherLatLongCoordDelta coordinate.
Returns
a TSLLatLongCoord containing the subtracted value. If the result would be outside [-90,90]x[-180,180], it will be clamped to that range.

◆ operator-=()

TSLLatLongCoord & TSLLatLongCoord::operator-= ( const TSLLatLongCoord & delta)
inline

Translates the LHS geodetic coordinate by the negative of the RHS.

Parameters
deltaDelta coordinate.
Returns
the LHS TSLLatLongCoord, which contains the subtracted value. If the result would be outside [-90,90]x[-180,180], it will be clamped to that range.

◆ operator<()

bool TSLLatLongCoord::operator< ( const TSLLatLongCoord & anotherLatLongCoord) const
inline

Less than operator.

Performs a comparison between two coordinates.

Parameters
anotherLatLongCoordSource comparison.
Returns
true if the longitude is less, or if the longitudes are equal and the latitude is less.

◆ operator=()

TSLLatLongCoord & TSLLatLongCoord::operator= ( const TSLLatLongCoord & anotherLatLongCoord)
inline

Assignment operator.

Assigns the lat, long values of the argument coordinate to those of this coordinate.

Parameters
anotherLatLongCoordSource for new value.
Returns
reference to updated value.

◆ operator==()

bool TSLLatLongCoord::operator== ( const TSLLatLongCoord & anotherLatLongCoord) const
inline

Compares two coordinates.

Parameters
anotherLatLongCoordSource comparison.
Returns
true if the longitude and the latitude values are equal.

◆ operator>()

bool TSLLatLongCoord::operator> ( const TSLLatLongCoord & anotherLatLongCoord) const
inline

Greater than operator.

Performs a comparison between two coordinates.

Parameters
anotherLatLongCoordSource comparison.
Returns
true if the longitude is greater, or if the longitudes are equal and the latitude is greater.

◆ setVal()

void TSLLatLongCoord::setVal ( double lat,
double lon )
inline

◆ squareDistance()

double TSLLatLongCoord::squareDistance ( const TSLLatLongCoord & anotherCoord) const
inline

Calculate the square of the distance between this coordinate and another.

This assumes that the latitude and longitude form a regular planar grid, nominally in degrees.

◆ translate() [1/2]

void TSLLatLongCoord::translate ( const TSLLatLongCoord & delta)
inline

◆ translate() [2/2]

void TSLLatLongCoord::translate ( double dlat,
double dlon )
inline

Translates the point by the delta values passed in. If the result would be outside [-90,90]x[-180,180], it will be clamped to that range.

Parameters
dlatlatitude value to translate by (degrees).
dlonlongitude value to translate by (degrees).

Member Data Documentation

◆ m_latitude

double TSLLatLongCoord::m_latitude
protected

◆ m_longitude

double TSLLatLongCoord::m_longitude
protected