7#include "LambertConformal.h"
13#include "IException.h"
15#include "Projection.h"
18#include "PvlKeyword.h"
49 if ((allowDefaults) && (!mapGroup.hasKeyword(
"CenterLongitude"))) {
56 if ((allowDefaults) && (!mapGroup.hasKeyword(
"CenterLatitude"))) {
71 message +=
"] must be between -360 and 360";
80 m_par1 = mapGroup[
"FirstStandardParallel"];
84 m_par2 = mapGroup[
"SecondStandardParallel"];
91 QString message =
"Standard Parallels must between -90 and 90";
95 QString message =
"Standard Parallels cannot be symmetric to the equator";
121 message +=
"] is not valid, it projects to infinity "
122 "for standard parallels [";
129 message +=
"] is not valid, it projects to infinity "
130 "for standard parallels [";
143 double sinpar1 = sin(
m_par1);
144 double cospar1 = cos(
m_par1);
145 double m1 =
mCompute(sinpar1, cospar1);
148 double sinpar2 = sin(
m_par2);
149 double cospar2 = cos(
m_par2);
150 double m2 =
mCompute(sinpar2, cospar2);
158 m_n = log(m1 / m2) / log(t1 / t2);
167 QString message =
"Invalid label group [Mapping]";
185 if (!Projection::operator==(proj))
return false;
200 return "LambertConformal";
239 double lonRadians = lon *
PI / 180.0;
244 double latRadians = lat;
246 latRadians *=
PI / 180.0;
250 if (fabs(fabs(latRadians) -
HALFPI) < DBL_EPSILON) {
252 if (latRadians *
m_n <= 0.0) {
259 double sinlat = sin(latRadians);
261 double t =
tCompute(latRadians, sinlat);
267 double x = rh * sin(theta);
268 double y =
m_rho - rh * cos(theta);
294 if (
m_n >= 0) sign = 1.0;
298 double rh = sign * sqrt(
GetX() *
GetX() + temp * temp);
301 if (rh != 0) theta = atan2(sign *
GetX(), sign * temp);
305 if (rh != 0 ||
m_n > 0) {
362 double &minY,
double &maxY) {
373 bool north_hemi =
true;
378 if (
m_par2 < 0.0) north_hemi =
false;
387 double pole_north, min_lat_north, max_lat_north, londiff;
409 double y = min_lat_north + 2.0 * (pole_north - min_lat_north);
419 for (
int i = 0; i < 3; i++) {
450 double y = max_lat_north - 2.0 * (max_lat_north - pole_north);
460 for (
int i = 0; i < 3; i++) {
542 bool allowDefaults) {
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ Io
A type of error that occurred when performing an actual I/O operation.
Adds specific functionality to C++ strings.
Base class for Map Projections.
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround,...
double m_maximumX
See minimumX description.
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround,...
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.
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.
double mCompute(const double sinphi, const double cosphi) const
A convience method to compute Snyder's m equation (14-15) for a given latitude, .
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.
virtual PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
double phi2Compute(const double t) const
A convience method to compute latitude angle phi2 given small t, from Syder's recursive equation (7-9...
double m_minimumLongitude
Contains the minimum longitude for the entire ground range.
double tCompute(const double phi, const double sinphi) const
A convience method to compute Snyder's t equation (15-9) for a given latitude, .
@ 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 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(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.