13#include "IException.h"
17#include "SpecialPixel.h"
96 if (mapping.hasKeyword(
"EquatorialRadius") && mapping.hasKeyword(
"PolarRadius")) {
111 QString msg =
"Unable to create Latitude object from given mapping group.";
118 if (mapping[
"LatitudeType"][0] ==
"Planetographic") {
121 else if (mapping[
"LatitudeType"][0] ==
"Planetocentric") {
125 QString msg =
"Latitude type [" + mapping[
"LatitudeType"][0] +
126 "] is not recognized";
156 if (mapping.hasKeyword(
"EquatorialRadius") && mapping.hasKeyword(
"PolarRadius")) {
171 QString msg =
"Unable to create Latitude object from given mapping group.";
178 if (mapping[
"LatitudeType"][0] ==
"Planetographic") {
181 else if (mapping[
"LatitudeType"][0] ==
"Planetocentric") {
185 QString msg =
"Latitude type [" + mapping[
"LatitudeType"][0] +
186 "] is not recognized";
229 QString msg =
"Enumeration value [" +
toString(latType) +
"] is not a valid CoordinateType";
247 if (latitudeToCopy.m_equatorialRadius) {
251 if (latitudeToCopy.m_polarRadius) {
318 QString msg =
"Latitude [" +
toString(
true) +
"] cannot "
319 "be converted to Planetographic without the planetary radii, please "
320 "use the other Latitude constructor.";
326 QString msg =
"Latitudes outside of the -90/90 range cannot be converted "
327 "between Planetographic and Planetocentric";
332 QString msg =
"Invalid planetographic latitudes are not currently "
337 double ographicLatitude = atan(tan(
radians()) *
363 QString msg =
"Latitude [" +
Isis::toString(latitude) +
" degrees] cannot be "
364 "converted to Planetocentic without the planetary radii, please use "
365 "the other Latitude constructor.";
369 Angle inputAngle(latitude, units);
373 QString msg =
"Latitudes outside of the -90/90 range cannot be converted "
374 "between Planetographic and Planetocentric";
382 QString msg =
"Invalid planetographic latitudes are not currently "
387 double ocentricLatitude = atan(tan(inputAngle.radians()) *
392 if ((ocentricLatitude > 0) != (inputAngle.radians() > 0)) {
393 ocentricLatitude *= -1;
443 QString msg =
"Minimum latitude [" + min.toString(
true) +
444 "] is greater than maximum latitude [" +
445 max.toString(
true) +
"]";
451 Latitude adjustedMin = min - epsilon;
452 Latitude adjustedMax = max + epsilon;
455 return *
this >= adjustedMin && *
this <= adjustedMax;
469 if (
this == &latitudeToCopy)
return *
this;
476 if (latitudeToCopy.m_equatorialRadius) {
480 if (latitudeToCopy.m_polarRadius) {
509 if (mapping.hasKeyword(
"EquatorialRadius") && mapping.hasKeyword(
"PolarRadius")) {
524 QString msg =
"Unable to add angle to Latitude object from given mapping group.";
529 if (mapping[
"LatitudeType"][0] ==
"Planetocentric")
531 else if (mapping[
"LatitudeType"][0] ==
"Planetographic")
534 QString msg =
"Latitude type [" + mapping[
"LatitudeType"][0] +
"] is not recognized";
538 return add(angleToAdd, equatorialRadius, polarRadius, latType);
591 QString msg =
"Latitudes past 90 degrees are not valid. The latitude ["
Defines an angle and provides unit conversions.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid,...
Angle()
Constructs a blank angle object which needs a value to be set in order to do any calculations.
virtual void setAngle(const double &angle, const Units &unit)
Set angle value in desired units.
double radians() const
Convert an angle to a double.
virtual double angle(const Units &unit) const
Return angle value in desired units.
Units
The set of usable angle measurement units.
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
@ Radians
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
virtual QString toString(bool includeUnits=true) const
Get the angle in human-readable form.
Distance measurement, usually in meters.
@ Meters
The distance is being specified in meters.
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
@ Programmer
This error is for when a programmer made an API call that was illegal.
This class is designed to encapsulate the concept of a Latitude.
void setPlanetographic(double latitude, Angle::Units units=Angle::Radians)
Set the latitude given a value in the Planetographic coordinate system.
Distance * m_equatorialRadius
Used for converting to Planetographic, this is the radius of the target on the equatorial plane.
Latitude & operator=(const Latitude &latitudeToCopy)
This assigns another latitude to this one - making this latitude an exact duplicate of the other.
~Latitude()
This cleans up the Latitude class.
Latitude add(Angle angleToAdd, PvlGroup mapping)
Adds an angle to this latitude.
ErrorChecking
Some user-configurable error checking parameters.
@ AllowPastPole
Don't throw an exception if a latitude beyond -90/90 is found.
CoordinateType
These are the latitude coordinate systems.
@ Planetocentric
This is the universal (and default) latitude coordinate system.
@ Planetographic
This is a secondary coordinate system for latitudes.
bool inRange(Latitude min, Latitude max) const
Checks if this latitude value is within the given range.
void setErrorChecking(ErrorChecking errors)
Set the error checking status.
Distance * m_polarRadius
Used for converting to Planetographic, this is the radius of the target perpendicular to the equatori...
double planetographic(Angle::Units units=Angle::Radians) const
Get the latitude in the planetographic coordinate system.
Latitude()
Create a blank Latitude object without Planetographic support.
double planetocentric(Angle::Units units=Angle::Radians) const
Get the latitude in the planetocentric (universal) coordinate system.
ErrorChecking m_errors
This contains which exceptions should not be thrown.
void setPlanetocentric(double latitude, Angle::Units units=Angle::Radians)
Set the latitude given a value in the Planetocentric coordinate system.
ErrorChecking errorChecking() const
Get the error checking status.
virtual void setAngle(const double &angle, const Angle::Units &units)
Same as planetocentric.
Contains multiple PvlContainers.
static PvlGroup radiiGroup(QString target)
Creates a Pvl Group with keywords TargetName, EquitorialRadius, and PolarRadius.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
bool IsSpecial(const double d)
Returns if the input pixel is special.
double toDouble(const QString &string)
Global function to convert from a string to a double.