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

constexpr Coord (double lat=COORD_NOT_SET_VALUE, double lon=COORD_NOT_SET_VALUE)
constexpr Coord (const Coord &copy)=default
constexpr Coord (Coord &&tmp)=default
constexpr void setLatitude (double lat)
constexpr void setLongitude (double lon)
constexpr bool isValid () const
constexpr double getLatitude () const
constexpr double getLongitude () const
constexpr int getMarsdenSquare () const
constexpr int getMarsdenOneDegreeSquare () const
constexpr MarsdenCoord getMarsdenCoord () const
constexpr double getInitialBearing (const Coord &destination) const
constexpr double getFinalBearing (const Coord &destination) const
constexpr double getGreatCircleDistance (const Coord &destination, double depth=0) const
constexpr Coordoperator= (const Coord &copy)=default
constexpr Coordoperator= (Coord &&tmp)=default

Static Public Member Functions

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

Static Public Attributes

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

Protected Member Functions

constexpr void updateMarsdenCoord ()

Static Protected Member Functions

static constexpr bool isValidUtmZoneChar (UtmZoneChar utm_zone_char)

Protected Attributes

double latitude
double longitude
int marsden_square
int marsden_one_degree

Friends

constexpr Coord operator+ (const Coord &left, const Coord &right)
constexpr Coord operator- (const Coord &left, const Coord &right)
constexpr Coordoperator+= (Coord &left, const Coord &right)
constexpr Coordoperator-= (Coord &left, const Coord &right)
constexpr bool operator== (const Coord &left, const Coord &right)
constexpr bool operator!= (const Coord &left, const Coord &right)
constexpr bool operator> (const Coord &left, const Coord &right)
constexpr bool operator< (const Coord &left, const Coord &right)
constexpr bool operator>= (const Coord &left, const Coord &right)
constexpr bool operator<= (const Coord &left, const Coord &right)
std::ostream & operator<< (std::ostream &os, const Coord &instance)

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.

Constructor & Destructor Documentation

◆ Coord() [1/3]

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

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 latitude, longitude, marsden_one_degree, marsden_square, and updateMarsdenCoord().

Referenced by Coord(), Coord(), woss::CoordZ::CoordZ(), woss::CoordZ::CoordZ(), getCoordAlongGreatCircle(), getCoordFromBearing(), getCoordFromUtmWgs84(), woss::CoordZ::getCoordZAlongGreatCircle(), getFinalBearing(), getGreatCircleDistance(), getInitialBearing(), operator!=, operator+, operator+=, operator-, operator-=, operator<, operator<<, operator<=, operator=(), operator=(), operator==, operator>, and operator>=.

Here is the call graph for this function:

◆ Coord() [2/3]

woss::Coord::Coord ( const Coord & copy)
constexprdefault

References Coord().

Here is the call graph for this function:

◆ Coord() [3/3]

woss::Coord::Coord ( Coord && tmp)
constexprdefault

References Coord().

Here is the call graph for this function:

Member Function Documentation

◆ getCoordAlongGreatCircle()

Coord woss::Coord::getCoordAlongGreatCircle ( const Coord & start_coord,
const Coord & end_coord,
double distance,
double depth = 0.0 )
inlinestaticconstexpr

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 Coord(), getCoordFromBearing(), and getInitialBearing().

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

Here is the call graph for this function:

◆ getCoordFromBearing()

Coord woss::Coord::getCoordFromBearing ( const Coord & start_coord,
double bearing,
double distance,
double depth = 0.0 )
inlinestaticconstexpr

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 WossCoordDefTest::doRun(), getCoordAlongGreatCircle(), and woss::ACToolboxWoss::initCoordZVector().

Here is the call graph for this function:

◆ getCoordFromUtmWgs84()

Coord woss::Coord::getCoordFromUtmWgs84 ( double easting,
double northing,
double utm_zone_number,
UtmZoneChar utm_zone_char )
inlinestaticconstexpr

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 woss::Coord::getFinalBearing ( const Coord & destination) const
inlineconstexpr

Gets the final bearing of a trajectory

Parameters
destinationdestination Coord instance
Returns
initial bearing measured in radians

References Coord(), and getInitialBearing().

Here is the call graph for this function:

◆ getGreatCircleDistance()

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

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 Coord(), EARTH_RADIUS, isValid(), latitude, and longitude.

Referenced by WossChannelModule::computeCoordZPairVect(), WossCoordDefTest::doBearingTests(), woss::CoordZ::getCoordZAlongGreatCircle(), woss::WossManager::getWossPressure(), woss::WossManager::getWossTimeArr(), woss::WossManagerResDb::getWossTimeArr(), woss::WossManagerResDbMT::getWossTimeArr(), woss::WossDbManager::RangeOperator::operator()(), and WossWpPosition::updateVerticalOrientation().

Here is the call graph for this function:

◆ getInitialBearing()

double woss::Coord::getInitialBearing ( const Coord & destination) const
inlineconstexpr

Gets the initial bearing of a trajectory

Parameters
destinationdestination Coord instance
Returns
initial bearing measured in radians

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

Referenced by WossCoordDefTest::doBearingTests(), getCoordAlongGreatCircle(), getFinalBearing(), woss::WossDbManager::BearingOperator::operator()(), and WossWpPosition::updateBearing().

Here is the call graph for this function:

◆ getLatitude()

◆ getLongitude()

◆ getMarsdenCoord()

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

Gets the marsden coordinates

Returns
complete marsden coordinates of the instance

References marsden_one_degree, and marsden_square.

◆ getMarsdenOneDegreeSquare()

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

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
inlineconstexpr

Gets the marsden square value

Returns
marsden square value of the instance

References marsden_square.

◆ isValid()

bool woss::Coord::isValid ( ) const
inlineconstexpr

◆ isValidUtmZoneChar()

bool woss::Coord::isValidUtmZoneChar ( UtmZoneChar utm_zone_char)
inlinestaticconstexprprotected

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=() [1/2]

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

Assignment operator

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

References Coord().

Here is the call graph for this function:

◆ operator=() [2/2]

Coord & woss::Coord::operator= ( Coord && tmp)
constexprdefault

Move assignment operator

Parameters
tmprvalue reference to a Coord object to be move
Returns
Coord reference to this

References Coord().

Here is the call graph for this function:

◆ setLatitude()

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

Sets latitude and updates marsden coordinates

Parameters
latlatitude value

References latitude, and updateMarsdenCoord().

Here is the call graph for this function:

◆ setLongitude()

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

Sets longitude and updates marsden coordinates

Parameters
lonlongitude value

References longitude, and updateMarsdenCoord().

Here is the call graph for this function:

◆ updateMarsdenCoord()

void woss::Coord::updateMarsdenCoord ( )
inlineconstexprprotected

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:

◆ 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

References Coord(), latitude, and longitude.

◆ operator+

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

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

◆ 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

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

◆ operator-

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

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

◆ 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

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

◆ 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

References Coord(), latitude, and longitude.

◆ operator<<

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

<< operator

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

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

◆ 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

References Coord().

◆ 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

References Coord(), latitude, and longitude.

◆ 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

References Coord(), latitude, and longitude.

◆ 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

References Coord().

Member Data Documentation

◆ COORD_MAX_LATITUDE

double woss::Coord::COORD_MAX_LATITUDE = 90.0
staticconstexpr

Maximum valid Latitude.

Referenced by woss::SedimDeck41CoordDb::getSedimIndexes(), and isValid().

◆ COORD_MAX_LONGITUDE

double woss::Coord::COORD_MAX_LONGITUDE = 180.0
staticconstexpr

Maximum valid Longitude.

Referenced by woss::SedimDeck41CoordDb::getSedimIndexes(), and isValid().

◆ COORD_MIN_LATITUDE

double woss::Coord::COORD_MIN_LATITUDE = -90.0
staticconstexpr

Minimum valid Latitude.

Referenced by woss::SedimDeck41CoordDb::getSedimIndexes(), and isValid().

◆ COORD_MIN_LONGITUDE

double woss::Coord::COORD_MIN_LONGITUDE = -180.0
staticconstexpr

Minimum valid Longitude.

Referenced by woss::SedimDeck41CoordDb::getSedimIndexes(), and isValid().

◆ EARTH_GRS80_ECCENTRICITY

double woss::Coord::EARTH_GRS80_ECCENTRICITY = 0.0818191910428158
staticconstexpr

Earth's first eccentricity as defined by GRS80.

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

◆ EARTH_GRS80_POLAR_RADIUS

double woss::Coord::EARTH_GRS80_POLAR_RADIUS = 6356752.3141
staticconstexpr

Earth's semi-major axis in meters as defined by GRS80.

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

◆ EARTH_RADIUS

◆ EARTH_SEMIMAJOR_AXIS

double woss::Coord::EARTH_SEMIMAJOR_AXIS = 6378137.0
staticconstexpr

Earth's semi-major axis in meters as defined by both GRS80 and WGS84.

Referenced by woss::CoordZ::getCartCoords(), getCoordFromUtmWgs84(), woss::CoordZ::getCoordZFromCartesianCoords(), and woss::UtmWgs84::getUtmWgs84FromCoord().

◆ EARTH_WGS84_ECCENTRICITY

double woss::Coord::EARTH_WGS84_ECCENTRICITY = 0.0818191908426215
staticconstexpr

Earth's first eccentricity as defined by WGS84.

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

◆ EARTH_WGS84_POLAR_RADIUS

double woss::Coord::EARTH_WGS84_POLAR_RADIUS = 6356752.314245
staticconstexpr

Earth's polar radius in meters as defined by WGS84.

Referenced by getCoordFromUtmWgs84(), and woss::CoordZ::getCoordZFromCartesianCoords().

◆ 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 file: