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