Commit bac68d02 authored by Adam Goins's avatar Adam Goins
Browse files

Merge branch 'dev' of github.com:AgoinsUSGS/ISIS3 into Goins_Adam_M05361

parents fb5f0daa dbffb2d9
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -102,14 +102,6 @@ namespace Isis {
    strncpy(env, "LANG=en_US", 1023);
    putenv(env);

    // Verify ISISROOT was set
    if (getenv("ISISROOT") == NULL || QString(getenv("ISISROOT")) == "") {
      QString message = "Please set ISISROOT before running any Isis "
          "applications";
      cerr << message << endl;
      abort();
    }

    // Get the starting cpu time, direct I/Os, page faults, and swaps
    //p_startClock = clock();
    p_startDirectIO = DirectIO();
+0 −44
Original line number Diff line number Diff line
@@ -593,50 +593,6 @@ namespace Isis {
  }


  /**
   * Computes and returns emission angle, in degrees, given the observer
   * position. The surface normal vector is calculated using an ellipsoid, not
   * the local normal of the actual target shape.
   *
   * Emission Angle: The angle between the surface normal vector at the
   * intersection point and the vector from the intersection point to the
   * observer (usually the spacecraft). The emission angle varies from 0 degrees
   * when the observer is viewing the sub-spacecraft point (nadir viewing) to 90
   * degrees when the intercept is tangent to the surface of the target body.
   * Thus, higher values of emission angle indicate more oblique viewing of the
   * target.
   *
   * @param observerBodyFixedPosition  Three dimensional position of the observer,
   *                                   in the coordinate system of the target body.
   *
   * @return The emission angle, in decimal degrees.
   *
   */
  double EmbreeShapeModel::emissionAngle(const std::vector<double> &observerBodyFixedPosition) {

    // If there is already a normal save it, because it's probably the local normal
    std::vector<double> localNormal;
    bool hadNormal = hasNormal();
    if ( hadNormal ) {
      localNormal = normal();
    }

    // Calculate the ellipsoid surface normal
    calculateDefaultNormal();
    
    // Use ShapeModel to calculate the ellipsoid emission angle
    double ellipsoidEmission = ShapeModel::emissionAngle(observerBodyFixedPosition);

    // If there's a saved normal, reset it
    if ( hadNormal ) {
      setNormal(localNormal);
    }

    // Return the ellipsoid emission angle
    return ellipsoidEmission;
  }


  /**
   * Computes and returns incidence angle, in degrees, given the illuminator position.
   * The surface normal vector is calculated using an ellipsoid, not the local
+2 −2
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ namespace Isis {
   *
   * @internal
   *   @history 2017-04-22 Jesse Mapel and Jeannie Backer - Original Version
   *   @history 2018-05-01 Christopher Combs - Removed emissionAngle function to
   *                fix issues with using ellipsoids to find normals. Fixes #5387.
   */
  class EmbreeShapeModel : public ShapeModel {
    public:
@@ -84,10 +86,8 @@ namespace Isis {
      virtual void calculateSurfaceNormal();
      QVector<double> ellipsoidNormal();

      virtual double emissionAngle(const std::vector<double> &sB);
      virtual double incidenceAngle(const std::vector<double> &uB);


      virtual Distance localRadius(const Latitude &lat, const Longitude &lon);

      // Determine if the internal intercept is occluded from the observer/lookdir
+9 −1
Original line number Diff line number Diff line
@@ -107,6 +107,14 @@ void InterruptSignal(int);
 * @return int
 */
int main(int argc, char *argv[]) {
  // Verify ISISROOT was set
  // Note: as printing and logging IExceptions requires ISISROOT to be set (for preferences),
  //       The case below cannot be handled with IExceptions
  if (getenv("ISISROOT") == NULL || QString(getenv("ISISROOT")) == "") {
    std::cerr << "Please set ISISROOT before running any Isis applications" << std::endl;
    exit(1);
  }

#ifdef CWDEBUG
  startMonitoringMemory();
  signal(SIGSEGV, SegmentationFault);
+42 −60
Original line number Diff line number Diff line
@@ -1847,11 +1847,6 @@ namespace Isis {
   */
  void ProcessImport::ProcessBip(void funct(Isis::Buffer &out)) {

    // Figure out the number of bytes to read for a single line
    int readBytes = Isis::SizeOf(p_pixelType);
    readBytes = readBytes * p_ns * p_nb;
    char *in = new char [readBytes];

    // Set up an Isis::EndianSwapper object
    QString tok(Isis::ByteOrderName(p_byteOrder));
    tok = tok.toUpper();
@@ -1902,6 +1897,11 @@ namespace Isis {
    p_progress->SetMaximumSteps(p_nl);
    p_progress->CheckStatus();

    // Figure out the number of bytes to read for a single line
    int sampleBytes = Isis::SizeOf(p_pixelType) * p_nb + p_dataPreBytes + p_dataPostBytes;
    int readBytes = p_ns * sampleBytes;
    char *in = new char [readBytes];

    // Loop for each line
    for(int line = 0; line < p_nl; line++) {
      // Check the last io
@@ -1915,16 +1915,6 @@ namespace Isis {
      // Space for storing prefix and suffix data pointers
      vector<char *> tempPre, tempPost;

      // Handle any line prefix bytes
      pos = fin.tellg();
      if (p_saveDataPre) {
        tempPre.push_back(new char[p_dataPreBytes]);
        fin.read(tempPre.back(), p_dataPreBytes);
      }
      else {
        fin.seekg(p_dataPreBytes, ios_base::cur);
      }

      // Check the last io
      if (!fin.good()) {
        QString msg = "Cannot read file [" + p_inFile + "]. Position [" +
@@ -1960,31 +1950,32 @@ namespace Isis {
        // to special pixels
        int osamp = 0;

        for(int samp = band; samp < p_ns * p_nb; samp += p_nb) {
        for(int samp = 0; samp < p_ns; samp++) {
          int bufferIndex = p_dataPreBytes + Isis::SizeOf(p_pixelType)*band + samp*sampleBytes;
          switch(p_pixelType) {
            case Isis::UnsignedByte:
              (*out)[osamp] = (double)((unsigned char *)in)[samp];
              (*out)[osamp] = (double)((unsigned char *)in)[bufferIndex];
              break;
            case Isis::UnsignedWord:
              (*out)[osamp] =
                (double)swapper.UnsignedShortInt((unsigned short int *)in+samp);
                (double)swapper.UnsignedShortInt(&in[bufferIndex]);
              break;
            case Isis::SignedWord:
              (*out)[osamp] = (double)swapper.ShortInt((short int *)in+samp);
              (*out)[osamp] = (double)swapper.ShortInt(&in[bufferIndex]);
              break;
            case Isis::SignedInteger:
              (*out)[samp] = (double)swapper.Int((int *)in+samp);
              (*out)[samp] = (double)swapper.Int(&in[bufferIndex]);
              break;
            case Isis::Real:
              if(p_vax_convert) {
                (*out)[osamp]= VAXConversion( (float *)in+samp );
                (*out)[osamp]= VAXConversion(&in[bufferIndex]);
              }
              else {
                (*out)[osamp] = (double)swapper.Float((float *)in+samp);
                (*out)[osamp] = (double)swapper.Float(&in[bufferIndex]);
              }
              break;
            case Isis::Double:
              (*out)[osamp] = (double)swapper.Double((double *)in+samp);
              (*out)[osamp] = (double)swapper.Double(&in[bufferIndex]);
              break;
            default:
              break;
@@ -2008,33 +1999,25 @@ namespace Isis {
          funct(*out);
        }

        // Handle any line suffix bytes
        pos = fin.tellg();
        if (p_saveDataPost) {
          tempPost.push_back(new char[p_dataPostBytes]);
          fin.read(tempPost.back(), p_dataPostBytes);
        }
        else {
          fin.seekg(p_dataPostBytes, ios_base::cur);
        }

        // Check the last io
        if (!fin.good()) {
          QString msg = "Cannot read file [" + p_inFile + "]. Position [" +
                       toString((int)pos) + "]. Byte count [" +
                       toString(p_dataPreBytes) + "]" ;
          throw IException(IException::Io, msg, _FILEINFO_);
        }

      } // End band loop

        // Save off the prefix bytes vector
      // Handle record prefix and suffix
      if (p_saveDataPre) {
        for(int samp = 0; samp < p_ns; samp++) {
          char *samplePrefix = new char[p_dataPreBytes];
          memcpy(samplePrefix, &in[samp*sampleBytes], p_dataPreBytes);
          tempPre.push_back(samplePrefix);
        }
        p_dataPre.push_back(tempPre);
        tempPre.clear();
      }

        // Save off the suffix bytes vector
      if (p_saveDataPost) {
        for(int samp = 0; samp < p_ns; samp++) {
          char *sampleSuffix = new char[p_dataPostBytes];
          int suffixIndex = p_dataPreBytes + Isis::SizeOf(p_pixelType)*p_nb + samp*sampleBytes;
          memcpy(sampleSuffix, &in[suffixIndex], p_dataPostBytes);
          tempPost.push_back(sampleSuffix);
        }
        p_dataPost.push_back(tempPost);
        tempPost.clear();
      }
@@ -2043,12 +2026,11 @@ namespace Isis {
      if (!fin.good()) {
        QString msg = "Cannot read file [" + p_inFile + "]. Position [" +
                     toString((int)pos) + "]. Byte count [" +
                       toString(p_fileHeaderBytes) + "]" ;
                     toString(p_dataPreBytes) + "]" ;
        throw IException(IException::Io, msg, _FILEINFO_);
      }

      } // End band loop

      // Handle the data trailer
      pos = fin.tellg();
      if (p_saveDataTrailer) {
        p_dataTrailer.push_back(new char[p_dataTrailerBytes]);
Loading