Commit 93a4bfa8 authored by Summer Stapleton's avatar Summer Stapleton
Browse files

Making changes from review

parent 20c95196
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ namespace Isis {


  /**
  * @brief Default constructor
  * Default constructor
  */
  TrackingTable::TrackingTable() {
    
@@ -45,7 +45,7 @@ namespace Isis {
  
  
  /**
  * @ brief Constructs a TrackingTable given a Table object. The Table is used to populate 
  * Constructs a TrackingTable given a Table object. The Table is used to populate 
  *         m_fileList.
  *
  * @param table The Table object to pull the filenames and serial numbers from
@@ -54,7 +54,7 @@ namespace Isis {
    
    for (int i=0; i < table.Records(); i++) {
      TableRecord record = table[i];
      QString nameField = QString(record["FileName"]).toLatin1().data();
      QString nameField = QString(record["FileName"]);
      int found = nameField.lastIndexOf(".cub");
      if (found != -1) {
        // clear the packing characters - get only the file name
@@ -68,7 +68,7 @@ namespace Isis {
  
  
  /**
  * @brief Destroys the TrackingTable object
  * Destroys the TrackingTable object
  */
  TrackingTable::~TrackingTable() {
    
@@ -76,7 +76,7 @@ namespace Isis {
  
  
  /**
  * @brief Constrcts and returns a Table object based on values in m_fileList.
  * Constrcts and returns a Table object based on values in m_fileList.
  *
  * @return Table The constructed table to be returned
  */
@@ -103,7 +103,7 @@ namespace Isis {
    dummyRecord += fileNameField;
    dummyRecord += serialNumberField;
    dummyRecord += indexField;
    Table table(tableName, dummyRecord);
    Table table(trackingTableName, dummyRecord);
    
    // Loop through m_fileList and add records to the table with the proper information.
    for (int i=0; i < m_fileList.size(); i++) {
@@ -126,7 +126,7 @@ namespace Isis {
  
  
  /**
  * @brief Returns the FileName at the given index within m_fileList.
  * Returns the FileName at the given index within m_fileList.
  *
  * @param index The index to find the filename for
  * @returns FileName The FileName at the index specified
@@ -143,7 +143,7 @@ namespace Isis {
  
  
  /**
  * @brief Returns the index of the filename/serialnumber combination.
  * Returns the index of the filename/serialnumber combination.
  *
  * @param file The FileName within m_fileList to find the index of
  * @param serialNumber The QString of the serial number within m_fileList to find the index of
+6 −8
Original line number Diff line number Diff line
@@ -31,22 +31,22 @@


namespace Isis {
  
  const QString trackingTableName = "InputImages";

  /**
   * @brief Table to store tracking information for a mosaic.
   * Table to store tracking information for a mosaic.
   *
   * This table will currently be stored in the label of a separate cube. This tracking cube will
   * also contain a single tracking band. The DN values stored in this band will correlate to the
   * indices in this table. Each record within this table will contain the filename of an
   * associated cube, that cube's serial number, and the DN value associated with this cube within
   * the tracking band (which should also be its index in tha table).
   * the tracking band (which should also be its index in the table).
   *
   * @author 2018-07-19 Jesse Mapel & Summer Stapleton
   *
   * @internal
   */
   
  const QString tableName = "InputImages";

  class TrackingTable{
    
    public:
@@ -59,8 +59,6 @@ namespace Isis {
      
      Table toTable();
            
      // oldDnToNewDn(); TODO (maybe?)
      
      FileName indexToFileName(unsigned int index);
      
      unsigned int fileNameToIndex(FileName file, QString serialNumber);
+9 −0
Original line number Diff line number Diff line
@@ -25,3 +25,12 @@ First record: fileName1.cub, 1234567890
Second record: fileName2.cub, 123
Third record: fileName3.cub, 456789
Fourth record: fileName4.cub, 2

Creating a new TrackingTable object with the table returned from toTable method ...
New TrackingTable object created

Testing that the Table returned from toTable on new TrackingTable matches ...
First record: fileName1.cub, 1234567890
Second record: fileName2.cub, 123
Third record: fileName3.cub, 456789
Fourth record: fileName4.cub, 2
+93 −66
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ int main(int argc, char *argv[]) {

  Preference::Preferences(true);
  
  try{
    cout << "Unit test for TrackingTable\n" << endl;
    
    cout << "Testing constructor with a Table object ..." << endl;
@@ -87,4 +88,30 @@ int main(int argc, char *argv[]) {
    cout << "Third record: " << QString(tableOut[2][0]) << ", " << QString(tableOut[2][1]) << endl;
    cout << "Fourth record: " << QString(tableOut[3][0]) << ", " << QString(tableOut[3][1]) << endl;
    
    cout << endl;
    
    cout << "Creating a new TrackingTable object with the table returned from toTable method ..." << endl;
    
    TrackingTable trackingTable2(tableOut);
    
    cout << "New TrackingTable object created" << endl;
    
    cout << endl;
    
    cout << "Testing that the Table returned from toTable on new TrackingTable matches ..." << endl;
             
    Table tableOut2 = trackingTable2.toTable();
             
    cout << "First record: " << QString(tableOut2[0][0]) << ", " << QString(tableOut2[0][1]) << endl;
    cout << "Second record: " << QString(tableOut2[1][0]) << ", " << QString(tableOut2[1][1]) << endl;
    cout << "Third record: " << QString(tableOut2[2][0]) << ", " << QString(tableOut2[2][1]) << endl;
    cout << "Fourth record: " << QString(tableOut2[3][0]) << ", " << QString(tableOut2[3][1]) << endl;
    
  }
  catch (IException &e) {
    cout << "Unit test failed." << endl;
    e.print();
  }
  
  
}