7#include "TransverseMercator.h" 
   13#include "IException.h" 
   14#include "TProjection.h" 
   17#include "PvlKeyword.h" 
   47      if ((allowDefaults) && (!mapGroup.hasKeyword(
"CenterLongitude"))) {
 
   54      if ((allowDefaults) && (!mapGroup.hasKeyword(
"CenterLatitude"))) {
 
   65        string msg = 
"Invalid Center Latitude Value. Must be between -90 and 90";
 
   71        string msg = 
"Invalid Center Longitude Value. Must be between -360 and 360";
 
  103      if ((allowDefaults) && (!mapGroup.hasKeyword(
"ScaleFactor"))) {
 
  109      string message = 
"Invalid label group [Mapping]";
 
 
  127    if (!Projection::operator==(proj)) 
return false;
 
 
  142    return "TransverseMercator";
 
 
  174    while(deltaLon < -360.0) deltaLon += 360.0;
 
  175    while(deltaLon > 360.0) deltaLon -= 360.0;
 
  176    double deltaLonRads = deltaLon * 
PI / 180.0;
 
  188                                      - 
m_e1 * sin(2.0 * latRadians)
 
  189                                      + 
m_e2 * sin(4.0 * latRadians) 
 
  190                                      - 
m_e3 * sin(6.0 * latRadians));
 
  193    const double epsilon = 1.0e-10;
 
  198      double cosphi = cos(latRadians);
 
  199      double b = cosphi * sin(deltaLonRads);
 
  202      if (fabs(fabs(b) - 1.0) <= epsilon) {
 
  209      double con = cosphi * cos(deltaLonRads) / sqrt(1.0 - b * b);
 
  210      if (fabs(con) > 1.0) {
 
  222      if (fabs(
HALFPI - fabs(latRadians)) < epsilon) {
 
  228        double sinphi = sin(latRadians);
 
  229        double cosphi = cos(latRadians);
 
  230        double A = cosphi * deltaLonRads;        
 
  231        double Asquared = A * A;
 
  232        double C = 
m_esp * cosphi * cosphi;      
 
  233        double tanphi = tan(latRadians);
 
  234        double T = tanphi * tanphi;              
 
  239               * (1.0 + Asquared / 6.0 * (1.0 - T + C + Asquared / 20.0 
 
  240                                 *(5.0 - 18.0*T + T*T + 72.0*C - 58.0*
m_esp)));
 
  242               * (M - 
m_ml0 + N*tanphi*(Asquared * (0.5 + Asquared / 24.0 *
 
  243                             (5.0 - T + 9.0*C + 4.0*C*C + Asquared / 30.0
 
  244                             *(61.0 - 58.0*T + T*T + 600.0*C - 330.0*
m_esp)))));
 
 
  271    double f, g, h, temp, con, phi, dphi, sinphi, cosphi, tanphi;
 
  272    double c, cs, t, ts, n, rp, d, ds;
 
  273    const double epsilon = 1.0e-10;
 
  278      g = 0.5 * (f - 1.0 / f);
 
  281      con = sqrt((1.0 - h * h) / (1.0 + g * g));
 
  282      if (con > 1.0) con = 1.0;
 
  283      if (con < -1.0) con = -1.0;
 
  287      if (g != 0.0 || h != 0.0) {
 
  296      for (
int i = 1; i < 7; i++) {
 
  297        dphi = ((con + 
m_e1 * sin(2.0 * phi) - 
m_e2 * sin(4.0 * phi)
 
  298                 + 
m_e3 * sin(6.0 * phi)) / 
m_e0) - phi;
 
  300        if (fabs(dphi) <= epsilon) 
break;
 
  304      if (fabs(dphi) > epsilon) {
 
  308      if (fabs(phi) >= 
HALFPI) {
 
  317        c = 
m_esp * cosphi * cosphi;
 
  321        con = 1.0 - 
m_eccsq * sinphi * sinphi;
 
  323        rp = n * (1.0 - 
m_eccsq) / con;
 
  326        m_latitude = phi - (n * tanphi * ds / rp) * (0.5 - ds /
 
  327                     24.0 * (5.0 + 3.0 * t + 10.0 * c - 4.0 * cs - 9.0 *
 
  328                             m_esp - ds / 30.0 * (61.0 + 90.0 * t + 298.0 * c +
 
  329                                 45.0 * ts - 252.0 * 
m_esp - 3.0 * cs)));
 
  338                      + (d * (1.0 - ds / 6.0 *
 
  339                              (1.0 + 2.0 * t + c - ds / 20.0 * (5.0 - 2.0 * c +
 
  340                                   28.0 * t - 3.0 * cs + 8.0 * 
m_esp + 24.0 * ts))) / cosphi);
 
 
  385                                   double &minY, 
double &maxY) {
 
 
  479    bool allowDefaults) {
 
@ Io
A type of error that occurred when performing an actual I/O operation.
 
Base class for Map Projections.
 
double m_maximumX
See minimumX description.
 
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.
 
double m_minimumX
The data elements m_minimumX, m_minimumY, m_maximumX, and m_maximumY are convience data elements when...
 
PvlGroup m_mappingGrp
Mapping group that created this projection.
 
double m_minimumY
See minimumX description.
 
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.
 
double m_maximumY
See minimumX description.
 
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
 
Contains multiple PvlContainers.
 
Container for cube-like labels.
 
A single keyword-value pair.
 
@ Traverse
Search child objects.
 
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
 
Base class for Map TProjections.
 
double m_longitude
This contains the currently set longitude value.
 
bool IsPlanetocentric() const
This indicates if the latitude type is planetocentric (as opposed to planetographic).
 
double m_minimumLatitude
Contains the minimum latitude for the entire ground range.
 
double m_maximumLongitude
Contains the maximum longitude for the entire ground range.
 
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
 
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.
 
int m_longitudeDomain
This integer is either 180 or 360 and is read from the labels.
 
double ToPlanetocentric(const double lat) const
This method converts a planetographic latitude to a planetocentric latitude.
 
void XYRangeCheck(const double latitude, const double longitude)
This convience function is established to assist in the development of the XYRange virtual method.
 
double Eccentricity() const
This returns the eccentricity of the target,.
 
virtual PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
 
double m_minimumLongitude
Contains the minimum longitude for the entire ground range.
 
@ PositiveWest
Longitude values increase in the westerly direction.
 
double m_maximumLatitude
Contains the maximum latitude for the entire ground range.
 
static double To360Domain(const double lon)
This method converts a longitude into the 0 to 360 domain.
 
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.
 
TransverseMercator Map Projection.
 
~TransverseMercator()
Destroys the TransverseMercator object.
 
bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
 
double m_ml0
Distance along the meridian from the equator to the center latitude.
 
double m_eccsq
Eccentricity Squared.
 
double m_e2
Eccentricity Constant: e2 = 15e^4/256 * (1 + 3e^2/4)) estimates the value e2 = 15e^4/256 + 45e^6/1024...
 
QString Version() const
Returns the version of the map projection.
 
double m_scalefactor
Scale Factor for the projection.
 
double m_centerLatitude
The center latitude for the map projection.
 
PvlGroup Mapping()
This function returns the keywords that this projection uses.
 
PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
 
double m_esp
Snyder's (e')^2 variable from equation (8-12) on page.
 
double m_centerLongitude
The center longitude for the map projection.
 
bool operator==(const Projection &proj)
Compares two Projection objects to see if they are equal.
 
double m_e3
Eccentricity Constant: e3 = 35e^6/3072 estimates the value e3 = 35e^6/3072 + ...
 
TransverseMercator(Pvl &label, bool allowDefaults=false)
Constructs a TransverseMercator object.
 
bool m_sph
Flag set to true if sphere, and false if ellipsiod.
 
QString Name() const
Returns the name of the map projection, "TransverseMercator".
 
double m_e0
Eccentricity Constant: e0 = 1 - e^2/4 * (1 + 3e^2/16 * (3 + 5e^2/4)) estimates the value e0 = 1 - e^2...
 
bool SetGround(const double lat, const double lon)
This method is used to set the latitude/longitude (assumed to be of the correct LatitudeType,...
 
PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
 
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...
 
double m_e1
Eccentricity Constant: e1 = 3e^2/8 * (1.0 + e^2/4 * (1.0 + 15e^2/32)) estimates the value e1 = 3e^2/8...
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
const double HALFPI
The mathematical constant PI/2.
 
const double PI
The mathematical constant PI.
 
Namespace for the standard library.