All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TiePointLocatorWidget.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 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/TiePointLocatorWidget.cpp
22 
23  \brief This file has the TiePointLocatorWidget class.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "../../../dataaccess/dataset/DataSet.h"
29 #include "../../../dataaccess/utils/Utils.h"
30 #include "../../../geometry/Coord2D.h"
31 #include "../../../geometry/GTFactory.h"
32 #include "../../../maptools/MarkRendererManager.h"
33 #include "../../../geometry/Point.h"
34 #include "../../../raster/Grid.h"
35 #include "../../../raster/Raster.h"
36 #include "../../../se/Fill.h"
37 #include "../../../se/Mark.h"
38 #include "../../../se/Stroke.h"
39 #include "../../../se/Utils.h"
40 #include "../../../srs/Converter.h"
41 #include "../../widgets/canvas/Canvas.h"
42 #include "../../widgets/canvas/MapDisplay.h"
43 #include "../../widgets/srs/SRSManagerDialog.h"
44 #include "../../widgets/Utils.h"
45 #include "RasterNavigatorWidget.h"
46 #include "TiePointLocatorWidget.h"
47 #include "ui_RasterNavigatorWidgetForm.h"
48 #include "ui_TiePointLocatorWidgetForm.h"
49 
50 // Qt
51 #include <QGridLayout>
52 #include <QMessageBox>
53 #include <QPixmap>
54 
55 // STL
56 #include <memory>
57 
58 #define PATTERN_SIZE 18
59 
60 /* TiePointData Class*/
61 
63  m_acqType(InvalidAcquisitionT),
64  m_selected(false)
65 {
66 
67 }
68 
70 {
71  operator=( other );
72 }
73 
75 {
76 
77 }
78 
80 {
81  m_acqType = other.m_acqType;
82  m_tiePoint = other.m_tiePoint;
83  m_selected = other.m_selected;
84  return other;
85 }
86 
87 /* TiePointLocatorWidget Class*/
88 
90  : QWidget(parent, f),
91  m_ui(new Ui::TiePointLocatorWidgetForm),
92  m_tiePointHasFirstCoord(false),
93  m_tiePointIdCounter(0)
94 {
95  m_ui->setupUi(this);
96 
97  m_ui->m_x1LineEdit->setValidator(new QDoubleValidator(this));
98  m_ui->m_y1LineEdit->setValidator(new QDoubleValidator(this));
99  m_ui->m_x2LineEdit->setValidator(new QDoubleValidator(this));
100  m_ui->m_y2LineEdit->setValidator(new QDoubleValidator(this));
101 
102  m_ui->m_resXLineEdit->setValidator(new QDoubleValidator(this));
103  m_ui->m_resYLineEdit->setValidator(new QDoubleValidator(this));
104 
105  m_ui->m_selectAllToolButton->setIcon(QIcon::fromTheme("table-select"));
106  m_ui->m_unselectAllToolButton->setIcon(QIcon::fromTheme("table-unselect"));
107  m_ui->m_deleteSelectedToolButton->setIcon(QIcon::fromTheme("table-delete-select"));
108  m_ui->m_autoAcquireTiePointsToolButton->setIcon(QIcon::fromTheme("wand"));
109  m_ui->m_addToolButton->setIcon(QIcon::fromTheme("list-add"));
110  m_ui->m_refreshToolButton->setIcon(QIcon::fromTheme("view-refresh"));
111  m_ui->m_doneToolButton->setIcon(QIcon::fromTheme("check"));
112 
113  //connects
114  connect(m_ui->m_autoAcquireTiePointsToolButton, SIGNAL(clicked()), this, SLOT(onAutoAcquireTiePointsToolButtonClicked()));
115  connect(m_ui->m_selectAllToolButton, SIGNAL(clicked()), this, SLOT(onSelectAllToolButtonClicked()));
116  connect(m_ui->m_unselectAllToolButton, SIGNAL(clicked()), this, SLOT(onUnselectAllToolButtonClicked()));
117  connect(m_ui->m_deleteSelectedToolButton, SIGNAL(clicked()), this, SLOT(onDeleteSelectedToolButtonClicked()));
118  connect(m_ui->m_addToolButton, SIGNAL(clicked()), this, SLOT(onAddToolButtonClicked()));
119  connect(m_ui->m_refreshToolButton, SIGNAL(clicked()), this, SLOT(onRefreshToolButtonClicked()));
120  connect(m_ui->m_doneToolButton, SIGNAL(clicked()), this, SLOT(onDoneToolButtonClicked()));
121  connect(m_ui->m_tiePointsTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onTiePointsTableWidgetItemSelectionChanged()));
122  connect(m_ui->m_sridPushButton, SIGNAL(clicked()), this, SLOT(onSRIDPushButtonClicked()));
123 
124 
125 // connects
126  connect(this, SIGNAL(tiePointsUpdated()), this, SLOT(onTiePointsUpdated()));
127 
128 //define mark selected
129  te::se::Stroke* strokeSel = te::se::CreateStroke("#000000", "2");
130  te::se::Fill* fillSel = te::se::CreateFill("#0000FF", "1.0");
131  m_markSelected = te::se::CreateMark("circle", strokeSel, fillSel);
132 
134 
135  QPixmap markSelPix = getPixmap(m_rgbaMarkSelected);
136  setSelectedTiePointMarkLegend(markSelPix);
137 
138 //define mark unselected
139  te::se::Stroke* strokeUnsel = te::se::CreateStroke("#000000", "2");
140  te::se::Fill* fillUnsel = te::se::CreateFill("#000000", "1.0");
141  m_markUnselected = te::se::CreateMark("cross", strokeUnsel, fillUnsel);
142 
144 
145  QPixmap markPix = getPixmap(m_rgbaMarkUnselected);
146  setTiePointMarkLegend(markPix);
147 
148 //define mark reference
149  te::se::Stroke* strokeRef = te::se::CreateStroke("#000000", "2");
150  te::se::Fill* fillRef = te::se::CreateFill("#FF0000", "1.0");
151  m_markRef = te::se::CreateMark("x", strokeRef, fillRef);
152 
154 
155  QPixmap markRefPix = getPixmap(m_rgbaMarkRef);
156  setReferenceTiePointMarkLegend(markRefPix);
157 
159 
161 }
162 
164 {
165  te::common::Free(m_rgbaMarkSelected, PATTERN_SIZE);
166  delete m_markSelected;
167 
168  te::common::Free(m_rgbaMarkUnselected, PATTERN_SIZE);
169  delete m_markUnselected;
170 
171  te::common::Free(m_rgbaMarkRef, PATTERN_SIZE);
172  delete m_markRef;
173 }
174 
175 Ui::TiePointLocatorWidgetForm* te::qt::widgets::TiePointLocatorWidget::getForm() const
176 {
177  return m_ui.get();
178 }
179 
180 void te::qt::widgets::TiePointLocatorWidget::getTiePoints( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const
181 {
182  tiePoints.clear();
183 
184  std::auto_ptr<te::da::DataSet> ds(m_refLayer->getData());
185  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
186  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
187 
188  te::qt::widgets::TiePointData::TPContainerT::const_iterator itB = m_tiePoints.begin();
189 
190  const te::qt::widgets::TiePointData::TPContainerT::const_iterator itE = m_tiePoints.end();
191 
192  tiePoints.reserve( m_tiePoints.size() );
193 
194  // create a SRS converter
195  std::auto_ptr<te::srs::Converter> converter(new te::srs::Converter());
196  converter->setSourceSRID(m_refLayer->getSRID());
197  converter->setTargetSRID(m_ui->m_sridLineEdit->text().toInt());
198 
199  while( itB != itE )
200  {
202 
203  tp.first = itB->second.m_tiePoint.second;
204 
205  te::gm::Coord2D c = inputRst->getGrid()->gridToGeo(itB->second.m_tiePoint.first.x, itB->second.m_tiePoint.first.y);
206 
207  converter->convert(c.x, c.y, c.x, c.y);
208 
209  tp.second = c;
210 
211  tiePoints.push_back(tp);
212  ++itB;
213  }
214 }
215 
216 void te::qt::widgets::TiePointLocatorWidget::getTiePointsIdxCoords( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const
217 {
218  tiePoints.clear();
219 
220  std::auto_ptr<te::da::DataSet> ds(m_refLayer->getData());
221  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
222  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
223 
224  te::qt::widgets::TiePointData::TPContainerT::const_iterator itB = m_tiePoints.begin();
225 
226  const te::qt::widgets::TiePointData::TPContainerT::const_iterator itE = m_tiePoints.end();
227 
228  tiePoints.reserve( m_tiePoints.size() );
229 
230  while( itB != itE )
231  {
232  te::gm::GTParameters::TiePoint tp = itB->second.m_tiePoint;
233 
234  tiePoints.push_back(tp);
235 
236  ++itB;
237  }
238 }
239 
241 {
242  return m_tiePoints;
243 }
244 
246 {
247  if(m_tiePointHasFirstCoord)
248  coordRef = m_currentTiePoint.first;
249 
250  return m_tiePointHasFirstCoord;
251 }
252 
254 {
255  m_refLayer = layer;
256 
257  m_refNavigator->set(layer);
258 
259  //list bands
260  std::auto_ptr<te::da::DataSet> ds = m_refLayer->getData();
261 
262  if(ds.get())
263  {
264  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
265  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
266 
267  if(inputRst.get())
268  {
269  m_ui->m_referenceBand1ComboBox->clear();
270 
271  for(unsigned band1Idx = 0; band1Idx < inputRst->getNumberOfBands(); ++band1Idx)
272  m_ui->m_referenceBand1ComboBox->addItem(QString::number(band1Idx));
273 
274 
275  QString strSRID;
276  strSRID.setNum(m_refLayer->getSRID());
277  m_ui->m_inputSRIDLineEdit->setText(strSRID);
278 
279  QString strResX;
280  strResX.setNum(inputRst->getGrid()->getResolutionX());
281  m_ui->m_inputResXLineEdit->setText(strResX);
282 
283  QString strResY;
284  strResY.setNum(inputRst->getGrid()->getResolutionY());
285  m_ui->m_inputResYLineEdit->setText(strResY);
286  }
287  }
288 }
289 
291 {
292  m_adjLayer = layer;
293 
294  m_adjNavigator->set(layer);
295 
296  //list bands
297  std::auto_ptr<te::da::DataSet> ds = m_adjLayer->getData();
298 
299  if(ds.get())
300  {
301  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
302  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
303 
304  if(inputRst.get())
305  {
306  m_ui->m_referenceBand2ComboBox->clear();
307 
308  for(unsigned band2Idx = 0; band2Idx < inputRst->getNumberOfBands(); ++band2Idx)
309  m_ui->m_referenceBand2ComboBox->addItem(QString::number(band2Idx));
310 
311  QString strSRID;
312  strSRID.setNum(m_adjLayer->getSRID());
313  m_ui->m_sridLineEdit->setText(strSRID);
314 
315  QString strResX;
316  strResX.setNum(inputRst->getGrid()->getResolutionX());
317  m_ui->m_resXLineEdit->setText(strResX);
318 
319  QString strResY;
320  strResY.setNum(inputRst->getGrid()->getResolutionY());
321  m_ui->m_resYLineEdit->setText(strResY);
322  }
323  }
324 }
325 
327 {
328  srid = m_ui->m_sridLineEdit->text().toInt();
329 }
330 
332 {
333  resX = m_ui->m_resXLineEdit->text().toDouble();
334  resY = m_ui->m_resYLineEdit->text().toDouble();
335 }
336 
338 {
339  assert(m_refLayer.get());
340 
341  //get input raster
342  std::auto_ptr<te::da::DataSet> ds = m_refLayer->getData();
343 
344  if(ds.get())
345  {
346  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
347  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
348 
349  if(inputRst.get())
350  {
351  m_currentTiePoint.first = inputRst->getGrid()->geoToGrid(x, y);
352 
353  m_tiePointHasFirstCoord = true;
354  }
355  }
356 }
357 
359 {
360  assert(m_adjLayer.get());
361 
362  //get input raster
363  std::auto_ptr<te::da::DataSet> ds = m_adjLayer->getData();
364 
365  if(ds.get())
366  {
367  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
368  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
369 
370  if(inputRst.get())
371  {
372  if(m_tiePointHasFirstCoord)
373  {
374  m_currentTiePoint.second = inputRst->getGrid()->geoToGrid(x, y);
375 
376  m_tiePointHasFirstCoord = false;
377 
378  //add tie point
379  TiePointData tpD;
381  tpD.m_tiePoint = m_currentTiePoint;
382 
383  ++m_tiePointIdCounter;
384  m_tiePoints[ m_tiePointIdCounter ] = tpD;
385 
386  tiePointsTableUpdate();
387  }
388  }
389  }
390 }
391 
393 {
394  m_ui->m_tiePointLabel->setPixmap(p);
395 }
396 
398 {
399  m_ui->m_selectedTiePointLabel->setPixmap(p);
400 }
401 
403 {
404  m_ui->m_refTiePointLabel->setPixmap(p);
405 }
406 
408 {
409  m_ui->m_tiePointsTableWidget->clearSelection();
410 
411  for(int i = 0; i < m_ui->m_tiePointsTableWidget->rowCount(); ++i)
412  {
413  QTableWidgetItem* item = m_ui->m_tiePointsTableWidget->item(i, 0);
414 
415  int curId = item->text().toInt();
416 
417 
418  if(curId >= initialId)
419  m_ui->m_tiePointsTableWidget->selectRow(i);
420  }
421 }
422 
424 {
425  // creating the algorithm parameters
426  std::auto_ptr<te::da::DataSet> dsRef(m_refLayer->getData());
427  std::size_t rpos = te::da::GetFirstPropertyPos(dsRef.get(), te::dt::RASTER_TYPE);
428  std::auto_ptr<te::rst::Raster> inputRstRef = dsRef->getRaster(rpos);
429 
430  std::auto_ptr<te::da::DataSet> dsAdj(m_adjLayer->getData());
432  std::auto_ptr<te::rst::Raster> inputRstAdj = dsAdj->getRaster(rpos);
433 
434  te::rp::TiePointsLocator::InputParameters inputParams = m_inputParameters;
435  inputParams.m_enableProgress = true;
436 
437  inputParams.m_inRaster1Ptr = inputRstRef.get();
438  inputParams.m_inRaster2Ptr = inputRstAdj.get();
439 
440  te::gm::Envelope auxEnvelope1(m_refNavigator->getCurrentExtent());
441  double r1LLX = 0;
442  double r1LLY = 0;
443  double r1URX = 0;
444  double r1URY = 0;
445  inputParams.m_inRaster1Ptr->getGrid()->geoToGrid(auxEnvelope1.m_llx, auxEnvelope1.m_lly, r1LLX, r1LLY);
446  inputParams.m_inRaster1Ptr->getGrid()->geoToGrid(auxEnvelope1.m_urx, auxEnvelope1.m_ury, r1URX, r1URY);
447  inputParams.m_raster1TargetAreaColStart = (unsigned int)std::max( 0.0, r1LLX);
448  inputParams.m_raster1TargetAreaLineStart = (unsigned int)std::max( 0.0, r1URY);
449  inputParams.m_raster1TargetAreaWidth = ((unsigned int)std::min((double)inputParams.m_inRaster1Ptr->getNumberOfColumns(), r1URX)) - inputParams.m_raster1TargetAreaColStart + 1;
450  inputParams.m_raster1TargetAreaHeight = ((unsigned int)std::min((double)inputParams.m_inRaster1Ptr->getNumberOfRows(), r1LLY)) - inputParams.m_raster1TargetAreaColStart + 1;
451 
452  te::gm::Envelope auxEnvelope2(m_adjNavigator->getCurrentExtent());
453  double r2LLX = 0;
454  double r2LLY = 0;
455  double r2URX = 0;
456  double r2URY = 0;
457  inputParams.m_inRaster2Ptr->getGrid()->geoToGrid(auxEnvelope2.m_llx, auxEnvelope2.m_lly, r2LLX, r2LLY);
458  inputParams.m_inRaster2Ptr->getGrid()->geoToGrid(auxEnvelope2.m_urx, auxEnvelope2.m_ury, r2URX, r2URY);
459  inputParams.m_raster2TargetAreaColStart = (unsigned int)std::max( 0.0, r2LLX);
460  inputParams.m_raster2TargetAreaLineStart = (unsigned int)std::max( 0.0, r2URY);
461  inputParams.m_raster2TargetAreaWidth = ((unsigned int)std::min((double)inputParams.m_inRaster2Ptr->getNumberOfColumns(), r2URX)) - inputParams.m_raster2TargetAreaColStart + 1;
462  inputParams.m_raster2TargetAreaHeight = ((unsigned int)std::min((double)inputParams.m_inRaster2Ptr->getNumberOfRows(), r2LLY)) - inputParams.m_raster2TargetAreaColStart + 1;
463 
464  inputParams.m_inRaster1Bands.push_back(m_ui->m_referenceBand1ComboBox->currentText().toUInt());
465  inputParams.m_inRaster2Bands.push_back(m_ui->m_referenceBand2ComboBox->currentText().toUInt());
466 
467  inputParams.m_pixelSizeXRelation = inputRstRef->getGrid()->getResolutionX() / m_ui->m_resXLineEdit->text().toDouble();
468  inputParams.m_pixelSizeYRelation = inputRstRef->getGrid()->getResolutionY() / m_ui->m_resYLineEdit->text().toDouble();
469 
471 
472  // Looking for manual inserted tie-points for an initial estimate
473  unsigned int manualTPNumber = 0;
474  te::qt::widgets::TiePointData::TPContainerT::const_iterator itB = m_tiePoints.begin();
475  const te::qt::widgets::TiePointData::TPContainerT::const_iterator itE = m_tiePoints.end();
476  double coordDiffX = 0;
477  double coordDiffY = 0;
478 
479  while(itB != itE)
480  {
481  if(itB->second.m_acqType == TiePointData::ManualAcquisitionT)
482  {
483  coordDiffX = itB->second.m_tiePoint.first.x - itB->second.m_tiePoint.second.x;
484  coordDiffY = itB->second.m_tiePoint.first.y - itB->second.m_tiePoint.second.y;
485 
486  inputParams.m_maxR1ToR2Offset += std::max(inputParams.m_maxR1ToR2Offset, (unsigned int)std::ceil(std::sqrt((coordDiffX * coordDiffX) + (coordDiffY * coordDiffY))));
487  ++manualTPNumber;
488  }
489 
490  ++itB;
491  }
492 
493  if(inputParams.m_maxR1ToR2Offset > 0)
494  {
495  inputParams.m_maxR1ToR2Offset /= manualTPNumber;
496  inputParams.m_maxR1ToR2Offset += ((inputParams.m_maxR1ToR2Offset * 10) / 100);
497  }
498 
499  // Executing the algorithm
500 
501  QApplication::setOverrideCursor(Qt::WaitCursor);
502 
503  try
504  {
505  te::rp::TiePointsLocator algorithmInstance;
506 
507  if(algorithmInstance.initialize(inputParams))
508  {
509  if(algorithmInstance.execute(outputParams))
510  {
511  const unsigned int tpsNmb = (unsigned int)outputParams.m_tiePoints.size();
512 
513  if(tpsNmb)
514  {
515  TiePointData auxTpData;
517 
518  int initialId = m_tiePointIdCounter + 1;
519 
520  for(unsigned int tpIdx = 0; tpIdx < tpsNmb; ++tpIdx)
521  {
522  ++m_tiePointIdCounter;
523  auxTpData.m_tiePoint = outputParams.m_tiePoints[ tpIdx ];
524  m_tiePoints[ m_tiePointIdCounter ] = auxTpData;
525  }
526 
527  tiePointsTableUpdate();
528 
529  createSelection(initialId);
530  }
531  else
532  {
533  QMessageBox::warning(this, tr("Warning"), tr("None tie points was located."));
534  }
535  }
536  }
537  }
538  catch(...)
539  {
540  QApplication::restoreOverrideCursor();
541 
542  QMessageBox::warning(this, tr("Warning"), tr("Error locating tie points."));
543  }
544 
545  QApplication::restoreOverrideCursor();
546 }
547 
549 {
550  m_ui->m_tiePointsTableWidget->selectAll();
551 }
552 
554 {
555  m_ui->m_tiePointsTableWidget->clearSelection();
556 }
557 
559 {
560  const int rowCount = m_ui->m_tiePointsTableWidget->rowCount();
561 
562  for( int row = 0 ; row < rowCount ; ++row )
563  {
564  QTableWidgetItem* itemPtr = m_ui->m_tiePointsTableWidget->item(row, 0);
565 
566  if(itemPtr->isSelected())
567  {
568  unsigned int tpID = itemPtr->text().toUInt();
569 
570  te::qt::widgets::TiePointData::TPContainerT::iterator deletionIt = m_tiePoints.find(tpID);
571 
572  assert(deletionIt != m_tiePoints.end());
573 
574  m_tiePoints.erase(deletionIt);
575  }
576  }
577 
578  if(m_tiePoints.empty())
579  {
580  m_tiePointIdCounter = 0;
581  }
582 
583  m_tiePointsSelected.clear();
584 
585  tiePointsTableUpdate();
586 }
587 
589 {
590  if((!m_ui->m_x1LineEdit->text().isEmpty()) && (!m_ui->m_y1LineEdit->text().isEmpty()) &&
591  (!m_ui->m_x2LineEdit->text().isEmpty()) && (!m_ui->m_y2LineEdit->text().isEmpty()))
592  {
593  TiePointData tpD;
595  tpD.m_tiePoint.first.x = m_ui->m_x1LineEdit->text().toDouble();
596  tpD.m_tiePoint.first.y = m_ui->m_y1LineEdit->text().toDouble();
597  tpD.m_tiePoint.second.x = m_ui->m_x2LineEdit->text().toDouble();
598  tpD.m_tiePoint.second.y = m_ui->m_y2LineEdit->text().toDouble();
599 
600  ++m_tiePointIdCounter;
601  m_tiePoints[m_tiePointIdCounter] = tpD;
602 
603  tiePointsTableUpdate();
604  }
605 }
606 
608 {
609  transformationInfoUpdate();
610 }
611 
613 {
614  updateAdvancedOptions();
615 
616  tiePointsTableUpdate();
617 }
618 
620 {
621  emit doneAcquiredTiePoints();
622 }
623 
625 {
626  drawTiePoints();
627 }
628 
630 {
631  drawTiePoints();
632 }
633 
635 {
636  refCoordPicked(x, y);
637 
638  drawTiePoints();
639 }
640 
642 {
643  adjCoordPicked(x, y);
644 
645  drawTiePoints();
646 }
647 
649 {
650  drawTiePoints();
651 }
652 
654 {
655  te::qt::widgets::SRSManagerDialog srsDialog(this);
656  srsDialog.setWindowTitle(tr("Choose the SRS"));
657 
658  if(srsDialog.exec() == QDialog::Accepted)
659  {
660  std::pair<int, std::string> srid = srsDialog.getSelectedSRS();
661 
662  QString strSRID;
663  strSRID.setNum(srid.first);
664  m_ui->m_sridLineEdit->setText(strSRID);
665  }
666 }
667 
669 {
670  // building the geometric transformation
671  te::gm::GTParameters transParams;
672 
673  te::qt::widgets::TiePointData::TPContainerT::const_iterator tPIt = m_tiePoints.begin();
674  const te::qt::widgets::TiePointData::TPContainerT::const_iterator tPItEnd = m_tiePoints.end();
675 
676  while( tPIt != tPItEnd )
677  {
678  transParams.m_tiePoints.push_back(tPIt->second.m_tiePoint);
679  ++tPIt;
680  }
681 
682  std::string geoTransfName = m_ui->m_geomTransfNameComboBox->currentText().toStdString();
683 
684  std::auto_ptr<te::gm::GeometricTransformation> transfPtr(te::gm::GTFactory::make(geoTransfName));
685 
686  if(transfPtr.get())
687  {
688  if(!transfPtr->initialize(transParams))
689  transfPtr.reset();
690  }
691 
692  // updating the tie points table
693  m_ui->m_tiePointsTableWidget->blockSignals( true );
694  m_ui->m_tiePointsTableWidget->setSortingEnabled( false );
695 
696  m_ui->m_tiePointsTableWidget->setRowCount(0);
697 
698  double currTPError = 0;
699 
700  tPIt = m_tiePoints.begin();
701 
702  while( tPIt != tPItEnd )
703  {
704  int newrow = m_ui->m_tiePointsTableWidget->rowCount();
705  m_ui->m_tiePointsTableWidget->insertRow(newrow);
706 
707  const te::gm::GTParameters::TiePoint& currTP = tPIt->second.m_tiePoint;
708  currTPError = transfPtr.get() ? transfPtr->getDirectMappingError(currTP) : 0.0;
709 
710  //tie point id
711  QTableWidgetItem* itemId = new QTableWidgetItem(QString::number(tPIt->first));
712  itemId->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
713  m_ui->m_tiePointsTableWidget->setItem(newrow, 0, itemId);
714 
715  //tie point current tie point error
716  QTableWidgetItem* itemError = new QTableWidgetItem(QString::number(currTPError));
717  itemError->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
718  m_ui->m_tiePointsTableWidget->setItem(newrow, 1, itemError);
719 
720  //acquisition type
721  QString type;
722  if(tPIt->second.m_acqType == TiePointData::ManualAcquisitionT)
723  {
724  type = tr("Manual");
725  }
726  else
727  {
728  type = tr("Automatic");
729  }
730 
731  QTableWidgetItem* itemType = new QTableWidgetItem(type);
732  itemType->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
733  m_ui->m_tiePointsTableWidget->setItem(newrow, 2, itemType);
734 
735  //ref x coord
736  QTableWidgetItem* itemRefX = new QTableWidgetItem(QString::number(currTP.first.x));
737  itemRefX->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
738  m_ui->m_tiePointsTableWidget->setItem(newrow, 3, itemRefX);
739 
740  //ref y coord
741  QTableWidgetItem* itemRefY = new QTableWidgetItem(QString::number(currTP.first.y));
742  itemRefY->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
743  m_ui->m_tiePointsTableWidget->setItem(newrow, 4, itemRefY);
744 
745  //adj x coord
746  QTableWidgetItem* itemAdjX = new QTableWidgetItem(QString::number(currTP.second.x));
747  itemAdjX->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
748  m_ui->m_tiePointsTableWidget->setItem(newrow, 5, itemAdjX);
749 
750  //adj y coord
751  QTableWidgetItem* itemAdjY = new QTableWidgetItem(QString::number(currTP.second.y));
752  itemAdjY->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
753  m_ui->m_tiePointsTableWidget->setItem(newrow, 6, itemAdjY);
754 
755  //check if this item was selected
756  std::set<int>::iterator it = m_tiePointsSelected.find(tPIt->first);
757 
758  if(it != m_tiePointsSelected.end())
759  {
760  m_ui->m_tiePointsTableWidget->selectRow(newrow);
761  }
762 
763  ++tPIt;
764  }
765 
766  m_ui->m_tiePointsTableWidget->setSortingEnabled(true);
767  m_ui->m_tiePointsTableWidget->blockSignals( false );
768  m_ui->m_tiePointsTableWidget->resizeColumnsToContents();
769 
770  transformationInfoUpdate();
771 }
772 
774 {
775  // creating the transformations parameters
776  te::gm::GTParameters transParamsAllTP;
777  te::gm::GTParameters transParamsSelectedTP;
778  te::gm::GTParameters transParamsUnselectedTP;
779 
780  m_tiePointsSelected.clear();
781 
782  const int rowCount = m_ui->m_tiePointsTableWidget->rowCount();
783 
784  for(int row = 0; row < rowCount; ++row)
785  {
786  QTableWidgetItem* itemPtr = m_ui->m_tiePointsTableWidget->item(row, 0);
787 
788  int id = itemPtr->text().toUInt();
789 
790  te::qt::widgets::TiePointData::TPContainerT::iterator it = m_tiePoints.find(id);
791 
792  assert(it != m_tiePoints.end());
793 
794  const te::gm::GTParameters::TiePoint& tiePoint = it->second.m_tiePoint;
795 
796  if( itemPtr->isSelected() )
797  {
798  it->second.m_selected = true;
799 
800  transParamsSelectedTP.m_tiePoints.push_back(tiePoint);
801 
802  m_tiePointsSelected.insert(id);
803  }
804  else
805  {
806  it->second.m_selected = false;
807 
808  transParamsUnselectedTP.m_tiePoints.push_back(tiePoint);
809  }
810 
811  transParamsAllTP.m_tiePoints.push_back(tiePoint);
812  }
813 
814  // instantiating the transformations
815  std::string geoTransfName = m_ui->m_geomTransfNameComboBox->currentText().toStdString();
816 
817  std::auto_ptr<te::gm::GeometricTransformation> transfAllTPPtr(te::gm::GTFactory::make(geoTransfName));
818  if(transfAllTPPtr.get())
819  if(!transfAllTPPtr->initialize(transParamsAllTP))
820  transfAllTPPtr.reset();
821 
822  std::auto_ptr<te::gm::GeometricTransformation> transfSelectedTPPtr(te::gm::GTFactory::make(geoTransfName));
823  if(transfSelectedTPPtr.get())
824  if(!transfSelectedTPPtr->initialize(transParamsSelectedTP))
825  transfSelectedTPPtr.reset();
826 
827  std::auto_ptr<te::gm::GeometricTransformation> transfUnselectedTPPtr(te::gm::GTFactory::make(geoTransfName));
828  if(transfUnselectedTPPtr.get())
829  if(!transfUnselectedTPPtr->initialize(transParamsUnselectedTP))
830  transfUnselectedTPPtr.reset();
831 
832  // updating widgets
833  m_ui->m_tiePointsNumberLineEdit->setText(QString::number(m_tiePoints.size()));
834 
835  if(transfAllTPPtr.get())
836  m_ui->m_transformationRMSEAllLineEdit->setText(QString::number(transfAllTPPtr->getDirectMapRMSE()));
837  else
838  m_ui->m_transformationRMSEAllLineEdit->setText("N/A");
839 
840  if(transfSelectedTPPtr.get())
841  m_ui->m_transformationRMSESelectedLineEdit->setText(QString::number(transfSelectedTPPtr->getDirectMapRMSE()));
842  else
843  m_ui->m_transformationRMSESelectedLineEdit->setText("N/A");
844 
845  if(transfUnselectedTPPtr.get())
846  m_ui->m_transformationRMSEunselectedLineEdit->setText(QString::number(transfUnselectedTPPtr->getDirectMapRMSE()));
847  else
848  m_ui->m_transformationRMSEunselectedLineEdit->setText("N/A");
849 
850  //emit signal
851  emit tiePointsUpdated();
852 }
853 
855 {
856  m_ui->m_enableGeometryFilterCheckBox->setChecked(m_inputParameters.m_enableGeometryFilter);
857  m_ui->m_enableMultiThreadCheckBox->setChecked(m_inputParameters.m_enableMultiThread);
858 
859  switch( m_inputParameters.m_interesPointsLocationStrategy )
860  {
862  {
863  int idx = m_ui->m_interesPointsLocationStrategyComboBox->findText("Surf");
864  m_ui->m_interesPointsLocationStrategyComboBox->setCurrentIndex(idx);
865  break;
866  }
867  default:
868  {
869  int idx = m_ui->m_interesPointsLocationStrategyComboBox->findText("Moravec");
870  m_ui->m_interesPointsLocationStrategyComboBox->setCurrentIndex(idx);
871  }
872  }
873 
876 
877  while( gtItB != gtItE )
878  {
879  m_ui->m_geomTransfNameComboBox->addItem(QString(gtItB->first.c_str()));
880  ++gtItB;
881  }
882 
883  int idx = m_ui->m_geomTransfNameComboBox->findText(m_inputParameters.m_geomTransfName.c_str());
884  m_ui->m_geomTransfNameComboBox->setCurrentIndex(idx);
885 
886  m_ui->m_geometryFilterAssuranceLineEdit->setText(QString::number(m_inputParameters.m_geometryFilterAssurance));
887 
888  m_ui->m_geomTransfMaxErrorLineEdit->setText(QString::number(m_inputParameters.m_geomTransfMaxError));
889 
890  switch(m_inputParameters.m_interpMethod)
891  {
893  {
894  int idx = m_ui->m_interpMethodComboBox->findText("Bilinear");
895  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
896  break;
897  }
899  {
900  int idx = m_ui->m_interpMethodComboBox->findText("Bicubic");
901  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
902  break;
903  }
904  default:
905  {
906  int idx = m_ui->m_interpMethodComboBox->findText("NearestNeighbor");
907  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
908  }
909  }
910 
911  m_ui->m_maxTiePointsLineEdit->setText(QString::number(m_inputParameters.m_maxTiePoints));
912 
913  m_ui->m_correlationWindowWidthLineEdit->setText(QString::number(m_inputParameters.m_moravecCorrelationWindowWidth));
914 
915  m_ui->m_gaussianFilterIterationsLineEdit->setText(QString::number(m_inputParameters.m_moravecGaussianFilterIterations));
916 
917  m_ui->m_minAbsCorrelationLineEdit->setText(QString::number(m_inputParameters.m_moravecMinAbsCorrelation));
918 
919  m_ui->m_moravecWindowWidthLineEdit->setText(QString::number(m_inputParameters.m_moravecWindowWidth));
920 
921  m_ui->m_maxNormEuclideanDistLineEdit->setText(QString::number(m_inputParameters.m_surfMaxNormEuclideanDist));
922 
923  m_ui->m_octavesNumberLineEdit->setText(QString::number(m_inputParameters.m_surfOctavesNumber));
924 
925  m_ui->m_scalesNumberLineEdit->setText(QString::number(m_inputParameters.m_surfScalesNumber));
926 }
927 
929 {
930  m_inputParameters.m_enableGeometryFilter = m_ui->m_enableGeometryFilterCheckBox->isChecked();
931 
932  m_inputParameters.m_enableMultiThread = m_ui->m_enableMultiThreadCheckBox->isChecked();
933 
934  if(m_ui->m_interesPointsLocationStrategyComboBox->currentText() == "Surf")
935  m_inputParameters.m_interesPointsLocationStrategy = te::rp::TiePointsLocator::InputParameters::SurfStrategyT;
936  else
937  m_inputParameters.m_interesPointsLocationStrategy = te::rp::TiePointsLocator::InputParameters::MoravecStrategyT;
938 
939  m_inputParameters.m_geomTransfName = m_ui->m_geomTransfNameComboBox->currentText().toStdString();
940 
941  m_inputParameters.m_geometryFilterAssurance = m_ui->m_geometryFilterAssuranceLineEdit->text().toDouble();
942 
943  m_inputParameters.m_geomTransfMaxError = m_ui->m_geomTransfMaxErrorLineEdit->text().toDouble();
944 
945  if(m_ui->m_interpMethodComboBox->currentText() == "Bilinear")
946  m_inputParameters.m_interpMethod = te::rst::Interpolator::Bilinear;
947  else if(m_ui->m_interpMethodComboBox->currentText() == "Bicubic")
948  m_inputParameters.m_interpMethod = te::rst::Interpolator::Bicubic;
949  else
950  m_inputParameters.m_interpMethod = te::rst::Interpolator::NearestNeighbor;
951 
952  m_inputParameters.m_maxTiePoints = m_ui->m_maxTiePointsLineEdit->text().toUInt();
953 
954  m_inputParameters.m_moravecCorrelationWindowWidth = m_ui->m_correlationWindowWidthLineEdit->text().toUInt();
955 
956  m_inputParameters.m_moravecGaussianFilterIterations = m_ui->m_gaussianFilterIterationsLineEdit->text().toUInt();
957 
958  m_inputParameters.m_moravecMinAbsCorrelation = m_ui->m_minAbsCorrelationLineEdit->text().toDouble();
959 
960  m_inputParameters.m_moravecWindowWidth = m_ui->m_moravecWindowWidthLineEdit->text().toUInt();
961 
962  m_inputParameters.m_surfMaxNormEuclideanDist = m_ui->m_maxNormEuclideanDistLineEdit->text().toDouble();
963 
964  m_inputParameters.m_surfOctavesNumber = m_ui->m_octavesNumberLineEdit->text().toUInt();
965 
966  m_inputParameters.m_surfScalesNumber = m_ui->m_scalesNumberLineEdit->text().toUInt();
967 }
968 
970 {
971  //reference
972  QGridLayout* layoutRef = new QGridLayout(m_ui->m_refWidget);
973 
974  m_refNavigator = new te::qt::widgets::RasterNavigatorWidget(m_ui->m_refWidget);
975  m_refNavigator->setWindowTitle(tr("Reference"));
976  m_refNavigator->setMinimumSize(550, 400);
977  m_refNavigator->hideGeomTool(true);
978  m_refNavigator->hideInfoTool(true);
979  m_refNavigator->hideBoxTool(true);
980 
981  layoutRef->addWidget(m_refNavigator);
982  layoutRef->setContentsMargins(0,0,0,0);
983 
984  connect(m_refNavigator, SIGNAL(mapDisplayExtentChanged()), this, SLOT(onRefMapDisplayExtentChanged()));
985  connect(m_refNavigator, SIGNAL(pointPicked(double, double)), this, SLOT(onRefPointPicked(double, double)));
986 
987  //adjust
988  QGridLayout* layoutAdj = new QGridLayout(m_ui->m_adjWidget);
989 
990  m_adjNavigator = new te::qt::widgets::RasterNavigatorWidget(m_ui->m_adjWidget);
991  m_adjNavigator->setWindowTitle(tr("Adjust"));
992  m_adjNavigator->setMinimumSize(550, 400);
993  m_adjNavigator->hideGeomTool(true);
994  m_adjNavigator->hideInfoTool(true);
995  m_adjNavigator->hideBoxTool(true);
996 
997  layoutAdj->addWidget(m_adjNavigator);
998  layoutAdj->setContentsMargins(0,0,0,0);
999 
1000  connect(m_adjNavigator, SIGNAL(mapDisplayExtentChanged()), this, SLOT(onAdjMapDisplayExtentChanged()));
1001  connect(m_adjNavigator, SIGNAL(pointPicked(double, double)), this, SLOT(onAdjPointPicked(double, double)));
1002 }
1003 
1005 {
1006  //get displays
1007  te::qt::widgets::MapDisplay* refDisplay = m_refNavigator->getDisplay();
1008  refDisplay->getDraftPixmap()->fill(QColor(0, 0, 0, 0));
1009  const te::gm::Envelope& refMapExt = refDisplay->getExtent();
1010  te::qt::widgets::Canvas refCanvasInstance(refDisplay->getDraftPixmap());
1011  refCanvasInstance.setWindow(refMapExt.m_llx, refMapExt.m_lly, refMapExt.m_urx, refMapExt.m_ury);
1012 
1013  te::qt::widgets::MapDisplay* adjDisplay = m_adjNavigator->getDisplay();
1014  adjDisplay->getDraftPixmap()->fill(QColor(0, 0, 0, 0));
1015  const te::gm::Envelope& adjMapExt = adjDisplay->getExtent();
1016  te::qt::widgets::Canvas adjCanvasInstance(adjDisplay->getDraftPixmap());
1017  adjCanvasInstance.setWindow(adjMapExt.m_llx, adjMapExt.m_lly, adjMapExt.m_urx, adjMapExt.m_ury);
1018 
1019  //get rasters
1020  if(!m_refLayer.get())
1021  return;
1022  std::auto_ptr<te::da::DataSet> dsRef = m_refLayer->getData();
1023  if(!dsRef.get())
1024  return;
1025  std::size_t rpos = te::da::GetFirstPropertyPos(dsRef.get(), te::dt::RASTER_TYPE);
1026  std::auto_ptr<te::rst::Raster> rstRef = dsRef->getRaster(rpos);
1027  if(!rstRef.get())
1028  return;
1029 
1030  if(!m_adjLayer.get())
1031  return;
1032  std::auto_ptr<te::da::DataSet> dsAdj = m_adjLayer->getData();
1033  if(!dsAdj.get())
1034  return;
1035  rpos = te::da::GetFirstPropertyPos(dsAdj.get(), te::dt::RASTER_TYPE);
1036  std::auto_ptr<te::rst::Raster> rstAdj = dsAdj->getRaster(rpos);
1037  if(!rstAdj.get())
1038  return;
1039 
1040  //get tie points
1041  te::qt::widgets::TiePointData::TPContainerT tpc = getTiePointContainer();
1042 
1043  te::qt::widgets::TiePointData::TPContainerT::const_iterator it = tpc.begin();
1044 
1045  while(it != tpc.end())
1046  {
1047  int id = it->first;
1048 
1049  te::qt::widgets::TiePointData tpd = it->second;
1050 
1051  refCanvasInstance.setPointColor(te::color::RGBAColor(0,0,0, TE_TRANSPARENT)); //GAMBI
1052  adjCanvasInstance.setPointColor(te::color::RGBAColor(0,0,0, TE_TRANSPARENT)); //GAMBI
1053 
1054  //configure mark
1055  if(tpd.m_selected)
1056  {
1057  refCanvasInstance.setPointPattern(m_rgbaMarkSelected, PATTERN_SIZE, PATTERN_SIZE);
1058  adjCanvasInstance.setPointPattern(m_rgbaMarkSelected, PATTERN_SIZE, PATTERN_SIZE);
1059  }
1060  else
1061  {
1062  refCanvasInstance.setPointPattern(m_rgbaMarkUnselected, PATTERN_SIZE, PATTERN_SIZE);
1063  adjCanvasInstance.setPointPattern(m_rgbaMarkUnselected, PATTERN_SIZE, PATTERN_SIZE);
1064  }
1065 
1066  //ref coord
1067  te::gm::Coord2D refCoord = it->second.m_tiePoint.first;
1068  te::gm::Coord2D refGeoCoord;
1069  rstRef->getGrid()->gridToGeo(refCoord.x, refCoord.y, refGeoCoord.x, refGeoCoord.y );
1070 
1071  te::gm::Point refPoint(refGeoCoord.x, refGeoCoord.y);
1072  refCanvasInstance.draw(&refPoint);
1073 
1074  //ref text
1075  QMatrix matrix = refCanvasInstance.getMatrix();
1076  QPointF pointCanvas = matrix.map(QPointF(refGeoCoord.x, refGeoCoord.y));
1077  pointCanvas.setX(pointCanvas.x() + 8);
1078  QPointF pointGeo = matrix.inverted().map(pointCanvas);
1079  refPoint.setX(pointGeo.x());
1080  refPoint.setY(pointGeo.y());
1081  refCanvasInstance.drawText(&refPoint, QString::number(id).toStdString());
1082 
1083  //adj coord
1084  te::gm::Coord2D adjCoord = it->second.m_tiePoint.second;
1085  te::gm::Coord2D adjGeoCoord;
1086  rstAdj->getGrid()->gridToGeo(adjCoord.x, adjCoord.y, adjGeoCoord.x, adjGeoCoord.y );
1087 
1088  te::gm::Point adjPoint(adjGeoCoord.x, adjGeoCoord.y);
1089  adjCanvasInstance.draw(&adjPoint);
1090 
1091  //adj text
1092  matrix = adjCanvasInstance.getMatrix();
1093  pointCanvas = matrix.map(QPointF(adjGeoCoord.x, adjGeoCoord.y));
1094  pointCanvas.setX(pointCanvas.x() + 8);
1095  pointGeo = matrix.inverted().map(pointCanvas);
1096  adjPoint.setX(pointGeo.x());
1097  adjPoint.setY(pointGeo.y());
1098  adjCanvasInstance.drawText(&adjPoint, QString::number(id).toStdString());
1099 
1100  ++it;
1101  }
1102 
1103  //draw ref coord if exist
1104  te::gm::Coord2D refCoord;
1105  if(getReferenceTiePointCoord(refCoord))
1106  {
1107  refCanvasInstance.setPointColor(te::color::RGBAColor(0,0,0, TE_TRANSPARENT)); //GAMBI
1108  refCanvasInstance.setPointPattern(m_rgbaMarkRef, PATTERN_SIZE, PATTERN_SIZE);
1109 
1110  te::gm::Coord2D refGeoCoord;
1111  rstRef->getGrid()->gridToGeo(refCoord.x, refCoord.y, refGeoCoord.x, refGeoCoord.y );
1112 
1113  te::gm::Point refPoint(refGeoCoord.x, refGeoCoord.y);
1114  refCanvasInstance.draw(&refPoint);
1115  }
1116 
1117  refDisplay->repaint();
1118  adjDisplay->repaint();
1119 }
1120 
1122 {
1123  QImage* img = te::qt::widgets::GetImage(rgba, PATTERN_SIZE, PATTERN_SIZE);
1124 
1125  QPixmap p = QPixmap::fromImage(*img);
1126 
1127  delete img;
1128 
1129  return p;
1130 }
te::color::RGBAColor ** m_rgbaMarkSelected
Represents the pattern of a selected tie point.
void getTiePointsIdxCoords(std::vector< te::gm::GTParameters::TiePoint > &tiePoints) const
Get the current acquired tie-points.
std::map< unsigned int, TiePointData > TPContainerT
Tie-pints container type definition.
std::vector< te::gm::GTParameters::TiePoint > m_tiePoints
The generated tie-pionts (te::gm::GTParameters::TiePoint::first are raster 1 line/column indexes...
std::vector< TiePoint > m_tiePoints
Tie points.
Definition: GTParameters.h:95
bool m_enableProgress
Enable/Disable the progress interface (default:false).
double y
y-coordinate.
Definition: Coord2D.h:87
te::se::Mark * m_markRef
Represents the mark of a reference tie point.
double m_pixelSizeXRelation
The pixel resolution relation m_pixelSizeXRelation = raster1_pixel_res_x / raster2_pixel_res_x (defau...
double x
x-coordinate.
Definition: Coord2D.h:86
This file has the TiePointLocatorWidget class.
void updateAdvancedOptions()
Update tie point values with advanced options changed values.
QPixmap getPixmap(te::color::RGBAColor **rgba)
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
Definition: Raster.cpp:213
const te::qt::widgets::TiePointData::TPContainerT & getTiePointContainer()
Get tie point data container.
te::gm::GTParameters::TiePoint m_tiePoint
Tie point coordinates.
bool getReferenceTiePointCoord(te::gm::Coord2D &coordRef)
Get tie point reference coord that does not have an adjust coordenate.
void startAdvancedOptions()
Fill interface widget with initial values.
te::rst::Raster const * m_inRaster2Ptr
Input raster 2.
TiePointsLocator input parameters.
void tiePointsTableUpdate()
Uptate the tie-points table widget.
double m_urx
Upper right corner x-coordinate.
Definition: Envelope.h:346
unsigned int m_raster1TargetAreaLineStart
The first line of the raster 1 target area to process (default:0 - The entire raster will be consider...
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories.
TiePointLocatorWidget(QWidget *parent=0, Qt::WindowFlags f=0)
A widget to control the display of a set of layers.
Definition: MapDisplay.h:65
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
std::pair< Coord2D, Coord2D > TiePoint
Tie point type definition.
Definition: GTParameters.h:59
unsigned int m_raster2TargetAreaWidth
The raster 2 target area width (default:0 - The entire raster will be considered).
void geoToGrid(const double &x, const double &y, double &col, double &row) const
Get the grid point associated to a spatial location.
Definition: Grid.cpp:307
unsigned int m_raster2TargetAreaLineStart
The first line of the raster 2 target area to process (default:0 - The entire raster will be consider...
Bicubic interpolation method.
Definition: Interpolator.h:65
Ui::TiePointLocatorWidgetForm * getForm() const
void getOutputResolution(double &resX, double &resY)
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator const_iterator
te::se::Mark * m_markSelected
Represents the mark of a selected tie point.
std::vector< unsigned int > m_inRaster2Bands
Bands to be used from the input raster 2.
const TiePointData & operator=(const TiePointData &other)
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers.
Definition: STLUtils.h:131
te::rst::Raster const * m_inRaster1Ptr
Input raster 1.
void setWindow(const double &llx, const double &lly, const double &urx, const double &ury)
It sets the world (or window) coordinates area (supposing a cartesian reference system).
Definition: Canvas.cpp:147
double m_llx
Lower left corner x-coordinate.
Definition: Envelope.h:344
static MarkRendererManager & getInstance()
It returns a reference to the singleton instance.
A point with x and y coordinate values.
Definition: Point.h:50
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Definition: Raster.cpp:208
te::se::Mark * m_markUnselected
Represents the mark of a unselected tie point.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
Definition: MapDisplay.cpp:63
te::color::RGBAColor ** m_rgbaMarkRef
Represents the pattern of reference tie point.
std::auto_ptr< Ui::TiePointLocatorWidgetForm > m_ui
bool m_selected
Tie point selection status;.
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
unsigned int m_raster1TargetAreaWidth
The raster 1 target area width (default:0 - The entire raster will be considered).
Grid * getGrid()
It returns the raster grid.
Definition: Raster.cpp:94
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator end() const
It returns an iterator to the end of the container.
TESEEXPORT Mark * CreateMark(const std::string &wellKnownName, Stroke *stroke, Fill *fill)
Creates a mark.
Definition: Utils.cpp:130
static GeometricTransformation * make(const std::string &factoryKey)
It creates an object with the appropriated factory.
TiePointsLocator output parameters.
unsigned int m_raster1TargetAreaColStart
The first column of the raster 2 target area to process (default:0 - The entire raster will be consid...
#define PATTERN_SIZE
double m_pixelSizeYRelation
The pixel resolution relation m_pixelSizeYRelation = raster1_pixel_res_y / raster2_pixel_res_y (defau...
unsigned int m_raster2TargetAreaColStart
The first column of the raster 2 target area to process (default:0 - The entire raster will be consid...
double m_lly
Lower left corner y-coordinate.
Definition: Envelope.h:345
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
Definition: Converter.h:53
TESEEXPORT Stroke * CreateStroke(const std::string &color, const std::string &width)
Creates a stroke.
Definition: Utils.cpp:54
A canvas built on top of Qt.
Definition: Canvas.h:54
void getTiePoints(std::vector< te::gm::GTParameters::TiePoint > &tiePoints) const
Get the current acquired tie-points.
Tie points locator.
void setX(const double &x)
It sets the Point x-coordinate value.
Definition: Point.h:143
virtual QPixmap * getDraftPixmap() const
It returns the map display draft pixmap.
Definition: MapDisplay.cpp:226
TEQTWIDGETSEXPORT QImage * GetImage(te::color::RGBAColor **img, int width, int height)
It creates a QImage from an RGBA color array.
Definition: Utils.cpp:63
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator begin() const
It returns an iterator to the first stored factory.
double m_ury
Upper right corner y-coordinate.
Definition: Envelope.h:347
This class is used to navigate over a DataSetLayer (having a raster representation) and given a set o...
te::color::RGBAColor ** m_rgbaMarkUnselected
Represents the pattern of a unselected tie point.
#define TE_TRANSPARENT
For an RGBA color this is the value of the alpha-channel for totally transparent. ...
Definition: Config.h:46
A Stroke specifies the appearance of a linear geometry.
Definition: Stroke.h:67
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
Bilinear interpolation method.
Definition: Interpolator.h:64
void setAdjustLayer(te::map::AbstractLayerPtr layer)
This method is used to set the selected layer used to be the adjust layer.
This file has the RasterNavigatorWidget class.
2D Geometric transformation parameters.
Definition: GTParameters.h:50
void transformationInfoUpdate()
Uptate the current transformation information widgets.
unsigned int m_maxR1ToR2Offset
The maximum offset (pixels units) between a raster 1 point end the respective raster 2 point (default...
TiePointAcquisitionType m_acqType
Acquisition type.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Definition: Utils.cpp:432
void setY(const double &y)
It sets the Point y-coordinate value.
Definition: Point.h:157
Near neighborhood interpolation method.
Definition: Interpolator.h:63
A dialog used to build a SRSManagerDialog element.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::vector< unsigned int > m_inRaster1Bands
Bands to be used from the input raster 1.
unsigned int m_raster1TargetAreaHeight
The raster 1 target area height (default:0 - The entire raster will be considered).
void setReferenceLayer(te::map::AbstractLayerPtr layer)
This method is used to set the selected layer used to be the reference layer.
const std::pair< int, std::string > & getSelectedSRS() const
Returns the selected SRS in the window.
unsigned int m_raster2TargetAreaHeight
The raster 2 target area height (default:0 - The entire raster will be considered).
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
TESEEXPORT Fill * CreateFill(const std::string &color, const std::string &opacity)
Creates a fill.
Definition: Utils.cpp:109