Unverified Commit 4fb91835 authored by Kaitlyn Lee's avatar Kaitlyn Lee Committed by GitHub
Browse files

Merge pull request #347 from SgStapleton/ipceDocksTarSen

Looks good!
parents efe9fa1d a03c27f0
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@ namespace Isis {
   * @param cube The Pvl label from the cube is used to create the Camera object.
   */
  Camera::Camera(Cube &cube) : Sensor(cube) {
    
    m_instrumentId = cube.label()->findGroup("Instrument", 
                        PvlObject::FindOptions::Traverse).findKeyword("InstrumentId")[0];
    
    m_instrumentNameLong = "Unknown";
    m_instrumentNameShort = "Unknown";
    m_spacecraftNameLong = "Unknown";
@@ -2876,6 +2880,16 @@ namespace Isis {
  }
  
  
  /**
   * This method returns the InstrumentId as it appears in the cube.
   *
   * @return QString Returns m_instrumentId
   */
  QString Camera::instrumentId() {
    return m_instrumentId;
  }


  /**
   * This method returns the full instrument name.
   *
+7 −0
Original line number Diff line number Diff line
@@ -241,6 +241,9 @@ namespace Isis {
   *   @history 2017-08-30 Summer Stapleton - Updated documentation. References #4807.
   *   @history 2017-01-11 Christopher Combs - Added bool deleteExisting to SetDistortionMap to 
   *                           prevent a segfault when the distortion map is incomplete. Fixes $5163.
   *   @hitsory 2018-07-12 Summer Stapleton - Added m_instrumentId and instrumentId() in order to 
   *                           collect the InstrumentId from the original cube label for 
   *                           comparisons related to image imports in ipce. References #5460.
   */

  class Camera : public Sensor {
@@ -329,6 +332,8 @@ namespace Isis {
      CameraGroundMap *GroundMap();
      CameraSkyMap *SkyMap();
      
      QString instrumentId();

      QString instrumentNameLong() const;
      QString instrumentNameShort() const;
      QString spacecraftNameLong() const;
@@ -497,6 +502,8 @@ namespace Isis {
      friend class RadarGroundMap;      //!< A friend class to calculate focal length
      friend class RadarSlantRangeMap;  //!< A friend class to calculate focal length
      
      QString m_instrumentId;        //!< The InstrumentId as it appears on the cube.

      QString m_instrumentNameLong;  //!< Full instrument name
      QString m_instrumentNameShort; //!< Shortened instrument name
      QString m_spacecraftNameLong;  //!< Full spacecraft name
+20 −6
Original line number Diff line number Diff line
@@ -531,12 +531,26 @@ namespace Isis {

          if (cube) {

            // Commenting these out as a quick and dirty fix to segfault related to threading on
            // astrovm4 until it can be handled properly. -Summer
            //Camera *camera = cube->camera();
            //project()->addCamera(camera);
            //Target *target = camera->target();
            //project()->addTarget(target);
            // Confirm that the target body and the gui camera do not exist before creating and 
            // and adding them for each image. Since a target may be covered by many cameras and a 
            // camera may cover many targets, have to get tricky with the checking.
            QString instrumentId = cube->label()->findGroup("Instrument", 
                              PvlObject::FindOptions::Traverse).findKeyword("InstrumentId")[0];
            QString targetName = cube->label()->findGroup("Instrument", 
                              PvlObject::FindOptions::Traverse).findKeyword("TargetName")[0];
            if (!project()->hasTarget(targetName)) {
              Camera *camera = cube->camera();
              Target *target = camera->target();
              project()->addTarget(target);
              
              if (!project()->hasCamera(instrumentId)) {
                project()->addCamera(camera);
              }
            }
            else if (!project()->hasCamera(instrumentId)) {
              Camera *camera = cube->camera();
              project()->addCamera(camera);
            }

            // Create a new image from the result in the thread spawned in WorkOrder::redo().
            Image *newImage = new Image(cube);
+5 −0
Original line number Diff line number Diff line
@@ -98,6 +98,11 @@ namespace Isis {
   *                           checking in functor operator method. Fixes #4955.
   *   @history 2018-01-18 Tracie Sucharski - Add the targets and gui cameras to the project.
   *                           Fixes #5181.
   *   @history 2018-07-12 Summer Stapleton - Updated how adding the targets and the gui cameras to
   *                           the project is handled to address segfault. Instead of creating a 
   *                           camera and a target with every new image imported and adding them if
   *                           needed, they are now no longer created in the first place except 
   *                           when needed. Fixes #5460.
   *            
   */
  class ImportImagesWorkOrder : public WorkOrder {
+15 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ namespace Isis {
//    m_radii[1] = target->radii().at(1);
//    m_radii[2] = target->radii().at(2);

    m_instrumentId = camera->instrumentId();

    m_spacecraftNameShort = camera->spacecraftNameShort();
    m_spacecraftNameLong = camera->spacecraftNameLong();
    m_instrumentNameShort = camera->instrumentNameShort();
@@ -297,6 +299,16 @@ namespace Isis {
    return m_id->toString().remove(QRegExp("[{}]"));
  }
  
  
  /**
   * @brief Retrieve the InstrumentId as appears in the original cube label.
   * @return @b QString Returns m_instrumentId
   */
  QString GuiCamera::instrumentId() {
    return m_instrumentId;
  }
  

  /**
   * @brief Retrieves an abbreviated version for the name of the instrument.
   * @return @b QString Returns m_instrumentNameShort.
@@ -305,6 +317,7 @@ namespace Isis {
    return m_instrumentNameShort;
  }


  /**
   * @brief Retrieves a long version for the name of the instrument.
   * @return @b QString Returns m_instrumentNameLong.
@@ -313,6 +326,7 @@ namespace Isis {
    return m_instrumentNameLong;
  }


  /**
   * @brief Retrieves an abbbreviated name for the spacecraft.
   * @return @b QString Returns m_spacecraftNameShort.
@@ -321,6 +335,7 @@ namespace Isis {
    return m_spacecraftNameShort;
  }


  /**
   * @brief Retrieves the full name of the spacecraft.
   * @return @b QString Returns m_spacecraftNameLong.
Loading