1 #include "SpecialPixelTool.h" 4 #include <QColorDialog> 12 #include <QPushButton> 14 #include <QToolButton> 15 #include <QVBoxLayout> 18 #include "MainWindow.h" 35 p_dialog->setWindowTitle(
"Special Pixel Tool");
47 QVBoxLayout *layout =
new QVBoxLayout();
48 layout->addWidget(defaults, 0);
49 layout->addWidget(
main, 0);
50 layout->addWidget(buttons, 0);
53 QPushButton *ok =
new QPushButton(
"Ok", buttons);
54 ok->setShortcut(Qt::Key_Enter);
55 connect(ok, SIGNAL(released()),
this, SLOT(
apply()));
56 connect(ok, SIGNAL(released()),
p_dialog, SLOT(hide()));
58 QPushButton *
apply =
new QPushButton(
"Apply", buttons);
59 connect(
apply, SIGNAL(released()),
this, SLOT(
apply()));
61 QPushButton *cancel =
new QPushButton(
"Cancel", buttons);
62 connect(cancel, SIGNAL(released()),
p_dialog, SLOT(hide()));
64 QPushButton *defaultBlackWhite =
new QPushButton(
"Default B&W", defaults);
65 connect(defaultBlackWhite, SIGNAL(released()),
this, SLOT(
defaultBW()));
67 QPushButton *
defaultColor =
new QPushButton(
"Default Color", defaults);
70 QHBoxLayout *hlayout =
new QHBoxLayout();
71 hlayout->addWidget(ok);
72 hlayout->addWidget(
apply);
73 hlayout->addWidget(cancel);
75 buttons->setLayout(hlayout);
77 QHBoxLayout *h2layout =
new QHBoxLayout();
78 h2layout->addWidget(defaultBlackWhite);
80 defaults->setLayout(h2layout);
84 QSize *size =
new QSize(25, 25);
85 QLabel *nullLabel =
new QLabel(
"Null");
90 QLabel *lisLabel =
new QLabel(
"Low Instrument Saturation");
95 QLabel *lrsLabel =
new QLabel(
"Low Representation Saturation");
100 QLabel *ldsLabel =
new QLabel(
"Low Display Saturation");
105 QLabel *hisLabel =
new QLabel(
"High Instrument Saturation");
110 QLabel *hrsLabel =
new QLabel(
"High Representation Saturation");
115 QLabel *hdsLabel =
new QLabel(
"High Display Saturation");
119 connect(
p_bgColor, SIGNAL(released()),
this, SLOT(setBgColor()));
120 QLabel *bgLabel =
new QLabel(
"Background");
126 QVBoxLayout *vlayout =
new QVBoxLayout();
127 vlayout->addWidget(nullLabel);
128 vlayout->addWidget(lisLabel);
129 vlayout->addWidget(hisLabel);
130 vlayout->addWidget(lrsLabel);
131 vlayout->addWidget(hrsLabel);
132 vlayout->addWidget(ldsLabel);
133 vlayout->addWidget(hdsLabel);
134 vlayout->addWidget(bgLabel);
135 labels->setLayout(vlayout);
137 QVBoxLayout *v2layout =
new QVBoxLayout();
146 colors->setLayout(v2layout);
148 QHBoxLayout *mainlayout =
new QHBoxLayout();
149 mainlayout->addWidget(colors);
150 mainlayout->addWidget(labels);
151 main->setLayout(mainlayout);
156 p_action->setText(
"&Special Pixel Tool ...");
158 p_action->setToolTip(
"SpecialPixelTool");
160 "<b>Function:</b> Opens a window that allows you to chose what color to \ 161 display each different type of special pixel \ 162 <p><b>Shortcut:</b> Ctrl+C</p>";
200 this, SLOT(
apply()));
219 QColor nullColor = palette.color(QPalette::Button);
221 nullColor.getRgb(&r, &g, &b);
228 QColor lisColor = palette.color(QPalette::Button);
229 lisColor.getRgb(&r, &g, &b);
236 QColor lrsColor = palette.color(QPalette::Button);
237 lrsColor.getRgb(&r, &g, &b);
244 QColor ldsColor = palette.color(QPalette::Button);
245 ldsColor.getRgb(&r, &g, &b);
246 redStretch.SetMinimum(r);
247 greenStretch.SetMinimum(g);
248 blueStretch.SetMinimum(b);
252 QColor hisColor = palette.color(QPalette::Button);
253 hisColor.getRgb(&r, &g, &b);
260 QColor hrsColor = palette.color(QPalette::Button);
261 hrsColor.getRgb(&r, &g, &b);
268 QColor hdsColor = palette.color(QPalette::Button);
269 hdsColor.getRgb(&r, &g, &b);
270 redStretch.SetMaximum(r);
271 greenStretch.SetMaximum(g);
272 blueStretch.SetMaximum(b);
276 QColor bgColor = palette.color(QPalette::Button);
277 bgColor.getRgb(&r, &g, &b);
362 void SpecialPixelTool::setBgColor() {
374 QColor color = QColorDialog::getColor();
377 if(color.isValid()) {
378 QPalette *palette =
new QPalette();
379 palette->setColor(QPalette::Button, color);
380 button->setPalette(*palette);
392 QPalette *palette =
new QPalette();
393 palette->setColor(QPalette::Button, Qt::black);
400 palette->setColor(QPalette::Button, Qt::white);
413 QPalette *palette =
new QPalette();
461 QString appName =
p_parent->windowTitle();
464 QString instanceName =
p_dialog->windowTitle();
466 FileName config(
"$HOME/.Isis/" + appName +
"/" + instanceName +
".config");
473 if(
p_settings->value(
"defaultNull", 1).toInt() == 0) {
481 if(
p_settings->value(
"defaultLis", 1).toInt() == 0) {
489 if(
p_settings->value(
"defaultLrs", 1).toInt() == 0) {
497 if(
p_settings->value(
"defaultLds", 1).toInt() == 0) {
505 if(
p_settings->value(
"defaultHis", 1).toInt() == 0) {
513 if(
p_settings->value(
"defaultHrs", 1).toInt() == 0) {
521 if(
p_settings->value(
"defaultHds", 1).toInt() == 0) {
529 if(
p_settings->value(
"defaultBg", 1).toInt() == 0) {
544 QString appName =
p_parent->windowTitle();
547 QString instanceName =
p_dialog->windowTitle();
550 FileName config(
"$HOME/.Isis/" + appName +
"/" + instanceName +
".config");
551 QSettings settings(config.
expanded(), QSettings::NativeFormat);
Cube display widget for certain Isis MDI applications.
Stretch redStretch() const
Return the red band stretch.
File name manipulation and expansion.
void stretchBlue(const QString &string)
Apply stretch pairs to blue bands.
Stretch greenStretch() const
Return the green band stretch.
void stretchRed(const QString &string)
Apply stretch pairs to red bands.
void SetLis(const double value)
Sets the mapping for LIS pixels.
void SetHrs(const double value)
Sets the mapping for HRS pixels.
void SetLrs(const double value)
Sets the mapping for LRS pixels.
int main(int argc, char *argv[])
The programmer supplied main function.
void SetHis(const double value)
Sets the mapping for HIS pixels.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
void stretchGreen(const QString &string)
Apply stretch pairs to green bands.
Namespace for ISIS/Bullet specific routines.
void setBackground(QColor color)
Sets the background color.
void SetNull(const double value)
Sets the mapping for NULL pixels.
Stretch blueStretch() const
Return the blue band stretch.