Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis Developer Reference
Projection.h
Go to the documentation of this file.
1#ifndef Projection_h
2#define Projection_h
7
8/* SPDX-License-Identifier: CC0-1.0 */
9#include <vector>
10
11#include "PvlGroup.h" // protected data member object (m_mappingGrp)
12
13namespace Isis {
14 class Displacement;
15 class Pvl;
16 class WorldMapper;
155 public:
156 // constructor
157 Projection(Pvl &label);
158 virtual ~Projection();
159 virtual bool operator== (const Projection &proj);
160 bool operator!= (const Projection &proj);
161
170
171 // These are the accessors for the projection type
172 void setProjectionType(const ProjectionType ptype);
173 ProjectionType projectionType() const;
174
175 // These return properties of the target
176 bool IsSky() const;
177
178 // These return or change properties of the projection, independent of calculations
185 virtual QString Name() const = 0;
186
187 // These return properties of the target
188 virtual double LocalRadius() const = 0; // requires SetGround or SetCoordinate
189
196 virtual QString Version() const = 0;
197 virtual bool IsEquatorialCylindrical();
198
199 // Check azimuth /longitude domain or get domain as a string
200 // TODO** check implementation to see if this can be generalized to
201 // work for azimuth and longitude and go in Projection
202
203 // Check longitude domain or get longitude domain as a string
204 /* bool Has180Domain() const;
205 bool Has360Domain() const;
206 QString LongitudeDomainString() const;
207 */
208
209 // Check if labels contain min/max lat/lon or comparable
210 virtual bool HasGroundRange() const;
211
212 // get rotation
213 double Rotation() const;
214
215 // Set world mapper
216 void SetWorldMapper(WorldMapper *mapper);
217
218 // Calculations
219 // Set ground position or x/y coordinate
220 virtual bool SetGround(const double lat, const double lon) = 0;
221 virtual bool SetCoordinate(const double x, const double y) = 0;
222 bool IsGood() const;
223
224 // Methods that depend on successful completion
225 // of SetCoordinate Get x,y
226 double XCoord() const;
227 double YCoord() const;
228
229 // Set the universal ground coordinate (calls SetGround)
230 virtual bool SetUniversalGround(const double coord1, const double coord2);
231 virtual bool SetUnboundUniversalGround(const double coord1, const double coord2);
232
233 // Set world position (calls SetCoordinate on projected x/y)
234 virtual bool SetWorld(const double x, const double y);
235
236 // Get computed world X/Y after successful SetGround
237 virtual double WorldX() const;
238 virtual double WorldY() const;
239
240 // convert from projected coordinate to world coordinate
241 double ToWorldX(const double projectionX) const;
242 double ToWorldY(const double projectionY) const;
243
244 // convert from world coordinate to projected coordinate
245 double ToProjectionX(const double worldX) const;
246 double ToProjectionY(const double worldY) const;
247
248 // get resolution and scale for mapping world coordinates
249 double Resolution() const;
250 virtual double Scale() const = 0;
251
252 // Return the x/y range which covers the lat/lon range in the labels
253 virtual bool XYRange(double &minX, double &maxX,
254 double &minY, double &maxY) = 0;
255
256 // set UpperLeftCornerX and UpperLeftCornerY in mapping group
257 void SetUpperLeftCorner(const Displacement &x, const Displacement &y);
258
259 // get mapping information
260 virtual PvlGroup Mapping() = 0;
261
262 // Static conversion methods
263 static double ToHours(double angle);
264 static QString ToDMS(double angle);
265 static QString ToHMS(double angle);
266
267 protected:
268 virtual void XYRangeCheck(const double latitude, const double longitude) = 0;
269 // bool xyRangeOblique(double &minX, double &maxX,
270 // double &minY, double &maxY);
271 void SetXY(double x, double y);
272 void SetComputedXY(double x, double y);
273 double GetX() const;
274 double GetY() const;
275 double PixelResolution() const;
276
277 private:
278 // This is currently only used in triaxial projections. In the future it may be needed by other types
279 /* virtual void doSearch(double minBorder, double maxBorder,
280 double &extremeVal, const double constBorder,
281 bool searchX, bool searchLongitude, bool findMin) = 0;
282 virtual void findExtreme(double &minBorder, double &maxBorder,
283 double &minBorderX, double &minBorderY,
284 double &maxBorderX, double &maxBorderY,
285 const double constBorder, bool searchX,
286 bool searchLongitude, bool findMin) = 0;
287 virtual void setSearchGround(const double variableBorder,
288 const double constBorder, bool variableIsLat) = 0;
289 */
290 protected:
298
299 bool m_good;
301
302 // TODO** Can this be generalized for both longitude and azimuth???
303 // int m_longitudeDomain; /**< This integer is either 180 or 360 and is read
304 // from the labels. It represents the longitude
305 // domain when returning values through Longitude
306 // method. The domain is either -180 to 180 or
307 // 0 to 360.**/
308
309 bool m_sky;
311
314
315 // Convenience data for XYRange virtual function
316 double m_minimumX;
325 double m_maximumX;
326 double m_minimumY;
327 double m_maximumY;
328 PvlGroup m_mappingGrp;
329
330 private:
331 ProjectionType m_projectionType;
332 double m_rotation;
333
334 double m_x;
338 double m_y;
342
343 double m_pixelResolution;
345 };
346};
347#endif
Displacement is a signed length, usually in meters.
Definition Displacement.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:687
double ToWorldY(const double projectionY) const
This method converts a projection y value to a world y value.
Definition Projection.cpp:588
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:411
virtual double LocalRadius() const =0
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:468
ProjectionType
This enum defines the subclasses of Projection supported in Isis.
Definition Projection.h:165
@ Triaxial
These projections are used to map triaxial and irregular-shaped bodies.
Definition Projection.h:165
@ RingPlane
These projections are used to map ring planes.
Definition Projection.h:167
WorldMapper * m_mapper
This points to a mapper passed into the SetWorldMapper method.
Definition Projection.h:291
double Resolution() const
This method returns the resolution for mapping world coordinates into projection coordinates.
Definition Projection.cpp:669
virtual bool operator==(const Projection &proj)
This method determines whether two map projection objects are equal by comparing the resolution,...
Definition Projection.cpp:156
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround,...
Definition Projection.cpp:381
double m_maximumX
See minimumX description.
Definition Projection.h:325
virtual bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
Definition Projection.cpp:491
virtual ~Projection()
Destroys the Projection object.
Definition Projection.cpp:142
virtual void XYRangeCheck(const double latitude, const double longitude)=0
bool IsSky() const
Returns true if projection is sky and false if it is land.
Definition Projection.cpp:202
virtual bool HasGroundRange() const
This indicates if the longitude direction type is positive west (as opposed to postive east).
Definition Projection.cpp:343
double ToWorldX(const double projectionX) const
This method converts a projection x value to a world x value.
Definition Projection.cpp:560
virtual bool SetCoordinate(const double x, const double y)=0
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...
Definition Projection.cpp:1367
bool m_groundRangeGood
Indicates if the ground range (min/max lat/lons) were read from the labels.
Definition Projection.h:312
double PixelResolution() const
Returns the pixel resolution value from the PVL mapping group in meters/pixel.
Definition Projection.cpp:834
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:440
virtual double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
Definition Projection.cpp:538
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround,...
Definition Projection.cpp:394
virtual double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
Definition Projection.cpp:518
virtual bool SetGround(const double lat, const double lon)=0
double ToProjectionY(const double worldY) const
This method converts a world y value to a projection y value.
Definition Projection.cpp:644
virtual QString Name() const =0
This method returns the name of the map projection.
double GetX() const
Calculates the unrotated form of current x value.
Definition Projection.cpp:812
bool operator!=(const Projection &proj)
This method determines whether two map projection objects are not equal.
Definition Projection.cpp:172
bool m_good
Indicates if the contents of m_x, m_y, m_latitude, and m_longitude are valid.
Definition Projection.h:299
double m_minimumX
The data elements m_minimumX, m_minimumY, m_maximumX, and m_maximumY are convience data elements when...
Definition Projection.h:316
virtual double Scale() const =0
Projection(Pvl &label)
Constructs an empty Projection object.
Definition Projection.cpp:85
PvlGroup m_mappingGrp
Mapping group that created this projection.
Definition Projection.h:328
static QString ToHMS(double angle)
Converts the given angle (in degrees) to hours, minutes, seconds.
Definition Projection.cpp:735
virtual bool XYRange(double &minX, double &maxX, double &minY, double &maxY)=0
double m_minimumY
See minimumX description.
Definition Projection.h:326
bool m_sky
Indicates whether projection is sky or land.
Definition Projection.h:309
double Rotation() const
Returns the value of the Rotation keyword from the mapping group.
Definition Projection.cpp:353
double ToProjectionX(const double worldX) const
This method converts a world x value to a projection x value.
Definition Projection.cpp:616
virtual PvlGroup Mapping()=0
double GetY() const
Calculates the unrotated form of the current y value.
Definition Projection.cpp:823
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
Definition Projection.cpp:216
virtual QString Version() const =0
This method returns the Version of the map projection.
void SetXY(double x, double y)
This protected method is a helper for derived classes.
Definition Projection.cpp:798
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround,...
Definition Projection.cpp:368
ProjectionType projectionType() const
Returns an enum value for the projection type.
Definition Projection.cpp:192
void setProjectionType(const ProjectionType ptype)
Sets the projection subclass type.
Definition Projection.cpp:182
double m_maximumY
See minimumX description.
Definition Projection.h:327
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
Definition Projection.cpp:774
static QString ToDMS(double angle)
Converts the given angle (in degrees) to degrees, minutes, seconds.
Definition Projection.cpp:700
Create a mapping between a projection and other coordinate system.
Definition WorldMapper.h:38
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16