USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::Latitude Class Reference
[Utility]

This class is designed to encapsulate the concept of a Latitude. More...

#include <Latitude.h>

Inherits Isis::Angle.

List of all members.

Public Types

enum  ErrorChecking { ThrowAllErrors = 0, AllowPastPole }
 

Some user-configurable error checking parameters.

More...
enum  CoordinateType { Planetocentric, Planetographic }
 

These are the latitude coordinate systems.

More...
enum  Units { Degrees, Radians }
 

The set of usable angle measurement units.

More...

Public Member Functions

 Latitude ()
 Create a blank Latitude object without Planetographic support.
 Latitude (double latitude, Angle::Units latitudeUnits, ErrorChecking errors=ThrowAllErrors)
 Create and initialize a Latitude value without planetographic support.
 Latitude (Angle latitude, ErrorChecking errors=ThrowAllErrors)
 Create and initialize a Latitude value in the planetocentric domain within the given angle.
 Latitude (Angle latitude, PvlGroup mapping, ErrorChecking errors=ThrowAllErrors)
 Create and initialize a Latitude value using the mapping group's latitude units and radii.
 Latitude (double latitude, PvlGroup mapping, Angle::Units latitudeUnits, ErrorChecking errors=ThrowAllErrors)
 Create and initialize a Latitude value using the mapping group's latitude units and radii.
 Latitude (double latitude, Distance equatorialRadius, Distance polarRadius, CoordinateType latType=Planetocentric, Angle::Units latitudeUnits=Angle::Radians, ErrorChecking errors=ThrowAllErrors)
 Create and initialize a Latitude value with planetographic support.
 Latitude (const Latitude &latitudeToCopy)
 This copies the given latitude exactly.
 ~Latitude ()
 This cleans up the Latitude class.
double GetPlanetocentric (Angle::Units units=Angle::Radians) const
 Get the latitude in the planetocentric (universal) coordinate system.
void SetPlanetocentric (double latitude, Angle::Units units=Angle::Radians)
 Set the latitude given a value in the Planetocentric coordinate system.
double GetPlanetographic (Angle::Units units=Angle::Radians) const
 Get the latitude in the planetographic coordinate system.
void SetPlanetographic (double latitude, Angle::Units units=Angle::Radians)
 Set the latitude given a value in the Planetographic coordinate system.
bool IsInRange (Latitude min, Latitude max) const
 Checks if this latitude value is within the given range.
Latitudeoperator= (const Latitude &latitudeToCopy)
 This assigns another latitude to this one - making this latitude an exact duplicate of the other.
bool Valid () const
 This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
Angle operator+ (const Angle &angle2) const
 Add angle value to another.
Angle operator- (const Angle &angle2) const
 Subtract angle value from another and return the resulting angle.
Angle operator* (double value) const
 Multiply this angle by a double and return the resulting angle.
Angle operator* (int value) const
 Multiply this angle by an integer and return the resulting angle.
Angle operator/ (double value) const
 Divide this angle by a double.
double operator/ (Angle value) const
 Divide this angle by another angle and return the ratio.
Angle operator/ (int value) const
 Divide this angle by an integer and return the resulting angle.
bool operator< (const Angle &angle2) const
 Test if the other angle is less than the current angle.
bool operator> (const Angle &angle2) const
 Test if the other angle is greater than the current angle.
void operator+= (const Angle &angle2)
 Add angle value to another as double and replace original.
void operator-= (const Angle &angle2)
 Subtract angle value from another and set this instance to the resulting angle.
void operator*= (double value)
 Multiply this angle by a double and set this instance to the resulting angle.
void operator/= (double value)
 Divide this angle by a double and return the resulting angle.
bool operator== (const Angle &angle2) const
 Test if another angle is equal to this angle.
bool operator!= (const Angle &angle2) const
 Test if another angle is not equal to this angle.
bool operator<= (const Angle &angle2) const
 Test if the other angle is less than or equal to the current angle.
bool operator>= (const Angle &angle2) const
 Test if the other angle is greater than or equal to the current angle.
double GetRadians () const
 Convert an angle to a double.
double GetDegrees () const
 Get the angle in units of Degrees.
void SetRadians (double radians)
 Set the angle in units of Radians.
void SetDegrees (double degrees)
 Set the angle in units of Degrees.

Protected Member Functions

virtual void SetAngle (double angle, const Angle::Units &units)
 Same as GetPlanetocentric.
double UnitWrapValue (const Units &unit) const
 Return wrap value in desired units.
virtual double GetAngle (const Units &unit) const
 Return angle value in desired units.
virtual void SetAngle (const double &angle, const Units &unit)
 Set angle value in desired units.

Friends

Angle operator* (double mult, Angle angle)
 Multiply this angle by a double and return the resulting angle.

Detailed Description

This class is designed to encapsulate the concept of a Latitude.

This is used primary for surface points but is also a general purpose class. This class has error checking for past the poles. This adds the concept of 90/-90 and planetographic to the Angle class.

Author:
2010-10-13 Steven Lambright

Member Enumeration Documentation

These are the latitude coordinate systems.

The universal system is Planetocentric and this class is heavily geared towards using them. If you wish to use Planetographic, planetary radii must be provided and at the moment latitudes past 90 aren't supported in Planetographic.

Enumerator:
Planetocentric 

This is the universal (and default) latitude coordinate system.

Latitudes in this system are the angle from the the equatorial plane (the line at 0 degrees latitude) to the requested latitude.

Planetographic 

This is a secondary coordinate system for latitudes.

Latitudes in this system are angle between the equatorial plane and the perpendicular to the surface at the point. Conceptually you draw the perpendicular to the surface back to the equatorial plane and the angle created is the planetographic latitude. This doesn't differ from Planetocentric on a sphere. These latitudes require the planetary radii to work with them at all, since the radii affect the latitude values themselves.

Some user-configurable error checking parameters.

This is meant to be used as a bit flag.

Example: Latitude(95, Angle::Degrees, Latitude::AllowPastPole) This will allow latitudes past 90 and not throw an exception.

Latitude(95, Angle::Degrees, Latitude::AllowPastPole | Latitude::ThrowAllErrors) This will allow latitudes past 90 still and not throw an exception.

Latitude(95, Angle::Degrees, Latitude::ThrowAllErrors) This will throw an exception.

Latitude(95, Angle::Degrees) This will throw an exception.

Enumerator:
ThrowAllErrors 

Throw an exception if any problems are found (default value).

AllowPastPole 

Don't throw an exception if a latitude beyond -90/90 is found.

enum Isis::Angle::Units [inherited]

The set of usable angle measurement units.

Enumerator:
Degrees 

Degrees are generally considered more human readable, 0-360 is one circle, however most math does not use this unit.

Use these for displaying to the user and accepting input from the user.

Radians 

Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more difficult for users to understand when displayed since they have PI in them.

This is the default unit and is necessary for most math library calls.


Constructor & Destructor Documentation

Isis::Latitude::Latitude (  ) 

Create a blank Latitude object without Planetographic support.

References errors, and latitude.

Isis::Latitude::Latitude ( double  latitude,
Angle::Units  latitudeUnits,
ErrorChecking  errors = ThrowAllErrors 
)

Create and initialize a Latitude value without planetographic support.

See also:
ErrorChecking
CoordinateType
Parameters:
latitude The latitude value this instance will represent, in the planetocentric coordinate system
latitudeUnits The angular units of the latitude value (degs, rads)
errors Error checking conditions
Isis::Latitude::Latitude ( Angle  latitude,
ErrorChecking  errors = ThrowAllErrors 
)

Create and initialize a Latitude value in the planetocentric domain within the given angle.

Parameters:
latitude The latitude value this instance will represent
errors Error checking conditions
Isis::Latitude::Latitude ( Angle  latitude,
PvlGroup  mapping,
ErrorChecking  errors = ThrowAllErrors 
)

Create and initialize a Latitude value using the mapping group's latitude units and radii.

See also:
ErrorChecking
CoordinateType
Parameters:
latitude The latitude value this instance will represent, in the mapping group's units
mapping A mapping group
latitudeUnits The angular units of the latitude value (degs, rads)
errors Error checking conditions
Isis::Latitude::Latitude ( double  latitude,
PvlGroup  mapping,
Angle::Units  latitudeUnits,
ErrorChecking  errors = ThrowAllErrors 
)

Create and initialize a Latitude value using the mapping group's latitude units and radii.

See also:
ErrorChecking
CoordinateType
Parameters:
latitude The latitude value this instance will represent, in the mapping group's units
mapping A mapping group
latitudeUnits The angular units of the latitude value (degs, rads)
errors Error checking conditions
Isis::Latitude::Latitude ( double  latitude,
Distance  equatorialRadius,
Distance  polarRadius,
CoordinateType  latType = Planetocentric,
Angle::Units  latitudeUnits = Angle::Radians,
ErrorChecking  errors = ThrowAllErrors 
)

Create and initialize a Latitude value with planetographic support.

See also:
ErrorChecking
CoordinateType
Parameters:
latitude The latitude value this instance will represent, in planetocentric
equatorialRadius Radius of the target (planet) at the equator
polarRadius Radius of the target (planet) at the poles
latType The coordinate system of the latitude parameter
latitudeUnits The angular units of the latitude value (degs, rads)
errors Error checking conditions
Isis::Latitude::Latitude ( const Latitude latitudeToCopy  ) 

This copies the given latitude exactly.

Parameters:
latitudeToCopy The latitude we're duplicating
Isis::Latitude::~Latitude (  ) 

This cleans up the Latitude class.


Member Function Documentation

double Isis::Angle::GetAngle ( const Units unit  )  const [protected, virtual, inherited]
double Isis::Angle::GetDegrees (  )  const [inline, inherited]
double Isis::Latitude::GetPlanetocentric ( Angle::Units  units = Angle::Radians  )  const

Get the latitude in the planetocentric (universal) coordinate system.

See also:
CoordinateType
Parameters:
units The angular units to get the latitude in
Returns:
The Planetocentric latitude value
double Isis::Latitude::GetPlanetographic ( Angle::Units  units = Angle::Radians  )  const

Get the latitude in the planetographic coordinate system.

If this instance was not constructed with the planetary radii, then an exception will be thrown.

See also:
CoordinateType
Parameters:
units The angular units to get the latitude in
Returns:
The Planetographic latitude value

References _FILEINFO_, Isis::Angle::Angle(), Isis::Angle::Degrees, Isis::Angle::GetDegrees(), Isis::Angle::GetRadians(), Isis::iException::Message(), Isis::iException::Programmer, and Isis::Angle::Valid().

double Isis::Angle::GetRadians (  )  const [inline, inherited]
bool Isis::Latitude::IsInRange ( Latitude  min,
Latitude  max 
) const

Checks if this latitude value is within the given range.

Defines the range as the change from the minimum latitude to the maximum latitude (an angle), and returns whether the change from the minimum latitude to this latitude is less than or equal to the maximum change allowed (the range).

Parameters:
min The beginning of the valid latitude range
max The end of the valid latitude range
Returns:
Whether the latitude is in the given range
bool Isis::Angle::operator!= ( const Angle angle2  )  const [inline, inherited]

Test if another angle is not equal to this angle.

Takes the negated result of the '==' operator.

Parameters:
angle2 The comparison angle (on right-hand-side of != operator)
Returns:
true if the angle does not equal the comparision angle
Angle Isis::Angle::operator* ( int  value  )  const [inline, inherited]

Multiply this angle by an integer and return the resulting angle.

Parameters:
value The integer value to multiply with this angle
Returns:
Product of the angles
Angle Isis::Angle::operator* ( double  value  )  const [inherited]

Multiply this angle by a double and return the resulting angle.

If this is an invalid angle, then the result will be an invalid angle.

Parameters:
value The value to multiply to this angle
Returns:
Multiplied angle
void Isis::Angle::operator*= ( double  value  )  [inline, inherited]

Multiply this angle by a double and set this instance to the resulting angle.

Parameters:
value The double value to multiply with this angle
Angle Isis::Angle::operator+ ( const Angle angle2  )  const [inherited]

Add angle value to another.

If either of these are invalid angles, then the result will be an invalid angle.

Parameters:
angle2 The angle to add to this angle
Returns:
sum angle

References Isis::Angle::Angle(), Isis::Angle::GetRadians(), Isis::Angle::Radians, and Isis::Angle::Valid().

void Isis::Angle::operator+= ( const Angle angle2  )  [inline, inherited]

Add angle value to another as double and replace original.

Parameters:
angle2 The angle to add to this angle
Returns:
sum angle, replaces original
Angle Isis::Angle::operator- ( const Angle angle2  )  const [inherited]

Subtract angle value from another and return the resulting angle.

If either of these are invalid angles, then the result will be an invalid angle.

Parameters:
angle2 The angle to subtract from this angle
Returns:
difference angle
void Isis::Angle::operator-= ( const Angle angle2  )  [inline, inherited]

Subtract angle value from another and set this instance to the resulting angle.

Parameters:
angle2 The angle to subtract from this angle
Angle Isis::Angle::operator/ ( int  value  )  const [inline, inherited]

Divide this angle by an integer and return the resulting angle.

Parameters:
value The double value to use as the divisor
Returns:
Quotient of the angles
double Isis::Angle::operator/ ( Angle  value  )  const [inherited]

Divide this angle by another angle and return the ratio.

Parameters:
value The ratio, Null if invalid
Returns:
Quotient of the angles

References Isis::Angle::GetRadians(), Isis::Null, and Isis::Angle::Valid().

Angle Isis::Angle::operator/ ( double  value  )  const [inherited]

Divide this angle by a double.

Parameters:
value The double value to use as the divisor
Returns:
Quotient of the angles

References Isis::Angle::Angle(), Isis::Angle::GetRadians(), Isis::Angle::Radians, and Isis::Angle::Valid().

void Isis::Angle::operator/= ( double  value  )  [inline, inherited]

Divide this angle by a double and return the resulting angle.

Parameters:
value The double value to use as the divisor
bool Isis::Angle::operator< ( const Angle angle2  )  const [inherited]

Test if the other angle is less than the current angle.

If either is invalid, then an exception will be thrown.

Parameters:
angle2 The comparison angle (on right-hand-side of < operator)
Returns:
True if the angle is less than the comparision angle

References _FILEINFO_, Isis::Angle::GetAngle(), Isis::iException::Message(), Isis::iException::Programmer, Isis::Angle::Radians, and Isis::Angle::Valid().

bool Isis::Angle::operator<= ( const Angle angle2  )  const [inline, inherited]

Test if the other angle is less than or equal to the current angle.

Parameters:
angle2 The comparison angle (on right-hand-side of < operator)
Returns:
true if the angle is less than or equal to the comparision angle
Latitude & Isis::Latitude::operator= ( const Latitude latitudeToCopy  ) 

This assigns another latitude to this one - making this latitude an exact duplicate of the other.

Parameters:
latitudeToCopy The latitude we are assigning from
Returns:
The result, a reference to this
bool Isis::Angle::operator== ( const Angle angle2  )  const [inline, inherited]

Test if another angle is equal to this angle.

This does not compensate for going around a circle: Angle(360, Angle::Degrees) does not equal Angle(0, Angle::Degrees)

Invalid angles are equal to each other.

Parameters:
angle2 The comparison angle (on right-hand-side of == operator)
Returns:
true if the angle equals the comparision angle

References Isis::Angle::GetAngle(), and Isis::Angle::Radians.

bool Isis::Angle::operator> ( const Angle angle2  )  const [inherited]

Test if the other angle is greater than the current angle.

If either is invalid, then an exception will be thrown.

Parameters:
angle2 The comparison angle (on right-hand-side of > operator)
Returns:
True if the angle is greater than the comparision angle

References _FILEINFO_, Isis::Angle::GetAngle(), Isis::iException::Message(), Isis::iException::Programmer, Isis::Angle::Radians, and Isis::Angle::Valid().

bool Isis::Angle::operator>= ( const Angle angle2  )  const [inline, inherited]

Test if the other angle is greater than or equal to the current angle.

Parameters:
angle2 The comparison angle (on right-hand-side of < operator)
Returns:
true if the angle is greater than or equal to the comparision angle
void Isis::Angle::SetAngle ( const double &  angle,
const Units unit 
) [protected, virtual, inherited]

Set angle value in desired units.

Parameters:
angle The angle value in units of the unit parameter
unit Desired units of the angle (see Angle::Units)

References _FILEINFO_, Isis::DEG2RAD(), Isis::Angle::Degrees, Isis::IsSpecial(), Isis::iException::Message(), Isis::Null, Isis::iException::Programmer, and Isis::Angle::Radians.

Referenced by Isis::Angle::operator=(), Isis::Angle::SetDegrees(), and Isis::Angle::SetRadians().

void Isis::Latitude::SetAngle ( double  angle,
const Angle::Units units 
) [protected, virtual]

Same as GetPlanetocentric.

We're overriding this method in order to do -90/90 degree checking.

See also:
GetPlanetocentric

operator double() const { return GetPlanetocentric(); }

Parameters:
angle The numeric value of the angle
units The units angle is in (radians or degrees typically)
void Isis::Angle::SetDegrees ( double  degrees  )  [inline, inherited]

Set the angle in units of Degrees.

Parameters:
degrees The new angle value, Null for invalid angle

References Isis::Angle::Degrees, and Isis::Angle::SetAngle().

void Isis::Latitude::SetPlanetocentric ( double  latitude,
Angle::Units  units = Angle::Radians 
)

Set the latitude given a value in the Planetocentric coordinate system.

Parameters:
latitude The planetographic latitude to set ourselves to
units The angular units latitude is in
void Isis::Latitude::SetPlanetographic ( double  latitude,
Angle::Units  units = Angle::Radians 
)

Set the latitude given a value in the Planetographic coordinate system.

Parameters:
latitude The planetographic latitude to set ourselves to
units The angular units latitude is in
void Isis::Angle::SetRadians ( double  radians  )  [inline, inherited]

Set the angle in units of Radians.

Parameters:
radians The new angle value, Null for invalid angle

References Isis::Angle::Radians, and Isis::Angle::SetAngle().

double Isis::Angle::UnitWrapValue ( const Units unit  )  const [protected, inherited]

Return wrap value in desired units.

The 'wrap' value is the value where one circle occurs - angles greater than this are conceptually 'wrapping' back to zero. For example, this is 2*PI in radians because 2*PI == 0 on a circle. Please keep in mind we still differentiate those two angles.

Parameters:
unit Desired units of the Angle wrap constant (see Angle::Units)
Returns:
Wrap value in specified units

Referenced by Isis::Longitude::GetPositiveWest().

bool Isis::Angle::Valid (  )  const [inherited]

Friends And Related Function Documentation

Angle operator* ( double  mult,
Angle  angle 
) [friend, inherited]

Multiply this angle by a double and return the resulting angle.

If this is an invalid angle, then the result will be an invalid angle.

Parameters:
mult The value to multiply to this angle
angle The angle being multiplied by mult
Returns:
Multiplied angle

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