World Ocean Simulation System (WOSS) library
woss::Coord Class Reference

Coordinates (lat, long) class definitions and functions library. More...

#include <coordinates-definitions.h>

Inheritance diagram for woss::Coord:
Inheritance graph
Collaboration diagram for woss::Coord:
Collaboration graph

Public Member Functions

 Coord (double lat=COORD_NOT_SET_VALUE, double lon=COORD_NOT_SET_VALUE)
 
 Coord (const Coord &copy)
 
void setLatitude (double lat)
 
void setLongitude (double lon)
 
virtual bool isValid () const
 
double getLatitude () const
 
double getLongitude () const
 
int getMarsdenSquare () const
 
int getMarsdenOneDegreeSquare () const
 
MarsdenCoord getMarsdenCoord () const
 
double getInitialBearing (const Coord &destination) const
 
double getFinalBearing (const Coord &destination) const
 
double getGreatCircleDistance (const Coord &destination, double depth=0) const
 
Coordoperator= (const Coord &copy)
 
friend::std::ostream & operator<< (::std::ostream &os, const Coord &instance)
 

Static Public Member Functions

static const Coord getCoordFromBearing (const Coord &start_coord, double bearing, double distance, double depth=0.0)
 
static const Coord getCoordAlongGreatCircle (const Coord &start_coord, const Coord &end_coord, double distance, double depth=0.0)
 
static const Coord getCoordFromUtmWgs84 (double easting, double northing, double utm_zone_number, UtmZoneChar utm_zone_char)
 

Static Public Attributes

static const double COORD_MIN_LATITUDE = -90.0
 Minimum valid Latitude.
 
static const double COORD_MAX_LATITUDE = 90.0
 Maximum valid Latitude.
 
static const double COORD_MIN_LONGITUDE = -180.0
 Minimum valid Longitude.
 
static const double COORD_MAX_LONGITUDE = 180.0
 Maximum valid Longitude.
 
static const double EARTH_RADIUS = 6371000.0
 Mean earth radius in meters.
 
static const double EARTH_SEMIMAJOR_AXIS = 6378137.0
 Earth's semi-major axis in meters as defined by both GRS80 and WGS84.
 
static const double EARTH_GRS80_POLAR_RADIUS = 6356752.3141
 Earth's semi-major axis in meters as defined by GRS80.
 
static const double EARTH_WGS84_POLAR_RADIUS = 6356752.314245
 Earth's polar radius in meters as defined by WGS84.
 
static const double EARTH_GRS80_ECCENTRICITY = 0.0818191910428158
 Earth's first eccentricity as defined by GRS80.
 
static const double EARTH_WGS84_ECCENTRICITY = 0.0818191908426215
 Earth's first eccentricity as defined by WGS84.
 

Protected Member Functions

void updateMarsdenCoord ()
 

Static Protected Member Functions

static bool isValidUtmZoneChar (UtmZoneChar utm_zone_char)
 

Protected Attributes

double latitude
 
double longitude
 
int marsden_square
 
int marsden_one_degree
 

Friends

const Coord operator+ (const Coord &left, const Coord &right)
 
const Coord operator- (const Coord &left, const Coord &right)
 
Coordoperator+= (Coord &left, const Coord &right)
 
Coordoperator-= (Coord &left, const Coord &right)
 
bool operator== (const Coord &left, const Coord &right)
 
bool operator!= (const Coord &left, const Coord &right)
 
bool operator> (const Coord &left, const Coord &right)
 
bool operator< (const Coord &left, const Coord &right)
 
bool operator>= (const Coord &left, const Coord &right)
 
bool operator<= (const Coord &left, const Coord &right)
 

Detailed Description

Coordinates (lat, long) class definitions and functions library.

Coord class stores a double decimal degree latitude and double decimal degree longitude. It has a reach library for Marsden coordinates, distance, bearing and arithmetic calculations. This class has virtual methods for the sole purpose of CoordZ inheritance.

Constructor & Destructor Documentation

◆ Coord() [1/2]

Coord::Coord ( double  lat = COORD_NOT_SET_VALUE,
double  lon = COORD_NOT_SET_VALUE 
)

Coord constructor.

Parameters
latdecimal degree latitude value. Default value makes the instance not valid
londecimal degree longitude value. Default value makes the instance not valid

References updateMarsdenCoord().

Referenced by getCoordFromBearing(), and getCoordFromUtmWgs84().

Here is the call graph for this function:

◆ Coord() [2/2]

Coord::Coord ( const Coord copy)

Coord copy constructor.

Parameters
copyCoord to be copied

References latitude, longitude, and updateMarsdenCoord().

Here is the call graph for this function:

Member Function Documentation

◆ getCoordAlongGreatCircle()

const Coord Coord::getCoordAlongGreatCircle ( const Coord start_coord,
const Coord end_coord,
double  distance,
double  depth = 0.0 
)
static

Gets destination Cood given bearing and distance from a start Coord, travelling along a (shortest distance) great circle arc of given depth to end Coord

Parameters
start_coordvalid start Coord instance
end_coordvalid end Coord instance
distancedistance measured in meters
depthdepth measured in meters
Returns
a new Coord instance containing the destination coordinates

References getCoordFromBearing(), and getInitialBearing().

Referenced by woss::CoordZ::getCoordZAlongGreatCircle().

Here is the call graph for this function:

◆ getCoordFromBearing()

const Coord Coord::getCoordFromBearing ( const Coord start_coord,
double  bearing,
double  distance,
double  depth = 0.0 
)
static

Gets destination Cood given bearing and distance from a start Coord, travelling along a (shortest distance) great circle arc of given depth

Parameters
start_coordvalid start Coord instance
bearingbearing measured in radians
distancedistance measured in meters
depthdepth measured in meters
Returns
a new Coord instance containing the destination coordinates

References Coord(), EARTH_RADIUS, isValid(), latitude, and longitude.

Referenced by getCoordAlongGreatCircle(), and woss::ACToolboxWoss::initCoordZVector().

Here is the call graph for this function:

◆ getCoordFromUtmWgs84()

const Coord Coord::getCoordFromUtmWgs84 ( double  easting,
double  northing,
double  utm_zone_number,
UtmZoneChar  utm_zone_char 
)
static

Gets destination Cood given easting and northing in UTM - WGS84 coordinates

Parameters
eastingvalid easting relative to central UTM zone meridian
end_coordvalid northing
utm_zone_numbervalidzone number
utm_zone_charvalidzone character
Returns
a new Coord instance containing the destination coordinates

References Coord(), EARTH_SEMIMAJOR_AXIS, EARTH_WGS84_POLAR_RADIUS, isValidUtmZoneChar(), latitude, and longitude.

Here is the call graph for this function:

◆ getFinalBearing()

double Coord::getFinalBearing ( const Coord destination) const

Gets the final bearing of a trajectory

Parameters
destinationdestination Coord instance
Returns
initial bearing measured in radians

References getInitialBearing().

Here is the call graph for this function:

◆ getGreatCircleDistance()

double Coord::getGreatCircleDistance ( const Coord destination,
double  depth = 0 
) const

Gets calculates great-circle distances between the two points – that is, the shortest distance over the earth’s surface – using the ‘Haversine’ formula

Parameters
destinationvalid destination Coord instance
Returns
distance measured in meters

References EARTH_RADIUS, isValid(), latitude, and longitude.

Referenced by woss::CoordZ::getCoordZAlongGreatCircle(), woss::WossManager::getWossPressure(), woss::WossManagerResDb::getWossTimeArr(), woss::WossManagerResDbMT::getWossTimeArr(), woss::WossManager::getWossTimeArr(), woss::ACToolboxWoss::initAltimetry(), woss::Woss::initialize(), and woss::WossDbManager::RangeOperator::operator()().

Here is the call graph for this function:

◆ getInitialBearing()

double Coord::getInitialBearing ( const Coord destination) const

Gets the initial bearing of a trajectory

Parameters
destinationdestination Coord instance
Returns
initial bearing measured in radians

References isValid(), latitude, and longitude.

Referenced by getCoordAlongGreatCircle(), getFinalBearing(), woss::Woss::initialize(), and woss::WossDbManager::BearingOperator::operator()().

Here is the call graph for this function:

◆ getLatitude()

◆ getLongitude()

◆ getMarsdenCoord()

MarsdenCoord woss::Coord::getMarsdenCoord ( ) const
inline

Gets the marsden coordinates

Returns
complete marsden coordinates of the instance

References marsden_one_degree, and marsden_square.

◆ getMarsdenOneDegreeSquare()

int woss::Coord::getMarsdenOneDegreeSquare ( ) const
inline

Gets the marsden one degree square value

Returns
marsden one degree square value of the instance

References marsden_one_degree.

◆ getMarsdenSquare()

int woss::Coord::getMarsdenSquare ( ) const
inline

Gets the marsden square value

Returns
marsden square value of the instance

References marsden_square.

◆ isValid()

virtual bool woss::Coord::isValid ( ) const
inlinevirtual

◆ isValidUtmZoneChar()

bool Coord::isValidUtmZoneChar ( UtmZoneChar  utm_zone_char)
staticprotected

Checks if the passed utm zone character is valid

Parameters
utm_zone_charutm zone character
Returns
true if valid, false otherwise

Referenced by getCoordFromUtmWgs84().

◆ operator<<()

friend::std::ostream & woss::Coord::operator<< ( ::std::ostream &  os,
const Coord instance 
)

<< operator

Parameters
osleft operand ostream reference
instanceright operand const Coord reference
Returns
os reference after the operation

◆ operator=()

Coord & Coord::operator= ( const Coord copy)

Assignment operator

Parameters
copyconst reference to a Coord object to be copied
Returns
Coord reference to this

References latitude, longitude, marsden_one_degree, and marsden_square.

◆ setLatitude()

void woss::Coord::setLatitude ( double  lat)
inline

Sets latitude and updates marsden coordinates

Parameters
latlatitude value

References latitude, and updateMarsdenCoord().

Referenced by woss::Location::setLatitude().

Here is the call graph for this function:

◆ setLongitude()

void woss::Coord::setLongitude ( double  lon)
inline

Sets longitude and updates marsden coordinates

Parameters
lonlongitude value

References longitude, and updateMarsdenCoord().

Referenced by woss::Location::setLongitude().

Here is the call graph for this function:

◆ updateMarsdenCoord()

void Coord::updateMarsdenCoord ( )
protected

Calculates marsden coordinates from latitude and longitude

References isValid(), latitude, longitude, marsden_one_degree, and marsden_square.

Referenced by Coord(), setLatitude(), and setLongitude().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Coord left,
const Coord right 
)
friend

Inequality operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left != right, false otherwise

◆ operator+

const Coord operator+ ( const Coord left,
const Coord right 
)
friend

Sum operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator+=

Coord & operator+= ( Coord left,
const Coord right 
)
friend

Compound assignment sum operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator-

const Coord operator- ( const Coord left,
const Coord right 
)
friend

Subtraction operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator-=

Coord & operator-= ( Coord left,
const Coord right 
)
friend

Compound assignment subtraction operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator<

bool operator< ( const Coord left,
const Coord right 
)
friend

Less than operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left < right, false otherwise

◆ operator<=

bool operator<= ( const Coord left,
const Coord right 
)
friend

Less than or equal to operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left <= right, false otherwise

◆ operator==

bool operator== ( const Coord left,
const Coord right 
)
friend

Equality operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left == right, false otherwise

◆ operator>

bool operator> ( const Coord left,
const Coord right 
)
friend

Greater than operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left > right, false otherwise

◆ operator>=

bool operator>= ( const Coord left,
const Coord right 
)
friend

Greater than or equal to operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left >= right, false otherwise

Member Data Documentation

◆ latitude

◆ longitude

◆ marsden_one_degree

int woss::Coord::marsden_one_degree
protected

◆ marsden_square

int woss::Coord::marsden_square
protected

The documentation for this class was generated from the following files: