Skip to content

Commit

Permalink
Adds the ability to adjust precision to q apps that display DNs
Browse files Browse the repository at this point in the history
  • Loading branch information
acpaquette authored and jessemapel committed Nov 9, 2021
1 parent fca9d0e commit 3dbee4d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 74 deletions.
4 changes: 2 additions & 2 deletions isis/src/base/objs/SpecialPixel/SpecialPixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -379,7 +379,7 @@ namespace Isis {
}

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


Expand Down
10 changes: 4 additions & 6 deletions isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
96 changes: 30 additions & 66 deletions isis/src/qisis/objs/TrackTool/TrackTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,11 @@ namespace Isis {
p_grnLabel->hide();
p_bluLabel->hide();

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

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);
}
}
QString pixelString = updateColorLabel(p, buf, p_grayLabel);

p_grayLabel->setText(pixelString);
}
else {
p_grayLabel->hide();
Expand All @@ -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 rLab = "R ";
rLab += IString(PixelToString(
redBuf->getLine(rBufY)[rBufX])).ToQt();
p_redLabel->setText(rLab);
}
}
QString pixelString = updateColorLabel(p, redBuf, p_redLabel);
QString rLab = "R ";
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();
QString gLab = "G ";
gLab += IString(PixelToString(
greenBuf->getLine(gBufY)[gBufX])).ToQt();
p_grnLabel->setText(gLab);
}
}
pixelString = updateColorLabel(p, greenBuf, p_grnLabel);
QString gLab = "G ";
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");
}
else {
const QRect bRect = blueBuf->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);
}
QString TrackTool::updateColorLabel(QPoint p, ViewportBuffer *buf, QLabel *label) {
if(buf->working()) {
label->setText("BUSY");
}
else {
const QRect rRect = buf->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();
return PixelToString(buf->getLine(rBufY)[rBufX], 12);
}
}
}
Expand Down Expand Up @@ -383,4 +348,3 @@ namespace Isis {
return p_sbar;
}
}

2 changes: 2 additions & 0 deletions isis/src/qisis/objs/TrackTool/TrackTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3dbee4d

Please sign in to comment.