Isis 3 Programmer Reference
Projection.h
Go to the documentation of this file.
1 #ifndef Projection_h
2 #define Projection_h
3 
25 #include <string>
26 #include <vector>
27 
28 #include "PvlGroup.h" // protected data member object (m_mappingGrp)
29 
30 namespace Isis {
31  class Displacement;
32  class Pvl;
33  class WorldMapper;
171  class Projection {
172  public:
173  // constructor
174  Projection(Pvl &label);
175  virtual ~Projection();
176  virtual bool operator== (const Projection &proj);
177  bool operator!= (const Projection &proj);
178 
186  };
187 
188  // These are the accessors for the projection type
189  void setProjectionType(const ProjectionType ptype);
191 
192  // These return properties of the target
193  bool IsSky() const;
194 
195  // These return or change properties of the projection, independent of calculations
202  virtual QString Name() const = 0;
203 
204  // These return properties of the target
205  virtual double LocalRadius() const = 0; // requires SetGround or SetCoordinate
206 
213  virtual QString Version() const = 0;
214  virtual bool IsEquatorialCylindrical();
215 
216  // Check azimuth /longitude domain or get domain as a string
217  // TODO** check implementation to see if this can be generalized to
218  // work for azimuth and longitude and go in Projection
219 
220  // Check longitude domain or get longitude domain as a string
221  /* bool Has180Domain() const;
222  bool Has360Domain() const;
223  QString LongitudeDomainString() const;
224  */
225 
226  // Check if labels contain min/max lat/lon or comparable
227  bool HasGroundRange() const;
228 
229  // get rotation
230  double Rotation() const;
231 
232  // Set world mapper
233  void SetWorldMapper(WorldMapper *mapper);
234 
235  // Calculations
236  // Set ground position or x/y coordinate
237  virtual bool SetGround(const double lat, const double lon) = 0;
238  virtual bool SetCoordinate(const double x, const double y) = 0;
239  bool IsGood() const;
240 
241  // Methods that depend on successful completion
242  // of SetCoordinate Get x,y
243  double XCoord() const;
244  double YCoord() const;
245 
246  // Set the universal ground coordinate (calls SetGround)
247  virtual bool SetUniversalGround(const double coord1, const double coord2);
248  virtual bool SetUnboundUniversalGround(const double coord1, const double coord2);
249 
250  // Set world position (calls SetCoordinate on projected x/y)
251  bool SetWorld(const double x, const double y);
252 
253  // Get computed world X/Y after successful SetGround
254  double WorldX() const;
255  double WorldY() const;
256 
257  // convert from projected coordinate to world coordinate
258  double ToWorldX(const double projectionX) const;
259  double ToWorldY(const double projectionY) const;
260 
261  // convert from world coordinate to projected coordinate
262  double ToProjectionX(const double worldX) const;
263  double ToProjectionY(const double worldY) const;
264 
265  // get resolution and scale for mapping world coordinates
266  double Resolution() const;
267  virtual double Scale() const = 0;
268 
269  // Return the x/y range which covers the lat/lon range in the labels
270  virtual bool XYRange(double &minX, double &maxX,
271  double &minY, double &maxY) = 0;
272 
273  // set UpperLeftCornerX and UpperLeftCornerY in mapping group
274  void SetUpperLeftCorner(const Displacement &x, const Displacement &y);
275 
276  // get mapping information
277  virtual PvlGroup Mapping() = 0;
278 
279  // Static conversion methods
280  static double ToHours(double angle);
281  static QString ToDMS(double angle);
282  static QString ToHMS(double angle);
283 
284  protected:
285  virtual void XYRangeCheck(const double latitude, const double longitude) = 0;
286  // bool xyRangeOblique(double &minX, double &maxX,
287  // double &minY, double &maxY);
288  void SetXY(double x, double y);
289  void SetComputedXY(double x, double y);
290  double GetX() const;
291  double GetY() const;
292  double PixelResolution() const;
293 
294  private:
295  // This is currently only used in triaxial projections. In the future it may be needed by other types
296  /* virtual void doSearch(double minBorder, double maxBorder,
297  double &extremeVal, const double constBorder,
298  bool searchX, bool searchLongitude, bool findMin) = 0;
299  virtual void findExtreme(double &minBorder, double &maxBorder,
300  double &minBorderX, double &minBorderY,
301  double &maxBorderX, double &maxBorderY,
302  const double constBorder, bool searchX,
303  bool searchLongitude, bool findMin) = 0;
304  virtual void setSearchGround(const double variableBorder,
305  const double constBorder, bool variableIsLat) = 0;
306  */
307  protected:
316  bool m_good;
319  // TODO** Can this be generalized for both longitude and azimuth???
320  // int m_longitudeDomain; /**< This integer is either 180 or 360 and is read
321  // from the labels. It represents the longitude
322  // domain when returning values through Longitude
323  // method. The domain is either -180 to 180 or
324  // 0 to 360.**/
325 
326  bool m_sky;
332  // Convenience data for XYRange virtual function
333  double m_minimumX;
342  double m_maximumX;
343  double m_minimumY;
344  double m_maximumY;
346 
347  private:
348  ProjectionType m_projectionType;
349  double m_rotation;
350 
351  double m_x;
355  double m_y;
362  };
363 };
364 #endif
double m_y
This contains the rotated Y coordinate for a specific projection at the position indicated by m_latit...
Definition: Projection.h:355
WorldMapper * m_mapper
This points to a mapper passed into the SetWorldMapper method.
Definition: Projection.h:308
ProjectionType projectionType() const
Returns an enum value for the projection type.
Definition: Projection.cpp:213
virtual QString Version() const =0
This method returns the Version of the map projection.
bool m_sky
Indicates whether projection is sky or land.
Definition: Projection.h:326
double m_x
This contains the rotated X coordinate for a specific projection at theposition indicated by m_latitu...
Definition: Projection.h:351
bool operator!=(const Projection &proj)
This method determines whether two map projection objects are not equal.
Definition: Projection.cpp:193
double Rotation() const
Returns the value of the Rotation keyword from the mapping group.
Definition: Projection.cpp:374
double ToProjectionX(const double worldX) const
This method converts a world x value to a projection x value.
Definition: Projection.cpp:637
double PixelResolution() const
Returns the pixel resolution value from the PVL mapping group in meters/pixel.
Definition: Projection.cpp:855
virtual bool SetUnboundUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
Definition: Projection.cpp:461
Projection(Pvl &label)
Constructs an empty Projection object.
Definition: Projection.cpp:106
void SetWorldMapper(WorldMapper *mapper)
If desired the programmer can use this method to set a world mapper to be used in the SetWorld...
Definition: Projection.cpp:489
double GetX() const
Calculates the unrotated form of current x value.
Definition: Projection.cpp:833
double Resolution() const
This method returns the resolution for mapping world coordinates into projection coordinates.
Definition: Projection.cpp:690
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround, or SetWorld was with successful or not.
Definition: Projection.cpp:389
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
Definition: Projection.cpp:402
double m_minimumX
The data elements m_minimumX, m_minimumY, m_maximumX, and m_maximumY are convience data elements when...
Definition: Projection.h:333
static QString ToHMS(double angle)
Converts the given angle (in degrees) to hours, minutes, seconds.
Definition: Projection.cpp:756
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
Definition: Projection.cpp:795
double m_rotation
Rotation of map (usually zero)
Definition: Projection.h:349
double m_maximumY
See minimumX description.
Definition: Projection.h:344
virtual ~Projection()
Destroys the Projection object.
Definition: Projection.cpp:163
double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
Definition: Projection.cpp:539
double ToWorldX(const double projectionX) const
This method converts a projection x value to a world x value.
Definition: Projection.cpp:581
Base class for Map Projections.
Definition: Projection.h:171
double m_minimumY
See minimumX description.
Definition: Projection.h:343
These projections are used to map ring planes.
Definition: Projection.h:184
bool HasGroundRange() const
This indicates if the longitude direction type is positive west (as opposed to postive east)...
Definition: Projection.cpp:364
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
void setProjectionType(const ProjectionType ptype)
Sets the projection subclass type.
Definition: Projection.cpp:203
bool m_groundRangeGood
Indicates if the ground range (min/max lat/lons) were read from the labels.
Definition: Projection.h:329
bool IsSky() const
Returns true if projection is sky and false if it is land.
Definition: Projection.cpp:223
double ToProjectionY(const double worldY) const
This method converts a world y value to a projection y value.
Definition: Projection.cpp:665
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
Definition: Projection.cpp:415
Container for cube-like labels.
Definition: Pvl.h:135
void SetUpperLeftCorner(const Displacement &x, const Displacement &y)
This method is used to find the XY range for oblique aspect projections (non-polar projections) by "w...
bool m_good
Indicates if the contents of m_x, m_y, m_latitude, and m_longitude are valid.
Definition: Projection.h:316
bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
Definition: Projection.cpp:512
Create a mapping between a projection and other coordinate system.
Definition: WorldMapper.h:54
double m_pixelResolution
Pixel resolution value from the PVL mapping group, in meters/pixel.
Definition: Projection.h:360
virtual bool operator==(const Projection &proj)
This method determines whether two map projection objects are equal by comparing the resolution...
Definition: Projection.cpp:177
static QString ToDMS(double angle)
Converts the given angle (in degrees) to degrees, minutes, seconds.
Definition: Projection.cpp:721
Displacement is a signed length, usually in meters.
Definition: Displacement.h:43
virtual bool SetUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
Definition: Projection.cpp:432
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
static double ToHours(double angle)
Converts the given angle (in degrees) to hours by using the ratio 15 degrees per hour.
Definition: Projection.cpp:708
double ToWorldY(const double projectionY) const
This method converts a projection y value to a world y value.
Definition: Projection.cpp:609
double GetY() const
Calculates the unrotated form of the current y value.
Definition: Projection.cpp:844
void SetXY(double x, double y)
This protected method is a helper for derived classes.
Definition: Projection.cpp:819
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
Definition: Projection.cpp:237
ProjectionType
This enum defines the subclasses of Projection supported in Isis.
Definition: Projection.h:182
virtual QString Name() const =0
This method returns the name of the map projection.
double m_maximumX
See minimumX description.
Definition: Projection.h:342
double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
Definition: Projection.cpp:559
PvlGroup m_mappingGrp
Mapping group that created this projection.
Definition: Projection.h:345
These projections are used to map triaxial and irregular-shaped bodies.
Definition: Projection.h:182