Isis Developer Reference
TProjection.h
Go to the documentation of this file.
1 #ifndef TProjection_h
2 #define TProjection_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include <string>
10 #include <vector>
11 
12 #include "Projection.h"
13 #include "PvlGroup.h" // protected data member object (m_mappingGrp)
14 
15 namespace Isis {
16  class Displacement;
17  class Pvl;
18  class WorldMapper;
166  class TProjection : public Projection {
167  public:
168  // constructor
169  TProjection(Pvl &label);
170  virtual ~TProjection();
171  virtual bool operator== (const Projection &proj);
172 
173  double EquatorialRadius() const;
174  double PolarRadius() const;
175  double Eccentricity() const;
176  double LocalRadius(double lat) const;
177  double LocalRadius() const; // requires SetGround or SetCoordinate
178 
179  // These return or change properties of the projection, independent of calculations
186  virtual QString Name() const = 0;
187 
188 
195  virtual QString Version() const = 0;
196  virtual double TrueScaleLatitude() const;
197  virtual bool IsEquatorialCylindrical();
198 
199 
203  enum LatitudeType {
209  };
210 
211 
212  // Check latitude type or get latitude type as a string
213  bool IsPlanetocentric() const;
214  bool IsPlanetographic() const;
215  QString LatitudeTypeString() const;
216  // change latitude type
217  double ToPlanetocentric(const double lat) const;
218  double ToPlanetographic(const double lat) const;
219 
225  PositiveWest
227  };
228 
229  // Check longitude direction or get longitude direction as a string
230  bool IsPositiveEast() const;
231  bool IsPositiveWest() const;
232  QString LongitudeDirectionString() const;
233 
234  // Check longitude domain or get longitude domain as a string
235  bool Has180Domain() const;
236  bool Has360Domain() const;
237  QString LongitudeDomainString() const;
238 
239  // Get min/max lat/lon
240  virtual double MinimumLatitude() const;
241  virtual double MaximumLatitude() const;
242  virtual double MinimumLongitude() const;
243  virtual double MaximumLongitude() const;
244 
245  // Calculations
246  // Set ground position or x/y coordinate
247  virtual bool SetGround(const double lat, const double lon);
248  virtual bool SetCoordinate(const double x, const double y);
249 
250  // Methods that depend on successful completion
251  // of SetGround/SetCoordinate Get lat,lon, x,y
252  virtual double Latitude() const;
253  virtual double Longitude() const;
254 
255  // Set the universal ground coordinate (calls SetGround)
256  virtual bool SetUniversalGround(const double lat, const double lon);
257  bool SetUnboundUniversalGround(const double coord1, const double coord2);
258 
259  // Return the universal ground coordinate after successful SetCoordinate
260  virtual double UniversalLatitude();
261  virtual double UniversalLongitude();
262 
263  // get scale for mapping world coordinates
264  double Scale() const;
265 
266  // Return the x/y range which covers the lat/lon range in the labels
267  virtual bool XYRange(double &minX, double &maxX,
268  double &minY, double &maxY);
269 
270  // get mapping information
271  virtual PvlGroup Mapping();
272  virtual PvlGroup MappingLatitudes();
273  virtual PvlGroup MappingLongitudes();
274 
275  // change latitude type
276  static double ToPlanetocentric(double lat,
277  double eRadius, double pRadius);
278  static double ToPlanetographic(double lat,
279  double eRadius, double pRadius);
280  // change longitude direction
281  static double ToPositiveEast(const double lon, const int domain);
282  static double ToPositiveWest(const double lon, const int domain);
283 
284  // change longitude domain
285  static double To180Domain(const double lon);
286  static double To360Domain(const double lon);
287 
288  protected:
289  void XYRangeCheck(const double latitude, const double longitude);
290  bool inLongitudeRange(double longitude);
291  bool inLongitudeRange(double minLon, double maxLon, double longitude);
292  bool inLatitudeRange(double latitude);
293  bool xyRangeOblique(double &minX, double &maxX,
294  double &minY, double &maxY);
295 
296  // Convience methods for typical projection computations from Snyder
297  double qCompute(const double sinPhi) const; // page 16
298  double phi2Compute(const double t) const; // page 44
299  double mCompute(const double sinphi, const double cosphi) const; // page 101
300  double tCompute(const double phi, const double sinphi) const; //page 108
301  double e4Compute() const; // page 161
302 
303  private:
304  void doSearch(double minBorder, double maxBorder,
305  double &extremeVal, const double constBorder,
306  bool searchX, bool searchLongitude, bool findMin);
307  void findExtreme(double &minBorder, double &maxBorder,
308  double &minBorderX, double &minBorderY,
309  double &maxBorderX, double &maxBorderY,
310  const double constBorder, bool searchX,
311  bool searchLongitude, bool findMin);
312  void setSearchGround(const double variableBorder,
313  const double constBorder, bool variableIsLat);
314 
315  protected:
316  double m_latitude;
318  double m_longitude;
330  // TODO** Can this be generalized for both longitude and azimuth???
342  double m_polarRadius;
352  double m_eccentricity;
353 
362  private:
363  // These are necessary for calculating oblique X/Y range with
364  // discontinuity
365  std::vector<double> m_specialLatCases;
367  std::vector<double> m_specialLonCases;
369  };
370 };
371 #endif
372 
Isis::TProjection::m_maximumLatitude
double m_maximumLatitude
Contains the maximum latitude for the entire ground range.
Definition: TProjection.h:356
Isis::Target::radiiGroup
static PvlGroup radiiGroup(QString target)
Creates a Pvl Group with keywords TargetName, EquitorialRadius, and PolarRadius.
Definition: Target.cpp:403
Isis::Angle::Degrees
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:56
Isis::HALFPI
const double HALFPI
The mathematical constant PI/2.
Definition: Constants.h:41
Displacement.h
FileName.h
Isis::TProjection::m_longitude
double m_longitude
This contains the currently set longitude value.
Definition: TProjection.h:318
Isis::TProjection::m_eccentricity
double m_eccentricity
The eccentricity of the target body.
Definition: TProjection.h:352
Isis::TProjection::m_longitudeDomain
int m_longitudeDomain
This integer is either 180 or 360 and is read from the labels.
Definition: TProjection.h:331
Isis::TProjection::operator==
virtual bool operator==(const Projection &proj)
This method determines whether two map projection objects are equal by comparing the equatorial radiu...
Definition: TProjection.cpp:260
Isis::TProjection::m_minimumLongitude
double m_minimumLongitude
Contains the minimum longitude for the entire ground range.
Definition: TProjection.h:358
Isis::TProjection::m_latitude
double m_latitude
This contains the currently set latitude value.
Definition: TProjection.h:316
Isis::TProjection::ToPositiveWest
static double ToPositiveWest(const double lon, const int domain)
This method converts a longitude into the positive west direction.
Definition: TProjection.cpp:587
Isis::TProjection::Version
virtual QString Version() const =0
This method returns the Version of the map projection.
Isis::Projection::m_mapper
WorldMapper * m_mapper
This points to a mapper passed into the SetWorldMapper method.
Definition: Projection.h:292
Isis::TProjection::IsPositiveWest
bool IsPositiveWest() const
This indicates if the longitude direction type is positive east (as opposed to postive west).
Definition: TProjection.cpp:531
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
Isis::TProjection::UniversalLatitude
virtual double UniversalLatitude()
This returns a universal latitude (planetocentric).
Definition: TProjection.cpp:908
Isis::TProjection::LongitudeDirectionString
QString LongitudeDirectionString() const
This method returns the longitude direction as a string.
Definition: TProjection.cpp:620
Isis::TProjection::m_longitudeDirection
LongitudeDirection m_longitudeDirection
An enumerated type indicating the LongitudeDirection read from the labels.
Definition: TProjection.h:324
Isis::TProjection::m_minimumLatitude
double m_minimumLatitude
Contains the minimum latitude for the entire ground range.
Definition: TProjection.h:354
SpecialPixel.h
Isis::TProjection::PositiveWest
@ PositiveWest
Longitude values increase in the westerly direction.
Definition: TProjection.h:225
Isis::TProjection::e4Compute
double e4Compute() const
A convience method to compute.
Definition: TProjection.cpp:1891
Isis::Projection::PixelResolution
double PixelResolution() const
Returns the pixel resolution value from the PVL mapping group in meters/pixel.
Definition: Projection.cpp:840
Isis::TProjection::SetCoordinate
virtual bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
Definition: TProjection.cpp:789
Isis::TProjection::MinimumLongitude
virtual double MinimumLongitude() const
This returns the minimum longitude of the area of interest.
Definition: TProjection.cpp:732
Isis::TProjection::~TProjection
virtual ~TProjection()
Destroys the TProjection object.
Definition: TProjection.cpp:247
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
PvlGroup.h
Isis::Projection::m_minimumY
double m_minimumY
See minimumX description.
Definition: Projection.h:327
Isis::TProjection::Planetocentric
@ Planetocentric
Latitudes are measured as the angle from the equatorial plane to the plane through the center of the ...
Definition: TProjection.h:204
Target.h
Isis::TProjection::IsPlanetographic
bool IsPlanetographic() const
This indicates if the latitude type is planetographic (as opposed to planetocentric).
Definition: TProjection.cpp:403
Isis::TProjection::Longitude
virtual double Longitude() const
This returns a longitude with correct longitude direction and domain as specified in the label object...
Definition: TProjection.cpp:823
Longitude.h
Isis::TProjection::xyRangeOblique
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...
Definition: TProjection.cpp:1195
NaifStatus.h
Isis::TProjection::tCompute
double tCompute(const double phi, const double sinphi) const
A convience method to compute Snyder's t equation (15-9) for a given latitude, .
Definition: TProjection.cpp:1870
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::TProjection::Eccentricity
double Eccentricity() const
This returns the eccentricity of the target,.
Definition: TProjection.cpp:304
Isis::TProjection::TProjection
TProjection(Pvl &label)
Constructs an empty TProjection object.
Definition: TProjection.cpp:90
Isis::Projection::SetXY
void SetXY(double x, double y)
This protected method is a helper for derived classes.
Definition: Projection.cpp:804
WorldMapper.h
Isis::TProjection::PositiveEast
@ PositiveEast
Longitude values increase in the easterly direction.
Definition: TProjection.h:223
Isis::TProjection::ToPlanetocentric
double ToPlanetocentric(const double lat) const
This method converts a planetographic latitude to a planetocentric latitude.
Definition: TProjection.cpp:418
Isis::TProjection::m_latitudeType
LatitudeType m_latitudeType
An enumerated type indicating the LatitudeType read from the labels.
Definition: TProjection.h:321
Isis::WorldMapper::Resolution
virtual double Resolution() const
This virtual method will the resolution of the world system relative to one unit in the projection sy...
Definition: WorldMapper.h:100
Isis::TProjection::MaximumLatitude
virtual double MaximumLatitude() const
This returns the maximum latitude of the area of interest.
Definition: TProjection.cpp:721
Isis::TProjection::XYRangeCheck
void XYRangeCheck(const double latitude, const double longitude)
This convience function is established to assist in the development of the XYRange virtual method.
Definition: TProjection.cpp:1062
QStringList
Isis::TProjection::EquatorialRadius
double EquatorialRadius() const
This returns the equatorial radius of the target.
Definition: TProjection.cpp:277
Isis::TProjection::Has360Domain
bool Has360Domain() const
This indicates if the longitude domain is 0 to 360 (as opposed to -180 to 180).
Definition: TProjection.cpp:643
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::Longitude::force180Domain
Longitude force180Domain() const
This returns a longitude that is constricted to -180 to 180 degrees.
Definition: Longitude.cpp:289
IString.h
Isis::Projection::m_mappingGrp
PvlGroup m_mappingGrp
Mapping group that created this projection.
Definition: Projection.h:329
Isis::Projection::setProjectionType
void setProjectionType(const ProjectionType ptype)
Sets the projection subclass type.
Definition: Projection.cpp:188
Isis::Longitude
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:40
Isis::TProjection::LongitudeDomainString
QString LongitudeDomainString() const
This method returns the longitude domain as a string.
Definition: TProjection.cpp:698
Isis::TProjection::LatitudeTypeString
QString LatitudeTypeString() const
This method returns the latitude type as a string.
Definition: TProjection.cpp:508
Isis::TProjection::SetUniversalGround
virtual bool SetUniversalGround(const double lat, const double lon)
This method is used to set the latitude/longitude which must be Planetocentric (latitude) and Positiv...
Definition: TProjection.cpp:839
Isis::TProjection::inLongitudeRange
bool inLongitudeRange(double longitude)
Determine whether the given longitude is within the range of the MinimumLongitude and MaximumLongitud...
Definition: TProjection.cpp:1140
Isis::Projection::IsGood
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:374
Isis::TProjection::qCompute
double qCompute(const double sinPhi) const
A convience method to compute Snyder's q equation (3-12) for a given latitude, .
Definition: TProjection.cpp:1770
Isis::Projection::m_minimumX
double m_minimumX
The data elements m_minimumX, m_minimumY, m_maximumX, and m_maximumY are convience data elements when...
Definition: Projection.h:317
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::TProjection::IsPositiveEast
bool IsPositiveEast() const
This indicates if the longitude direction type is positive west (as opposed to postive east).
Definition: TProjection.cpp:520
Pvl.h
Isis::TProjection::Planetographic
@ Planetographic
Latitudes are measured as the angle from the equatorial plane to the normal to the surface of the pla...
Definition: TProjection.h:207
Isis::TProjection::PolarRadius
double PolarRadius() const
This returns the polar radius of the target.
Definition: TProjection.cpp:287
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::TProjection::Latitude
virtual double Latitude() const
This returns a latitude with correct latitude type as specified in the label object.
Definition: TProjection.cpp:811
Isis::Projection::m_good
bool m_good
Indicates if the contents of m_x, m_y, m_latitude, and m_longitude are valid.
Definition: Projection.h:300
Isis::TProjection::XYRange
virtual 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...
Definition: TProjection.cpp:993
Isis::TProjection
Base class for Map TProjections.
Definition: TProjection.h:166
Isis::TProjection::SetUnboundUniversalGround
bool SetUnboundUniversalGround(const double coord1, const double coord2)
This method is used to set the latitude/longitude.
Definition: TProjection.cpp:879
Isis::TProjection::Scale
double Scale() const
This method returns the scale for mapping world coordinates into projection coordinates.
Definition: TProjection.cpp:940
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::TProjection::To180Domain
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
Definition: TProjection.cpp:657
Isis::TProjection::Has180Domain
bool Has180Domain() const
This indicates if the longitude domain is -180 to 180 (as opposed to 0 to 360).
Definition: TProjection.cpp:632
TProjection.h
Isis::Projection::m_groundRangeGood
bool m_groundRangeGood
Indicates if the ground range (min/max lat/lons) were read from the labels.
Definition: Projection.h:313
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::TProjection::MaximumLongitude
virtual double MaximumLongitude() const
This returns the maximum longitude of the area of interest.
Definition: TProjection.cpp:743
Isis::TProjection::inLatitudeRange
bool inLatitudeRange(double latitude)
Determine whether the given latitude is within the range of the MinimumLatitude and MaximumLatitude r...
Definition: TProjection.cpp:1160
Isis::TProjection::LatitudeType
LatitudeType
This enum defines the types of Latitude supported in this class.
Definition: TProjection.h:203
Isis::TProjection::MappingLongitudes
virtual PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
Definition: TProjection.cpp:1739
Isis::TProjection::LocalRadius
double LocalRadius() const
This method returns the local radius in meters at the current latitude position.
Definition: TProjection.cpp:353
Isis::TProjection::TrueScaleLatitude
virtual double TrueScaleLatitude() const
This method returns the latitude of true scale.
Definition: TProjection.cpp:368
Isis::Projection::SetComputedXY
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
Definition: Projection.cpp:780
IException.h
Isis::TProjection::SetGround
virtual bool SetGround(const double lat, const double lon)
This method is used to set the latitude/longitude (assumed to be of the correct LatitudeType,...
Definition: TProjection.cpp:760
std
Namespace for the standard library.
Isis::TProjection::m_maximumLongitude
double m_maximumLongitude
Contains the maximum longitude for the entire ground range.
Definition: TProjection.h:360
Isis::TProjection::ToPositiveEast
static double ToPositiveEast(const double lon, const int domain)
This method converts a longitude into the positive east direction.
Definition: TProjection.cpp:548
PvlKeyword.h
Isis::TProjection::UniversalLongitude
virtual double UniversalLongitude()
This returns a universal longitude (positive east in 0 to 360 domain).
Definition: TProjection.cpp:922
Isis::TProjection::MappingLatitudes
virtual PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
Definition: TProjection.cpp:1723
Isis::TProjection::ToPlanetographic
double ToPlanetographic(const double lat) const
This method converts a planetocentric latitude to a planetographic latitude.
Definition: TProjection.cpp:463
Isis::TProjection::phi2Compute
double phi2Compute(const double t) const
A convience method to compute latitude angle phi2 given small t, from Syder's recursive equation (7-9...
Definition: TProjection.cpp:1803
Isis::Angle::degrees
double degrees() const
Get the angle in units of Degrees.
Definition: Angle.h:232
Isis::TProjection::LongitudeDirection
LongitudeDirection
This enum defines the types of Longitude directions supported in this class.
Definition: TProjection.h:223
Projection.h
Isis::TProjection::MinimumLatitude
virtual double MinimumLatitude() const
This returns the minimum latitude of the area of interest.
Definition: TProjection.cpp:710
Isis::Projection::Triaxial
@ Triaxial
These projections are used to map triaxial and irregular-shaped bodies.
Definition: Projection.h:166
Isis::TProjection::Mapping
virtual PvlGroup Mapping()
This function returns the keywords that this projection uses.
Definition: TProjection.cpp:1698
Isis::TProjection::m_equatorialRadius
double m_equatorialRadius
Polar radius of the target.
Definition: TProjection.h:335
Isis::TProjection::m_polarRadius
double m_polarRadius
Polar radius of the target.
Definition: TProjection.h:342
Isis::TProjection::Name
virtual QString Name() const =0
This method returns the name of the map projection.
Isis::TProjection::To360Domain
static double To360Domain(const double lon)
This method converts a longitude into the 0 to 360 domain.
Definition: TProjection.cpp:675
Constants.h
Isis::TProjection::IsPlanetocentric
bool IsPlanetocentric() const
This indicates if the latitude type is planetocentric (as opposed to planetographic).
Definition: TProjection.cpp:392
Isis::Projection::YCoord
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:400
Isis::Projection::m_maximumY
double m_maximumY
See minimumX description.
Definition: Projection.h:328
Isis::TProjection::IsEquatorialCylindrical
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
Definition: TProjection.cpp:381
Isis::Projection
Base class for Map Projections.
Definition: Projection.h:155
Isis::Projection::m_maximumX
double m_maximumX
See minimumX description.
Definition: Projection.h:326
Isis::TProjection::mCompute
double mCompute(const double sinphi, const double cosphi) const
A convience method to compute Snyder's m equation (14-15) for a given latitude, .
Definition: TProjection.cpp:1847
Isis::Longitude::force360Domain
Longitude force360Domain() const
This returns a longitude that is constricted to 0-360 degrees.
Definition: Longitude.cpp:267
Isis::Projection::XCoord
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:387
Isis::Projection::HasGroundRange
virtual bool HasGroundRange() const
This indicates if the longitude direction type is positive west (as opposed to postive east).
Definition: Projection.cpp:349
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16