Commit 15ac2e27 authored by acpaquette's avatar acpaquette Committed by Jesse Mapel
Browse files

Adds the ability to adjust precision to q apps that display DNs

parent 2dfc499c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ namespace Isis {
   *
   * @return string The name of the pixel type
   */
  inline QString PixelToString(double d) {
  inline QString PixelToString(double d, double precision=8) {
    if(Isis::IsSpecial(d)) {
      if(Isis::IsNullPixel(d)) return "Null";
      if(Isis::IsLrsPixel(d)) return "Lrs";
@@ -379,7 +379,7 @@ namespace Isis {
    }

    QString result;
    return result.setNum(d, 'g', 8);
    return result.setNum(d, 'g', precision);
  }


+4 −6
Original line number Diff line number Diff line
@@ -337,16 +337,14 @@ namespace Isis {
    }

    // Otherwise write out col 4 (Pixel value)
    QString pixel;
    if(cvp->isGray()) {
      QString grayPixel = PixelToString(cvp->grayPixel(isample, iline));
      QString p = grayPixel;
      p_tableWin->table()->item(row, getIndex("Pixel"))->setText(p);
      pixel = PixelToString(cvp->grayPixel(isample, iline), 12);
    }
    else {
      QString redPixel = PixelToString(cvp->redPixel(isample, iline));
      QString p = redPixel;
      p_tableWin->table()->item(row, getIndex("Pixel"))->setText(p);
      pixel = PixelToString(cvp->redPixel(isample, iline), 12);
    }
    p_tableWin->table()->item(row, getIndex("Pixel"))->setText(pixel);

    // Do we have a camera model?
    if(cvp->camera() != NULL) {
+30 −66
Original line number Diff line number Diff line
@@ -240,24 +240,12 @@ namespace Isis {
      p_grnLabel->hide();
      p_bluLabel->hide();

      ViewportBuffer *grayBuf = cvp->grayBuffer();
      ViewportBuffer *buf = cvp->grayBuffer();

      QString pixelString = updateColorLabel(p, buf, p_grayLabel);

      if(grayBuf->working()) {
        p_grayLabel->setText("BUSY");
      }
      else {
        const QRect rect(grayBuf->bufferXYRect());

        if(p.x() >= rect.left() && p.x() <= rect.right() &&
            p.y() >= rect.top() && p.y() <= rect.bottom()) {
          const int bufX = p.x() - rect.left();
          const int bufY = p.y() - rect.top();
          QString pixelString = IString(PixelToString(
                                                grayBuf->getLine(bufY)[bufX])).ToQt();
      p_grayLabel->setText(pixelString);
    }
      }
    }
    else {
      p_grayLabel->hide();
      p_redLabel->show();
@@ -265,60 +253,37 @@ namespace Isis {
      p_bluLabel->show();

      ViewportBuffer *redBuf = cvp->redBuffer();

      if(redBuf->working()) {
        p_grayLabel->setText("BUSY");
      }
      else {
        const QRect rRect = redBuf->bufferXYRect();

        if(p.x() >= rRect.left() && p.x() < rRect.right() &&
            p.y() >= rRect.top() && p.y() < rRect.bottom()) {
          const int rBufX = p.x() - rRect.left();
          const int rBufY = p.y() - rRect.top();
      QString pixelString = updateColorLabel(p, redBuf, p_redLabel);
      QString rLab = "R ";
          rLab += IString(PixelToString(
                                  redBuf->getLine(rBufY)[rBufX])).ToQt();
      rLab += IString(pixelString).ToQt();
      p_redLabel->setText(rLab);
        }
      }

      ViewportBuffer *greenBuf = cvp->greenBuffer();

      if(greenBuf->working()) {
        p_grayLabel->setText("BUSY");
      }
      else {
        const QRect gRect = greenBuf->bufferXYRect();

        if(p.x() >= gRect.left() && p.x() < gRect.right() &&
            p.y() >= gRect.top() && p.y() < gRect.bottom()) {
          const int gBufX = p.x() - gRect.left();
          const int gBufY = p.y() - gRect.top();
      pixelString = updateColorLabel(p, greenBuf, p_grnLabel);
      QString gLab = "G ";
          gLab += IString(PixelToString(
                                  greenBuf->getLine(gBufY)[gBufX])).ToQt();
      gLab += IString(pixelString).ToQt();
      p_grnLabel->setText(gLab);
        }
      }

      ViewportBuffer *blueBuf = cvp->blueBuffer();
      pixelString = updateColorLabel(p, blueBuf, p_bluLabel);
      QString bLab = "B ";
      bLab += IString(pixelString).ToQt();
      p_bluLabel->setText(bLab);
    }
  }

      if(blueBuf->working()) {
        p_grayLabel->setText("BUSY");
  QString TrackTool::updateColorLabel(QPoint p, ViewportBuffer *buf, QLabel *label) {
    if(buf->working()) {
      label->setText("BUSY");
    }
    else {
        const QRect bRect = blueBuf->bufferXYRect();
      const QRect rRect = buf->bufferXYRect();

        if(p.x() >= bRect.left() && p.x() < bRect.right() &&
            p.y() >= bRect.top() && p.y() < bRect.bottom()) {
          const int bBufX = p.x() - bRect.left();
          const int bBufY = p.y() - bRect.top();
          QString bLab = "B ";
          bLab += IString(PixelToString(
                                  blueBuf->getLine(bBufY)[bBufX])).ToQt();
          p_bluLabel->setText(bLab);
        }
      if(p.x() >= rRect.left() && p.x() < rRect.right() &&
          p.y() >= rRect.top() && p.y() < rRect.bottom()) {
        const int rBufX = p.x() - rRect.left();
        const int rBufY = p.y() - rRect.top();
        return PixelToString(buf->getLine(rBufY)[rBufX], 12);
      }
    }
  }
@@ -383,4 +348,3 @@ namespace Isis {
    return p_sbar;
  }
}
+2 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ class QStatusBar;
namespace Isis {
  class MdiCubeViewport;
  class WarningWidget;
  class ViewportBuffer;

  /**
   * @brief This tool is part of the Qisis namespace and displays the statusbar of the window.
@@ -61,6 +62,7 @@ namespace Isis {

    private:
      void updateLabels(QPoint p);
      QString updateColorLabel(QPoint p, ViewportBuffer *buf, QLabel *label);
      void clearLabels();

      QStatusBar *p_sbar;           //!< Status bar