-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathResultParameters.cpp
209 lines (191 loc) · 5.57 KB
/
ResultParameters.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#include "stdafx.h"
#include "ResultParameters.h"
#include "ui/ui_ResultParameters.h"
#include "Workspace.h"
#include "ZExcept.h"
#include "DSSCommon.h"
#include "StackSettings.h"
#include "StackingTasks.h"
namespace DSS
{
ResultParameters::ResultParameters(QWidget* parent) :
QWidget(parent),
ui(new Ui::ResultParameters),
workspace{ std::make_unique<Workspace>() },
pStackingTasks{ nullptr },
customRectEnabled{ false }
{
ui->setupUi(this);
}
ResultParameters::~ResultParameters()
{
delete ui;
}
void ResultParameters::setStackingTasks(CAllStackingTasks* pTasks)
{
pStackingTasks = pTasks;
customRectEnabled = pTasks->getCustomRectangle(customRect);
}
void ResultParameters::onSetActive()
{
STACKINGMODE stackingMode{ static_cast<STACKINGMODE>(workspace->value("Stacking/Mosaic", uint(0)).toUInt()) };
//
// Initially set the Custom Rectangle radio buttion to disabled - it should only be enabled if
// a custom rectangle has been defined.
//
ui->customMode->setEnabled(false);
//
// Custom rectangle mode is actually Normal Mode but with a custom rectangle
// selected.
//
// If this has been done, enable the custom rectangle stacking mode
// If the custom rectangle is also enabled (as it will be initially)
// then set stacking mode to Custom Rectangle
//
if (!customRect.isEmpty())
{
ui->customMode->setEnabled(true);
if (customRectEnabled) stackingMode = SM_CUSTOM;
}
//
// select the appropriate check box for stacking mode
//
switch (stackingMode)
{
case SM_NORMAL:
ui->normalMode->setChecked(true);
if (normalPix.isNull())
{
normalPix.load(":/stacking/normalmode.bmp");
}
ui->previewImage->setPixmap(normalPix);
ui->modeText->setText(tr("The result of the stacking process is framed by the reference light frame.",
"IDS_STACKINGMODE_NORMAL"));
break;
case SM_MOSAIC:
ui->mosaicMode->setChecked(true);
if (mosaicPix.isNull())
{
mosaicPix.load(":/stacking/mosaicmode.bmp");
}
ui->previewImage->setPixmap(mosaicPix);
ui->modeText->setText(tr("The result of the stacking process contains all the light frames of the stack.",
"IDS_STACKINGMODE_MOSAIC"));
break;
case SM_INTERSECTION:
ui->intersectionMode->setChecked(true);
if (intersectionPix.isNull())
{
intersectionPix.load(":/stacking/intersectionmode.bmp");
}
ui->previewImage->setPixmap(intersectionPix);
ui->modeText->setText(tr("The result of the stacking process is framed by the intersection of all the frames.",
"IDS_STACKINGMODE_INTERSECTION"));
break;
case SM_CUSTOM:
ui->customMode->setChecked(true);
if (customPix.isNull())
{
customPix.load(":/stacking/custommode.bmp");
}
ui->previewImage->setPixmap(customPix);
ui->modeText->setText("");
break;
default:
break;
}
uint drizzle = workspace->value("Stacking/PixelSizeMultiplier", uint(0)).toUInt();
switch (drizzle)
{
case 2:
ui->drizzle2x->setChecked(true);
break;
case 3:
ui->drizzle3x->setChecked(true);
break;
default:
break;
}
bool alignRGB = workspace->value("Stacking/AlignChannels", false).toBool();
ui->alignRGB->setChecked(alignRGB);
}
void ResultParameters::on_normalMode_clicked()
{
if (pStackingTasks) pStackingTasks->enableCustomRect(false);
workspace->setValue("Stacking/Mosaic", (uint)SM_NORMAL);
if (normalPix.isNull())
{
normalPix.load(":/stacking/normalmode.bmp");
}
ui->previewImage->setPixmap(normalPix);
ui->modeText->setText(tr("The result of the stacking process is framed by the reference light frame.",
"IDS_STACKINGMODE_NORMAL"));
}
void ResultParameters::on_mosaicMode_clicked()
{
if (pStackingTasks) pStackingTasks->enableCustomRect(false);
workspace->setValue("Stacking/Mosaic", (uint)SM_MOSAIC);
if (mosaicPix.isNull())
{
mosaicPix.load(":/stacking/mosaicmode.bmp");
}
ui->previewImage->setPixmap(mosaicPix);
ui->modeText->setText(tr("The result of the stacking process contains all the light frames of the stack.",
"IDS_STACKINGMODE_MOSAIC"));
}
void ResultParameters::on_intersectionMode_clicked()
{
if (pStackingTasks) pStackingTasks->enableCustomRect(false);
workspace->setValue("Stacking/Mosaic", (uint)SM_INTERSECTION);
if (intersectionPix.isNull())
{
intersectionPix.load(":/stacking/intersectionmode.bmp");
}
ui->previewImage->setPixmap(intersectionPix);
ui->modeText->setText(tr("The result of the stacking process is framed by the intersection of all the frames.",
"IDS_STACKINGMODE_INTERSECTION"));
}
void ResultParameters::on_customMode_clicked()
{
ZASSERT(nullptr != pStackingTasks);
pStackingTasks->enableCustomRect();
// Note well: DO NOT set workspace value "Stacking/Mosaic" to SM_CUSTOM
if (customPix.isNull())
{
customPix.load(":/stacking/custommode.bmp");
}
ui->previewImage->setPixmap(customPix);
ui->modeText->setText("");
}
void ResultParameters::on_drizzle2x_clicked()
{
if (ui->drizzle2x->isChecked())
{
ui->drizzle3x->setChecked(false);
workspace->setValue("Stacking/PixelSizeMultiplier", uint(2));
}
else
workspace->setValue("Stacking/PixelSizeMultiplier", uint(1));
}
void ResultParameters::on_drizzle3x_clicked()
{
if (ui->drizzle3x->isChecked())
{
ui->drizzle2x->setChecked(false);
workspace->setValue("Stacking/PixelSizeMultiplier", uint(3));
}
else
workspace->setValue("Stacking/PixelSizeMultiplier", uint(1));
}
void ResultParameters::on_alignRGB_clicked()
{
if (ui->alignRGB->isChecked())
{
workspace->setValue("Stacking/AlignChannels", true);
}
else
{
workspace->setValue("Stacking/AlignChannels", false);
}
}
}