Isis 3.0 Programmer Reference
Home
TProjection.h
Go to the documentation of this file.
1 #ifndef TProjection_h
2 #define TProjection_h
3 
25 #include <string>
26 #include <vector>
27 
28 #include "Projection.h"
29 #include "PvlGroup.h" // protected data member object (m_mappingGrp)
30 
31 namespace Isis {
32  class Displacement;
33  class Pvl;
34  class WorldMapper;
178  class TProjection : public Projection {
179  public:
180  // constructor
181  TProjection(Pvl &label);
182  virtual ~TProjection();
183  virtual bool operator== (const Projection &proj);
184 
185  double EquatorialRadius() const;
186  double PolarRadius() const;
187  double Eccentricity() const;
188  double LocalRadius(double lat) const;
189  double LocalRadius() const; // requires SetGround or SetCoordinate
190 
191  // These return or change properties of the projection, independent of calculations
198  virtual QString Name() const = 0;
199 
200 
207  virtual QString Version() const = 0;
208  virtual double TrueScaleLatitude() const;
209  virtual bool IsEquatorialCylindrical();
210 
211 
215  enum LatitudeType {
221  };
222 
223 
224  // Check latitude type or get latitude type as a string
225  bool IsPlanetocentric() const;
226  bool IsPlanetographic() const;
227  QString LatitudeTypeString() const;
228  // change latitude type
229  double ToPlanetocentric(const double lat) const;
230  double ToPlanetographic(const double lat) const;
231 
239  };
240 
241  // Check longitude direction or get longitude direction as a string
242  bool IsPositiveEast() const;
243  bool IsPositiveWest() const;
244  QString LongitudeDirectionString() const;
245 
246  // Check longitude domain or get longitude domain as a string
247  bool Has180Domain() const;
248  bool Has360Domain() const;
249  QString LongitudeDomainString() const;
250 
251  // Get min/max lat/lon
252  double MinimumLatitude() const;
253  double MaximumLatitude() const;
254  double MinimumLongitude() const;
255  double MaximumLongitude() const;
256 
257  // Calculations
258  // Set ground position or x/y coordinate
259  virtual bool SetGround(const double lat, const double lon);
260  virtual bool SetCoordinate(const double x, const double y);
261 
262  // Methods that depend on successful completion
263  // of SetGround/SetCoordinate Get lat,lon, x,y
264  double Latitude() const;
265  double Longitude() const;
266 
267  // Set the universal ground coordinate (calls SetGround)
268  bool SetUniversalGround(const double lat, const double lon);
269 
270  // Return the universal ground coordinate after successful SetCoordinate
271  double UniversalLatitude();
272  double UniversalLongitude();
273 
274  // get scale for mapping world coordinates
275  double Scale() const;
276 
277  // Return the x/y range which covers the lat/lon range in the labels
278  virtual bool XYRange(double &minX, double &maxX,
279  double &minY, double &maxY);
280 
281  // get mapping information
282  virtual PvlGroup Mapping();
283  virtual PvlGroup MappingLatitudes();
284  virtual PvlGroup MappingLongitudes();
285 
286  // change latitude type
287  static double ToPlanetocentric(double lat,
288  double eRadius, double pRadius);
289  static double ToPlanetographic(double lat,
290  double eRadius, double pRadius);
291  // change longitude direction
292  static double ToPositiveEast(const double lon, const int domain);
293  static double ToPositiveWest(const double lon, const int domain);
294 
295  // change longitude domain
296  static double To180Domain(const double lon);
297  static double To360Domain(const double lon);
298 
299  protected:
300  void XYRangeCheck(const double latitude, const double longitude);
301  bool inLongitudeRange(double longitude);
302  bool inLongitudeRange(double minLon, double maxLon, double longitude);
303  bool inLatitudeRange(double latitude);
304  bool xyRangeOblique(double &minX, double &maxX,
305  double &minY, double &maxY);
306 
307  // Convience methods for typical projection computations from Snyder
308  double qCompute(const double sinPhi) const; // page 16
309  double phi2Compute(const double t) const; // page 44
310  double mCompute(const double sinphi, const double cosphi) const; // page 101
311  double tCompute(const double phi, const double sinphi) const; //page 108
312  double e4Compute() const; // page 161
313 
314  private:
315  void doSearch(double minBorder, double maxBorder,
316  double &extremeVal, const double constBorder,
317  bool searchX, bool searchLongitude, bool findMin);
318  void findExtreme(double &minBorder, double &maxBorder,
319  double &minBorderX, double &minBorderY,
320  double &maxBorderX, double &maxBorderY,
321  const double constBorder, bool searchX,
322  bool searchLongitude, bool findMin);
323  void setSearchGround(const double variableBorder,
324  const double constBorder, bool variableIsLat);
325 
326  protected:
327  double m_latitude;
329  double m_longitude;
341  // TODO** Can this be generalized for both longitude and azimuth???
353  double m_polarRadius;
363  double m_eccentricity;
364 
373  private:
374  // These are necessary for calculating oblique X/Y range with
375  // discontinuity
376  std::vector<double> m_specialLatCases;
378  std::vector<double> m_specialLonCases;
380  };
381 };
382 #endif
383 
virtual ~TProjection()
Destroys the TProjection object.
QString LongitudeDirectionString() const
This method returns the longitude direction as a string.
bool inLatitudeRange(double latitude)
Determine whether the given latitude is within the range of the MinimumLatitude and MaximumLatitude r...
std::vector< double > m_specialLonCases
Constant Longitudes that intersect a discontinuity.
Definition: TProjection.h:378
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 &quot;w...
bool SetUniversalGround(const double lat, const double lon)
This method is used to set the latitude/longitude which must be Planetocentric (latitude) and Positiv...
Longitude values increase in the westerly direction.
Definition: TProjection.h:237
bool IsPositiveEast() const
This indicates if the longitude direction type is positive west (as opposed to postive east)...
Base class for Map TProjections.
Definition: TProjection.h:178
bool Has360Domain() const
This indicates if the longitude domain is 0 to 360 (as opposed to -180 to 180).
double ToPlanetographic(const double lat) const
This method converts a planetocentric latitude to a planetographic latitude.
virtual bool operator==(const Projection &proj)
This method determines whether two map projection objects are equal by comparing the equatorial radiu...
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
std::vector< double > m_specialLatCases
Constant Latitudes that intersect a discontinuity.
Definition: TProjection.h:376
Latitudes are measured as the angle from the equatorial plane to the normal to the surface of the pla...
Definition: TProjection.h:219
virtual QString Version() const =0
This method returns the Version of the map projection.
double Eccentricity() const
This returns the eccentricity of the target,.
double UniversalLongitude()
This returns a universal longitude (positive east in 0 to 360 domain).
double m_polarRadius
Polar radius of the target.
Definition: TProjection.h:353
bool IsPositiveWest() const
This indicates if the longitude direction type is positive east (as opposed to postive west)...
bool inLongitudeRange(double longitude)
Determine whether the given longitude is within the range of the MinimumLongitude and MaximumLongitud...
double e4Compute() const
A convience method to compute.
double LocalRadius() const
This method returns the local radius in meters at the current latitude position.
Latitudes are measured as the angle from the equatorial plane to the plane through the center of the ...
Definition: TProjection.h:216
double m_latitude
This contains the currently set latitude value.
Definition: TProjection.h:327
void setSearchGround(const double variableBorder, const double constBorder, bool variableIsLat)
This function sets the ground for the given border values.
virtual PvlGroup MappingLatitudes()
This function returns the latitude keywords that this projection uses.
double MinimumLatitude() const
This returns the minimum latitude of the area of interest.
LongitudeDirection
This enum defines the types of Longitude directions supported in this class.
Definition: TProjection.h:235
double m_longitude
This contains the currently set longitude value.
Definition: TProjection.h:329
virtual QString Name() const =0
This method returns the name of the map projection.
double m_maximumLongitude
Contains the maximum longitude for the entire ground range.
Definition: TProjection.h:371
double EquatorialRadius() const
This returns the equatorial radius of the target.
double m_minimumLatitude
Contains the minimum latitude for the entire ground range.
Definition: TProjection.h:365
static double ToPositiveWest(const double lon, const int domain)
This method converts a longitude into the positive west direction.
double phi2Compute(const double t) const
A convience method to compute latitude angle phi2 given small t, from Syder&#39;s recursive equation (7-9...
double m_maximumLatitude
Contains the maximum latitude for the entire ground range.
Definition: TProjection.h:367
Base class for Map Projections.
Definition: Projection.h:169
double m_equatorialRadius
Polar radius of the target.
Definition: TProjection.h:346
int m_longitudeDomain
This integer is either 180 or 360 and is read from the labels.
Definition: TProjection.h:342
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
void findExtreme(double &minBorder, double &maxBorder, double &minBorderX, double &minBorderY, double &maxBorderX, double &maxBorderY, const double constBorder, bool searchX, bool searchLongitude, bool findMin)
Searches for extreme (min/max/discontinuity) coordinate values across latitudes/longitudes.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
double MinimumLongitude() const
This returns the minimum longitude of the area of interest.
TProjection(Pvl &label)
Constructs an empty TProjection object.
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, LongitudeDirection, and LongitudeDomain.
double MaximumLatitude() const
This returns the maximum latitude of the area of interest.
Container for cube-like labels.
Definition: Pvl.h:135
bool Has180Domain() const
This indicates if the longitude domain is -180 to 180 (as opposed to 0 to 360).
bool IsPlanetocentric() const
This indicates if the latitude type is planetocentric (as opposed to planetographic).
double ToPlanetocentric(const double lat) const
This method converts a planetographic latitude to a planetocentric latitude.
virtual PvlGroup Mapping()
This function returns the keywords that this projection uses.
double UniversalLatitude()
This returns a universal latitude (planetocentric).
static double To360Domain(const double lon)
This method converts a longitude into the 0 to 360 domain.
LongitudeDirection m_longitudeDirection
An enumerated type indicating the LongitudeDirection read from the labels.
Definition: TProjection.h:335
double Longitude() const
This returns a longitude with correct longitude direction and domain as specified in the label object...
double mCompute(const double sinphi, const double cosphi) const
A convience method to compute Snyder&#39;s m equation (14-15) for a given latitude, . ...
virtual bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
virtual double TrueScaleLatitude() const
This method returns the latitude of true scale.
LatitudeType m_latitudeType
An enumerated type indicating the LatitudeType read from the labels.
Definition: TProjection.h:332
double PolarRadius() const
This returns the polar radius of the target.
double Latitude() const
This returns a latitude with correct latitude type as specified in the label object.
double m_eccentricity
The eccentricity of the target body.
Definition: TProjection.h:363
double qCompute(const double sinPhi) const
A convience method to compute Snyder&#39;s q equation (3-12) for a given latitude, .
double MaximumLongitude() const
This returns the maximum longitude of the area of interest.
bool IsPlanetographic() const
This indicates if the latitude type is planetographic (as opposed to planetocentric).
QString LatitudeTypeString() const
This method returns the latitude type as a string.
virtual PvlGroup MappingLongitudes()
This function returns the longitude keywords that this projection uses.
double tCompute(const double phi, const double sinphi) const
A convience method to compute Snyder&#39;s t equation (15-9) for a given latitude, .
void XYRangeCheck(const double latitude, const double longitude)
This convience function is established to assist in the development of the XYRange virtual method...
QString LongitudeDomainString() const
This method returns the longitude domain as a string.
double m_minimumLongitude
Contains the minimum longitude for the entire ground range.
Definition: TProjection.h:369
void doSearch(double minBorder, double maxBorder, double &extremeVal, const double constBorder, bool searchX, bool searchLongitude, bool findMin)
This method searches for extreme (min/max/discontinuity) coordinate values along the constBorder line...
static double ToPositiveEast(const double lon, const int domain)
This method converts a longitude into the positive east direction.
Longitude values increase in the easterly direction.
Definition: TProjection.h:235
LatitudeType
This enum defines the types of Latitude supported in this class.
Definition: TProjection.h:215
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...
double Scale() const
This method returns the scale for mapping world coordinates into projection coordinates.