Commit 416af579 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

pointing table now retains row values when adding new rows

parent 87805f48
Loading
Loading
Loading
Loading
+48 −45
Original line number Diff line number Diff line
@@ -1356,6 +1356,7 @@ namespace Isis {

    if (newRowCount > oldRowCount) {
      for (int row = oldRowCount; row < newRowCount; row++) {
        // Headers : coefficient, description, units, a priori sigma
        QTableWidgetItem *coefficient = new QTableWidgetItem();
        coefficient->setFlags(Qt::ItemIsEnabled);
        coefficient->setText(QString::number(row + 1));
@@ -1376,7 +1377,7 @@ namespace Isis {
        sigma->setText("0.0");
        table->setItem(row, 3, sigma);

        // Solve option: spk degree -> { NONE: -1, POSITION: 0, VELOCITY: 1, ACCELERATION: 2, ALL: 2 }
        // Solve option: spk degree { NONE: -1, POSITION: 0, VELOCITY: 1, ACCELERATION: 2, ALL: 2 }
        // POSITION
        if (row == 0) { 
          QTableWidgetItem *description = table->item(0, 1);
@@ -1423,13 +1424,14 @@ namespace Isis {
  void JigsawSetupDialog::on_ckSolveDegreeSpinBox_valueChanged(int i) {
    // number of rows == ckSolveDegree value + 1 (i+1)
    QTableWidget *table = m_ui->pointingAprioriSigmaTable;
    const int oldRowCount = table->rowCount();
    table->setRowCount(i + 1);
    const int newRowCount = table->rowCount();

    const int columnCount = table->columnCount();
    if (newRowCount > oldRowCount) {

      for (int row = oldRowCount; row < newRowCount; row++) {
        // Headers : coefficient, description, units, a priori sigma
    // The description and units are related directly to the solve options, so for now do those
    // generically (columns 1 and 2)
    for (int row = 0; row < i + 1; row++) {
        QTableWidgetItem *coefficient = new QTableWidgetItem();
        coefficient->setFlags(Qt::ItemIsEnabled);
        coefficient->setText(QString::number(row + 1));
@@ -1448,12 +1450,11 @@ namespace Isis {
        QTableWidgetItem *sigma = new QTableWidgetItem();
        sigma->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
        sigma->setText("0.0");
      table->setItem(row, columnCount - 1, sigma);
    }
        table->setItem(row, 3, sigma);

        // { NONE: N/A, ANGLES: 0, ANGULAR VELOCITY: 1, ANGULAR ACCELERATION: 2, ALL: 2 }
        // ANGLES
    if (i + 1 > 0) { 
        if (row == 0) { 
          QTableWidgetItem *description = table->item(0, 1);
          description->setText("ANGLES");

@@ -1462,7 +1463,7 @@ namespace Isis {
        }

        // VELOCITY
    if (i + 1 > 1) {
        if (row == 1) {
          QTableWidgetItem *description = table->item(1, 1);
          description->setText("ANGULAR VELOCITY");

@@ -1471,13 +1472,15 @@ namespace Isis {
        }

        // ACCELERATION
    if (i + 1 > 2) {
        if (row == 2) {
          QTableWidgetItem *description = table->item(2, 1);
          description->setText("ANGULAR ACCELERATION");

          QTableWidgetItem *units = table->item(2, 2);
          units->setText("deg/s^2");
        }
      }
    }

    table->resizeColumnToContents(1);
    table->resizeColumnToContents(2);