USGS

Isis 3.0 Developer's Reference (API)

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;
165  class TProjection : public Projection {
166  public:
167  // constructor
168  TProjection(Pvl &label);
169  virtual ~TProjection();
170  virtual bool operator== (const Projection &proj);
171 
172  // These return properties of the target
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;
193  virtual QString Version() const = 0;
194  virtual double TrueScaleLatitude() const;
195  virtual bool IsEquatorialCylindrical();
210  };
211  // Check latitude type or get latitude type as a string
212  bool IsPlanetocentric() const;
213  bool IsPlanetographic() const;
214  QString LatitudeTypeString() const;
215  // change latitude type
216  double ToPlanetocentric(const double lat) const;
217  double ToPlanetographic(const double lat) const;
218 
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  double MinimumLatitude() const;
241  double MaximumLatitude() const;
242  double MinimumLongitude() const;
243  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  double Latitude() const;
253  double Longitude() const;
254 
255  // Set the universal ground coordinate (calls SetGround)
256  bool SetUniversalGround(const double lat, const double lon);
257 
258  // Return the universal ground coordinate after successful SetCoordinate
259  double UniversalLatitude();
260  double UniversalLongitude();
261 
262  // get scale for mapping world coordinates
263  double Scale() const;
264 
265  // Return the x/y range which covers the lat/lon range in the labels
266  virtual bool XYRange(double &minX, double &maxX,
267  double &minY, double &maxY);
268 
269  // get mapping information
270  virtual PvlGroup Mapping();
271  virtual PvlGroup MappingLatitudes();
272  virtual PvlGroup MappingLongitudes();
273 
274  // Static conversion methods
275  static PvlGroup TargetRadii(QString target);
276  static PvlGroup TargetRadii(Pvl &cubeLab, PvlGroup &mapGroup);
277 
278  // change latitude type
279  static double ToPlanetocentric(double lat,
280  double eRadius, double pRadius);
281  static double ToPlanetographic(double lat,
282  double eRadius, double pRadius);
283  // change longitude direction
284  static double ToPositiveEast(const double lon, const int domain);
285  static double ToPositiveWest(const double lon, const int domain);
286 
287  // change longitude domain
288  static double To180Domain(const double lon);
289  static double To360Domain(const double lon);
290 
291  protected:
292  void XYRangeCheck(const double latitude, const double longitude);
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;
333  // TODO** Can this be generalized for both longitude and azimuth???
345  double m_polarRadius;
352  double m_eccentricity;
353 
367  private:
368  // These are necessary for calculating oblique X/Y range with
369  // discontinuity
370  std::vector<double> m_specialLatCases;
372  std::vector<double> m_specialLonCases;
374  };
375 };
376 #endif
377