Commit 93d41bbf authored by Marjorie Hahn's avatar Marjorie Hahn
Browse files

Add an exception to findimageoverlaps for a cube list that contains only one cube. Fixes #4200.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7149 41f8697f-d340-4b68-9986-7bafba869bb8
parent 8171a158
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
#include "Isis.h"
#include "SerialNumberList.h"
#include "ImageOverlapSet.h"

#include "FileList.h"
#include "ImageOverlapSet.h"
#include "SerialNumber.h"
#include "SerialNumberList.h"

using namespace std;
using namespace Isis;
@@ -16,17 +17,20 @@ void IsisMain() {

  vector< pair<QString, QString> > sortedList;
  
  if (images.size() == 1) {
    throw IException(IException::User, "The list [" + ui.GetFileName("FROMLIST") +
                     "] only contains one image.", _FILEINFO_);
  }

  // We want to sort the input data by serial number so that the same
  //   results are produced every time this program is run with the same
  //   images. This is a modified insertion sort.
  for (int image = 0; image < images.size(); image++) {
    unsigned int insertPos = 0;
    QString sn = SerialNumber::Compose(images[image].toString());

    for (insertPos = 0; insertPos < sortedList.size(); insertPos++) {
      if (sn.compare(sortedList[insertPos].first) < 0) break;
    }

    pair<QString, QString> newPair = pair<QString, QString>(sn, images[image].toString());
    sortedList.insert(sortedList.begin() + insertPos, newPair);
  }
+4 −0
Original line number Diff line number Diff line
@@ -123,6 +123,10 @@
      Fixed a bug where ImageOverlapSet was not recording overlaps where 
      one image is fully enveloped within another. Fixes #2199.
    </change>
    <change name="Marjorie Hahn" date="2016-10-03">
      Added an exception for giving findimageoverlaps a cube list of only 
      one cube. Fixes #4200.
    </change>
  </history>

  <groups>
+9 −9
Original line number Diff line number Diff line
#include <string>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>

#include "Cube.h"
#include "FileName.h"
@@ -72,7 +72,6 @@ namespace Isis {
    
    // Create an ImageOverlap for each image boundary
    for (int i = 0; i < sns.size(); i++) {
            
      // Open the cube
      Cube cube;
      try {
@@ -89,7 +88,6 @@ namespace Isis {
      ImagePolygon *poly = new ImagePolygon();
      cube.read(*poly);
      cube.close();

      // Create an ImageOverlap with the serial number and the bounding
      // polygon and save it
      geos::geom::MultiPolygon *tmp = PolygonTools::MakeMultiPolygon(poly->Polys());
@@ -151,6 +149,7 @@ namespace Isis {
      // Determine the overlap between each boundary polygon
      FindAllOverlaps(&sns);
    }

  }


@@ -446,6 +445,7 @@ namespace Isis {
    IString file = FileName(filename).expanded();
    bool failed = false;
    bool noOverlaps = false;
    
    if (p_threadedCalculate) {
      p_calculatePolygonMutex.lock();
    }