33 #include "CubeManager.h"
55 m_usedCubes->SetNumOpenCubes(50);
61 void CameraPointInfo::SetCSVOutput(
bool csvOutput) {
63 m_csvOutput = csvOutput;
87 m_currentCube = m_usedCubes->OpenCube(cubeFileName);
88 m_camera = m_currentCube->camera();
106 const bool allowOutside,
const bool allowErrors) {
108 bool passed = m_camera->SetImage(sample, line);
109 return GetPointInfo(passed, allowOutside, allowErrors);
128 bool passed = m_camera->SetImage(m_currentCube->sampleCount() / 2.0,
129 m_currentCube->lineCount() / 2.0);
130 return GetPointInfo(passed, allowOutside, allowErrors);
150 const bool allowOutside,
151 const bool allowErrors) {
153 bool passed = m_camera->SetImage(sample, m_currentCube->lineCount() / 2.0);
154 return GetPointInfo(passed, allowOutside, allowErrors);
174 const bool allowOutside,
175 const bool allowErrors) {
177 bool passed = m_camera->SetImage(m_currentCube->sampleCount() / 2.0, line);
178 return GetPointInfo(passed, allowOutside, allowErrors);
199 const bool allowOutside,
const bool allowErrors) {
201 bool passed = m_camera->SetUniversalGround(latitude, longitude);
202 return GetPointInfo(passed, allowOutside, allowErrors);
216 if (m_currentCube == NULL) {
217 string msg =
"Please set a cube before setting parameters";
351 bool noErrors = passed;
353 if (!m_camera->HasSurfaceIntersection()) {
354 error =
"Requested position does not project in camera model; no surface intersection";
358 if (!m_camera->InCube() && !allowOutside) {
359 error =
"Requested position does not project in camera model; not inside cube";
365 for (
int i = 0; i < gp->
keywords(); i++) {
366 QString name = (*gp)[i].name();
368 if (name ==
"BodyFixedCoordinate" || name ==
"SpacecraftPosition" ||
369 name ==
"SunPosition") {
370 (*gp)[i].addValue(
"NULL");
371 (*gp)[i].addValue(
"NULL");
372 (*gp)[i].addValue(
"NULL");
375 (*gp)[i].setValue(
"NULL");
384 toString(m_camera->time().Et()),
"seconds");
386 QString utc = m_camera->time().UTC();
394 Brick b(3, 3, 1, m_currentCube->pixelType());
396 int intSamp = (int)(m_camera->Sample() + 0.5);
397 int intLine = (int)(m_camera->Line() + 0.5);
399 m_currentCube->read(b);
401 double pB[3], spB[3], sB[3];
403 double ssplat, ssplon, sslat, sslon, ocentricLat, ographicLat, pe360Lon, pw360Lon;
411 m_camera->RightAscension()),
"DEGREE");
413 m_camera->Declination()),
"DEGREE");
414 ocentricLat = m_camera->UniversalLatitude();
419 m_camera->radii(radii);
421 radii[0].kilometers(),
422 radii[2].kilometers());
425 pe360Lon = m_camera->UniversalLongitude();
440 m_camera->Coordinate(pB);
446 m_camera->LocalRadius().meters()),
"meters");
448 m_camera->SampleResolution()),
"meters/pixel");
450 m_camera->LineResolution()),
"meters/pixel");
453 toString(m_camera->ObliqueDetectorResolution()),
"meters");
455 toString(m_camera->ObliqueLineResolution()),
"meters");
457 toString(m_camera->ObliqueSampleResolution()),
"meters");
459 toString(m_camera->ObliquePixelResolution()),
"meters/pix");
463 m_camera->instrumentPosition(spB);
469 double spacecraftAzi = m_camera->SpacecraftAzimuth();
478 m_camera->SlantDistance()),
"km");
480 m_camera->targetCenterDistance()),
"km");
481 m_camera->subSpacecraftPoint(ssplat, ssplon);
485 m_camera->SpacecraftAltitude()),
"km");
487 m_camera->OffNadirAngle()),
"DEGREE");
488 double subspcgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(),
489 m_camera->UniversalLongitude(),
494 m_camera->sunPosition(sB);
500 double sunAzi = m_camera->SunAzimuth();
509 m_camera->SolarDistance()),
"AU");
510 m_camera->subSolarPoint(sslat, sslon);
513 double subsolgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(),
514 m_camera->UniversalLongitude(),
522 m_camera->IncidenceAngle()),
"DEGREE");
524 m_camera->EmissionAngle()),
"DEGREE");
526 double northAzi = m_camera->NorthAzimuth();
535 m_camera->time().Et()),
"seconds");
537 utc = m_camera->time().UTC();
540 m_camera->LocalSolarTime()),
"hour");
542 m_camera->solarLongitude().degrees()),
"DEGREE");
544 std::vector<double>lookB = m_camera->lookDirectionBodyFixed();
548 gp->
findKeyword(
"LookDirectionBodyFixed").
addComment(
"Look Direction Unit Vectors in Body Fixed, J2000, and Camera Coordinate Systems.");
550 std::vector<double>lookJ = m_camera->lookDirectionJ2000();
556 m_camera->LookDirection(lookC);
586 return m_currentCube;
Cube * cube()
Retrieves a pointer to the current cube.
CameraPointInfo()
Constructor, initializes CubeManager and other variables for use.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
double ToPlanetographic(const double lat) const
This method converts a planetocentric latitude to a planetographic latitude.
Camera * camera()
Retrieves a pointer to the camera.
Buffer for containing a three dimensional section of an image.
void SetBasePosition(const int start_sample, const int start_line, const int start_band)
This method is used to set the base position of the shape buffer.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
virtual ~CameraPointInfo()
Destructor, deletes CubeManager object used.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
bool IsValidPixel(const double d)
Returns if the input pixel is valid.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
This error is for when a programmer made an API call that was illegal.
Distance measurement, usually in meters.
void addComment(QString comment)
Add a comment to the PvlKeyword.
static double ToPositiveWest(const double lon, const int domain)
This method converts a longitude into the positive west direction.
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
void SetCube(const QString &cubeFileName)
SetCube opens the given cube in a CubeManager.
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.
bool CheckCube()
CheckCube checks that a cube has been set before the data for a point is accessed.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
A single keyword-value pair.
A type of error that cannot be classified as any of the other error types.
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.
Class for quick re-accessing of cubes based on file name.
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QString PixelToString(double d)
Takes a double pixel value and returns the name of the pixel type as a string.
virtual PvlGroup * GetPointInfo(bool passed, bool outside, bool errors)
GetPointInfo builds the PvlGroup containing all the important information derived from the Camera...
void setValue(QString value, QString unit="")
Sets new values.
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...
PvlGroup * SetCenter(const bool outside=false, const bool error=false)
SetCenter sets the image coordinates to the center of the image.
void addValue(QString value, QString unit="")
Adds a value with units.
IO Handler for Isis Cubes.