1 #include "JigsawDialog.h"
7 #include "JigsawSetupDialog.h"
14 #include "JigsawSetupDialog.h"
19 #include "ui_JigsawDialog.h"
27 m_bundleAdjust = NULL;
29 m_selectedControl = NULL;
34 if (bundleSolutionInfo.size() <= 0) {
35 m_ui->useLastSettings->setEnabled(
false);
38 m_ui->iterationLcdNumber->setDigitCount(3);
40 m_ui->sigma0LcdNumber->setMode(QLCDNumber::Dec);
41 m_ui->sigma0LcdNumber->setDigitCount(5);
43 setWindowFlags(Qt::WindowStaysOnTopHint);
47 JigsawDialog::~JigsawDialog() {
55 void JigsawDialog::on_JigsawSetupButton_pressed() {
63 m_ui->useLastSettings->isChecked(),
74 if (setupdlg.exec() == QDialog::Accepted) {
75 m_selectedControlName = setupdlg.selectedControlName();
76 m_selectedControl = setupdlg.selectedControl();
77 m_bundleSettings = setupdlg.bundleSettings();
82 void JigsawDialog::on_JigsawRunButton_clicked() {
86 if (m_selectedControl == NULL) {
89 if (m_project->
images().size() == 0) {
93 if (m_bundleSettings == NULL) {
97 if (m_ui->useLastSettings->isChecked() && bundleSolutionInfo.size() > 0) {
98 BundleSettingsQsp lastBundleSettings = (bundleSolutionInfo.last())->bundleSettings();
100 if (lastBundleSettings) {
101 m_bundleSettings = lastBundleSettings;
155 m_bundleAdjust =
new BundleAdjust(m_bundleSettings, *m_selectedControl, m_project->
images(),
158 m_bundleAdjust->moveToThread(bundleThread);
160 connect( m_bundleAdjust, SIGNAL( statusUpdate(QString) ),
163 connect( m_bundleAdjust, SIGNAL( error(QString) ),
166 connect( m_bundleAdjust, SIGNAL( bundleException(QString) ),
169 connect( m_bundleAdjust, SIGNAL( iterationUpdate(
int,
double) ),
172 connect( bundleThread, SIGNAL( started() ),
173 m_bundleAdjust, SLOT( solveCholesky() ) );
178 connect( bundleThread, SIGNAL( finished() ),
179 bundleThread, SLOT( deleteLater() ) );
182 connect( bundleThread, SIGNAL( finished() ),
183 this, SLOT( notifyThreadFinished() ) );
185 connect( m_bundleAdjust, SIGNAL( finished() ),
186 bundleThread, SLOT( quit() ) );
188 connect( m_bundleAdjust, SIGNAL( finished() ),
189 m_bundleAdjust, SLOT( deleteLater() ) );
192 bundleThread->start();
196 m_ui->JigsawRunButton->setText(
"&Abort");
204 m_ui->JigsawRunButton->setText(
"&Aborting...");
212 m_ui->useLastSettings->setEnabled(
true);
225 QString updateStr =
"\n" + status;
227 m_ui->statusUpdatesLabel->setText( m_ui->statusUpdatesLabel->text().append(updateStr) );
229 m_ui->statusUpdateScrollArea->verticalScrollBar()->setSliderPosition(
230 m_ui->statusUpdateScrollArea->verticalScrollBar()->maximum());
242 QString errorStr =
"\n" + error;
243 m_ui->statusUpdatesLabel->setText( m_ui->statusUpdatesLabel->text().append(errorStr) );
245 m_ui->statusUpdateScrollArea->verticalScrollBar()->setSliderPosition(
246 m_ui->statusUpdateScrollArea->verticalScrollBar()->maximum());
258 QString exceptionStr =
"\n" + exception;
259 m_ui->statusUpdatesLabel->setText( m_ui->statusUpdatesLabel->text().append(exceptionStr) );
261 m_ui->statusUpdateScrollArea->verticalScrollBar()->setSliderPosition(
262 m_ui->statusUpdateScrollArea->verticalScrollBar()->maximum());
274 m_ui->iterationLcdNumber->display(iteration);
275 m_ui->sigma0LcdNumber->display(sigma0);
281 void JigsawDialog::notifyThreadFinished() {
282 QString str =
"\nThread Finished signal received";
283 m_ui->statusUpdatesLabel->setText( m_ui->statusUpdatesLabel->text().append(str) );
286 m_ui->JigsawRunButton->setText(
"&Run...");
290 m_ui->statusUpdateScrollArea->verticalScrollBar()->setSliderPosition(
291 m_ui->statusUpdateScrollArea->verticalScrollBar()->maximum());
void setRunTime(QString runTime)
Sets the run time.
QSharedPointer< BundleSettings > BundleSettingsQsp
Definition for a BundleSettingsQsp, a shared pointer to a BundleSettings object.
The main project for cnetsuite.
static QString CurrentLocalTime()
Returns the current local time This time is taken directly from the system clock, so if the system cl...
Container class for BundleAdjustment results.
void updateIterationSigma0(int iteration, double sigma0)
Update the label or text edit area with the error message by appending to list and refreshing...
void bundleFinished(BundleSolutionInfo *bundleSolutionInfo)
This method will be called when the bundle is complete.
static QStringList images(QStringList)
Verify that the input fileNames are image files.
void addBundleSolutionInfo(BundleSolutionInfo *bundleSolutionInfo)
Add the given BundleSolutionInfo to the current project.
void abortBundle()
Flag to abort when bundle is threaded.
void outputBundleStatus(QString status)
Update the label or text edit area with the most recent status update by appending to list and refres...
void reportException(QString exception)
Update the label or text edit area with the error message by appending to list and refreshing...
This dialog allows the user to select the bundle adjust parameters, run the bundle, and view the results.
void errorString(QString error)
Update the label or text edit area with the error message by appending to list and refreshing...
bool converged() const
Returns whether or not the bundle adjustment converged.
BundleResults bundleResults()
Returns the bundle results.
An image bundle adjustment object.