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
CameraPointInfo.cpp
1
5
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "CameraPointInfo.h"
8
9#include <QDebug>
10
11#include <iomanip>
12
13#include "Brick.h"
14#include "Camera.h"
15#include "CameraFocalPlaneMap.h"
16#include "Cube.h"
17#include "CubeManager.h"
18#include "Distance.h"
19#include "IException.h"
20#include "iTime.h"
21#include "Longitude.h"
22#include "PvlGroup.h"
23#include "SpecialPixel.h"
24#include "TProjection.h"
25
26using namespace Isis;
27using namespace std;
28
29namespace Isis {
30
31
37 m_usedCubes = NULL;
39 m_usedCubes->SetNumOpenCubes(50);
40 m_currentCube = NULL;
41 m_camera = NULL;
42 m_csvOutput = false;
43 }
44
50 void CameraPointInfo::SetCSVOutput(bool csvOutput) {
51
52 m_csvOutput = csvOutput;
53
54 }
55
61 if (m_usedCubes) {
62 delete m_usedCubes;
63 m_usedCubes = NULL;
64 }
65 }
66
67
75 void CameraPointInfo::SetCube(const QString &cubeFileName) {
76 m_currentCube = m_usedCubes->OpenCube(cubeFileName);
77 m_camera = m_currentCube->camera();
78 }
79
80
94 PvlGroup *CameraPointInfo::SetImage(const double sample, const double line,
95 const bool allowOutside, const bool allowErrors) {
96 if (CheckCube()) {
97 bool passed = m_camera->SetImage(sample, line);
98 return GetPointInfo(passed, allowOutside, allowErrors);
99 }
100 // Should never get here, error will be thrown in CheckCube()
101 return NULL;
102 }
103
104
115 PvlGroup *CameraPointInfo::SetCenter(const bool allowOutside, const bool allowErrors) {
116 if (CheckCube()) {
117 bool passed = m_camera->SetImage(m_currentCube->sampleCount() / 2.0,
118 m_currentCube->lineCount() / 2.0);
119 return GetPointInfo(passed, allowOutside, allowErrors);
120 }
121 // Should never get here, error will be thrown in CheckCube()
122 return NULL;
123 }
124
125
138 PvlGroup *CameraPointInfo::SetSample(const double sample,
139 const bool allowOutside,
140 const bool allowErrors) {
141 if (CheckCube()) {
142 bool passed = m_camera->SetImage(sample, m_currentCube->lineCount() / 2.0);
143 return GetPointInfo(passed, allowOutside, allowErrors);
144 }
145 // Should never get here, error will be thrown in CheckCube()
146 return NULL;
147 }
148
149
162 PvlGroup *CameraPointInfo::SetLine(const double line,
163 const bool allowOutside,
164 const bool allowErrors) {
165 if (CheckCube()) {
166 bool passed = m_camera->SetImage(m_currentCube->sampleCount() / 2.0, line);
167 return GetPointInfo(passed, allowOutside, allowErrors);
168 }
169 // Should never get here, error will be thrown in CheckCube()
170 return NULL;
171 }
172
173
187 PvlGroup *CameraPointInfo::SetGround(const double latitude, const double longitude,
188 const bool allowOutside, const bool allowErrors) {
189 if (CheckCube()) {
190 bool passed = m_camera->SetUniversalGround(latitude, longitude);
191 return GetPointInfo(passed, allowOutside, allowErrors);
192 }
193 // Should never get here, error will be thrown in CheckCube()
194 return NULL;
195 }
196
197
205 if (m_currentCube == NULL) {
206 string msg = "Please set a cube before setting parameters";
207 throw IException(IException::Programmer, msg, _FILEINFO_);
208 return false;
209 }
210 return true;
211 }
212
213
227 PvlGroup *CameraPointInfo::GetPointInfo(bool passed, bool allowOutside, bool allowErrors) {
228 PvlGroup *gp = new PvlGroup("GroundPoint");
229
230 //Outputting in PVL format
231 if(!m_csvOutput)
232 {
233 gp->addKeyword(PvlKeyword("Filename"));
234 gp->addKeyword(PvlKeyword("Sample"));
235 gp->addKeyword(PvlKeyword("Line"));
236 gp->addKeyword(PvlKeyword("PixelValue"));
237 gp->addKeyword(PvlKeyword("RightAscension"));
238 gp->addKeyword(PvlKeyword("Declination"));
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"));
246 gp->addKeyword(PvlKeyword("LocalRadius"));
247 gp->addKeyword(PvlKeyword("SampleResolution"));
248 gp->addKeyword(PvlKeyword("LineResolution"));
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"));
255 gp->addKeyword(PvlKeyword("SlantDistance"));
256 gp->addKeyword(PvlKeyword("TargetCenterDistance"));
257 gp->addKeyword(PvlKeyword("SubSpacecraftLatitude"));
258 gp->addKeyword(PvlKeyword("SubSpacecraftLongitude"));
259 gp->addKeyword(PvlKeyword("SpacecraftAltitude"));
260 gp->addKeyword(PvlKeyword("OffNadirAngle"));
261 gp->addKeyword(PvlKeyword("SubSpacecraftGroundAzimuth"));
262 gp->addKeyword(PvlKeyword("SunPosition"));
263 gp->addKeyword(PvlKeyword("SubSolarAzimuth"));
264 gp->addKeyword(PvlKeyword("SolarDistance"));
265 gp->addKeyword(PvlKeyword("SubSolarLatitude"));
266 gp->addKeyword(PvlKeyword("SubSolarLongitude"));
267 gp->addKeyword(PvlKeyword("SubSolarGroundAzimuth"));
268 gp->addKeyword(PvlKeyword("Phase"));
269 gp->addKeyword(PvlKeyword("Incidence"));
270 gp->addKeyword(PvlKeyword("Emission"));
271 gp->addKeyword(PvlKeyword("NorthAzimuth"));
272 gp->addKeyword(PvlKeyword("EphemerisTime"));
273 gp->addKeyword(PvlKeyword("UTC"));
274 gp->addKeyword(PvlKeyword("LocalSolarTime"));
275 gp->addKeyword(PvlKeyword("SolarLongitude"));
276 gp->addKeyword(PvlKeyword("LookDirectionBodyFixed"));
277 gp->addKeyword(PvlKeyword("LookDirectionJ2000"));
278 gp->addKeyword(PvlKeyword("LookDirectionCamera"));
279
280 if (allowErrors) gp->addKeyword(PvlKeyword("Error"));
281 }
282
283 else {
284
285 gp->addKeyword(PvlKeyword("Filename"));
286 gp->addKeyword(PvlKeyword("Sample"));
287 gp->addKeyword(PvlKeyword("Line"));
288 gp->addKeyword(PvlKeyword("PixelValue"));
289 gp->addKeyword(PvlKeyword("RightAscension"));
290 gp->addKeyword(PvlKeyword("Declination"));
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"));
298 gp->addKeyword(PvlKeyword("LocalRadius"));
299 gp->addKeyword(PvlKeyword("SampleResolution"));
300 gp->addKeyword(PvlKeyword("LineResolution"));
301 gp->addKeyword(PvlKeyword("SpacecraftPosition"));
302 gp->addKeyword(PvlKeyword("SpacecraftAzimuth"));
303 gp->addKeyword(PvlKeyword("SlantDistance"));
304 gp->addKeyword(PvlKeyword("TargetCenterDistance"));
305 gp->addKeyword(PvlKeyword("SubSpacecraftLatitude"));
306 gp->addKeyword(PvlKeyword("SubSpacecraftLongitude"));
307 gp->addKeyword(PvlKeyword("SpacecraftAltitude"));
308 gp->addKeyword(PvlKeyword("OffNadirAngle"));
309 gp->addKeyword(PvlKeyword("SubSpacecraftGroundAzimuth"));
310 gp->addKeyword(PvlKeyword("SunPosition"));
311 gp->addKeyword(PvlKeyword("SubSolarAzimuth"));
312 gp->addKeyword(PvlKeyword("SolarDistance"));
313 gp->addKeyword(PvlKeyword("SubSolarLatitude"));
314 gp->addKeyword(PvlKeyword("SubSolarLongitude"));
315 gp->addKeyword(PvlKeyword("SubSolarGroundAzimuth"));
316 gp->addKeyword(PvlKeyword("Phase"));
317 gp->addKeyword(PvlKeyword("Incidence"));
318 gp->addKeyword(PvlKeyword("Emission"));
319 gp->addKeyword(PvlKeyword("NorthAzimuth"));
320 gp->addKeyword(PvlKeyword("EphemerisTime"));
321 gp->addKeyword(PvlKeyword("UTC"));
322 gp->addKeyword(PvlKeyword("LocalSolarTime"));
323 gp->addKeyword(PvlKeyword("SolarLongitude"));
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"));
332
333
334
335
336 }
337
338 bool noErrors = passed;
339 QString error = "";
340 if (!m_camera->HasSurfaceIntersection()) {
341 error = "Requested position does not project in camera model; no surface intersection";
342 noErrors = false;
343 if (!allowErrors) throw IException(IException::Unknown, error, _FILEINFO_);
344 }
345 if (!m_camera->InCube() && !allowOutside) {
346 error = "Requested position does not project in camera model; not inside cube";
347 noErrors = false;
348 if (!allowErrors) throw IException(IException::Unknown, error, _FILEINFO_);
349 }
350
351 if (!noErrors) {
352 for (int i = 0; i < gp->keywords(); i++) {
353 QString name = (*gp)[i].name();
354 // These three keywords have 3 values, so they must have 3 NULLs
355 if (name == "BodyFixedCoordinate" || name == "SpacecraftPosition" ||
356 name == "SunPosition" || name == "LookDirectionJ2000" ||
357 name == "LookDirectionBodyFixed" || name == "LookDirectionCamera") {
358 (*gp)[i].addValue("NULL");
359 (*gp)[i].addValue("NULL");
360 (*gp)[i].addValue("NULL");
361 }
362 else {
363 (*gp)[i].setValue("NULL");
364 }
365 }
366 if (allowErrors) {
367 double spB[3], sB[3];
368
369 m_camera->instrumentPosition(spB);
370 gp->findKeyword("SpacecraftPosition").clear();
371 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[0]), "km");
372 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[1]), "km");
373 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[2]), "km");
374
375 try {
376 m_camera->sunPosition(sB);
377 gp->findKeyword("SunPosition").clear();
378 gp->findKeyword("SunPosition").addValue(toString(sB[0]), "km");
379 gp->findKeyword("SunPosition").addValue(toString(sB[1]), "km");
380 gp->findKeyword("SunPosition").addValue(toString(sB[2]), "km");
381 }
382 catch (IException &e) {
383 gp->findKeyword("SunPosition").addValue("Null");
384 gp->findKeyword("SunPosition").addValue("Null");
385 gp->findKeyword("SunPosition").addValue("Null");
386 }
387
388 std::vector<double>lookB = m_camera->lookDirectionBodyFixed();
389 gp->findKeyword("LookDirectionBodyFixed").clear();
390 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[0]), "DEGREE");
391 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[1]), "DEGREE");
392 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[2]), "DEGREE");
393
394 try {
395 std::vector<double>lookJ = m_camera->lookDirectionJ2000();
396 gp->findKeyword("LookDirectionJ2000").clear();
397 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[0]), "DEGREE");
398 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[1]), "DEGREE");
399 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[2]), "DEGREE");
400 }
401 catch (IException &e) {
402 gp->findKeyword("LookDirectionJ2000").addValue("Null");
403 gp->findKeyword("LookDirectionJ2000").addValue("Null");
404 gp->findKeyword("LookDirectionJ2000").addValue("Null");
405 }
406
407 try {
408 double lookC[3];
409 m_camera->LookDirection(lookC);
410 gp->findKeyword("LookDirectionCamera").clear();
411 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[0]), "DEGREE");
412 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[1]), "DEGREE");
413 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[2]), "DEGREE");
414 }
415 catch (IException &e) {
416 gp->findKeyword("LookDirectionCamera").addValue("Null");
417 gp->findKeyword("LookDirectionCamera").addValue("Null");
418 gp->findKeyword("LookDirectionCamera").addValue("Null");
419 }
420 }
421
422 // Set all keywords that still have valid information
423 gp->findKeyword("Error").setValue(error);
424 gp->findKeyword("FileName").setValue(m_currentCube->fileName());
425 gp->findKeyword("Sample").setValue(toString(m_camera->Sample()));
426 gp->findKeyword("Line").setValue(toString(m_camera->Line()));
427 gp->findKeyword("EphemerisTime").setValue(
428 toString(m_camera->time().Et()), "seconds");
429 gp->findKeyword("EphemerisTime").addComment("Time");
430 QString utc = m_camera->time().UTC();
431 gp->findKeyword("UTC").setValue(utc);
432 gp->findKeyword("SpacecraftPosition").addComment("Spacecraft Information");
433 gp->findKeyword("SunPosition").addComment("Sun Information");
434 gp->findKeyword("Phase").addComment("Illumination and Other");
435 }
436 else {
437
438 Brick b(3, 3, 1, m_currentCube->pixelType());
439
440 int intSamp = (int)(m_camera->Sample() + 0.5);
441 int intLine = (int)(m_camera->Line() + 0.5);
442 b.SetBasePosition(intSamp, intLine, 1);
443 m_currentCube->read(b);
444
445 double pB[3], spB[3], sB[3];
446 QString utc;
447 double ssplat, ssplon, ocentricLat, ographicLat, pe360Lon, pw360Lon;
448
449 {
450 gp->findKeyword("FileName").setValue(m_currentCube->fileName());
451 gp->findKeyword("Sample").setValue(toString(m_camera->Sample()));
452 gp->findKeyword("Line").setValue(toString(m_camera->Line()));
453 gp->findKeyword("PixelValue").setValue(PixelToString(b[0]));
454 try {
455 gp->findKeyword("RightAscension").setValue(toString(
456 m_camera->RightAscension()), "DEGREE");
457 }
458 catch (IException &e) {
459 gp->findKeyword("RightAscension").setValue("Null");
460 }
461 try {
462 gp->findKeyword("Declination").setValue(toString(
463 m_camera->Declination()), "DEGREE");
464 }
465 catch (IException &e) {
466 gp->findKeyword("Declination").setValue("Null");
467 }
468 ocentricLat = m_camera->UniversalLatitude();
469 gp->findKeyword("PlanetocentricLatitude").setValue(toString(ocentricLat), "DEGREE");
470
471 // Convert lat to planetographic
472 Distance radii[3];
473 m_camera->radii(radii);
474 ographicLat = TProjection::ToPlanetographic(ocentricLat,
475 radii[0].kilometers(),
476 radii[2].kilometers());
477 gp->findKeyword("PlanetographicLatitude").setValue(toString(ographicLat), "DEGREE");
478
479 pe360Lon = m_camera->UniversalLongitude();
480 gp->findKeyword("PositiveEast360Longitude").setValue(toString(pe360Lon), "DEGREE");
481
482 //Convert lon to -180 - 180 range
483 gp->findKeyword("PositiveEast180Longitude").setValue(toString(
484 TProjection::To180Domain(pe360Lon)), "DEGREE");
485
486 //Convert lon to positive west
487 pw360Lon = TProjection::ToPositiveWest(pe360Lon, 360);
488 gp->findKeyword("PositiveWest360Longitude").setValue(toString(pw360Lon), "DEGREE");
489
490 //Convert pwlon to -180 - 180 range
491 gp->findKeyword("PositiveWest180Longitude").setValue(
492 toString( TProjection::To180Domain(pw360Lon)), "DEGREE");
493
494 m_camera->Coordinate(pB);
495 gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[0]), "km");
496 gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[1]), "km");
497 gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[2]), "km");
498
499 gp->findKeyword("LocalRadius").setValue(toString(
500 m_camera->LocalRadius().meters()), "meters");
501 gp->findKeyword("SampleResolution").setValue(toString(
502 m_camera->SampleResolution()), "meters/pixel");
503 gp->findKeyword("LineResolution").setValue(toString(
504 m_camera->LineResolution()), "meters/pixel");
505
506 gp->findKeyword("ObliqueDetectorResolution").setValue(
507 toString(m_camera->ObliqueDetectorResolution()),"meters");
508 gp->findKeyword("ObliqueLineResolution").setValue(
509 toString(m_camera->ObliqueLineResolution()),"meters");
510 gp->findKeyword("ObliqueSampleResolution").setValue(
511 toString(m_camera->ObliqueSampleResolution()),"meters");
512 gp->findKeyword("ObliquePixelResolution").setValue(
513 toString(m_camera->ObliquePixelResolution()), "meters/pix");
514
515
516 //body fixed
517 m_camera->instrumentPosition(spB);
518 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[0]), "km");
519 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[1]), "km");
520 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[2]), "km");
521 gp->findKeyword("SpacecraftPosition").addComment("Spacecraft Information");
522
523 double spacecraftAzi = m_camera->SpacecraftAzimuth();
524 if (Isis::IsValidPixel(spacecraftAzi)) {
525 gp->findKeyword("SpacecraftAzimuth").setValue(toString(spacecraftAzi), "DEGREE");
526 }
527 else {
528 gp->findKeyword("SpacecraftAzimuth").setValue("NULL");
529 }
530
531 gp->findKeyword("SlantDistance").setValue(toString(
532 m_camera->SlantDistance()), "km");
533 gp->findKeyword("TargetCenterDistance").setValue(toString(
534 m_camera->targetCenterDistance()), "km");
535 m_camera->subSpacecraftPoint(ssplat, ssplon);
536 gp->findKeyword("SubSpacecraftLatitude").setValue(toString(ssplat), "DEGREE");
537 gp->findKeyword("SubSpacecraftLongitude").setValue(toString(ssplon), "DEGREE");
538 gp->findKeyword("SpacecraftAltitude").setValue(toString(
539 m_camera->SpacecraftAltitude()), "km");
540 gp->findKeyword("OffNadirAngle").setValue(toString(
541 m_camera->OffNadirAngle()), "DEGREE");
542 double subspcgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(),
543 m_camera->UniversalLongitude(),
544 ssplat, ssplon);
545 gp->findKeyword("SubSpacecraftGroundAzimuth").setValue(
546 toString(subspcgrdaz), "DEGREE");
547
548 try {
549 m_camera->sunPosition(sB);
550 gp->findKeyword("SunPosition").addValue(toString(sB[0]), "km");
551 gp->findKeyword("SunPosition").addValue(toString(sB[1]), "km");
552 gp->findKeyword("SunPosition").addValue(toString(sB[2]), "km");
553 gp->findKeyword("SunPosition").addComment("Sun Information");
554 }
555 catch (IException &e) {
556 gp->findKeyword("SunPosition").addValue("Null");
557 gp->findKeyword("SunPosition").addValue("Null");
558 gp->findKeyword("SunPosition").addValue("Null");
559 gp->findKeyword("SunPosition").addComment("Sun Information");
560 }
561
562 try {
563 double sunAzi = m_camera->SunAzimuth();
564 if (Isis::IsValidPixel(sunAzi)) {
565 gp->findKeyword("SubSolarAzimuth").setValue(toString(sunAzi), "DEGREE");
566 }
567 else {
568 gp->findKeyword("SubSolarAzimuth").setValue("NULL");
569 }
570 }
571 catch(IException &e) {
572 gp->findKeyword("SubSolarAzimuth").setValue("NULL");
573 }
574
575 try {
576 gp->findKeyword("SolarDistance").setValue(toString(
577 m_camera->SolarDistance()), "AU");
578 }
579 catch(IException &e) {
580 gp->findKeyword("SolarDistance").setValue("NULL");
581 }
582 try {
583 double sslat, sslon;
584 m_camera->subSolarPoint(sslat, sslon);
585 gp->findKeyword("SubSolarLatitude").setValue(toString(sslat), "DEGREE");
586 gp->findKeyword("SubSolarLongitude").setValue(toString(sslon), "DEGREE");
587
588 try {
589 double subsolgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(),
590 m_camera->UniversalLongitude(),
591 sslat, sslon);
592 gp->findKeyword("SubSolarGroundAzimuth").setValue(toString(subsolgrdaz), "DEGREE");
593 }
594 catch(IException &e) {
595 gp->findKeyword("SubSolarGroundAzimuth").setValue("NULL");
596 }
597 }
598 catch(IException &e) {
599 gp->findKeyword("SubSolarLatitude").setValue("NULL");
600 gp->findKeyword("SubSolarLongitude").setValue("NULL");
601 gp->findKeyword("SubSolarGroundAzimuth").setValue("NULL");
602 }
603
604 gp->findKeyword("Phase").setValue(toString(m_camera->PhaseAngle()), "DEGREE");
605 gp->findKeyword("Phase").addComment("Illumination and Other");
606 gp->findKeyword("Incidence").setValue(toString(
607 m_camera->IncidenceAngle()), "DEGREE");
608 gp->findKeyword("Emission").setValue(toString(
609 m_camera->EmissionAngle()), "DEGREE");
610
611 double northAzi = m_camera->NorthAzimuth();
612 if (Isis::IsValidPixel(northAzi)) {
613 gp->findKeyword("NorthAzimuth").setValue(toString(northAzi), "DEGREE");
614 }
615 else {
616 gp->findKeyword("NorthAzimuth").setValue("NULL");
617 }
618
619 gp->findKeyword("EphemerisTime").setValue(toString(
620 m_camera->time().Et()), "seconds");
621 gp->findKeyword("EphemerisTime").addComment("Time");
622 utc = m_camera->time().UTC();
623 gp->findKeyword("UTC").setValue(utc);
624 try {
625 gp->findKeyword("LocalSolarTime").setValue(toString(
626 m_camera->LocalSolarTime()), "hour");
627 }
628 catch (IException &e) {
629 gp->findKeyword("LocalSolarTime").setValue("Null");
630 }
631 try {
632 gp->findKeyword("SolarLongitude").setValue(toString(
633 m_camera->solarLongitude().degrees()), "DEGREE");
634 }
635 catch (IException &e) {
636 gp->findKeyword("SolarLongitude").setValue("Null");
637 }
638
639 std::vector<double>lookB = m_camera->lookDirectionBodyFixed();
640 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[0]), "DEGREE");
641 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[1]), "DEGREE");
642 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[2]), "DEGREE");
643 gp->findKeyword("LookDirectionBodyFixed").addComment("Look Direction Unit Vectors in Body Fixed, J2000, and Camera Coordinate Systems.");
644
645 try {
646 std::vector<double>lookJ = m_camera->lookDirectionJ2000();
647 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[0]), "DEGREE");
648 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[1]), "DEGREE");
649 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[2]), "DEGREE");
650 }
651 catch (IException &e) {
652 gp->findKeyword("LookDirectionJ2000").addValue("Null");
653 gp->findKeyword("LookDirectionJ2000").addValue("Null");
654 gp->findKeyword("LookDirectionJ2000").addValue("Null");
655 }
656
657 try {
658 double lookC[3];
659 m_camera->LookDirection(lookC);
660 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[0]), "DEGREE");
661 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[1]), "DEGREE");
662 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[2]), "DEGREE");
663 }
664 catch (IException &e) {
665 gp->findKeyword("LookDirectionCamera").addValue("Null");
666 gp->findKeyword("LookDirectionCamera").addValue("Null");
667 gp->findKeyword("LookDirectionCamera").addValue("Null");
668 }
669
670
671 if (allowErrors) gp->findKeyword("Error").setValue("NULL");
672 }
673 }
674 return gp;
675 }
676
677
686
687
696}
697
Buffer for containing a three dimensional section of an image.
Definition Brick.h:45
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.
Definition Brick.h:120
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.
Definition Cube.h:168
Class for quick re-accessing of cubes based on file name.
Definition CubeManager.h:70
Distance measurement, usually in meters.
Definition Distance.h:34
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.
Definition Apollo.h:16
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.