Isis Developer Reference
Projection.h
Go to the documentation of this file.
1 #ifndef Projection_h
2 #define Projection_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include <string>
10 #include <vector>
11 
12 #include "PvlGroup.h" // protected data member object (m_mappingGrp)
13 
14 namespace Isis {
15  class Displacement;
16  class Pvl;
17  class WorldMapper;
155  class Projection {
156  public:
157  // constructor
158  Projection(Pvl &label);
159  virtual ~Projection();
160  virtual bool operator== (const Projection &proj);
161  bool operator!= (const Projection &proj);
162 
168  RingPlane
170  };
171 
172  // These are the accessors for the projection type
173  void setProjectionType(const ProjectionType ptype);
175 
176  // These return properties of the target
177  bool IsSky() const;
178 
179  // These return or change properties of the projection, independent of calculations
186  virtual QString Name() const = 0;
187 
188  // These return properties of the target
189  virtual double LocalRadius() const = 0; // requires SetGround or SetCoordinate
190 
197  virtual QString Version() const = 0;
198  virtual bool IsEquatorialCylindrical();
199 
200  // Check azimuth /longitude domain or get domain as a string
201  // TODO** check implementation to see if this can be generalized to
202  // work for azimuth and longitude and go in Projection
203 
204  // Check longitude domain or get longitude domain as a string
205  /* bool Has180Domain() const;
206  bool Has360Domain() const;
207  QString LongitudeDomainString() const;
208  */
209 
210  // Check if labels contain min/max lat/lon or comparable
211  virtual bool HasGroundRange() const;
212 
213  // get rotation
214  double Rotation() const;
215 
216  // Set world mapper
217  void SetWorldMapper(WorldMapper *mapper);
218 
219  // Calculations
220  // Set ground position or x/y coordinate
221  virtual bool SetGround(const double lat, const double lon) = 0;
222  virtual bool SetCoordinate(const double x, const double y) = 0;
223  bool IsGood() const;
224 
225  // Methods that depend on successful completion
226  // of SetCoordinate Get x,y
227  double XCoord() const;
228  double YCoord() const;
229 
230  // Set the universal ground coordinate (calls SetGround)
231  virtual bool SetUniversalGround(const double coord1, const double coord2);
232  virtual bool SetUnboundUniversalGround(const double coord1, const double coord2);
233 
234  // Set world position (calls SetCoordinate on projected x/y)
235  virtual bool SetWorld(const double x, const double y);
236 
237  // Get computed world X/Y after successful SetGround
238  virtual double WorldX() const;
239  virtual double WorldY() const;
240 
241  // convert from projected coordinate to world coordinate
242  double ToWorldX(const double projectionX) const;
243  double ToWorldY(const double projectionY) const;
244 
245  // convert from world coordinate to projected coordinate
246  double ToProjectionX(const double worldX) const;
247  double ToProjectionY(const double worldY) const;
248 
249  // get resolution and scale for mapping world coordinates
250  double Resolution() const;
251  virtual double Scale() const = 0;
252 
253  // Return the x/y range which covers the lat/lon range in the labels
254  virtual bool XYRange(double &minX, double &maxX,
255  double &minY, double &maxY) = 0;
256 
257  // set UpperLeftCornerX and UpperLeftCornerY in mapping group
258  void SetUpperLeftCorner(const Displacement &x, const Displacement &y);
259 
260  // get mapping information
261  virtual PvlGroup Mapping() = 0;
262 
263  // Static conversion methods
264  static double ToHours(double angle);
265  static QString ToDMS(double angle);
266  static QString ToHMS(double angle);
267 
268  protected:
269  virtual void XYRangeCheck(const double latitude, const double longitude) = 0;
270  // bool xyRangeOblique(double &minX, double &maxX,
271  // double &minY, double &maxY);
272  void SetXY(double x, double y);
273  void SetComputedXY(double x, double y);
274  double GetX() const;
275  double GetY() const;
276  double PixelResolution() const;
277 
278  private:
279  // This is currently only used in triaxial projections. In the future it may be needed by other types
280  /* virtual void doSearch(double minBorder, double maxBorder,
281  double &extremeVal, const double constBorder,
282  bool searchX, bool searchLongitude, bool findMin) = 0;
283  virtual void findExtreme(double &minBorder, double &maxBorder,
284  double &minBorderX, double &minBorderY,
285  double &maxBorderX, double &maxBorderY,
286  const double constBorder, bool searchX,
287  bool searchLongitude, bool findMin) = 0;
288  virtual void setSearchGround(const double variableBorder,
289  const double constBorder, bool variableIsLat) = 0;
290  */
291  protected:
300  bool m_good;
303  // TODO** Can this be generalized for both longitude and azimuth???
304  // int m_longitudeDomain; /**< This integer is either 180 or 360 and is read
305  // from the labels. It represents the longitude
306  // domain when returning values through Longitude
307  // method. The domain is either -180 to 180 or
308  // 0 to 360.**/
309 
310  bool m_sky;
316  // Convenience data for XYRange virtual function
317  double m_minimumX;
326  double m_maximumX;
327  double m_minimumY;
328  double m_maximumY;
330 
331  private:
332  ProjectionType m_projectionType;
333  double m_rotation;
334 
335  double m_x;
339  double m_y;
344  double m_pixelResolution;
346  };
347 };
348 #endif
Displacement.h
FileName.h
Isis::Projection::SetGround
virtual bool SetGround(const double lat, const double lon)=0
Isis::WorldMapper::WorldX
virtual double WorldX(const double projectionX) const =0
This pure virtual method will return a world X coordinate given a projection Y coordinate in meters.
Isis::Projection::m_sky
bool m_sky
Indicates whether projection is sky or land.
Definition: Projection.h:310
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::Projection::m_mapper
WorldMapper * m_mapper
This points to a mapper passed into the SetWorldMapper method.
Definition: Projection.h:292
Isis::Projection::Version
virtual QString Version() const =0
This method returns the Version of the map projection.
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Projection::Resolution
double Resolution() const
This method returns the resolution for mapping world coordinates into projection coordinates.
Definition: Projection.cpp:675
Isis::Projection::Projection
Projection(Pvl &label)
Constructs an empty Projection object.
Definition: Projection.cpp:91
Isis::Projection::SetUpperLeftCorner
void SetUpperLeftCorner(const Displacement &x, const Displacement &y)
This method searches for extreme (min/max/discontinuity) coordinate values along the constBorder line...
Definition: Projection.cpp:1373
Isis::WorldMapper::ProjectionX
virtual double ProjectionX(const double worldX) const =0
This pure virtual method will return a projection X coordinate in meters given a world X coordinate.
Isis::Projection::Rotation
double Rotation() const
Returns the value of the Rotation keyword from the mapping group.
Definition: Projection.cpp:359
Isis::PvlContainer::addKeyword
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
Definition: PvlContainer.cpp:202
SpecialPixel.h
Isis::Projection::PixelResolution
double PixelResolution() const
Returns the pixel resolution value from the PVL mapping group in meters/pixel.
Definition: Projection.cpp:840
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::Projection::GetX
double GetX() const
Calculates the unrotated form of current x value.
Definition: Projection.cpp:818
Longitude.h
Isis::Projection::ToProjectionY
double ToProjectionY(const double worldY) const
This method converts a world y value to a projection y value.
Definition: Projection.cpp:650
Isis::Projection::Name
virtual QString Name() const =0
This method returns the name of the map projection.
NaifStatus.h
Isis::Projection::projectionType
ProjectionType projectionType() const
Returns an enum value for the projection type.
Definition: Projection.cpp:198
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::Projection::SetXY
void SetXY(double x, double y)
This protected method is a helper for derived classes.
Definition: Projection.cpp:804
WorldMapper.h
Isis::Projection::SetWorldMapper
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:474
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::Projection::SetUniversalGround
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:417
Isis::WorldMapper::WorldY
virtual double WorldY(const double projectionY) const =0
This pure virtual method will return a world Y coordinate given a projection Y coordinate in meters.
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
IString.h
Isis::Projection::m_mappingGrp
PvlGroup m_mappingGrp
Mapping group that created this projection.
Definition: Projection.h:329
Isis::Projection::operator!=
bool operator!=(const Projection &proj)
This method determines whether two map projection objects are not equal.
Definition: Projection.cpp:178
Isis::Projection::GetY
double GetY() const
Calculates the unrotated form of the current y value.
Definition: Projection.cpp:829
Isis::Projection::setProjectionType
void setProjectionType(const ProjectionType ptype)
Sets the projection subclass type.
Definition: Projection.cpp:188
Isis::WorldMapper::ProjectionY
virtual double ProjectionY(const double worldY) const =0
This pure virtual method will return a projection Y coordinate in meters given a world Y coordinate.
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Displacement
Displacement is a signed length, usually in meters.
Definition: Displacement.h:31
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::Projection::WorldY
virtual double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:544
Isis::Projection::IsGood
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:374
Isis::RingPlaneProjection
Base class for Map Projections of plane shapes.
Definition: RingPlaneProjection.h:147
Isis::Displacement::meters
double meters() const
Get the displacement in meters.
Definition: Displacement.cpp:73
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::Projection::IsEquatorialCylindrical
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
Definition: Projection.cpp:222
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Pvl.h
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::Projection::XYRange
virtual bool XYRange(double &minX, double &maxX, double &minY, double &maxY)=0
Isis::Projection::XYRangeCheck
virtual void XYRangeCheck(const double latitude, const double longitude)=0
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
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::Projection::Mapping
virtual PvlGroup Mapping()=0
Isis::Projection::LocalRadius
virtual double LocalRadius() const =0
Isis::WorldMapper
Create a mapping between a projection and other coordinate system.
Definition: WorldMapper.h:38
Isis::Projection::ToWorldY
double ToWorldY(const double projectionY) const
This method converts a projection y value to a world y value.
Definition: Projection.cpp:594
Isis::Projection::RingPlane
@ RingPlane
These projections are used to map ring planes.
Definition: Projection.h:168
Isis::RingPlaneProjection::SetUniversalGround
bool SetUniversalGround(const double ringRadius, const double ringLongitude)
This method is used to set the ring radius/longitude which must be PositiveEast/Domain360 (ring longi...
Definition: RingPlaneProjection.cpp:546
Isis::Projection::WorldX
virtual double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:524
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Projection::SetWorld
virtual bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
Definition: Projection.cpp:497
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::Projection::operator==
virtual bool operator==(const Projection &proj)
This method determines whether two map projection objects are equal by comparing the resolution,...
Definition: Projection.cpp:162
Isis::Projection::SetComputedXY
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
Definition: Projection.cpp:780
IException.h
std
Namespace for the standard library.
Isis::PvlContainer::Replace
@ Replace
Definition: PvlContainer.h:95
RingPlaneProjection.h
Isis::Projection::ToWorldX
double ToWorldX(const double projectionX) const
This method converts a projection x value to a world x value.
Definition: Projection.cpp:566
Isis::Projection::ToProjectionX
double ToProjectionX(const double worldX) const
This method converts a world x value to a projection x value.
Definition: Projection.cpp:622
Isis::Projection::~Projection
virtual ~Projection()
Destroys the Projection object.
Definition: Projection.cpp:148
PvlKeyword.h
Isis::Projection::Scale
virtual double Scale() const =0
Isis::Projection::ToDMS
static QString ToDMS(double angle)
Converts the given angle (in degrees) to degrees, minutes, seconds.
Definition: Projection.cpp:706
Projection.h
Isis::Projection::Triaxial
@ Triaxial
These projections are used to map triaxial and irregular-shaped bodies.
Definition: Projection.h:166
Isis::Projection::IsSky
bool IsSky() const
Returns true if projection is sky and false if it is land.
Definition: Projection.cpp:208
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Constants.h
Isis::Projection::ToHours
static double ToHours(double angle)
Converts the given angle (in degrees) to hours by using the ratio 15 degrees per hour.
Definition: Projection.cpp:693
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::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::Projection::ToHMS
static QString ToHMS(double angle)
Converts the given angle (in degrees) to hours, minutes, seconds.
Definition: Projection.cpp:741
Isis::Projection::ProjectionType
ProjectionType
This enum defines the subclasses of Projection supported in Isis.
Definition: Projection.h:166
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
Isis::Projection::SetUnboundUniversalGround
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:446
Isis::Projection::SetCoordinate
virtual bool SetCoordinate(const double x, const double y)=0