Isis 3 Programmer Reference
CameraPointInfo.cpp
1
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;
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);
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
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
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 = "";
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") {
357 (*gp)[i].addValue("NULL");
358 (*gp)[i].addValue("NULL");
359 (*gp)[i].addValue("NULL");
360 }
361 else {
362 (*gp)[i].setValue("NULL");
363 }
364 }
365 if (!allowErrors) {
366 double spB[3], sB[3];
367
369 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[0]), "km");
370 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[1]), "km");
371 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[2]), "km");
372
373 try {
375 gp->findKeyword("SunPosition").addValue(toString(sB[0]), "km");
376 gp->findKeyword("SunPosition").addValue(toString(sB[1]), "km");
377 gp->findKeyword("SunPosition").addValue(toString(sB[2]), "km");
378 }
379 catch (IException &e) {
380 gp->findKeyword("SunPosition").addValue("Null");
381 gp->findKeyword("SunPosition").addValue("Null");
382 gp->findKeyword("SunPosition").addValue("Null");
383 }
384
385 std::vector<double>lookB = m_camera->lookDirectionBodyFixed();
386 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[0]), "DEGREE");
387 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[1]), "DEGREE");
388 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[2]), "DEGREE");
389
390 try {
391 std::vector<double>lookJ = m_camera->lookDirectionJ2000();
392 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[0]), "DEGREE");
393 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[1]), "DEGREE");
394 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[2]), "DEGREE");
395 }
396 catch (IException &e) {
397 gp->findKeyword("LookDirectionJ2000").addValue("Null");
398 gp->findKeyword("LookDirectionJ2000").addValue("Null");
399 gp->findKeyword("LookDirectionJ2000").addValue("Null");
400 }
401
402 try {
403 double lookC[3];
404 m_camera->LookDirection(lookC);
405 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[0]), "DEGREE");
406 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[1]), "DEGREE");
407 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[2]), "DEGREE");
408 }
409 catch (IException &e) {
410 gp->findKeyword("LookDirectionCamera").addValue("Null");
411 gp->findKeyword("LookDirectionCamera").addValue("Null");
412 gp->findKeyword("LookDirectionCamera").addValue("Null");
413 }
414 }
415
416 // Set all keywords that still have valid information
417 gp->findKeyword("Error").setValue(error);
418 gp->findKeyword("FileName").setValue(m_currentCube->fileName());
419 gp->findKeyword("Sample").setValue(toString(m_camera->Sample()));
420 gp->findKeyword("Line").setValue(toString(m_camera->Line()));
421 gp->findKeyword("EphemerisTime").setValue(
422 toString(m_camera->time().Et()), "seconds");
423 gp->findKeyword("EphemerisTime").addComment("Time");
424 QString utc = m_camera->time().UTC();
425 gp->findKeyword("UTC").setValue(utc);
426 gp->findKeyword("SpacecraftPosition").addComment("Spacecraft Information");
427 gp->findKeyword("SunPosition").addComment("Sun Information");
428 gp->findKeyword("Phase").addComment("Illumination and Other");
429 }
430 else {
431
432 Brick b(3, 3, 1, m_currentCube->pixelType());
433
434 int intSamp = (int)(m_camera->Sample() + 0.5);
435 int intLine = (int)(m_camera->Line() + 0.5);
436 b.SetBasePosition(intSamp, intLine, 1);
438
439 double pB[3], spB[3], sB[3];
440 QString utc;
441 double ssplat, ssplon, ocentricLat, ographicLat, pe360Lon, pw360Lon;
442
443 {
444 gp->findKeyword("FileName").setValue(m_currentCube->fileName());
445 gp->findKeyword("Sample").setValue(toString(m_camera->Sample()));
446 gp->findKeyword("Line").setValue(toString(m_camera->Line()));
447 gp->findKeyword("PixelValue").setValue(PixelToString(b[0]));
448 try {
449 gp->findKeyword("RightAscension").setValue(toString(
450 m_camera->RightAscension()), "DEGREE");
451 }
452 catch (IException &e) {
453 gp->findKeyword("RightAscension").setValue("Null");
454 }
455 try {
456 gp->findKeyword("Declination").setValue(toString(
457 m_camera->Declination()), "DEGREE");
458 }
459 catch (IException &e) {
460 gp->findKeyword("Declination").setValue("Null");
461 }
462 ocentricLat = m_camera->UniversalLatitude();
463 gp->findKeyword("PlanetocentricLatitude").setValue(toString(ocentricLat), "DEGREE");
464
465 // Convert lat to planetographic
466 Distance radii[3];
467 m_camera->radii(radii);
468 ographicLat = TProjection::ToPlanetographic(ocentricLat,
469 radii[0].kilometers(),
470 radii[2].kilometers());
471 gp->findKeyword("PlanetographicLatitude").setValue(toString(ographicLat), "DEGREE");
472
473 pe360Lon = m_camera->UniversalLongitude();
474 gp->findKeyword("PositiveEast360Longitude").setValue(toString(pe360Lon), "DEGREE");
475
476 //Convert lon to -180 - 180 range
477 gp->findKeyword("PositiveEast180Longitude").setValue(toString(
478 TProjection::To180Domain(pe360Lon)), "DEGREE");
479
480 //Convert lon to positive west
481 pw360Lon = TProjection::ToPositiveWest(pe360Lon, 360);
482 gp->findKeyword("PositiveWest360Longitude").setValue(toString(pw360Lon), "DEGREE");
483
484 //Convert pwlon to -180 - 180 range
485 gp->findKeyword("PositiveWest180Longitude").setValue(
486 toString( TProjection::To180Domain(pw360Lon)), "DEGREE");
487
488 m_camera->Coordinate(pB);
489 gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[0]), "km");
490 gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[1]), "km");
491 gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[2]), "km");
492
493 gp->findKeyword("LocalRadius").setValue(toString(
494 m_camera->LocalRadius().meters()), "meters");
495 gp->findKeyword("SampleResolution").setValue(toString(
496 m_camera->SampleResolution()), "meters/pixel");
497 gp->findKeyword("LineResolution").setValue(toString(
498 m_camera->LineResolution()), "meters/pixel");
499
500 gp->findKeyword("ObliqueDetectorResolution").setValue(
502 gp->findKeyword("ObliqueLineResolution").setValue(
504 gp->findKeyword("ObliqueSampleResolution").setValue(
506 gp->findKeyword("ObliquePixelResolution").setValue(
507 toString(m_camera->ObliquePixelResolution()), "meters/pix");
508
509
510 //body fixed
512 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[0]), "km");
513 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[1]), "km");
514 gp->findKeyword("SpacecraftPosition").addValue(toString(spB[2]), "km");
515 gp->findKeyword("SpacecraftPosition").addComment("Spacecraft Information");
516
517 double spacecraftAzi = m_camera->SpacecraftAzimuth();
518 if (Isis::IsValidPixel(spacecraftAzi)) {
519 gp->findKeyword("SpacecraftAzimuth").setValue(toString(spacecraftAzi), "DEGREE");
520 }
521 else {
522 gp->findKeyword("SpacecraftAzimuth").setValue("NULL");
523 }
524
525 gp->findKeyword("SlantDistance").setValue(toString(
526 m_camera->SlantDistance()), "km");
527 gp->findKeyword("TargetCenterDistance").setValue(toString(
529 m_camera->subSpacecraftPoint(ssplat, ssplon);
530 gp->findKeyword("SubSpacecraftLatitude").setValue(toString(ssplat), "DEGREE");
531 gp->findKeyword("SubSpacecraftLongitude").setValue(toString(ssplon), "DEGREE");
532 gp->findKeyword("SpacecraftAltitude").setValue(toString(
533 m_camera->SpacecraftAltitude()), "km");
534 gp->findKeyword("OffNadirAngle").setValue(toString(
535 m_camera->OffNadirAngle()), "DEGREE");
536 double subspcgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(),
538 ssplat, ssplon);
539 gp->findKeyword("SubSpacecraftGroundAzimuth").setValue(
540 toString(subspcgrdaz), "DEGREE");
541
542 try {
544 gp->findKeyword("SunPosition").addValue(toString(sB[0]), "km");
545 gp->findKeyword("SunPosition").addValue(toString(sB[1]), "km");
546 gp->findKeyword("SunPosition").addValue(toString(sB[2]), "km");
547 gp->findKeyword("SunPosition").addComment("Sun Information");
548 }
549 catch (IException &e) {
550 gp->findKeyword("SunPosition").addValue("Null");
551 gp->findKeyword("SunPosition").addValue("Null");
552 gp->findKeyword("SunPosition").addValue("Null");
553 gp->findKeyword("SunPosition").addComment("Sun Information");
554 }
555
556 try {
557 double sunAzi = m_camera->SunAzimuth();
558 if (Isis::IsValidPixel(sunAzi)) {
559 gp->findKeyword("SubSolarAzimuth").setValue(toString(sunAzi), "DEGREE");
560 }
561 else {
562 gp->findKeyword("SubSolarAzimuth").setValue("NULL");
563 }
564 }
565 catch(IException &e) {
566 gp->findKeyword("SubSolarAzimuth").setValue("NULL");
567 }
568
569 try {
570 gp->findKeyword("SolarDistance").setValue(toString(
571 m_camera->SolarDistance()), "AU");
572 }
573 catch(IException &e) {
574 gp->findKeyword("SolarDistance").setValue("NULL");
575 }
576 try {
577 double sslat, sslon;
578 m_camera->subSolarPoint(sslat, sslon);
579 gp->findKeyword("SubSolarLatitude").setValue(toString(sslat), "DEGREE");
580 gp->findKeyword("SubSolarLongitude").setValue(toString(sslon), "DEGREE");
581
582 try {
583 double subsolgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(),
585 sslat, sslon);
586 gp->findKeyword("SubSolarGroundAzimuth").setValue(toString(subsolgrdaz), "DEGREE");
587 }
588 catch(IException &e) {
589 gp->findKeyword("SubSolarGroundAzimuth").setValue("NULL");
590 }
591 }
592 catch(IException &e) {
593 gp->findKeyword("SubSolarLatitude").setValue("NULL");
594 gp->findKeyword("SubSolarLongitude").setValue("NULL");
595 gp->findKeyword("SubSolarGroundAzimuth").setValue("NULL");
596 }
597
598 gp->findKeyword("Phase").setValue(toString(m_camera->PhaseAngle()), "DEGREE");
599 gp->findKeyword("Phase").addComment("Illumination and Other");
600 gp->findKeyword("Incidence").setValue(toString(
601 m_camera->IncidenceAngle()), "DEGREE");
602 gp->findKeyword("Emission").setValue(toString(
603 m_camera->EmissionAngle()), "DEGREE");
604
605 double northAzi = m_camera->NorthAzimuth();
606 if (Isis::IsValidPixel(northAzi)) {
607 gp->findKeyword("NorthAzimuth").setValue(toString(northAzi), "DEGREE");
608 }
609 else {
610 gp->findKeyword("NorthAzimuth").setValue("NULL");
611 }
612
613 gp->findKeyword("EphemerisTime").setValue(toString(
614 m_camera->time().Et()), "seconds");
615 gp->findKeyword("EphemerisTime").addComment("Time");
616 utc = m_camera->time().UTC();
617 gp->findKeyword("UTC").setValue(utc);
618 try {
619 gp->findKeyword("LocalSolarTime").setValue(toString(
620 m_camera->LocalSolarTime()), "hour");
621 }
622 catch (IException &e) {
623 gp->findKeyword("LocalSolarTime").setValue("Null");
624 }
625 try {
626 gp->findKeyword("SolarLongitude").setValue(toString(
627 m_camera->solarLongitude().degrees()), "DEGREE");
628 }
629 catch (IException &e) {
630 gp->findKeyword("SolarLongitude").setValue("Null");
631 }
632
633 std::vector<double>lookB = m_camera->lookDirectionBodyFixed();
634 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[0]), "DEGREE");
635 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[1]), "DEGREE");
636 gp->findKeyword("LookDirectionBodyFixed").addValue(toString(lookB[2]), "DEGREE");
637 gp->findKeyword("LookDirectionBodyFixed").addComment("Look Direction Unit Vectors in Body Fixed, J2000, and Camera Coordinate Systems.");
638
639 try {
640 std::vector<double>lookJ = m_camera->lookDirectionJ2000();
641 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[0]), "DEGREE");
642 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[1]), "DEGREE");
643 gp->findKeyword("LookDirectionJ2000").addValue(toString(lookJ[2]), "DEGREE");
644 }
645 catch (IException &e) {
646 gp->findKeyword("LookDirectionJ2000").addValue("Null");
647 gp->findKeyword("LookDirectionJ2000").addValue("Null");
648 gp->findKeyword("LookDirectionJ2000").addValue("Null");
649 }
650
651 try {
652 double lookC[3];
653 m_camera->LookDirection(lookC);
654 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[0]), "DEGREE");
655 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[1]), "DEGREE");
656 gp->findKeyword("LookDirectionCamera").addValue(toString(lookC[2]), "DEGREE");
657 }
658 catch (IException &e) {
659 gp->findKeyword("LookDirectionCamera").addValue("Null");
660 gp->findKeyword("LookDirectionCamera").addValue("Null");
661 gp->findKeyword("LookDirectionCamera").addValue("Null");
662 }
663
664
665 if (allowErrors) gp->findKeyword("Error").setValue("NULL");
666 }
667 }
668 return gp;
669 }
670
671
680
681
690}
691
Buffer for containing a three dimensional section of an image.
Definition Brick.h:45
double NorthAzimuth()
Returns the North Azimuth.
Definition Camera.cpp:1927
virtual double SampleResolution()
Returns the sample resolution at the current position in meters.
Definition Camera.cpp:640
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,...
Definition Camera.cpp:2267
double SpacecraftAzimuth()
Return the Spacecraft Azimuth.
Definition Camera.cpp:1968
virtual double Line() const
Returns the current line number.
Definition Camera.cpp:2740
double SunAzimuth()
Returns the Sun Azimuth.
Definition Camera.cpp:1954
virtual double ObliquePixelResolution(bool useLocal=true)
Returns the oblique pixel resolution at the current position in meters/pixel.
Definition Camera.cpp:696
virtual double Sample() const
Returns the current sample number.
Definition Camera.cpp:2720
double OffNadirAngle()
Return the off nadir angle in degrees.
Definition Camera.cpp:2229
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
Definition Camera.cpp:156
virtual double LineResolution()
Returns the line resolution at the current position in meters.
Definition Camera.cpp:660
bool InCube()
This returns true if the current Sample() or Line() value is outside of the cube (meaning the point m...
Definition Camera.cpp:2649
virtual bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
Definition Camera.cpp:382
virtual double ObliqueLineResolution(bool useLocal=true)
Returns the oblique line resolution at the current position in meters.
Definition Camera.cpp:672
virtual double ObliqueSampleResolution(bool useLocal=true)
Returns the oblique sample resolution at the current position in m.
Definition Camera.cpp:650
virtual double ObliqueDetectorResolution(bool useLocal=true)
This method returns the Oblique Detector Resolution if the Look Vector intersects the target and if t...
Definition Camera.cpp:583
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
int lineCount() const
Definition Cube.cpp:1741
Camera * camera()
Return a camera associated with the cube.
Definition Cube.cpp:1458
int sampleCount() const
Definition Cube.cpp:1814
PixelType pixelType() const
Definition Cube.cpp:1765
void read(Blob &blob, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
This method will read data from the specified Blob object.
Definition Cube.cpp:814
virtual QString fileName() const
Returns the opened cube's filename.
Definition Cube.cpp:1570
Class for quick re-accessing of cubes based on file name.
Definition CubeManager.h:70
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.
Definition Distance.h:34
double meters() const
Get the distance in meters.
Definition Distance.cpp:85
Isis exception class.
Definition IException.h:91
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition IException.h:118
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
Contains multiple PvlContainers.
Definition PvlGroup.h:41
A single keyword-value pair.
Definition PvlKeyword.h:87
double LocalSolarTime()
Return the local solar time in hours.
Definition Sensor.cpp:665
virtual double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
Definition Sensor.cpp:212
virtual double RightAscension()
Returns the right ascension angle (sky longitude).
Definition Sensor.cpp:565
virtual double SolarDistance() const
Returns the distance between the sun and surface point in AU.
Definition Sensor.cpp:682
bool HasSurfaceIntersection() const
Returns if the last call to either SetLookDirection or SetUniversalGround had a valid intersection wi...
Definition Sensor.cpp:188
virtual double SlantDistance() const
Return the distance between the spacecraft and surface point in kmv.
Definition Sensor.cpp:646
double SpacecraftAltitude()
Returns the distance from the spacecraft to the subspacecraft point in km.
Definition Sensor.cpp:703
virtual std::vector< double > lookDirectionBodyFixed() const
Returns the look direction in the body fixed coordinate system.
Definition Sensor.cpp:539
virtual std::vector< double > lookDirectionJ2000() const
Returns the look direction in the camera coordinate system.
Definition Sensor.cpp:553
virtual double PhaseAngle() const
Returns the phase angle in degrees.
Definition Sensor.cpp:314
virtual double IncidenceAngle() const
Returns the incidence angle in degrees.
Definition Sensor.cpp:339
virtual double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
Definition Sensor.cpp:235
void Coordinate(double p[3]) const
Returns the x,y,z of the surface intersection in BodyFixed km.
Definition Sensor.cpp:198
Distance LocalRadius() const
Returns the local radius at the intersection point.
Definition Sensor.cpp:269
virtual double Declination()
Returns the declination angle (sky latitude).
Definition Sensor.cpp:578
virtual double EmissionAngle() const
Returns the emission angle in degrees.
Definition Sensor.cpp:328
void LookDirection(double v[3]) const
Returns the look direction in the camera coordinate system.
Definition Sensor.cpp:527
virtual Longitude solarLongitude()
Returns the solar longitude.
Definition Spice.cpp:1521
virtual double targetCenterDistance() const
Calculates and returns the distance from the spacecraft to the target center.
Definition Spice.cpp:925
virtual void subSolarPoint(double &lat, double &lon)
Returns the sub-solar latitude/longitude in universal coordinates (0-360 positive east,...
Definition Spice.cpp:1341
void radii(Distance r[3]) const
Returns the radii of the body in km.
Definition Spice.cpp:937
void instrumentPosition(double p[3]) const
Returns the spacecraft position in body-fixed frame km units.
Definition Spice.cpp:829
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
virtual void sunPosition(double p[3]) const
Fills the input vector with sun position information, in either body-fixed or J2000 reference frame a...
Definition Spice.cpp:909
virtual void subSpacecraftPoint(double &lat, double &lon)
Returns the sub-spacecraft latitude/longitude in universal coordinates (0-360 positive east,...
Definition Spice.cpp:1290
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(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
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.