Unverified Commit 23866ed6 authored by dcookastro's avatar dcookastro Committed by GitHub
Browse files

Merge pull request #409 from dcookastro/devRadii

Dev radii
parents 71c63ba2 5e329e25
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
APPNAME = photomet

angleSourceDemUsedemFalse.cub.TOLERANCE = 0.0005
angleSourceDemUsedemTrue.cub.TOLERANCE = 0.0005
angleSourceDemUsedemFalse.cub.TOLERANCE = 0.001
angleSourceDemUsedemTrue.cub.TOLERANCE = 0.001

include $(ISISROOT)/make/isismake.tsts

+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.
   *   @history 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
+30 −94
Original line number Diff line number Diff line
@@ -26,12 +26,7 @@ namespace Isis {
   *
   */
  SurfacePoint::SurfacePoint(const SurfacePoint &other) {
    if(other.p_localRadius) {
      p_localRadius = new Distance(*other.p_localRadius);
    }
    else {
      p_localRadius = NULL;
    }
    p_localRadius = other.p_localRadius;

    if(other.p_x) {
      p_x = new Displacement(*other.p_x);
@@ -204,7 +199,7 @@ namespace Isis {
    p_x = NULL;
    p_y = NULL;
    p_z = NULL;
    p_localRadius = NULL;
    p_localRadius = Distance();
  }

  
@@ -257,10 +252,10 @@ namespace Isis {
    //   throw IException(IException::User, msg, _FILEINFO_);
    // }

    if (!p_localRadius || (p_localRadius && !(*p_localRadius).isValid())) {
    if (!p_localRadius.isValid()) {
      ComputeLocalRadius();
      p_localRadius = GetLocalRadius();
    }
    *p_localRadius = GetLocalRadius();
  }


@@ -282,8 +277,9 @@ namespace Isis {
      const Displacement &y, const Displacement &z, const Distance &xSigma,
      const Distance &ySigma, const Distance &zSigma) {
    
    // Wipe out local radius to ensure it will be recalulated in SetRectangularPoint
    if (p_localRadius) *p_localRadius = Distance();
    // Wipe out current local radius to ensure it will be recalculated in SetRectangularPoint
     p_localRadius = Distance();
    
    SetRectangularPoint(x, y, z);

    if (xSigma.isValid() && ySigma.isValid() && zSigma.isValid())
@@ -304,8 +300,8 @@ namespace Isis {
   */
  void SurfacePoint::SetRectangular(Displacement x, Displacement y, Displacement z,
                                    const symmetric_matrix<double,upper>& covar) {
    // Wipe out local radius to ensure it will be recalulated in SetRectangularPoint
    if (p_localRadius) *p_localRadius = Distance();
    // Wipe out current local radius to ensure it will be recalulated in SetRectangularPoint
    p_localRadius = Distance();

    SetRectangularPoint(x, y, z);
    SetRectangularMatrix(covar);
@@ -434,13 +430,8 @@ namespace Isis {
    SpiceDouble rect[3];
    latrec_c ( dradius, dlon, dlat, rect);

    // Set local radius now to avoid calculating it later
    if(p_localRadius) {
      *p_localRadius = radius;
    }
    else {
      p_localRadius = new Distance(radius);
    }
    // Set local radius now since we have it to avoid calculating it later
    p_localRadius = radius;

    SetRectangularPoint(Displacement(rect[0], Displacement::Kilometers),
                        Displacement(rect[1], Displacement::Kilometers),
@@ -465,14 +456,6 @@ namespace Isis {
      const Distance &radius, const Angle &latSigma, const Angle &lonSigma,
      const Distance &radiusSigma) {

    // Set local radius now to avoid calculating it later
    if (p_localRadius) {
      *p_localRadius = radius;
    }
    else {
      p_localRadius = new Distance(radius);
    }
    
    SetSphericalPoint(lat, lon, radius);

    if (latSigma.isValid() && lonSigma.isValid() && radiusSigma.isValid())
@@ -491,15 +474,6 @@ namespace Isis {
   */
  void SurfacePoint::SetSpherical(const Latitude &lat, const Longitude &lon,
      const Distance &radius, const symmetric_matrix<double, upper> &covar) {

    // Set local radius now to avoid calculating it later
    if (p_localRadius) {
      *p_localRadius = radius;
    }
    else {
      p_localRadius = new Distance(radius);
    }

    SetSphericalPoint(lat, lon, radius);
    SetSphericalMatrix(covar);
  }
@@ -515,15 +489,6 @@ namespace Isis {
   */
  void SurfacePoint::SetSphericalCoordinates(const Latitude &lat,
                                                const Longitude &lon, const Distance &radius) {

    // Set local radius now to avoid calculating it later
    if (p_localRadius) {
      *p_localRadius = radius;
    }
    else {
      p_localRadius = new Distance(radius);
    }
    
    SetSphericalPoint(lat, lon, radius);
  }

@@ -729,7 +694,7 @@ namespace Isis {
    }
    
    ComputeLocalRadius();
    *p_localRadius = GetLocalRadius();
    p_localRadius = GetLocalRadius();
  }


@@ -757,12 +722,7 @@ namespace Isis {
    SpiceDouble lat = (double) GetLatitude().radians();
    SpiceDouble lon = (double) GetLongitude().radians();
    
    if (p_localRadius) {
      *p_localRadius = radius;
    }
    else {
      p_localRadius = new Distance(radius);
    }
    p_localRadius = radius;
    
    // Set rectangular coordinates
    SpiceDouble rect[3];
@@ -909,20 +869,10 @@ namespace Isis {
        double y = p_y->meters();
        double z = p_z->meters();

        if (p_localRadius) {
        *p_localRadius = Distance(sqrt(x*x + y*y + z*z), Distance::Meters);
        }
        else {
        p_localRadius = new Distance(sqrt(x*x + y*y + z*z), Distance::Meters);
        }
        p_localRadius = Distance(sqrt(x*x + y*y + z*z), Distance::Meters);
      }
      else if (*p_x == zero && *p_y == zero && *p_z == zero) { // for backwards compatability
        if (p_localRadius) {
          *p_localRadius = Distance(0., Distance::Meters);
        }
        else {
          p_localRadius = new Distance(0., Distance::Meters);
        }
        p_localRadius = Distance(0., Distance::Meters);
      }
      else { // Invalid point
        IString msg = "SurfacePoint::Can't compute local radius on invalid point";
@@ -936,15 +886,7 @@ namespace Isis {
   *
   */
    Distance SurfacePoint::GetLocalRadius() const {
      if (!Valid())
        return Distance();

      if (p_localRadius) {
        return *p_localRadius;
      }
      else {
        return Distance();
      }
     return p_localRadius;
    }


@@ -953,12 +895,12 @@ namespace Isis {
   *
   */
  Distance SurfacePoint::GetLatSigmaDistance() const {
      Distance latSigmaDistance;
    Distance latSigmaDistance = Distance();

    if(Valid()) {
      Angle latSigma = GetLatSigma();

        if (latSigma.isValid()) {
      if (latSigma.isValid() && GetLocalRadius().isValid()) {
        // Distance scalingRadius = GetLocalRadius();

        // Convert from radians to meters
@@ -1167,10 +1109,6 @@ namespace Isis {
      *p_x = *other.p_x;
      *p_y = *other.p_y;
      *p_z = *other.p_z;
        // Finally initialize local radius to avoid using a previous value
      if (p_localRadius && other.p_localRadius) {
        *p_localRadius = other.GetLocalRadius();
      }
    }
    else {
      FreeAllocatedMemory();
@@ -1200,6 +1138,9 @@ namespace Isis {
      }
    }

    // Finally initialize local radius to avoid using a previous value
    p_localRadius = other.GetLocalRadius();

    return *this;
  }

@@ -1219,11 +1160,6 @@ namespace Isis {
      p_z = NULL;
    }

    if(p_localRadius) {
      delete p_localRadius;
      p_localRadius = NULL;
    }

    if(p_rectCovar) {
      delete p_rectCovar;
      p_rectCovar = NULL;
+5 −3
Original line number Diff line number Diff line
@@ -95,9 +95,11 @@ namespace Isis {
   *                           have not changed.  Also corrected the longitude conversion equation
   *                           in SetSphericalSigmasDistance and GetLonSigmaDistance.
   *                           References #5457.
   *   @history 2018-07-30 Debbie A. Cook - Initialized the local radius whenever any 
   *   @history 2018-08-15 Debbie A. Cook - Initialized the local radius whenever any 
   *                           SurfacePoint coordinate was changed, removed memory errors,
   *                           and cleaned up documentation.  References #5457
   *                           and cleaned up documentation.  Changed localRadius member
   *                           from a pointer to value to reduce extraneous if blocks.  
   *                           References #5457
   */

  class SurfacePoint {
@@ -215,7 +217,7 @@ namespace Isis {
      void SetSphericalPoint(const Latitude &lat, const Longitude &lon, const Distance &radius);
      void FreeAllocatedMemory();

      Distance *p_localRadius;
      Distance p_localRadius;
      Displacement *p_x;
      Displacement *p_y;
      Displacement *p_z;
Loading