13#include "IException.h"
14#include "Projection.h"
17#include "PvlKeyword.h"
19const double EPSILON = 1.0e-10;
68 m_xlr << 0 << 0.9986 <<
94 if ((allowDefaults) && (!mapGroup.hasKeyword(
"CenterLongitude"))) {
107 QString message =
"Invalid label group [Mapping]";
125 if (!Projection::operator==(proj))
return false;
168 double latRadians = lat *
DEG2RAD;
169 double lonRadians = lon *
DEG2RAD;
174 double p2 = fabs(latRadians / 5.0 /
DEG2RAD);
175 long ip1 = (long) (p2 - EPSILON);
184 m_xlr[ip1 + 1]) / 2.0 +
185 p2 * p2 * (m_xlr[ip1 + 3] - 2.0 * m_xlr[ip1 + 2] +
186 m_xlr[ip1 + 1])/2.0) * deltaLon;
189 m_pr[ip1 +1]) / 2.0 + p2 * p2 * (m_pr[ip1 + 3] -
190 2.0 * m_pr[ip1 + 2] + m_pr[ip1 + 1]) / 2.0);
191 if (lat < 0) y *= -1.;
219 double phid = yy * 90.0;
220 double p2 = fabs(phid / 5.0);
221 long ip1 = (long) (p2 - EPSILON);
222 if (ip1 == 0) ip1 = 1;
236 u = m_pr[ip1 + 3] - m_pr[ip1 + 1];
237 v = m_pr[ip1 + 3] - 2.0 * m_pr[ip1 + 2] + m_pr[ip1 + 1];
238 t = 2.0 * (fabs(yy) - m_pr[ip1 + 2]) / u;
240 p2 = t * (1.0 - c * t * (1.0 - 2.0 * c * t));
242 if ((p2 >= 0.0) || (ip1 == 1)) {
243 phid = (p2 + (double) ip1 ) * 5.0;
244 if (y < 0) phid *= -1;
247 p2 = fabs(phid / 5.0);
248 ip1 = (long) (p2 - EPSILON);
255 m_pr[ip1 +1]) / 2.0 + p2 * p2 * (m_pr[ip1 + 3] -
256 2.0 * m_pr[ip1 + 2] + m_pr[ip1 + 1])/2.0);
257 if (y < 0) y1 *= -1.;
264 }
while (fabs(y1 - y) > .00001);
281 p2 * (m_xlr[ip1 + 3] - m_xlr[ip1 + 1]) / 2.0 +
282 p2 * p2 * (m_xlr[ip1 + 3] - 2.0 * m_xlr[ip1 + 2] +
283 m_xlr[ip1 + 1]) / 2.0);
318 double &minY,
double &maxY) {
397 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.
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.
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.
double m_centerLongitude
The center longitude for the map projection.
~Robinson()
Destroys the Robinson 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,...
QString Version() const
Returns the version of the map projection.
PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
PvlGroup Mapping()
This function returns the 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...
Robinson(Pvl &label, bool allowDefaults=false)
Constructs a Robinson object.
bool operator==(const Projection &proj)
Compares two Projection objects to see if they are equal.
bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
QString Name() const
Returns the name of the map projection, "Robinson".
PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
Base class for Map TProjections.
double m_longitude
This contains the currently set longitude value.
double m_minimumLatitude
Contains the minimum latitude for the entire ground range.
double m_maximumLongitude
Contains the maximum longitude for the entire ground range.
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.
void XYRangeCheck(const double latitude, const double longitude)
This convience function is established to assist in the development of the XYRange virtual method.
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.
virtual PvlGroup Mapping()
This function returns the keywords that this projection uses.
double m_latitude
This contains the currently set latitude value.
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 DEG2RAD
Multiplier for converting from degrees to radians.
const double RAD2DEG
Multiplier for converting from radians to degrees.
Namespace for the standard library.