All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TiePointLocatorParametersWidget.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/rp/TiePointLocatorParametersWidget.cpp
22 
23  \brief This file has the TiePointLocatorParametersWidget class.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "../../../geometry/GTFactory.h"
29 #include "../../../geometry/GTParameters.h"
31 #include "ui_TiePointLocatorParametersWidgetForm.h"
32 
33 // Qt
34 #include <QMessageBox>
35 
37  : QWidget(parent, f),
38  m_ui(new Ui::TiePointLocatorParametersWidgetForm)
39 {
40  m_ui->setupUi(this);
41 
43 }
44 
46 {
47 }
48 
49 Ui::TiePointLocatorParametersWidgetForm* te::qt::widgets::TiePointLocatorParametersWidget::getWidgetForm()
50 {
51  return m_ui.get();
52 }
53 
55 {
56  m_ui->m_glLabel->setVisible(false);
57  m_ui->m_enableGeometryFilterCheckBox->setVisible(false);
58 
59  m_ui->m_mtLabel->setVisible(false);
60  m_ui->m_enableMultiThreadCheckBox->setVisible(false);
61 
62  m_ui->m_gtLabel->setVisible(false);
63  m_ui->m_geomTransfNameComboBox->setVisible(false);
64 
65  m_ui->m_interLabel->setVisible(false);
66  m_ui->m_interpMethodComboBox->setVisible(false);
67 }
68 
70 {
71  m_ui->m_rescaleFactorLineEdit->setText(QString::number(value));
72 }
73 
75 {
76  return m_ui->m_geomTransfNameComboBox->currentText().toStdString();
77 }
78 
80 {
81  updateAdvancedOptions();
82 
83  return m_inputParameters;
84 }
85 
87 {
88  m_ui->m_enableGeometryFilterCheckBox->setChecked(m_inputParameters.m_enableGeometryFilter);
89  m_ui->m_enableMultiThreadCheckBox->setChecked(m_inputParameters.m_enableMultiThread);
90 
91  switch( m_inputParameters.m_interesPointsLocationStrategy )
92  {
94  {
95  int idx = m_ui->m_interesPointsLocationStrategyComboBox->findText("Surf");
96  m_ui->m_interesPointsLocationStrategyComboBox->setCurrentIndex(idx);
97  break;
98  }
99  default:
100  {
101  int idx = m_ui->m_interesPointsLocationStrategyComboBox->findText("Moravec");
102  m_ui->m_interesPointsLocationStrategyComboBox->setCurrentIndex(idx);
103  }
104  }
105 
108 
109  while( gtItB != gtItE )
110  {
111  m_ui->m_geomTransfNameComboBox->addItem(QString(gtItB->first.c_str()));
112  ++gtItB;
113  }
114 
115  int idx = m_ui->m_geomTransfNameComboBox->findText(m_inputParameters.m_geomTransfName.c_str());
116  m_ui->m_geomTransfNameComboBox->setCurrentIndex(idx);
117 
118  m_ui->m_geometryFilterAssuranceLineEdit->setText(QString::number(m_inputParameters.m_geometryFilterAssurance));
119 
120  m_ui->m_geomTransfMaxErrorLineEdit->setText(QString::number(m_inputParameters.m_geomTransfMaxError));
121 
122  switch(m_inputParameters.m_interpMethod)
123  {
124  case te::rst::Bilinear :
125  {
126  int idx = m_ui->m_interpMethodComboBox->findText("Bilinear");
127  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
128  break;
129  }
130  case te::rst::Bicubic :
131  {
132  int idx = m_ui->m_interpMethodComboBox->findText("Bicubic");
133  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
134  break;
135  }
136  default:
137  {
138  int idx = m_ui->m_interpMethodComboBox->findText("NearestNeighbor");
139  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
140  }
141  }
142 
143  m_ui->m_maxTiePointsLineEdit->setText(QString::number(m_inputParameters.m_maxTiePoints));
144 
145  m_ui->m_correlationWindowWidthLineEdit->setText(QString::number(m_inputParameters.m_moravecCorrelationWindowWidth));
146 
147  m_ui->m_gaussianFilterIterationsLineEdit->setText(QString::number(m_inputParameters.m_moravecNoiseFilterIterations));
148 
149  m_ui->m_minAbsCorrelationLineEdit->setText(QString::number(m_inputParameters.m_moravecMinAbsCorrelation));
150 
151  m_ui->m_moravecWindowWidthLineEdit->setText(QString::number(m_inputParameters.m_moravecWindowWidth));
152 
153  m_ui->m_maxNormEuclideanDistLineEdit->setText(QString::number(m_inputParameters.m_surfMaxNormEuclideanDist));
154 
155  m_ui->m_octavesNumberLineEdit->setText(QString::number(m_inputParameters.m_surfOctavesNumber));
156 
157  m_ui->m_scalesNumberLineEdit->setText(QString::number(m_inputParameters.m_surfScalesNumber));
158 
159  m_ui->m_rescaleFactorLineEdit->setText(QString::number(m_inputParameters.m_subSampleOptimizationRescaleFactor));
160 }
161 
163 {
164  m_inputParameters.m_enableGeometryFilter = m_ui->m_enableGeometryFilterCheckBox->isChecked();
165 
166  m_inputParameters.m_enableMultiThread = m_ui->m_enableMultiThreadCheckBox->isChecked();
167 
168  if(m_ui->m_interesPointsLocationStrategyComboBox->currentText() == "Surf")
169  m_inputParameters.m_interesPointsLocationStrategy = te::rp::TiePointsLocator::InputParameters::SurfStrategyT;
170  else
171  m_inputParameters.m_interesPointsLocationStrategy = te::rp::TiePointsLocator::InputParameters::MoravecStrategyT;
172 
173  m_inputParameters.m_geomTransfName = m_ui->m_geomTransfNameComboBox->currentText().toStdString();
174 
175  if(m_ui->m_geometryFilterAssuranceLineEdit->text().isEmpty())
176  {
177  QMessageBox::warning(this, tr("Warning"), tr("Geometry assurance not defined."));
178  return;
179  }
180  m_inputParameters.m_geometryFilterAssurance = m_ui->m_geometryFilterAssuranceLineEdit->text().toDouble();
181 
182  if(m_ui->m_geomTransfMaxErrorLineEdit->text().isEmpty())
183  {
184  QMessageBox::warning(this, tr("Warning"), tr("Transformation error not defined."));
185  return;
186  }
187  m_inputParameters.m_geomTransfMaxError = m_ui->m_geomTransfMaxErrorLineEdit->text().toDouble();
188 
189  if(m_ui->m_interpMethodComboBox->currentText() == "Bilinear")
190  m_inputParameters.m_interpMethod = te::rst::Bilinear;
191  else if(m_ui->m_interpMethodComboBox->currentText() == "Bicubic")
192  m_inputParameters.m_interpMethod = te::rst::Bicubic;
193  else
194  m_inputParameters.m_interpMethod = te::rst::NearestNeighbor;
195 
196  if(m_ui->m_maxTiePointsLineEdit->text().isEmpty())
197  {
198  QMessageBox::warning(this, tr("Warning"), tr("Maximum number of tie-points not defined."));
199  return;
200  }
201  m_inputParameters.m_maxTiePoints = m_ui->m_maxTiePointsLineEdit->text().toUInt();
202 
203  if(m_ui->m_rescaleFactorLineEdit->text().isEmpty())
204  {
205  QMessageBox::warning(this, tr("Warning"), tr("Sub-sampled search rescale factor not defined."));
206  return;
207  }
208  m_inputParameters.m_subSampleOptimizationRescaleFactor = m_ui->m_rescaleFactorLineEdit->text().toDouble();
209 
210  if(m_ui->m_interesPointsLocationStrategyComboBox->currentText() == "Surf")
211  {
212  if(m_ui->m_maxNormEuclideanDistLineEdit->text().isEmpty())
213  {
214  QMessageBox::warning(this, tr("Warning"), tr("Maximum euclidean distance not defined."));
215  return;
216  }
217  m_inputParameters.m_surfMaxNormEuclideanDist = m_ui->m_maxNormEuclideanDistLineEdit->text().toDouble();
218 
219  if(m_ui->m_octavesNumberLineEdit->text().isEmpty())
220  {
221  QMessageBox::warning(this, tr("Warning"), tr("Octaves number not defined."));
222  return;
223  }
224  m_inputParameters.m_surfOctavesNumber = m_ui->m_octavesNumberLineEdit->text().toUInt();
225 
226  if(m_ui->m_scalesNumberLineEdit->text().isEmpty())
227  {
228  QMessageBox::warning(this, tr("Warning"), tr("Scales number not defined."));
229  return;
230  }
231  m_inputParameters.m_surfScalesNumber = m_ui->m_scalesNumberLineEdit->text().toUInt();
232  }
233  else
234  {
235  if(m_ui->m_correlationWindowWidthLineEdit->text().isEmpty())
236  {
237  QMessageBox::warning(this, tr("Warning"), tr("Correlation window width not defined."));
238  return;
239  }
240  m_inputParameters.m_moravecCorrelationWindowWidth = m_ui->m_correlationWindowWidthLineEdit->text().toUInt();
241 
242  if(m_ui->m_gaussianFilterIterationsLineEdit->text().isEmpty())
243  {
244  QMessageBox::warning(this, tr("Warning"), tr("Gaussian filter iterations not defined."));
245  return;
246  }
247  m_inputParameters.m_moravecNoiseFilterIterations = m_ui->m_gaussianFilterIterationsLineEdit->text().toUInt();
248 
249  if(m_ui->m_minAbsCorrelationLineEdit->text().isEmpty())
250  {
251  QMessageBox::warning(this, tr("Warning"), tr("Minimum correlation value not defined."));
252  return;
253  }
254  m_inputParameters.m_moravecMinAbsCorrelation = m_ui->m_minAbsCorrelationLineEdit->text().toDouble();
255 
256  if(m_ui->m_moravecWindowWidthLineEdit->text().isEmpty())
257  {
258  QMessageBox::warning(this, tr("Warning"), tr("Moravec window width not defined."));
259  return;
260  }
261  m_inputParameters.m_moravecWindowWidth = m_ui->m_moravecWindowWidthLineEdit->text().toUInt();
262  }
263 }
Near neighborhood interpolation method.
Definition: Enums.h:95
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories.
std::auto_ptr< Ui::TiePointLocatorParametersWidgetForm > m_ui
This file has the TiePointLocatorParametersWidget class.
te::rp::TiePointsLocator::InputParameters getTiePointInputParameters()
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator const_iterator
void startAdvancedOptions()
Fill interface widget with initial values.
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator end() const
It returns an iterator to the end of the container.
Bicubic interpolation method.
Definition: Enums.h:97
void updateAdvancedOptions()
Update tie point values with advanced options changed values.
Ui::TiePointLocatorParametersWidgetForm * getWidgetForm()
TiePointLocatorParametersWidget(QWidget *parent=0, Qt::WindowFlags f=0)
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator begin() const
It returns an iterator to the first stored factory.
Bilinear interpolation method.
Definition: Enums.h:96