Commit 5623c141 authored by Jeannie Backer's avatar Jeannie Backer
Browse files

Updated from trunk

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6341 41f8697f-d340-4b68-9986-7bafba869bb8
parents 8e95a4e8 e9e3a035
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -229,8 +229,8 @@ html: force
clean:  localclean
	$(RM) $(OBJS) $(PROTOSGEN) $(MOCGEN) unitTest.o unitTest print.prt    \
	  $(UIHEADERS) $(ARCHIVELIB) $(SHAREDLIB) libisis$(ISISLIBVERSION).a  \
	  libisis$(ISISLIBVERSION).so libisis$(ISISLIBVERSION).dylib          \
	  unitTest.output;                                                    \
	  libisis$(ISISLIBVERSION).so libisis?.?.?.so                         \
          libisis$(ISISLIBVERSION).dylib unitTest.output;                     \
	$(RM) -rf html scopecoverage scopecoverage.html scopecoverage_html    \
	  linecoverage linecoverage.html linecoverage_html functioncoverage   \
	  functioncoverage.html functioncoverage_html .objs *.csexe *.csmes
+84 −27
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@

#include "ApolloMetricDistortionMap.h"

#include <QString>

#include "CameraDetectorMap.h"
#include "CameraFocalPlaneMap.h"
#include "CameraGroundMap.h"
@@ -48,29 +50,8 @@ namespace Isis {
  ApolloMetricCamera::ApolloMetricCamera(Cube &cube) : FramingCamera(cube) {
    NaifStatus::CheckErrors();
    
    // Get the camera characteristics
    SetFocalLength();
    SetPixelPitch();

    // Setup detector map
    new CameraDetectorMap(this);

    // Setup focal plane map
    CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
    focalMap->SetDetectorOrigin(ParentSamples() / 2.0, ParentLines() / 2.0);

    QString ppKey("INS" + toString(naifIkCode()) + "_PP");
    QString odkKey("INS" + toString(naifIkCode()) + "_OD_K");
    QString decenterKey("INS" + toString(naifIkCode()) + "_DECENTER");

    new ApolloMetricDistortionMap(this, getDouble(ppKey, 0),
                                  getDouble(ppKey, 1), getDouble(odkKey, 0), getDouble(odkKey, 1),
                                  getDouble(odkKey, 2), getDouble(decenterKey, 0),
                                  getDouble(decenterKey, 1), getDouble(decenterKey, 2));

    // Setup the ground and sky map
    new CameraGroundMap(this);
    new CameraSkyMap(this);
    m_instrumentNameLong = "Metric Camera";
    m_instrumentNameShort = "Metric";

    Pvl &lab = *cube.label();
    const PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);
@@ -78,27 +59,61 @@ namespace Isis {
    // The Spacecraft Name should be either Apollo 15, 16, or 17.  The name
    // itself could be formatted any number of ways, but the number contained
    // in the name should be unique between the missions
    QString spacecraft = inst.findKeyword("SpacecraftName")[0];
    if (spacecraft.contains("15")) {
    // We use the naifIkCode instead now
    //QString spacecraft = inst.findKeyword("SpacecraftName")[0];
    // Apollo 15 Pan naif code = -917240
    if (naifIkCode() == -915240) {
      p_ckFrameId = -915240;
      p_ckReferenceId = 1;
      p_spkTargetId = -915;
      m_spacecraftNameLong = "Apollo 15";
      m_spacecraftNameShort = "Apollo15";
    }
    else if (spacecraft.contains("16")) {
    // Apollo 16 Pan naif code = -917240
    else if (naifIkCode() == -916240) {
      p_ckFrameId = -916240;
      p_ckReferenceId = 1;
      p_spkTargetId = -916;
      m_spacecraftNameLong = "Apollo 16";
      m_spacecraftNameShort = "Apollo16";
    }
    else if (spacecraft.contains("17")) {
    // Apollo 17 Pan naif code = -917240
    else if (naifIkCode() == -917240) {
      p_ckFrameId = -917240;
      p_ckReferenceId = 1;
      p_spkTargetId = -917;
      m_spacecraftNameLong = "Apollo 17";
      m_spacecraftNameShort = "Apollo17";
    }
    else {
      QString msg = "File does not appear to be an Apollo image";
      throw IException(IException::User, msg, _FILEINFO_);
    }
    
    // Get the camera characteristics
    SetFocalLength();
    SetPixelPitch();

    // Setup detector map
    new CameraDetectorMap(this);

    // Setup focal plane map
    CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());
    focalMap->SetDetectorOrigin(ParentSamples() / 2.0, ParentLines() / 2.0);

    QString ppKey("INS" + toString(naifIkCode()) + "_PP");
    QString odkKey("INS" + toString(naifIkCode()) + "_OD_K");
    QString decenterKey("INS" + toString(naifIkCode()) + "_DECENTER");

    new ApolloMetricDistortionMap(this, getDouble(ppKey, 0),
                                  getDouble(ppKey, 1), getDouble(odkKey, 0), getDouble(odkKey, 1),
                                  getDouble(odkKey, 2), getDouble(decenterKey, 0),
                                  getDouble(decenterKey, 1), getDouble(decenterKey, 2));

    // Setup the ground and sky map
    new CameraGroundMap(this);
    new CameraSkyMap(this);

    // Create a cache and grab spice info since it does not change for
    // a framing camera (fixed spacecraft position and pointing)
    // Convert the start time to et
@@ -107,6 +122,7 @@ namespace Isis {
    NaifStatus::CheckErrors();
  }

  
  /**
   * Returns the shutter open and close times. The user should pass in the
   * exposure duration in seconds and the StartTime keyword value, converted to
@@ -137,8 +153,49 @@ namespace Isis {
    shuttertimes.second = time + (exposureDuration / 2.0);
    return shuttertimes;
  }
  
  
  /**
   * This method returns the full instrument name.
   *
   * @return QString
   */
  QString ApolloMetricCamera::instrumentNameLong() const {
    return m_instrumentNameLong;
  }
  
  
  /**
   * This method returns the shortened instrument name.
   *
   * @return QString
   */
  QString ApolloMetricCamera::instrumentNameShort() const {
    return m_instrumentNameShort;
  }
  
  
  /**
   * This method returns the full spacecraft name.
   * 
   * @return QString
   */
  QString ApolloMetricCamera::spacecraftNameLong() const {
    return m_spacecraftNameLong;
  }
  
  
  /**
   * This method returns the shortened spacecraft name.
   *
   * @return QString
   */
  QString ApolloMetricCamera::spacecraftNameShort() const {
    return m_spacecraftNameShort;
  }
} // End Apollo namespace


/**
 * This is the function that is called in order to instantiate an
 * ApolloMetricCamera object.
+15 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@

#include "FramingCamera.h"

#include <QString>

namespace Isis {
  /**
   * @brief Apollo Metric Camera Model
@@ -52,6 +54,9 @@ namespace Isis {
   *   @history 2014-01-17 Kris Becker - Set CkReferenceID to J2000 to resolve
   *                           problem with ckwriter. Also, set the SpkReferenceId
   *                           to J2000. References #1737 and #1739.
   *   @history 2015-08-24 Ian Humphrey and Makayla Shepherd - Added new data members and methods
   *                           to get spacecraft and instrument names. Extended unit test to test
   *                           these methods and added test data for Apollo 16 and 17.
   */
  class ApolloMetricCamera : public FramingCamera {
    public:
@@ -106,10 +111,20 @@ namespace Isis {
       */
      virtual int SpkReferenceId() const { return (1); }
      
      virtual QString instrumentNameLong() const;
      virtual QString instrumentNameShort() const;
      virtual QString spacecraftNameLong() const;
      virtual QString spacecraftNameShort() const;

    private:
      int p_ckFrameId;       //!< "Camera-matrix" Kernel Frame ID
      int p_ckReferenceId;   //!< "Camera-matrix" Kernel Reference ID
      int p_spkTargetId;     //!< Spacecraft Kernel Target ID
      
      QString m_instrumentNameLong; //!< Full instrument name
      QString m_instrumentNameShort; //!< Shortened instrument name
      QString m_spacecraftNameLong; //!< Full spacecraft name
      QString m_spacecraftNameShort; //!< Shortened spacecraft name
  };
};
#endif
+22 −0
Original line number Diff line number Diff line
@@ -30,3 +30,25 @@ DeltaLine = 0.000000000
For center pixel position ...
Latitude OK
Longitude OK


Testing name methods ...
Spacecraft Name Long: Apollo 15
Spacecraft Name Short: Apollo15
Instrument Name Long: Metric Camera
Instrument Name Short: Metric

Spacecraft Name Long: Apollo 16
Spacecraft Name Short: Apollo16
Instrument Name Long: Metric Camera
Instrument Name Short: Metric

Spacecraft Name Long: Apollo 17
Spacecraft Name Short: Apollo17
Instrument Name Long: Metric Camera
Instrument Name Short: Metric


Testing exceptions:

**USER ERROR** File does not appear to be an Apollo image.
+24 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@
#include <iomanip>
#include <iostream>

#include <QList>
#include <QString>

#include "ApolloMetricCamera.h"
#include "Camera.h"
#include "CameraFactory.h"
@@ -106,6 +109,27 @@ int main(void) {
    else {
      cout << setprecision(16) << "Longitude off by: " << cam->UniversalLongitude() - knownLon << endl;
    }
    
    // Test name methods
    QList<QString> files;
    files.append("$apollo15/testData/AS15-M-0533.cropped.cub");
    files.append("$apollo16/testData/AS16-M-0533.reduced.cub");
    files.append("$apollo17/testData/AS17-M-0543.reduced.cub");
    
    cout << endl << endl << "Testing name methods ..." << endl;
    for (int i = 0; i < files.size(); i++) {
      Cube n(files[i], "r");
      ApolloMetricCamera *nCam = (ApolloMetricCamera *) CameraFactory::Create(n);
      cout << "Spacecraft Name Long: " << nCam->spacecraftNameLong() << endl;
      cout << "Spacecraft Name Short: " << nCam->spacecraftNameShort() << endl;
      cout << "Instrument Name Long: " << nCam->instrumentNameLong() << endl;
      cout << "Instrument Name Short: " << nCam->instrumentNameShort() << endl << endl;
    }
    
    // Test exception
    cout << endl << "Testing exceptions:" << endl << endl;
    Cube test("$hayabusa/testData/st_2530292409_v.cub", "r");
    ApolloMetricCamera mCam(test);
  }
  catch(IException &e) {
    e.print();
Loading