7#include "ObliqueCylindrical.h"
15#include "IException.h"
16#include "TProjection.h"
19#include "PvlKeyword.h"
20#include "NaifStatus.h"
41 PvlGroup &mapGroup = label.findGroup(
"Mapping", Pvl::Traverse);
51 throw IException(IException::Unknown,
52 "Pole latitude must be between -90 and 90.",
59 throw IException(IException::Unknown,
60 "Pole longitude must be between -360 and 360.",
67 throw IException(IException::Unknown,
68 "Pole rotation must be between -360 and 360.",
72 bool calculateVectors =
false;
75 if (!mapGroup.hasKeyword(
"XAxisVector")
76 || mapGroup[
"XAxisVector"].size() != 3) {
77 calculateVectors =
true;
80 if (!mapGroup.hasKeyword(
"YAxisVector")
81 || mapGroup[
"YAxisVector"].size() != 3) {
82 calculateVectors =
true;
85 if (!mapGroup.hasKeyword(
"ZAxisVector")
86 || mapGroup[
"ZAxisVector"].size() != 3) {
87 calculateVectors =
true;
90 if (!calculateVectors) {
92 m_xAxisVector.push_back(toDouble(mapGroup[
"XAxisVector"][0]));
93 m_xAxisVector.push_back(toDouble(mapGroup[
"XAxisVector"][1]));
94 m_xAxisVector.push_back(toDouble(mapGroup[
"XAxisVector"][2]));
96 m_yAxisVector.push_back(toDouble(mapGroup[
"YAxisVector"][0]));
97 m_yAxisVector.push_back(toDouble(mapGroup[
"YAxisVector"][1]));
98 m_yAxisVector.push_back(toDouble(mapGroup[
"YAxisVector"][2]));
100 m_zAxisVector.push_back(toDouble(mapGroup[
"ZAxisVector"][0]));
101 m_zAxisVector.push_back(toDouble(mapGroup[
"ZAxisVector"][1]));
102 m_zAxisVector.push_back(toDouble(mapGroup[
"ZAxisVector"][2]));
114 eul2m_c(rotationAngle, latitudeAngle, longitudeAngle, 3, 2, 3, pvec);
118 if (mapGroup.hasKeyword(
"XAxisVector")) {
119 mapGroup.deleteKeyword(
"XAxisVector");
121 if (mapGroup.hasKeyword(
"YAxisVector")) {
122 mapGroup.deleteKeyword(
"YAxisVector");
124 if (mapGroup.hasKeyword(
"ZAxisVector")) {
125 mapGroup.deleteKeyword(
"ZAxisVector");
128 mapGroup += PvlKeyword(
"XAxisVector");
129 mapGroup += PvlKeyword(
"YAxisVector");
130 mapGroup += PvlKeyword(
"ZAxisVector");
133 for (
int i = 0; i < 3; i++) {
138 mapGroup[
"XAxisVector"] +=
toString(pvec[0][i]);
139 mapGroup[
"YAxisVector"] +=
toString(pvec[1][i]);
140 mapGroup[
"ZAxisVector"] +=
toString(pvec[2][i]);
146 catch(IException &e) {
147 QString message =
"Invalid label group [Mapping]";
148 throw IException(e, IException::Io, message, _FILEINFO_);
165 if (!Projection::operator==(proj))
return false;
182 return "ObliqueCylindrical";
208 double normalLat, normalLon;
209 double obliqueLat, obliqueLon;
232 obliqueLon = atan2(cos(normalLat) * sin(normalLon -
poleLongitude),
237 while(obliqueLon < - PI) {
238 obliqueLon += (2.0 * PI);
241 while(obliqueLon >= PI) {
242 obliqueLon -= (2.0 * PI);
277 if (abs(abs(
m_latitude) - HALFPI) < DBL_EPSILON) {
290 double obliqueLat, obliqueLon;
346 double &minY,
double &maxY) {
418 void ObliqueCylindrical::init() {
429 throw IException(IException::Unknown,
430 "The input center latitude is too close to a pole "
431 "which will result in a division by zero.",
450 bool allowDefaults) {
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Oblique Cylindrical Map Projection.
QString Version() const
Returns the version of the map projection.
std::vector< double > m_xAxisVector
The x-axis vector, read from the mapping group in the label.
~ObliqueCylindrical()
Destroys the ObliqueCylindrical object.
bool SetGround(const double lat, const double lon)
This method is used to set the latitude/longitude (assumed to be of the correct LatitudeType,...
bool operator==(const Isis::Projection &proj)
Compares two Projection objects to see if they are equal.
ObliqueCylindrical(Isis::Pvl &label, bool allowDefaults=false)
Constructs an ObliqueCylindrical object.
std::vector< double > m_yAxisVector
The y-axis vector, read from the mapping group in the label.
std::vector< double > m_zAxisVector
The z-axis vector, read from the mapping group in the label.
PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
double poleRotation() const
Returns the value of the pole rotation.
double m_poleLongitude
The Oblique Pole Longitude.
double poleLongitude() const
Returns the value of the pole longitude.
double m_poleLatitude
The Oblique Pole Latitude.
QString Name() const
Returns the name of the map projection, "ObliqueCylindrical".
bool XYRange(double &minX, double &maxX, double &minY, double &maxY)
This method is used to determine the x/y range which completely covers the area of interest specified...
bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
double poleLatitude() const
Returns the value of the pole latitude.
PvlGroup Mapping()
This function returns the keywords that this projection uses.
double m_poleRotation
The Oblique Pole Rotation.
Base class for Map Projections.
double GetX() const
Calculates the unrotated form of current x value.
bool m_good
Indicates if the contents of m_x, m_y, m_latitude, and m_longitude are valid.
PvlGroup m_mappingGrp
Mapping group that created this projection.
double GetY() const
Calculates the unrotated form of the current y value.
void SetXY(double x, double y)
This protected method is a helper for derived classes.
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
double m_longitude
This contains the currently set longitude value.
bool xyRangeOblique(double &minX, double &maxX, double &minY, double &maxY)
This method is used to find the XY range for oblique aspect projections (non-polar projections) by "w...
bool IsPlanetocentric() const
This indicates if the latitude type is planetocentric (as opposed to planetographic).
double m_equatorialRadius
Polar radius of the target.
LongitudeDirection m_longitudeDirection
An enumerated type indicating the LongitudeDirection read from the labels.
virtual PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
virtual PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
@ PositiveWest
Longitude values increase in the westerly direction.
TProjection(Pvl &label)
Constructs an empty TProjection object.
virtual PvlGroup Mapping()
This function returns the keywords that this projection uses.
double ToPlanetographic(const double lat) const
This method converts a planetocentric latitude to a planetographic latitude.
double m_latitude
This contains the currently set latitude value.
This is free and unencumbered software released into the public domain.
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.