106 Projection::Projection(
Pvl &label) : m_mappingGrp(
"Mapping") {
149 if (str.toUpper() ==
"SKY")
m_sky =
true;
157 QString msg =
"Projection failed. Invalid label group [Mapping]";
179 if (
Name() != proj.
Name())
return false;
194 return !(*
this == proj);
204 m_projectionType = ptype;
214 return m_projectionType;
433 if (coord1 ==
Null || coord2 ==
Null) {
492 projectionX = worldX;
493 projectionY = worldY;
496 return SetCoordinate(projectionX, projectionY);
553 if (projectionX ==
Null) {
555 "Unable to convert to world x. The given x-value ["
556 +
IString(projectionX) +
"] is invalid.",
581 if (projectionY ==
Null) {
583 "Unable to convert to world y. The given y-value ["
584 +
IString(projectionY) +
"] is invalid.",
609 if (worldX ==
Null) {
611 "Unable to convert to projection x. The given x-value ["
612 +
IString(worldX) +
"] is invalid.",
637 if (worldY ==
Null) {
639 "Unable to convert to projection y. The given y-value ["
640 +
IString(worldY) +
"] is invalid.",
693 int iangle = (int)angle;
694 double mins = abs(angle - iangle) * 60.0;
695 int imins = (int)mins;
696 double secs = (mins - imins) * 60.0;
697 int isecs = (int)secs;
698 double frac = (secs - isecs) * 1000.0;
699 if (frac >= 1000.0) {
712 s << iangle <<
" " << setw(2) << setfill(
'0')
713 << imins <<
"m " << setw(2) << setfill(
'0') << isecs <<
"." <<
714 setprecision(3) << frac <<
"s";
715 return s.str().c_str();
728 double tangle = angle;
729 while (tangle < 0.0) tangle += 360.0;
730 while (tangle > 360.0) tangle -= 360.0;
732 int ihrs = (int)(hrs);
733 double mins = (hrs - ihrs) * 60.0;
734 int imins = (int)(mins);
735 double secs = (mins - imins) * 60.0;
736 int isecs = (int)(secs);
737 double msecs = (secs - isecs) * 1000.0;
738 int imsecs = (int)(msecs + 0.5);
739 if (imsecs >= 1000) {
752 s << setw(2) << setfill(
'0') << ihrs <<
"h " << setw(2) << setfill(
'0') <<
753 imins <<
"m " << setw(2) << setfill(
'0') << isecs <<
"." << imsecs <<
"s";
754 return s.str().c_str();
777 m_x = x * cos(rot) + y * sin(rot);
778 m_y = y * cos(rot) - x * sin(rot);
807 return m_x * cos(rot) -
m_y * sin(rot);
818 return m_y * cos(rot) +
m_x * sin(rot);
double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
virtual double Resolution() const
This virtual method will the resolution of the world system relative to one unit in the projection sy...
double GetX() const
Calculates the unrotated form of current x value.
const double Null
Value for an Isis Null pixel.
double Rotation() const
Returns the value of the Rotation keyword from the mapping group.
bool IsSky() const
Returns true if projection is sky and false if it is land.
double m_y
This contains the rotated Y coordinate for a specific projection at the position indicated by m_latit...
WorldMapper * m_mapper
This points to a mapper passed into the SetWorldMapper method.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
bool SetUniversalGround(const double lat, const double lon)
This method is used to set the latitude/longitude which must be Planetocentric (latitude) and Positiv...
double meters() const
Get the displacement in meters.
bool m_sky
Indicates whether projection is sky or land.
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...
double m_x
This contains the rotated X coordinate for a specific projection at theposition indicated by m_latitu...
bool operator!=(const Projection &proj)
This method determines whether two map projection objects are not equal.
Base class for Map TProjections.
bool HasGroundRange() const
This indicates if the longitude direction type is positive west (as opposed to postive east)...
const double PI(3.14159265358979323846)
The mathematical constant PI.
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
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_minimumX
The data elements m_minimumX, m_minimumY, m_maximumX, and m_maximumY are convience data elements when...
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
static QString ToHMS(double angle)
Converts the given angle (in degrees) to hours, minutes, seconds.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void SetComputedXY(double x, double y)
This protected method is a helper for derived classes.
double m_rotation
Rotation of map (usually zero)
double m_maximumY
See minimumX description.
virtual ~Projection()
Destroys the Projection object.
Base class for Map Projections.
double m_minimumY
See minimumX description.
double Resolution() const
This method returns the resolution for mapping world coordinates into projection coordinates.
void setProjectionType(const ProjectionType ptype)
Sets the projection subclass type.
bool m_groundRangeGood
Indicates if the ground range (min/max lat/lons) were read from the labels.
#define _FILEINFO_
Macro for the filename and line number.
A single keyword-value pair.
double ToProjectionY(const double worldY) const
This method converts a world y value to a projection y value.
A type of error that cannot be classified as any of the other error types.
double ToWorldY(const double projectionY) const
This method converts a projection y value to a world y value.
Container for cube-like labels.
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 IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround, or SetWorld was with successful or not.
bool m_good
Indicates if the contents of m_x, m_y, m_latitude, and m_longitude are valid.
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Base class for Map Projections of plane shapes.
Create a mapping between a projection and other coordinate system.
double m_pixelResolution
Pixel resolution value from the PVL mapping group, in meters/pixel.
virtual bool operator==(const Projection &proj)
This method determines whether two map projection objects are equal by comparing the resolution...
static QString ToDMS(double angle)
Converts the given angle (in degrees) to degrees, minutes, seconds.
double ToWorldX(const double projectionX) const
This method converts a projection x value to a world x value.
Displacement is a signed length, usually in meters.
double ToProjectionX(const double worldX) const
This method converts a world x value to a projection x value.
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...
virtual bool SetUniversalGround(const double coord1, const double coord2)
This method is used to set the lat/lon or radius/azimuth (i.e.
double GetY() const
Calculates the unrotated form of the current y value.
Adds specific functionality to C++ strings.
static double ToHours(double angle)
Converts the given angle (in degrees) to hours by using the ratio 15 degrees per hour.
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...
void SetXY(double x, double y)
This protected method is a helper for derived classes.
ProjectionType projectionType() const
Returns an enum value for the projection type.
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
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...
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...
ProjectionType
This enum defines the subclasses of Projection supported in Isis.
virtual QString Name() const =0
This method returns the name of the map projection.
double m_maximumX
See minimumX description.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
double PixelResolution() const
Returns the pixel resolution value from the PVL mapping group in meters/pixel.
PvlGroup m_mappingGrp
Mapping group that created this projection.
double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
These projections are used to map triaxial and irregular-shaped bodies.