55 TransverseMercator::TransverseMercator(
Pvl &label,
bool allowDefaults) :
63 if ((allowDefaults) && (!mapGroup.
hasKeyword(
"CenterLongitude"))) {
70 if ((allowDefaults) && (!mapGroup.
hasKeyword(
"CenterLatitude"))) {
81 string msg =
"Invalid Center Latitude Value. Must be between -90 and 90";
87 string msg =
"Invalid Center Longitude Value. Must be between -360 and 360";
119 if ((allowDefaults) && (!mapGroup.
hasKeyword(
"ScaleFactor"))) {
125 string message =
"Invalid label group [Mapping]";
143 if (!Projection::operator==(proj))
return false;
158 return "TransverseMercator";
190 while(deltaLon < -360.0) deltaLon += 360.0;
191 while(deltaLon > 360.0) deltaLon -= 360.0;
192 double deltaLonRads = deltaLon *
PI / 180.0;
204 -
m_e1 * sin(2.0 * latRadians)
205 +
m_e2 * sin(4.0 * latRadians)
206 -
m_e3 * sin(6.0 * latRadians));
209 const double epsilon = 1.0e-10;
214 double cosphi = cos(latRadians);
215 double b = cosphi * sin(deltaLonRads);
218 if (fabs(fabs(b) - 1.0) <= epsilon) {
225 double con = cosphi * cos(deltaLonRads) / sqrt(1.0 - b * b);
226 if (fabs(con) > 1.0) {
238 if (fabs(
HALFPI - fabs(latRadians)) < epsilon) {
244 double sinphi = sin(latRadians);
245 double cosphi = cos(latRadians);
246 double A = cosphi * deltaLonRads;
247 double Asquared = A * A;
248 double C =
m_esp * cosphi * cosphi;
249 double tanphi = tan(latRadians);
250 double T = tanphi * tanphi;
255 * (1.0 + Asquared / 6.0 * (1.0 - T + C + Asquared / 20.0
256 *(5.0 - 18.0*T + T*T + 72.0*C - 58.0*
m_esp)));
258 * (M -
m_ml0 + N*tanphi*(Asquared * (0.5 + Asquared / 24.0 *
259 (5.0 - T + 9.0*C + 4.0*C*C + Asquared / 30.0
260 *(61.0 - 58.0*T + T*T + 600.0*C - 330.0*
m_esp)))));
287 double f, g, h, temp, con, phi, dphi, sinphi, cosphi, tanphi;
288 double c, cs, t, ts, n, rp, d, ds;
289 const double epsilon = 1.0e-10;
294 g = 0.5 * (f - 1.0 / f);
297 con = sqrt((1.0 - h * h) / (1.0 + g * g));
298 if (con > 1.0) con = 1.0;
299 if (con < -1.0) con = -1.0;
303 if (g != 0.0 || h != 0.0) {
312 for (
int i = 1; i < 7; i++) {
313 dphi = ((con +
m_e1 * sin(2.0 * phi) -
m_e2 * sin(4.0 * phi)
314 +
m_e3 * sin(6.0 * phi)) /
m_e0) - phi;
316 if (fabs(dphi) <= epsilon)
break;
320 if (fabs(dphi) > epsilon) {
324 if (fabs(phi) >=
HALFPI) {
333 c =
m_esp * cosphi * cosphi;
337 con = 1.0 -
m_eccsq * sinphi * sinphi;
339 rp = n * (1.0 -
m_eccsq) / con;
342 m_latitude = phi - (n * tanphi * ds / rp) * (0.5 - ds /
343 24.0 * (5.0 + 3.0 * t + 10.0 * c - 4.0 * cs - 9.0 *
344 m_esp - ds / 30.0 * (61.0 + 90.0 * t + 298.0 * c +
345 45.0 * ts - 252.0 *
m_esp - 3.0 * cs)));
354 + (d * (1.0 - ds / 6.0 *
355 (1.0 + 2.0 * t + c - ds / 20.0 * (5.0 - 2.0 * c +
356 28.0 * t - 3.0 * cs + 8.0 *
m_esp + 24.0 * ts))) / cosphi);
401 double &minY,
double &maxY) {
495 bool allowDefaults) {
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
bool m_sph
Flag set to true if sphere, and false if ellipsiod.
const double PI
The mathematical constant PI.
Longitude values increase in the westerly direction.
Base class for Map TProjections.
double m_e3
Eccentricity Constant: e3 = 35e^6/3072 estimates the value e3 = 35e^6/3072 + ...
QString Version() const
Returns the version of the map projection.
const double HALFPI
The mathematical constant PI/2.
Namespace for the standard library.
double m_scalefactor
Scale Factor for the projection.
double GetX() const
Calculates the unrotated form of current x value.
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_minimumX
The data elements m_minimumX, m_minimumY, m_maximumX, and m_maximumY are convience data elements when...
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
A type of error that occurred when performing an actual I/O operation.
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
double m_latitude
This contains the currently set latitude value.
virtual PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
double m_maximumY
See minimumX description.
double m_longitude
This contains the currently set longitude value.
Isis::Projection * TransverseMercatorPlugin(Isis::Pvl &lab, bool allowDefaults)
This is the function that is called in order to instantiate a TransverseMercator object.
bool IsPlanetocentric() const
This indicates if the latitude type is planetocentric (as opposed to planetographic).
double m_maximumLongitude
Contains the maximum longitude for the entire ground range.
double m_eccsq
Eccentricity Squared.
double m_minimumLatitude
Contains the minimum latitude for the entire ground range.
QString Name() const
Returns the name of the map projection, "TransverseMercator".
double m_maximumLatitude
Contains the maximum latitude for the entire ground range.
Base class for Map Projections.
double m_minimumY
See minimumX description.
double m_e2
Eccentricity Constant: e2 = 15e^4/256 * (1 + 3e^2/4)) estimates the value e2 = 15e^4/256 + 45e^6/1024...
double Eccentricity() const
This returns the eccentricity of the target,.
double m_equatorialRadius
Polar radius of the target.
int m_longitudeDomain
This integer is either 180 or 360 and is read from the labels.
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
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...
A single keyword-value pair.
bool SetGround(const double lat, const double lon)
This method is used to set the latitude/longitude (assumed to be of the correct LatitudeType, LongitudeDirection, and LongitudeDomain.
TransverseMercator Map Projection.
Container for cube-like labels.
double ToPlanetographic(const double lat) const
This method converts a planetocentric latitude to a planetographic latitude.
virtual PvlGroup Mapping()
This function returns the keywords that this projection uses.
bool m_good
Indicates if the contents of m_x, m_y, m_latitude, and m_longitude are valid.
static double To360Domain(const double lon)
This method converts a longitude into the 0 to 360 domain.
double m_ml0
Distance along the meridian from the equator to the center latitude.
double m_centerLongitude
The center longitude for the map projection.
LongitudeDirection m_longitudeDirection
An enumerated type indicating the LongitudeDirection read from the labels.
Namespace for ISIS/Bullet specific routines.
double m_centerLatitude
The center latitude for the map projection.
PvlGroup Mapping()
This function returns the keywords that this projection uses.
double GetY() const
Calculates the unrotated form of the current y value.
double ToPlanetocentric(const double lat) const
This method converts a planetographic latitude to a planetocentric latitude.
double m_esp
Snyder's (e')^2 variable from equation (8-12) on page.
virtual PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
void SetXY(double x, double y)
This protected method is a helper for derived classes.
PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
void XYRangeCheck(const double latitude, const double longitude)
This convience function is established to assist in the development of the XYRange virtual method...
double m_minimumLongitude
Contains the minimum longitude for the entire ground range.
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...
double m_maximumX
See minimumX description.
~TransverseMercator()
Destroys the TransverseMercator object.
PvlGroup m_mappingGrp
Mapping group that created this projection.
bool operator==(const Projection &proj)
Compares two Projection objects to see if they are equal.