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 3 Programmer Reference
Projection.h
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
345 };
346};
347#endif
Displacement is a signed length, usually in meters.
double m_y
This contains the rotated Y coordinate for a specific projection at the position indicated by m_latit...
Definition Projection.h:338
static double ToHours(double angle)
Converts the given angle (in degrees) to hours by using the ratio 15 degrees per hour.
double ToWorldY(const double projectionY) const
This method converts a projection y value to a world y value.
virtual bool SetUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
void SetWorldMapper(WorldMapper *mapper)
If desired the programmer can use this method to set a world mapper to be used in the SetWorld,...
double m_rotation
Rotation of map (usually zero)
Definition Projection.h:332
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.
virtual bool operator==(const Projection &proj)
This method determines whether two map projection objects are equal by comparing the resolution,...
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround,...
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.
virtual ~Projection()
Destroys the Projection object.
bool IsSky() const
Returns true if projection is sky and false if it is land.
virtual bool HasGroundRange() const
This indicates if the longitude direction type is positive west (as opposed to postive east).
double ToWorldX(const double projectionX) const
This method converts a projection x value to a world x value.
double m_pixelResolution
Pixel resolution value from the PVL mapping group, in meters/pixel.
Definition Projection.h:343
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_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.
virtual bool SetUnboundUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
virtual double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround,...
virtual double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround,...
double ToProjectionY(const double worldY) const
This method converts a world y value to a projection y value.
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.
bool operator!=(const Projection &proj)
This method determines whether two map projection objects are not equal.
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
Projection(Pvl &label)
Constructs an empty Projection object.
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.
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.
double ToProjectionX(const double worldX) const
This method converts a world x value to a projection x value.
double GetY() const
Calculates the unrotated form of the current y value.
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
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.
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround,...
double m_x
This contains the rotated X coordinate for a specific projection at theposition indicated by m_latitu...
Definition Projection.h:334
ProjectionType projectionType() const
Returns an enum value for the projection type.
void setProjectionType(const ProjectionType ptype)
Sets the projection subclass type.
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.
static QString ToDMS(double angle)
Converts the given angle (in degrees) to degrees, minutes, seconds.
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