7#include "CameraPointInfo.h" 
   15#include "CameraFocalPlaneMap.h" 
   17#include "CubeManager.h" 
   19#include "IException.h" 
   23#include "SpecialPixel.h" 
   24#include "TProjection.h" 
   95                                      const bool allowOutside, 
const bool allowErrors) {
 
 
  139                                       const bool allowOutside,
 
  140                                       const bool allowErrors) {
 
 
  163                                     const bool allowOutside,
 
  164                                     const bool allowErrors) {
 
 
  188                                       const bool allowOutside, 
const bool allowErrors) {
 
 
  206      string msg = 
"Please set a cube before setting parameters";
 
 
  239        gp->addKeyword(
PvlKeyword(
"PlanetocentricLatitude"));
 
  240        gp->addKeyword(
PvlKeyword(
"PlanetographicLatitude"));
 
  241        gp->addKeyword(
PvlKeyword(
"PositiveEast360Longitude"));
 
  242        gp->addKeyword(
PvlKeyword(
"PositiveEast180Longitude"));
 
  243        gp->addKeyword(
PvlKeyword(
"PositiveWest360Longitude"));
 
  244        gp->addKeyword(
PvlKeyword(
"PositiveWest180Longitude"));
 
  245        gp->addKeyword(
PvlKeyword(
"BodyFixedCoordinate"));
 
  247        gp->addKeyword(
PvlKeyword(
"SampleResolution"));
 
  249        gp->addKeyword(
PvlKeyword(
"ObliqueDetectorResolution"));
 
  250        gp->addKeyword(
PvlKeyword(
"ObliquePixelResolution"));
 
  251        gp->addKeyword(
PvlKeyword(
"ObliqueLineResolution"));
 
  252        gp->addKeyword(
PvlKeyword(
"ObliqueSampleResolution"));
 
  253        gp->addKeyword(
PvlKeyword(
"SpacecraftPosition"));
 
  254        gp->addKeyword(
PvlKeyword(
"SpacecraftAzimuth"));
 
  256        gp->addKeyword(
PvlKeyword(
"TargetCenterDistance"));
 
  257        gp->addKeyword(
PvlKeyword(
"SubSpacecraftLatitude"));
 
  258        gp->addKeyword(
PvlKeyword(
"SubSpacecraftLongitude"));
 
  259        gp->addKeyword(
PvlKeyword(
"SpacecraftAltitude"));
 
  261        gp->addKeyword(
PvlKeyword(
"SubSpacecraftGroundAzimuth"));
 
  263        gp->addKeyword(
PvlKeyword(
"SubSolarAzimuth"));
 
  265        gp->addKeyword(
PvlKeyword(
"SubSolarLatitude"));
 
  266        gp->addKeyword(
PvlKeyword(
"SubSolarLongitude"));
 
  267        gp->addKeyword(
PvlKeyword(
"SubSolarGroundAzimuth"));
 
  276        gp->addKeyword(
PvlKeyword(
"LookDirectionBodyFixed"));
 
  277        gp->addKeyword(
PvlKeyword(
"LookDirectionJ2000"));
 
  278        gp->addKeyword(
PvlKeyword(
"LookDirectionCamera"));
 
  280        if (allowErrors) gp->addKeyword(
PvlKeyword(
"Error"));
 
  291        gp->addKeyword(
PvlKeyword(
"PlanetocentricLatitude"));
 
  292        gp->addKeyword(
PvlKeyword(
"PlanetographicLatitude"));
 
  293        gp->addKeyword(
PvlKeyword(
"PositiveEast360Longitude"));
 
  294        gp->addKeyword(
PvlKeyword(
"PositiveEast180Longitude"));
 
  295        gp->addKeyword(
PvlKeyword(
"PositiveWest360Longitude"));
 
  296        gp->addKeyword(
PvlKeyword(
"PositiveWest180Longitude"));
 
  297        gp->addKeyword(
PvlKeyword(
"BodyFixedCoordinate"));
 
  299        gp->addKeyword(
PvlKeyword(
"SampleResolution"));
 
  301        gp->addKeyword(
PvlKeyword(
"SpacecraftPosition"));
 
  302        gp->addKeyword(
PvlKeyword(
"SpacecraftAzimuth"));
 
  304        gp->addKeyword(
PvlKeyword(
"TargetCenterDistance"));
 
  305        gp->addKeyword(
PvlKeyword(
"SubSpacecraftLatitude"));
 
  306        gp->addKeyword(
PvlKeyword(
"SubSpacecraftLongitude"));
 
  307        gp->addKeyword(
PvlKeyword(
"SpacecraftAltitude"));
 
  309        gp->addKeyword(
PvlKeyword(
"SubSpacecraftGroundAzimuth"));
 
  311        gp->addKeyword(
PvlKeyword(
"SubSolarAzimuth"));
 
  313        gp->addKeyword(
PvlKeyword(
"SubSolarLatitude"));
 
  314        gp->addKeyword(
PvlKeyword(
"SubSolarLongitude"));
 
  315        gp->addKeyword(
PvlKeyword(
"SubSolarGroundAzimuth"));
 
  324        gp->addKeyword(
PvlKeyword(
"LookDirectionBodyFixed"));
 
  325        gp->addKeyword(
PvlKeyword(
"LookDirectionJ2000"));
 
  326        gp->addKeyword(
PvlKeyword(
"LookDirectionCamera"));
 
  327        gp->addKeyword(
PvlKeyword(
"ObliqueDetectorResolution"));
 
  328        gp->addKeyword(
PvlKeyword(
"ObliquePixelResolution"));
 
  329        gp->addKeyword(
PvlKeyword(
"ObliqueLineResolution"));
 
  330        gp->addKeyword(
PvlKeyword(
"ObliqueSampleResolution"));
 
  331        if (allowErrors) gp->addKeyword(
PvlKeyword(
"Error"));
 
  338    bool noErrors = passed;
 
  341      error = 
"Requested position does not project in camera model; no surface intersection";
 
  346      error = 
"Requested position does not project in camera model; not inside cube";
 
  352      for (
int i = 0; i < gp->keywords(); i++) {
 
  353        QString name = (*gp)[i].name();
 
  355        if (name == 
"BodyFixedCoordinate" || name == 
"SpacecraftPosition" ||
 
  356            name == 
"SunPosition") {
 
  357          (*gp)[i].addValue(
"NULL");
 
  358          (*gp)[i].addValue(
"NULL");
 
  359          (*gp)[i].addValue(
"NULL");
 
  362          (*gp)[i].setValue(
"NULL");
 
  366      gp->findKeyword(
"Error").setValue(error);
 
  370      gp->findKeyword(
"EphemerisTime").setValue(
 
  372      gp->findKeyword(
"EphemerisTime").addComment(
"Time");
 
  374      gp->findKeyword(
"UTC").setValue(utc);
 
  375      gp->findKeyword(
"SpacecraftPosition").addComment(
"Spacecraft Information");
 
  376      gp->findKeyword(
"SunPosition").addComment(
"Sun Information");
 
  377      gp->findKeyword(
"Phase").addComment(
"Illumination and Other");
 
  385      b.SetBasePosition(intSamp, intLine, 1);
 
  388      double pB[3], spB[3], sB[3];
 
  390      double ssplat, ssplon, ocentricLat, ographicLat, pe360Lon, pw360Lon;
 
  398          gp->findKeyword(
"RightAscension").setValue(
toString(
 
  402          gp->findKeyword(
"RightAscension").setValue(
"Null");
 
  405          gp->findKeyword(
"Declination").setValue(
toString(
 
  409          gp->findKeyword(
"Declination").setValue(
"Null");
 
  412        gp->findKeyword(
"PlanetocentricLatitude").setValue(
toString(ocentricLat), 
"DEGREE");
 
  418                                              radii[0].kilometers(),
 
  419                                              radii[2].kilometers());
 
  420        gp->findKeyword(
"PlanetographicLatitude").setValue(
toString(ographicLat), 
"DEGREE");
 
  423        gp->findKeyword(
"PositiveEast360Longitude").setValue(
toString(pe360Lon), 
"DEGREE");
 
  426        gp->findKeyword(
"PositiveEast180Longitude").setValue(
toString(
 
  431        gp->findKeyword(
"PositiveWest360Longitude").setValue(
toString(pw360Lon), 
"DEGREE");
 
  434        gp->findKeyword(
"PositiveWest180Longitude").setValue(
 
  438        gp->findKeyword(
"BodyFixedCoordinate").addValue(
toString(pB[0]), 
"km");
 
  439        gp->findKeyword(
"BodyFixedCoordinate").addValue(
toString(pB[1]), 
"km");
 
  440        gp->findKeyword(
"BodyFixedCoordinate").addValue(
toString(pB[2]), 
"km");
 
  442        gp->findKeyword(
"LocalRadius").setValue(
toString(
 
  444        gp->findKeyword(
"SampleResolution").setValue(
toString(
 
  446        gp->findKeyword(
"LineResolution").setValue(
toString(
 
  449        gp->findKeyword(
"ObliqueDetectorResolution").setValue(
 
  451        gp->findKeyword(
"ObliqueLineResolution").setValue(
 
  453        gp->findKeyword(
"ObliqueSampleResolution").setValue(
 
  455        gp->findKeyword(
"ObliquePixelResolution").setValue(
 
  461        gp->findKeyword(
"SpacecraftPosition").addValue(
toString(spB[0]), 
"km");
 
  462        gp->findKeyword(
"SpacecraftPosition").addValue(
toString(spB[1]), 
"km");
 
  463        gp->findKeyword(
"SpacecraftPosition").addValue(
toString(spB[2]), 
"km");
 
  464        gp->findKeyword(
"SpacecraftPosition").addComment(
"Spacecraft Information");
 
  468          gp->findKeyword(
"SpacecraftAzimuth").setValue(
toString(spacecraftAzi), 
"DEGREE");
 
  471          gp->findKeyword(
"SpacecraftAzimuth").setValue(
"NULL");
 
  474        gp->findKeyword(
"SlantDistance").setValue(
toString(
 
  476        gp->findKeyword(
"TargetCenterDistance").setValue(
toString(
 
  479        gp->findKeyword(
"SubSpacecraftLatitude").setValue(
toString(ssplat), 
"DEGREE");
 
  480        gp->findKeyword(
"SubSpacecraftLongitude").setValue(
toString(ssplon), 
"DEGREE");
 
  481        gp->findKeyword(
"SpacecraftAltitude").setValue(
toString(
 
  483        gp->findKeyword(
"OffNadirAngle").setValue(
toString(
 
  488        gp->findKeyword(
"SubSpacecraftGroundAzimuth").setValue(
 
  493          gp->findKeyword(
"SunPosition").addValue(
toString(sB[0]), 
"km");
 
  494          gp->findKeyword(
"SunPosition").addValue(
toString(sB[1]), 
"km");
 
  495          gp->findKeyword(
"SunPosition").addValue(
toString(sB[2]), 
"km");
 
  496          gp->findKeyword(
"SunPosition").addComment(
"Sun Information");
 
  499          gp->findKeyword(
"SunPosition").addValue(
"Null");
 
  500          gp->findKeyword(
"SunPosition").addValue(
"Null");
 
  501          gp->findKeyword(
"SunPosition").addValue(
"Null");
 
  502          gp->findKeyword(
"SunPosition").addComment(
"Sun Information");
 
  508            gp->findKeyword(
"SubSolarAzimuth").setValue(
toString(sunAzi), 
"DEGREE");
 
  511            gp->findKeyword(
"SubSolarAzimuth").setValue(
"NULL");
 
  515          gp->findKeyword(
"SubSolarAzimuth").setValue(
"NULL");
 
  519          gp->findKeyword(
"SolarDistance").setValue(
toString(
 
  523          gp->findKeyword(
"SolarDistance").setValue(
"NULL");
 
  528          gp->findKeyword(
"SubSolarLatitude").setValue(
toString(sslat), 
"DEGREE");
 
  529          gp->findKeyword(
"SubSolarLongitude").setValue(
toString(sslon), 
"DEGREE");
 
  535            gp->findKeyword(
"SubSolarGroundAzimuth").setValue(
toString(subsolgrdaz), 
"DEGREE");
 
  538            gp->findKeyword(
"SubSolarGroundAzimuth").setValue(
"NULL");
 
  542          gp->findKeyword(
"SubSolarLatitude").setValue(
"NULL");
 
  543          gp->findKeyword(
"SubSolarLongitude").setValue(
"NULL");
 
  544          gp->findKeyword(
"SubSolarGroundAzimuth").setValue(
"NULL");
 
  548        gp->findKeyword(
"Phase").addComment(
"Illumination and Other");
 
  549        gp->findKeyword(
"Incidence").setValue(
toString(
 
  551        gp->findKeyword(
"Emission").setValue(
toString(
 
  556          gp->findKeyword(
"NorthAzimuth").setValue(
toString(northAzi), 
"DEGREE");
 
  559          gp->findKeyword(
"NorthAzimuth").setValue(
"NULL");
 
  562        gp->findKeyword(
"EphemerisTime").setValue(
toString(
 
  564        gp->findKeyword(
"EphemerisTime").addComment(
"Time");
 
  566        gp->findKeyword(
"UTC").setValue(utc);
 
  568          gp->findKeyword(
"LocalSolarTime").setValue(
toString(
 
  572          gp->findKeyword(
"LocalSolarTime").setValue(
"Null");
 
  575          gp->findKeyword(
"SolarLongitude").setValue(
toString(
 
  579          gp->findKeyword(
"SolarLongitude").setValue(
"Null");
 
  583        gp->findKeyword(
"LookDirectionBodyFixed").addValue(
toString(lookB[0]), 
"DEGREE");
 
  584        gp->findKeyword(
"LookDirectionBodyFixed").addValue(
toString(lookB[1]), 
"DEGREE");
 
  585        gp->findKeyword(
"LookDirectionBodyFixed").addValue(
toString(lookB[2]), 
"DEGREE");
 
  586        gp->findKeyword(
"LookDirectionBodyFixed").addComment(
"Look Direction Unit Vectors in Body Fixed, J2000, and Camera Coordinate Systems.");
 
  590          gp->findKeyword(
"LookDirectionJ2000").addValue(
toString(lookJ[0]), 
"DEGREE");
 
  591          gp->findKeyword(
"LookDirectionJ2000").addValue(
toString(lookJ[1]), 
"DEGREE");
 
  592          gp->findKeyword(
"LookDirectionJ2000").addValue(
toString(lookJ[2]), 
"DEGREE");
 
  595          gp->findKeyword(
"LookDirectionJ2000").addValue(
"Null");
 
  596          gp->findKeyword(
"LookDirectionJ2000").addValue(
"Null");
 
  597          gp->findKeyword(
"LookDirectionJ2000").addValue(
"Null");
 
  603          gp->findKeyword(
"LookDirectionCamera").addValue(
toString(lookC[0]), 
"DEGREE");
 
  604          gp->findKeyword(
"LookDirectionCamera").addValue(
toString(lookC[1]), 
"DEGREE");
 
  605          gp->findKeyword(
"LookDirectionCamera").addValue(
toString(lookC[2]), 
"DEGREE");
 
  608          gp->findKeyword(
"LookDirectionCamera").addValue(
"Null");
 
  609          gp->findKeyword(
"LookDirectionCamera").addValue(
"Null");
 
  610          gp->findKeyword(
"LookDirectionCamera").addValue(
"Null");
 
  614        if (allowErrors) gp->findKeyword(
"Error").setValue(
"NULL");
 
 
Buffer for containing a three dimensional section of an image.
 
double NorthAzimuth()
Returns the North Azimuth.
 
virtual double SampleResolution()
Returns the sample resolution at the current position in meters.
 
static double GroundAzimuth(double glat, double glon, double slat, double slon)
Computes and returns the ground azimuth between the ground point and another point of interest,...
 
double SpacecraftAzimuth()
Return the Spacecraft Azimuth.
 
virtual double Line() const
Returns the current line number.
 
double SunAzimuth()
Returns the Sun Azimuth.
 
virtual double ObliquePixelResolution(bool useLocal=true)
Returns the oblique pixel resolution at the current position in meters/pixel.
 
virtual double Sample() const
Returns the current sample number.
 
double OffNadirAngle()
Return the off nadir angle in degrees.
 
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
 
virtual double LineResolution()
Returns the line resolution at the current position in meters.
 
bool InCube()
This returns true if the current Sample() or Line() value is outside of the cube (meaning the point m...
 
virtual bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
 
virtual double ObliqueLineResolution(bool useLocal=true)
Returns the oblique line resolution at the current position in meters.
 
virtual double ObliqueSampleResolution(bool useLocal=true)
Returns the oblique sample resolution at the current position in m.
 
virtual double ObliqueDetectorResolution(bool useLocal=true)
This method returns the Oblique Detector Resolution if the Look Vector intersects the target and if t...
 
void SetCSVOutput(bool csvOutput)
Set the output format (true is CSV, false is PVL)
 
Camera * m_camera
The camera to extract point information from.
 
virtual PvlGroup * GetPointInfo(bool passed, bool outside, bool errors)
GetPointInfo builds the PvlGroup containing all the important information derived from the Camera.
 
CubeManager * m_usedCubes
The cubeManager used to open the current cube.
 
Camera * camera()
Retrieves a pointer to the camera.
 
PvlGroup * SetCenter(const bool outside=false, const bool error=false)
SetCenter sets the image coordinates to the center of the image.
 
Cube * cube()
Retrieves a pointer to the current cube.
 
CameraPointInfo()
Constructor, initializes CubeManager and other variables for use.
 
bool m_csvOutput
Boolean to keep track of output format (CSV or PVL)
 
PvlGroup * SetSample(const double sample, const bool outside=false, const bool error=false)
SetSample sets the image coordinates to the center line and the given sample.
 
PvlGroup * SetGround(const double latitude, const double longitude, const bool outside=false, const bool error=false)
SetGround sets a latitude, longitude grrund coordinate in the camera so data can be accessed.
 
bool CheckCube()
CheckCube checks that a cube has been set before the data for a point is accessed.
 
virtual ~CameraPointInfo()
Destructor, deletes CubeManager object used.
 
PvlGroup * SetImage(const double sample, const double line, const bool outside=false, const bool error=false)
SetImage sets a sample, line image coordinate in the camera so data can be accessed.
 
PvlGroup * SetLine(const double line, const bool outside=false, const bool error=false)
SetLine sets the image coordinates to the center sample and the given line.
 
void SetCube(const QString &cubeFileName)
SetCube opens the given cube in a CubeManager.
 
Cube * m_currentCube
The cube to extract camera information from.
 
IO Handler for Isis Cubes.
 
Camera * camera()
Return a camera associated with the cube.
 
PixelType pixelType() const
 
void read(Blob &blob, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
This method will read data from the specified Blob object.
 
virtual QString fileName() const
Returns the opened cube's filename.
 
Class for quick re-accessing of cubes based on file name.
 
Cube * OpenCube(const QString &cubeFileName)
This method opens a cube.
 
void SetNumOpenCubes(unsigned int numCubes)
This sets the maximum number of opened cubes for this instance of CubeManager.
 
Distance measurement, usually in meters.
 
double meters() const
Get the distance in meters.
 
@ Unknown
A type of error that cannot be classified as any of the other error types.
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
Contains multiple PvlContainers.
 
A single keyword-value pair.
 
double LocalSolarTime()
Return the local solar time in hours.
 
virtual double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
 
virtual double RightAscension()
Returns the right ascension angle (sky longitude).
 
virtual double SolarDistance() const
Returns the distance between the sun and surface point in AU.
 
bool HasSurfaceIntersection() const
Returns if the last call to either SetLookDirection or SetUniversalGround had a valid intersection wi...
 
virtual double SlantDistance() const
Return the distance between the spacecraft and surface point in kmv.
 
double SpacecraftAltitude()
Returns the distance from the spacecraft to the subspacecraft point in km.
 
virtual std::vector< double > lookDirectionBodyFixed() const
Returns the look direction in the body fixed coordinate system.
 
virtual std::vector< double > lookDirectionJ2000() const
Returns the look direction in the camera coordinate system.
 
virtual double PhaseAngle() const
Returns the phase angle in degrees.
 
virtual double IncidenceAngle() const
Returns the incidence angle in degrees.
 
virtual double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
 
void Coordinate(double p[3]) const
Returns the x,y,z of the surface intersection in BodyFixed km.
 
Distance LocalRadius() const
Returns the local radius at the intersection point.
 
virtual double Declination()
Returns the declination angle (sky latitude).
 
virtual double EmissionAngle() const
Returns the emission angle in degrees.
 
void LookDirection(double v[3]) const
Returns the look direction in the camera coordinate system.
 
virtual Longitude solarLongitude()
Returns the solar longitude.
 
virtual double targetCenterDistance() const
Calculates and returns the distance from the spacecraft to the target center.
 
virtual void subSolarPoint(double &lat, double &lon)
Returns the sub-solar latitude/longitude in universal coordinates (0-360 positive east,...
 
void radii(Distance r[3]) const
Returns the radii of the body in km.
 
void instrumentPosition(double p[3]) const
Returns the spacecraft position in body-fixed frame km units.
 
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
 
virtual void sunPosition(double p[3]) const
Fills the input vector with sun position information, in either body-fixed or J2000 reference frame a...
 
virtual void subSpacecraftPoint(double &lat, double &lon)
Returns the sub-spacecraft latitude/longitude in universal coordinates (0-360 positive east,...
 
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
 
static double ToPositiveWest(const double lon, const int domain)
This method converts a longitude into the positive west direction.
 
double ToPlanetographic(const double lat) const
This method converts a planetocentric latitude to a planetographic latitude.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
bool IsValidPixel(const double d)
Returns if the input pixel is valid.
 
QString PixelToString(double d, double precision=8)
Takes a double pixel value and returns the name of the pixel type as a string.
 
Namespace for the standard library.