Isis Developer Reference
Isis::Longitude Class Reference

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

#include <Longitude.h>

Inheritance diagram for Isis::Longitude:
Inheritance graph
Collaboration diagram for Isis::Longitude:
Collaboration graph

Public Types

enum  Direction { PositiveEast , PositiveWest }
 Possible longitude directions: Is a positive longitude towards east or towards west? More...
 
enum  Domain { Domain360 , Domain180 }
 Use LongitudeDomain360 if 0-360 is the primary range of the longitude values with 180 being the 'center'. More...
 
enum  Units { Degrees , Radians }
 The set of usable angle measurement units. More...
 

Public Member Functions

 Longitude ()
 Create a blank Longitude object with 0-360 domain.
 
 Longitude (double longitude, Angle::Units longitudeUnits, Direction lonDir=PositiveEast, Domain lonDomain=Domain360)
 Create and initialize a Longitude value.
 
 Longitude (Angle longitude, Direction lonDir=PositiveEast, Domain lonDomain=Domain360)
 Create and initialize a Longitude value.
 
 Longitude (double longitude, PvlGroup mapping, Angle::Units longitudeUnits)
 Create and initialize a Longitude value.
 
 Longitude (const Longitude &longitudeToCopy)
 This copies the given longitude exactly.
 
 ~Longitude ()
 This cleans up the Longitude class.
 
double positiveEast (Angle::Units units=Angle::Radians) const
 Get the longitude in the PositiveEast coordinate system.
 
void setPositiveEast (double longitude, Angle::Units units=Angle::Radians)
 Set the longitude given a value in the PositiveEast longitude system.
 
double positiveWest (Angle::Units units=Angle::Radians) const
 Get the longitude in the PositiveWest coordinate system.
 
void setPositiveWest (double longitude, Angle::Units units=Angle::Radians)
 Set the longitude given a value in the PositiveWest longitude system.
 
Longitude force180Domain () const
 This returns a longitude that is constricted to -180 to 180 degrees.
 
Longitude force360Domain () const
 This returns a longitude that is constricted to 0-360 degrees.
 
bool inRange (Longitude min, Longitude max) const
 Checks if this longitude value is within the given range.
 
Longitudeoperator= (const Longitude &longitudeToCopy)
 Same as positiveEast.
 
bool isValid () 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 radians () const
 Convert an angle to a double.
 
double degrees () 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.
 
virtual QString toString (bool includeUnits=true) const
 Get the angle in human-readable form.
 
double unitWrapValue (const Units &unit) const
 Return wrap value in desired units.
 
virtual double angle (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.
 

Static Public Member Functions

static QList< QPair< Longitude, Longitude > > to360Range (Longitude startLon, Longitude endLon)
 Calculates where the longitude range is in 0-360.
 
static Angle fullRotation ()
 Makes an angle to represent a full rotation (0-360 or 0-2pi).
 

Detailed Description

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

This is used primary for surface points but is also a general purpose class. This class accepts values past the longitude domain limits. This adds the concept of longitude direction to the Angle class.

Author
2010-10-12 Steven Lambright

Member Enumeration Documentation

◆ Direction

Possible longitude directions: Is a positive longitude towards east or towards west?

Enumerator
PositiveEast 

As the longitude increases the actual position is more east.

PositiveWest 

As the longitude increases the actual position is more west.

◆ Domain

Use LongitudeDomain360 if 0-360 is the primary range of the longitude values with 180 being the 'center'.

use LongitudeDomain180 if 0 is the 'center' longitude. This is used for converting between longitude directions, because a 'center' longitude of 0 (-180 to 180) implies negation is all that needs done to reverse the longitude direction, whereas if you are in the 360 domain, where 180 is the center, more needs done.

Enumerator
Domain360 

As the longitude increases the actual position is more east.

Domain180 

As the longitude increases the actual position is more west.

◆ Units

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

◆ Longitude() [1/5]

Isis::Longitude::Longitude ( )

Create a blank Longitude object with 0-360 domain.

References Domain360.

Referenced by force180Domain(), force360Domain(), and to360Range().

◆ Longitude() [2/5]

Isis::Longitude::Longitude ( double longitude,
Angle::Units longitudeUnits,
Direction lonDir = PositiveEast,
Domain lonDomain = Domain360 )

Create and initialize a Longitude value.

This value can wrap the planet any number of times regardless of the domain.

Parameters
longitudeThe longitude value this instance will represent
longitudeUnitsThe angular units of the longitude value (degs, rads)
lonDirTrue if moving east means an increase in longitude
lonDomainDomain of the given longitude value

References _FILEINFO_, PositiveEast, PositiveWest, Isis::IException::Programmer, setPositiveEast(), and setPositiveWest().

◆ Longitude() [3/5]

Isis::Longitude::Longitude ( Angle longitude,
Direction lonDir = PositiveEast,
Domain lonDomain = Domain360 )

Create and initialize a Longitude value.

This value can wrap the planet any number of times regardless of the domain.

Parameters
longitudeThe longitude value this instance will represent
lonDirTrue if moving east means an increase in longitude
lonDomainDomain of the given longitude value

References _FILEINFO_, PositiveEast, PositiveWest, Isis::IException::Programmer, Isis::Angle::Radians, setPositiveEast(), and setPositiveWest().

◆ Longitude() [4/5]

Isis::Longitude::Longitude ( double longitude,
PvlGroup mapping,
Angle::Units longitudeUnits )

Create and initialize a Longitude value.

This value can wrap the planet any number of times regardless of the domain. The longitude domain and direction are read from the mapping group.

Parameters
longitudeThe longitude value this instance will represent
mappingThe mapping group containing the longitude direction and domain
longitudeUnitsThe angular units of the longitude value (degs, rads)

References _FILEINFO_, Domain180, Domain360, Isis::IException::Programmer, setPositiveEast(), and setPositiveWest().

◆ Longitude() [5/5]

Isis::Longitude::Longitude ( const Longitude & longitudeToCopy)

This copies the given longitude exactly.

Parameters
longitudeToCopyThe latitude we're duplicating

◆ ~Longitude()

Isis::Longitude::~Longitude ( )

This cleans up the Longitude class.

Member Function Documentation

◆ angle()

◆ degrees()

◆ force180Domain()

Longitude Isis::Longitude::force180Domain ( ) const

This returns a longitude that is constricted to -180 to 180 degrees.

Returns
Longitude with an angular value between -180 and 180 inclusive

References Isis::Angle::Angle(), Isis::Angle::Degrees, force360Domain(), Isis::Angle::isValid(), and Longitude().

Referenced by Isis::RingPlaneProjection::To180Domain(), and Isis::TProjection::To180Domain().

◆ force360Domain()

Longitude Isis::Longitude::force360Domain ( ) const

This returns a longitude that is constricted to 0-360 degrees.

Returns
Longitude with an angular value between 0 and 360 inclusive

References Isis::Angle::angle(), Isis::Angle::Degrees, Isis::Angle::degrees(), Isis::Angle::isValid(), and Longitude().

Referenced by Isis::Spice::computeSolarLongitude(), force180Domain(), inRange(), Isis::RingPlaneProjection::To360Domain(), and Isis::TProjection::To360Domain().

◆ fullRotation()

Angle Isis::Angle::fullRotation ( )
staticinherited

Makes an angle to represent a full rotation (0-360 or 0-2pi).

Returns
the angle of 1 full rotation

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

Referenced by Isis::Hillshade::shadedValue(), and to360Range().

◆ inRange()

bool Isis::Longitude::inRange ( Longitude min,
Longitude max ) const

Checks if this longitude value is within the given range.

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

All longitude values are restricted to a 0-360 range for the sake of comparison. If the provided min and max longitude values are nominally different, but resolve to the same value when clamped to the 0-360 range, (for example: min=0 and max=360 => adjustedMin=0 and adjustedMax=0), then every point will be considered valid (because the whole planet is the range).

Parameters
minThe beginning of the valid longitude range
maxThe end of the valid longitude range
Returns
Whether the longitude is in the given range

References force360Domain(), Isis::PI, and to360Range().

◆ isValid()

◆ operator!=()

bool Isis::Angle::operator!= ( const Angle & angle2) const
inlineinherited

Test if another angle is not equal to this angle.

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

Parameters
angle2The comparison angle (on right-hand-side of != operator)
Returns
true if the angle does not equal the comparision angle

◆ operator*() [1/2]

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
valueThe value to multiply to this angle
Returns
Multiplied angle

References Isis::Angle::Angle(), Isis::Angle::isValid(), Isis::Angle::Radians, and Isis::Angle::radians().

◆ operator*() [2/2]

Angle Isis::Angle::operator* ( int value) const
inlineinherited

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

Parameters
valueThe integer value to multiply with this angle
Returns
Product of the angles

◆ operator*=()

void Isis::Angle::operator*= ( double value)
inlineinherited

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

Parameters
valueThe double value to multiply with this angle

◆ operator+()

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
angle2The angle to add to this angle
Returns
sum angle

References Isis::Angle::Angle(), Isis::Angle::isValid(), Isis::Angle::Radians, and Isis::Angle::radians().

◆ operator+=()

void Isis::Angle::operator+= ( const Angle & angle2)
inlineinherited

Add angle value to another as double and replace original.

Parameters
angle2The angle to add to this angle
Returns
sum angle, replaces original

◆ operator-()

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
angle2The angle to subtract from this angle
Returns
difference angle

References Isis::Angle::Angle(), Isis::Angle::isValid(), Isis::Angle::Radians, and Isis::Angle::radians().

◆ operator-=()

void Isis::Angle::operator-= ( const Angle & angle2)
inlineinherited

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

Parameters
angle2The angle to subtract from this angle

◆ operator/() [1/3]

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

Divide this angle by another angle and return the ratio.

Parameters
valueThe ratio, Null if invalid
Returns
Quotient of the angles

References Isis::Angle::isValid(), Isis::Null, and Isis::Angle::radians().

◆ operator/() [2/3]

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

Divide this angle by a double.

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

References Isis::Angle::Angle(), Isis::Angle::isValid(), Isis::Angle::Radians, and Isis::Angle::radians().

◆ operator/() [3/3]

Angle Isis::Angle::operator/ ( int value) const
inlineinherited

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

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

◆ operator/=()

void Isis::Angle::operator/= ( double value)
inlineinherited

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

Parameters
valueThe double value to use as the divisor

◆ operator<()

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
angle2The comparison angle (on right-hand-side of < operator)
Returns
True if the angle is less than the comparision angle

References _FILEINFO_, Isis::Angle::angle(), Isis::Angle::isValid(), Isis::IException::Programmer, and Isis::Angle::Radians.

◆ operator<=()

bool Isis::Angle::operator<= ( const Angle & angle2) const
inlineinherited

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

Parameters
angle2The comparison angle (on right-hand-side of < operator)
Returns
true if the angle is less than or equal to the comparision angle

◆ operator=()

Longitude & Isis::Longitude::operator= ( const Longitude & longitudeToCopy)

Same as positiveEast.

Assign the values in the given longitude to ourselves.

See also
positiveEast

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

This will make an exact duplicate.

Parameters
longitudeToCopyThe longitude we're duplicating with the current instance

References setPositiveEast().

◆ operator==()

bool Isis::Angle::operator== ( const Angle & angle2) const
inlineinherited

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
angle2The comparison angle (on right-hand-side of == operator)
Returns
true if the angle equals the comparision angle

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

◆ operator>()

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
angle2The comparison angle (on right-hand-side of > operator)
Returns
True if the angle is greater than the comparision angle

References _FILEINFO_, Isis::Angle::angle(), Isis::Angle::isValid(), Isis::IException::Programmer, and Isis::Angle::Radians.

◆ operator>=()

bool Isis::Angle::operator>= ( const Angle & angle2) const
inlineinherited

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

Parameters
angle2The comparison angle (on right-hand-side of < operator)
Returns
true if the angle is greater than or equal to the comparision angle

◆ positiveEast()

double Isis::Longitude::positiveEast ( Angle::Units units = Angle::Radians) const

Get the longitude in the PositiveEast coordinate system.

Parameters
unitsThe angular units to get the longitude in
See also
Direction
Returns
The PositiveEast longitude value

References Isis::Angle::angle().

Referenced by Isis::LidarData::write().

◆ positiveWest()

double Isis::Longitude::positiveWest ( Angle::Units units = Angle::Radians) const

Get the longitude in the PositiveWest coordinate system.

Parameters
unitsThe angular units to get the longitude in
See also
Direction
Returns
The PositiveWest longitude value

References Isis::Angle::angle(), Domain360, Isis::IsSpecial(), and Isis::Angle::unitWrapValue().

◆ radians()

◆ setAngle()

void Isis::Angle::setAngle ( const double & angle,
const Units & unit )
virtualinherited

◆ setDegrees()

void Isis::Angle::setDegrees ( double degrees)
inlineinherited

Set the angle in units of Degrees.

Parameters
degreesThe new angle value, Null for invalid angle

References Isis::Angle::Degrees, Isis::Angle::degrees(), and Isis::Angle::setAngle().

◆ setPositiveEast()

void Isis::Longitude::setPositiveEast ( double longitude,
Angle::Units units = Angle::Radians )

Set the longitude given a value in the PositiveEast longitude system.

Parameters
longitudeThe positive east longitude to set ourselves to
unitsThe angular units longitude is in

References Isis::Angle::setAngle().

Referenced by Longitude(), Longitude(), Longitude(), and operator=().

◆ setPositiveWest()

void Isis::Longitude::setPositiveWest ( double longitude,
Angle::Units units = Angle::Radians )

Set the longitude given a value in the PositiveWest longitude system.

Parameters
longitudeThe positive west longitude to set ourselves to
unitsThe angular units longitude is in

References Domain360, Isis::IsSpecial(), Isis::Angle::setAngle(), and Isis::Angle::unitWrapValue().

Referenced by Longitude(), Longitude(), and Longitude().

◆ setRadians()

void Isis::Angle::setRadians ( double radians)
inlineinherited

Set the angle in units of Radians.

Parameters
radiansThe new angle value, Null for invalid angle

References Isis::Angle::Radians, Isis::Angle::radians(), and Isis::Angle::setAngle().

Referenced by Isis::LinearAlgebra::toAxisAngle().

◆ to360Range()

QList< QPair< Longitude, Longitude > > Isis::Longitude::to360Range ( Longitude startLon,
Longitude endLon )
static

Calculates where the longitude range is in 0-360.

This method will return 2 subranges if the total range intersects the 0/360 line. For instance, if the input range is -10-10, the output ranges will be 350-360 and 0-10. If the longitude range is invalid then an empty list will result.

Parameters
startLonthe western edge of the longitude range
endLonthe eastern edge of the range
Returns
a list of longitude pairs (first is the start and second is the end) that represent the calculated range(s).

References Isis::Angle::Degrees, Isis::Angle::fullRotation(), and Longitude().

Referenced by inRange(), and Isis::FeatureNomenclature::queryFeatures().

◆ toString()

QString Isis::Angle::toString ( bool includeUnits = true) const
virtualinherited

Get the angle in human-readable form.

Parameters
includeUnitsInclude the angle's units in the text.
Returns
A user-displayable angle string.

References Isis::Angle::degrees(), Isis::Angle::isValid(), and Isis::toString().

Referenced by Isis::Latitude::Latitude(), Isis::Latitude::planetographic(), and Isis::Hillshade::shadedValue().

◆ unitWrapValue()

double Isis::Angle::unitWrapValue ( const Units & unit) const
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
unitDesired units of the Angle wrap constant (see Angle::Units)
Returns
Wrap value in specified units

References _FILEINFO_, Isis::Angle::Degrees, Isis::PI, Isis::IException::Programmer, and Isis::Angle::Radians.

Referenced by positiveWest(), and setPositiveWest().


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