54 Angle(longitude, longitudeUnits) {
55 if(mapping[
"LongitudeDomain"][0] ==
"360") {
58 else if(mapping[
"LongitudeDomain"][0] ==
"180") {
62 IString msg =
"Longitude domain [" +
63 IString(mapping[
"LongitudeDomain"][0]) +
"] not recognized";
67 if(mapping[
"LongitudeDirection"][0] ==
"PositiveEast") {
70 else if(mapping[
"LongitudeDirection"][0] ==
"PositiveWest") {
74 IString msg =
"Longitude direction [" +
75 IString(mapping[
"LongitudeDirection"][0]) +
"] not recognized";
101 IString msg =
"Longitude direction [" +
IString(lonDir) +
"] not valid";
118 Angle(longitude, longitudeUnits) {
128 IString msg =
"Longitude direction [" +
IString(lonDir) +
"] not valid";
140 :
Angle(longitudeToCopy) {
172 double longitude =
angle(units);
177 double halfWrap = wrapPoint / 2.0;
179 int numPlanetWraps = qFloor(longitude / wrapPoint);
184 if (numPlanetWraps != 0 && qFuzzyCompare(numPlanetWraps * wrapPoint, longitude)) {
185 if (numPlanetWraps > 0)
191 longitude -= numPlanetWraps * wrapPoint;
192 longitude = -(longitude - halfWrap) + halfWrap;
193 longitude -= numPlanetWraps * wrapPoint;
198 longitude = -1 * longitude;
228 double halfWrap = wrapPoint / 2.0;
230 int numPlanetWraps = qFloor(longitude / wrapPoint);
235 if (numPlanetWraps != 0 && qFuzzyCompare(numPlanetWraps * wrapPoint, longitude)) {
236 if (numPlanetWraps > 0)
243 longitude -= numPlanetWraps * wrapPoint;
244 longitude = -(longitude - halfWrap) + halfWrap;
245 longitude -= numPlanetWraps * wrapPoint;
250 longitude = -1 * longitude;
266 if(
this == &longitudeToCopy)
return *
this;
286 if (qFuzzyCompare(
degrees(), 360.0)) {
287 resultantLongitude = 360.0;
290 resultantLongitude -= 360 * qFloor(resultantLongitude / 360);
340 foreach (range, ranges) {
341 if (thisLon >= range.first && thisLon <= range.second) {
345 double thisLonRadians = thisLon.
radians();
346 double rangeStartRadians = range.first.radians();
347 double rangeEndRadians = range.second.radians();
349 if (qFuzzyCompare(thisLonRadians, rangeStartRadians) ||
350 qFuzzyCompare(thisLonRadians, rangeEndRadians)) {
355 if ((qFuzzyCompare(thisLonRadians, 0.0) || qFuzzyCompare(thisLonRadians, 2.0 *
PI)) &&
356 (qFuzzyCompare(rangeStartRadians, 0.0) ||
357 qFuzzyCompare(rangeEndRadians, 2.0 *
PI))) {
381 if (startLon.
isValid() && endLon.
isValid() && startLon < endLon) {
393 if (endLon2 < startLon) {
394 range.append(qMakePair(startLon2, endLon2));
404 range.append(qMakePair(startLon, endLon));
Direction
Possible longitude directions: Is a positive longitude towards east or towards west?
Units
The set of usable angle measurement units.
double degrees() const
Get the angle in units of Degrees.
double radians() const
Convert an angle to a double.
virtual void setAngle(const double &angle, const Units &unit)
Set angle value in desired units.
Domain
Use LongitudeDomain360 if 0-360 is the primary range of the longitude values with 180 being the 'cent...
const double PI(3.14159265358979323846)
The mathematical constant PI.
~Longitude()
This cleans up the Longitude class.
Longitude force180Domain() const
This returns a longitude that is constricted to -180 to 180 degrees.
This error is for when a programmer made an API call that was illegal.
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.
As the longitude increases the actual position is more west.
Domain m_currentDomain
This is necessary for converting to PositiveWest and back.
void setPositiveEast(double longitude, Angle::Units units=Angle::Radians)
Set the longitude given a value in the PositiveEast longitude system.
This class is designed to encapsulate the concept of a Longitude.
Longitude & operator=(const Longitude &longitudeToCopy)
Same as positiveEast.
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
As the longitude increases the actual position is more east.
Angle()
Constructs a blank angle object which needs a value to be set in order to do any calculations.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
double positiveEast(Angle::Units units=Angle::Radians) const
Get the longitude in the PositiveEast coordinate system.
static QList< QPair< Longitude, Longitude > > to360Range(Longitude startLon, Longitude endLon)
Calculates where the longitude range is in 0-360.
bool IsSpecial(const double d)
Returns if the input pixel is special.
As the longitude increases the actual position is more east.
double positiveWest(Angle::Units units=Angle::Radians) const
Get the longitude in the PositiveWest coordinate system.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
static Angle fullRotation()
Makes an angle to represent a full rotation (0-360 or 0-2pi).
double unitWrapValue(const Units &unit) const
Return wrap value in desired units.
Defines an angle and provides unit conversions.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void setPositiveWest(double longitude, Angle::Units units=Angle::Radians)
Set the longitude given a value in the PositiveWest longitude system.
Longitude()
Create a blank Longitude object with 0-360 domain.
As the longitude increases the actual position is more west.
Adds specific functionality to C++ strings.
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
virtual double angle(const Units &unit) const
Return angle value in desired units.