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) {
462 if (coord1 ==
Null || coord2 ==
Null) {
521 projectionX = worldX;
522 projectionY = worldY;
525 return SetCoordinate(projectionX, projectionY);
582 if (projectionX ==
Null) {
584 "Unable to convert to world x. The given x-value [" 585 +
IString(projectionX) +
"] is invalid.",
610 if (projectionY ==
Null) {
612 "Unable to convert to world y. The given y-value [" 613 +
IString(projectionY) +
"] is invalid.",
638 if (worldX ==
Null) {
640 "Unable to convert to projection x. The given x-value [" 641 +
IString(worldX) +
"] is invalid.",
666 if (worldY ==
Null) {
668 "Unable to convert to projection y. The given y-value [" 669 +
IString(worldY) +
"] is invalid.",
722 int iangle = (int)angle;
723 double mins = abs(angle - iangle) * 60.0;
724 int imins = (int)mins;
725 double secs = (mins - imins) * 60.0;
726 int isecs = (int)secs;
727 double frac = (secs - isecs) * 1000.0;
728 if (frac >= 1000.0) {
741 s << iangle <<
" " << setw(2) << setfill(
'0')
742 << imins <<
"m " << setw(2) << setfill(
'0') << isecs <<
"." <<
743 setprecision(3) << frac <<
"s";
744 return s.str().c_str();
757 double tangle = angle;
758 while (tangle < 0.0) tangle += 360.0;
759 while (tangle > 360.0) tangle -= 360.0;
761 int ihrs = (int)(hrs);
762 double mins = (hrs - ihrs) * 60.0;
763 int imins = (int)(mins);
764 double secs = (mins - imins) * 60.0;
765 int isecs = (int)(secs);
766 double msecs = (secs - isecs) * 1000.0;
767 int imsecs = (int)(msecs + 0.5);
768 if (imsecs >= 1000) {
781 s << setw(2) << setfill(
'0') << ihrs <<
"h " << setw(2) << setfill(
'0') <<
782 imins <<
"m " << setw(2) << setfill(
'0') << isecs <<
"." << imsecs <<
"s";
783 return s.str().c_str();
806 m_x = x * cos(rot) + y * sin(rot);
807 m_y = y * cos(rot) - x * sin(rot);
836 return m_x * cos(rot) -
m_y * sin(rot);
847 return m_y * cos(rot) +
m_x * sin(rot);
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
const double Null
Value for an Isis Null pixel.
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...
ProjectionType projectionType() const
Returns an enum value for the projection type.
const double PI
The mathematical constant PI.
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.
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 meters() const
Get the displacement in meters.
double PixelResolution() const
Returns the pixel resolution value from the PVL mapping group in meters/pixel.
Namespace for the standard library.
virtual bool SetUnboundUniversalGround(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 GetX() const
Calculates the unrotated form of current x value.
double Resolution() const
This method returns the resolution for mapping world coordinates into projection coordinates.
bool IsGood() const
This indicates if the last invocation of SetGround, SetCoordinate, SetUniversalGround, or SetWorld was with successful or not.
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
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.
double WorldX() const
This returns the world X coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
double ToWorldX(const double projectionX) const
This method converts a projection x value to a world x value.
Base class for Map Projections.
double m_minimumY
See minimumX description.
bool HasGroundRange() const
This indicates if the longitude direction type is positive west (as opposed to postive east)...
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.
bool IsSky() const
Returns true if projection is sky and false if it is land.
double ToProjectionY(const double worldY) const
This method converts a world y value to a projection y value.
A single keyword-value pair.
A type of error that cannot be classified as any of the other error types.
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
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 m_good
Indicates if the contents of m_x, m_y, m_latitude, and m_longitude are valid.
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.
Displacement is a signed length, usually in meters.
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.
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
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.
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...
double GetY() const
Calculates the unrotated form of the current y value.
void SetXY(double x, double y)
This protected method is a helper for derived classes.
virtual double Resolution() const
This virtual method will the resolution of the world system relative to one unit in the projection sy...
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...
bool SetUnboundUniversalGround(const double coord1, const double coord2)
This method is used to set the latitude/longitude.
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.
double WorldY() const
This returns the world Y coordinate provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
PvlGroup m_mappingGrp
Mapping group that created this projection.
These projections are used to map triaxial and irregular-shaped bodies.