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) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/rp/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 "../../../rp/Functions.h"
37 #include "../../../se/Fill.h"
38 #include "../../../se/Mark.h"
39 #include "../../../se/Stroke.h"
40 #include "../../../se/Utils.h"
41 #include "../../../srs/Converter.h"
42 #include "../../widgets/canvas/Canvas.h"
43 #include "../../widgets/canvas/MapDisplay.h"
44 #include "../../widgets/srs/SRSManagerDialog.h"
45 #include "../../widgets/Utils.h"
46 #include "RasterNavigatorWidget.h"
47 #include "TiePointLocatorWidget.h"
49 #include "ui_RasterNavigatorWidgetForm.h"
50 #include "ui_TiePointLocatorWidgetForm.h"
51 #include "ui_TiePointLocatorParametersWidgetForm.h"
52 
53 // Qt
54 #include <QGridLayout>
55 #include <QMessageBox>
56 #include <QPixmap>
57 
58 // STL
59 #include <memory>
60 
61 #define PATTERN_SIZE 12
62 
63 /* TiePointData Class*/
64 
66  m_acqType(InvalidAcquisitionT),
67  m_selected(false)
68 {
69 
70 }
71 
73 {
74  operator=( other );
75 }
76 
78 {
79 
80 }
81 
83 {
84  m_acqType = other.m_acqType;
85  m_tiePoint = other.m_tiePoint;
86  m_selected = other.m_selected;
87  return other;
88 }
89 
90 /* TiePointLocatorWidget Class*/
91 
93  : QWidget(parent, f),
94  m_ui(new Ui::TiePointLocatorWidgetForm),
95  m_tiePointHasFirstCoord(false),
96  m_tiePointIdCounter(0)
97 {
98  m_ui->setupUi(this);
99 
100  m_ui->m_x1LineEdit->setValidator(new QDoubleValidator(this));
101  m_ui->m_y1LineEdit->setValidator(new QDoubleValidator(this));
102  m_ui->m_x2LineEdit->setValidator(new QDoubleValidator(this));
103  m_ui->m_y2LineEdit->setValidator(new QDoubleValidator(this));
104 
105  m_ui->m_resXLineEdit->setValidator(new QDoubleValidator(this));
106  m_ui->m_resYLineEdit->setValidator(new QDoubleValidator(this));
107 
108  m_ui->m_selectAllToolButton->setIcon(QIcon::fromTheme("table-select"));
109  m_ui->m_unselectAllToolButton->setIcon(QIcon::fromTheme("table-unselect"));
110  m_ui->m_deleteSelectedToolButton->setIcon(QIcon::fromTheme("table-delete-select"));
111  m_ui->m_autoAcquireTiePointsToolButton->setIcon(QIcon::fromTheme("wand"));
112  m_ui->m_addToolButton->setIcon(QIcon::fromTheme("list-add"));
113  m_ui->m_refreshToolButton->setIcon(QIcon::fromTheme("view-refresh"));
114  m_ui->m_doneToolButton->setIcon(QIcon::fromTheme("check"));
115 
116  //add tie point parameters widget
118  m_ui->m_tabWidget->addTab(m_tiePointParameters, tr("Options"));
119 
120  //connects
121  connect(m_ui->m_autoAcquireTiePointsToolButton, SIGNAL(clicked()), this, SLOT(onAutoAcquireTiePointsToolButtonClicked()));
122  connect(m_ui->m_selectAllToolButton, SIGNAL(clicked()), this, SLOT(onSelectAllToolButtonClicked()));
123  connect(m_ui->m_unselectAllToolButton, SIGNAL(clicked()), this, SLOT(onUnselectAllToolButtonClicked()));
124  connect(m_ui->m_deleteSelectedToolButton, SIGNAL(clicked()), this, SLOT(onDeleteSelectedToolButtonClicked()));
125  connect(m_ui->m_addToolButton, SIGNAL(clicked()), this, SLOT(onAddToolButtonClicked()));
126  connect(m_ui->m_refreshToolButton, SIGNAL(clicked()), this, SLOT(onRefreshToolButtonClicked()));
127  connect(m_ui->m_doneToolButton, SIGNAL(clicked()), this, SLOT(onDoneToolButtonClicked()));
128  connect(m_ui->m_tiePointsTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onTiePointsTableWidgetItemSelectionChanged()));
129  connect(m_ui->m_sridPushButton, SIGNAL(clicked()), this, SLOT(onSRIDPushButtonClicked()));
130 
131  connect(m_tiePointParameters->getWidgetForm()->m_geomTransfNameComboBox, SIGNAL(activated(int)), this, SLOT(onRefreshToolButtonClicked()));
132 
133 
134 // connects
135  connect(this, SIGNAL(tiePointsUpdated()), this, SLOT(onTiePointsUpdated()));
136 
137 //define mark selected
138  te::se::Stroke* strokeSel = te::se::CreateStroke("#000000", "1");
139  te::se::Fill* fillSel = te::se::CreateFill("#0000FF", "1.0");
140  m_markSelected = te::se::CreateMark("circle", strokeSel, fillSel);
141 
143 
144  QPixmap markSelPix = getPixmap(m_rgbaMarkSelected);
145  setSelectedTiePointMarkLegend(markSelPix);
146 
147 //define mark unselected
148  te::se::Stroke* strokeUnsel = te::se::CreateStroke("#000000", "1");
149  te::se::Fill* fillUnsel = te::se::CreateFill("#00FF00", "1.0");
150  m_markUnselected = te::se::CreateMark("cross", strokeUnsel, fillUnsel);
151 
153 
154  QPixmap markPix = getPixmap(m_rgbaMarkUnselected);
155  setTiePointMarkLegend(markPix);
156 
157 //define mark reference
158  te::se::Stroke* strokeRef = te::se::CreateStroke("#000000", "1");
159  te::se::Fill* fillRef = te::se::CreateFill("#FF0000", "1.0");
160  m_markRef = te::se::CreateMark("x", strokeRef, fillRef);
161 
163 
164  QPixmap markRefPix = getPixmap(m_rgbaMarkRef);
165  setReferenceTiePointMarkLegend(markRefPix);
166 
168 }
169 
171 {
172  te::common::Free(m_rgbaMarkSelected, PATTERN_SIZE);
173  delete m_markSelected;
174 
175  te::common::Free(m_rgbaMarkUnselected, PATTERN_SIZE);
176  delete m_markUnselected;
177 
178  te::common::Free(m_rgbaMarkRef, PATTERN_SIZE);
179  delete m_markRef;
180 }
181 
182 Ui::TiePointLocatorWidgetForm* te::qt::widgets::TiePointLocatorWidget::getForm() const
183 {
184  return m_ui.get();
185 }
186 
187 void te::qt::widgets::TiePointLocatorWidget::getTiePoints( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const
188 {
189  tiePoints.clear();
190 
191  std::auto_ptr<te::da::DataSet> ds(m_refLayer->getData());
192  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
193  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
194 
195  te::qt::widgets::TiePointData::TPContainerT::const_iterator itB = m_tiePoints.begin();
196 
197  const te::qt::widgets::TiePointData::TPContainerT::const_iterator itE = m_tiePoints.end();
198 
199  tiePoints.reserve( m_tiePoints.size() );
200 
201  // create a SRS converter
202  std::auto_ptr<te::srs::Converter> converter(new te::srs::Converter());
203  converter->setSourceSRID(m_refLayer->getSRID());
204  converter->setTargetSRID(m_ui->m_sridLineEdit->text().toInt());
205 
206  while( itB != itE )
207  {
209 
210  tp.first = itB->second.m_tiePoint.second;
211 
212  te::gm::Coord2D c = inputRst->getGrid()->gridToGeo(itB->second.m_tiePoint.first.x, itB->second.m_tiePoint.first.y);
213 
214  converter->convert(c.x, c.y, c.x, c.y);
215 
216  tp.second = c;
217 
218  tiePoints.push_back(tp);
219  ++itB;
220  }
221 }
222 
223 void te::qt::widgets::TiePointLocatorWidget::getTiePointsIdxCoords( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const
224 {
225  tiePoints.clear();
226 
227  std::auto_ptr<te::da::DataSet> ds(m_refLayer->getData());
228  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
229  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
230 
231  te::qt::widgets::TiePointData::TPContainerT::const_iterator itB = m_tiePoints.begin();
232 
233  const te::qt::widgets::TiePointData::TPContainerT::const_iterator itE = m_tiePoints.end();
234 
235  tiePoints.reserve( m_tiePoints.size() );
236 
237  while( itB != itE )
238  {
239  te::gm::GTParameters::TiePoint tp = itB->second.m_tiePoint;
240 
241  tiePoints.push_back(tp);
242 
243  ++itB;
244  }
245 }
246 
248 {
249  return m_tiePoints;
250 }
251 
253 {
254  if(m_tiePointHasFirstCoord)
255  coordRef = m_currentTiePoint.first;
256 
257  return m_tiePointHasFirstCoord;
258 }
259 
261 {
262  m_refLayer = layer;
263 
264  m_refNavigator->set(layer);
265 
266  //list bands
267  std::auto_ptr<te::da::DataSet> ds = m_refLayer->getData();
268 
269  if(ds.get())
270  {
271  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
272  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
273 
274  if(inputRst.get())
275  {
276  m_ui->m_referenceBand1ComboBox->clear();
277 
278  for(unsigned band1Idx = 0; band1Idx < inputRst->getNumberOfBands(); ++band1Idx)
279  m_ui->m_referenceBand1ComboBox->addItem(QString::number(band1Idx));
280 
281 
282  QString strSRID;
283  strSRID.setNum(m_refLayer->getSRID());
284  m_ui->m_inputSRIDLineEdit->setText(strSRID);
285 
286  QString strResX;
287  strResX.setNum(inputRst->getGrid()->getResolutionX());
288  m_ui->m_inputResXLineEdit->setText(strResX);
289 
290  QString strResY;
291  strResY.setNum(inputRst->getGrid()->getResolutionY());
292  m_ui->m_inputResYLineEdit->setText(strResY);
293  }
294 
295  if(m_adjLayer.get())
296  {
297  std::auto_ptr<te::da::DataSet> dsAdj = m_adjLayer->getData();
298 
299  if(dsAdj.get())
300  {
302  std::auto_ptr<te::rst::Raster> inputRstAdj = dsAdj->getRaster(rpos);
303 
304  if(inputRstAdj.get())
305  {
306  double maxSize1 = std::max(inputRst->getNumberOfColumns(), inputRstAdj->getNumberOfColumns());
307  double maxSize2 = std::max(inputRst->getNumberOfRows(), inputRstAdj->getNumberOfRows());
308  double maxSize = std::max(maxSize1, maxSize2);
309 
310  if(maxSize > 1000)
311  {
312  double rescaleFactor = 1000. / maxSize;
313  m_tiePointParameters->setRescaleFactor(rescaleFactor);
314  }
315  }
316  }
317  }
318  }
319 }
320 
322 {
323  m_adjLayer = layer;
324 
325  m_adjNavigator->set(layer);
326 
327  //list bands
328  std::auto_ptr<te::da::DataSet> ds = m_adjLayer->getData();
329 
330  if(ds.get())
331  {
332  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
333  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
334 
335  if(inputRst.get())
336  {
337  m_ui->m_referenceBand2ComboBox->clear();
338 
339  for(unsigned band2Idx = 0; band2Idx < inputRst->getNumberOfBands(); ++band2Idx)
340  m_ui->m_referenceBand2ComboBox->addItem(QString::number(band2Idx));
341 
342  QString strSRID;
343  strSRID.setNum(m_adjLayer->getSRID());
344  m_ui->m_sridLineEdit->setText(strSRID);
345 
346  QString strResX;
347  strResX.setNum(inputRst->getGrid()->getResolutionX());
348  m_ui->m_resXLineEdit->setText(strResX);
349 
350  QString strResY;
351  strResY.setNum(inputRst->getGrid()->getResolutionY());
352  m_ui->m_resYLineEdit->setText(strResY);
353  }
354 
355  if(m_refLayer.get())
356  {
357  std::auto_ptr<te::da::DataSet> dsRef = m_refLayer->getData();
358 
359  if(dsRef.get())
360  {
362  std::auto_ptr<te::rst::Raster> inputRstRef = dsRef->getRaster(rpos);
363 
364  if(inputRstRef.get())
365  {
366  double maxSize1 = std::max(inputRst->getNumberOfColumns(), inputRstRef->getNumberOfColumns());
367  double maxSize2 = std::max(inputRst->getNumberOfRows(), inputRstRef->getNumberOfRows());
368  double maxSize = std::max(maxSize1, maxSize2);
369 
370  if(maxSize > 1000)
371  {
372  double rescaleFactor = 1000. / maxSize;
373  m_tiePointParameters->setRescaleFactor(rescaleFactor);
374  }
375  }
376  }
377  }
378  }
379 }
380 
382 {
383  srid = m_ui->m_sridLineEdit->text().toInt();
384 }
385 
387 {
388  resX = m_ui->m_resXLineEdit->text().toDouble();
389  resY = m_ui->m_resYLineEdit->text().toDouble();
390 }
391 
393 {
394  assert(m_refLayer.get());
395 
396  //get input raster
397  std::auto_ptr<te::da::DataSet> ds = m_refLayer->getData();
398 
399  if(ds.get())
400  {
401  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
402  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
403 
404  if(inputRst.get())
405  {
406  m_currentTiePoint.first = inputRst->getGrid()->geoToGrid(x, y);
407 
408  m_tiePointHasFirstCoord = true;
409  }
410  }
411 }
412 
414 {
415  assert(m_adjLayer.get());
416 
417  //get input raster
418  std::auto_ptr<te::da::DataSet> ds = m_adjLayer->getData();
419 
420  if(ds.get())
421  {
422  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
423  std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
424 
425  if(inputRst.get())
426  {
427  if(m_tiePointHasFirstCoord)
428  {
429  m_currentTiePoint.second = inputRst->getGrid()->geoToGrid(x, y);
430 
431  m_tiePointHasFirstCoord = false;
432 
433  //add tie point
434  TiePointData tpD;
436  tpD.m_tiePoint = m_currentTiePoint;
437 
438  ++m_tiePointIdCounter;
439  m_tiePoints[ m_tiePointIdCounter ] = tpD;
440 
441  tiePointsTableUpdate();
442  }
443  }
444  }
445 }
446 
448 {
449  m_ui->m_tiePointLabel->setPixmap(p);
450 }
451 
453 {
454  m_ui->m_selectedTiePointLabel->setPixmap(p);
455 }
456 
458 {
459  m_ui->m_refTiePointLabel->setPixmap(p);
460 }
461 
463 {
464  m_ui->m_tiePointsTableWidget->clearSelection();
465 
466  QModelIndex idxStart = m_ui->m_tiePointsTableWidget->model()->index(initialIdx, 0);
467  QModelIndex idxEnd = m_ui->m_tiePointsTableWidget->model()->index(initialIdx + nPos - 1, 6);
468 
469  if(idxStart.isValid() && idxEnd.isValid())
470  {
471  QItemSelection itemSel(idxStart, idxEnd);
472 
473  m_ui->m_tiePointsTableWidget->selectionModel()->select(itemSel, QItemSelectionModel::Select);
474  }
475 }
476 
478 {
479  //check parameters
480  if(m_ui->m_sridLineEdit->text().isEmpty())
481  {
482  QMessageBox::warning(this, tr("Warning"), tr("Output SRID not defined."));
483  return;
484  }
485 
486  if(m_ui->m_resXLineEdit->text().isEmpty() || m_ui->m_resYLineEdit->text().isEmpty())
487  {
488  QMessageBox::warning(this, tr("Warning"), tr("Output resolution not defined."));
489  return;
490  }
491 
492  // creating the algorithm parameters
493  std::auto_ptr<te::da::DataSet> dsRef(m_refLayer->getData());
494  std::size_t rpos = te::da::GetFirstPropertyPos(dsRef.get(), te::dt::RASTER_TYPE);
495  std::auto_ptr<te::rst::Raster> inputRstRef = dsRef->getRaster(rpos);
496 
497  std::auto_ptr<te::da::DataSet> dsAdj(m_adjLayer->getData());
499  std::auto_ptr<te::rst::Raster> inputRstAdj = dsAdj->getRaster(rpos);
500 
501  te::rp::TiePointsLocator::InputParameters inputParams = m_tiePointParameters->getTiePointInputParameters();
502  inputParams.m_enableProgress = true;
503 
504  inputParams.m_inRaster1Ptr = inputRstRef.get();
505  inputParams.m_inRaster2Ptr = inputRstAdj.get();
506 
507  te::gm::Envelope auxEnvelope1(m_refNavigator->getCurrentExtent());
508  double r1LLX = 0;
509  double r1LLY = 0;
510  double r1URX = 0;
511  double r1URY = 0;
512  inputParams.m_inRaster1Ptr->getGrid()->geoToGrid(auxEnvelope1.m_llx, auxEnvelope1.m_lly, r1LLX, r1LLY);
513  inputParams.m_inRaster1Ptr->getGrid()->geoToGrid(auxEnvelope1.m_urx, auxEnvelope1.m_ury, r1URX, r1URY);
514  inputParams.m_raster1TargetAreaColStart = (unsigned int)std::max( 0.0, r1LLX);
515  inputParams.m_raster1TargetAreaLineStart = (unsigned int)std::max( 0.0, r1URY);
516  inputParams.m_raster1TargetAreaWidth = ((unsigned int)std::min((double)inputParams.m_inRaster1Ptr->getNumberOfColumns(), r1URX)) - inputParams.m_raster1TargetAreaColStart + 1;
517  inputParams.m_raster1TargetAreaHeight = ((unsigned int)std::min((double)inputParams.m_inRaster1Ptr->getNumberOfRows(), r1LLY)) - inputParams.m_raster1TargetAreaLineStart + 1;
518 
519  te::gm::Envelope auxEnvelope2(m_adjNavigator->getCurrentExtent());
520  double r2LLX = 0;
521  double r2LLY = 0;
522  double r2URX = 0;
523  double r2URY = 0;
524  inputParams.m_inRaster2Ptr->getGrid()->geoToGrid(auxEnvelope2.m_llx, auxEnvelope2.m_lly, r2LLX, r2LLY);
525  inputParams.m_inRaster2Ptr->getGrid()->geoToGrid(auxEnvelope2.m_urx, auxEnvelope2.m_ury, r2URX, r2URY);
526  inputParams.m_raster2TargetAreaColStart = (unsigned int)std::max( 0.0, r2LLX);
527  inputParams.m_raster2TargetAreaLineStart = (unsigned int)std::max( 0.0, r2URY);
528  inputParams.m_raster2TargetAreaWidth = ((unsigned int)std::min((double)inputParams.m_inRaster2Ptr->getNumberOfColumns(), r2URX)) - inputParams.m_raster2TargetAreaColStart + 1;
529  inputParams.m_raster2TargetAreaHeight = ((unsigned int)std::min((double)inputParams.m_inRaster2Ptr->getNumberOfRows(), r2LLY)) - inputParams.m_raster2TargetAreaLineStart + 1;
530 
531  inputParams.m_inRaster1Bands.push_back(m_ui->m_referenceBand1ComboBox->currentText().toUInt());
532  inputParams.m_inRaster2Bands.push_back(m_ui->m_referenceBand2ComboBox->currentText().toUInt());
533 
534  if(m_ui->m_inputSRIDLineEdit->text().toInt() != m_ui->m_sridLineEdit->text().toInt())
535  {
536  te::gm::Envelope env(*inputRstAdj->getExtent());
537 
538  env.transform(m_ui->m_sridLineEdit->text().toInt(), m_ui->m_inputSRIDLineEdit->text().toInt());
539 
540  double resX = env.getWidth() / inputRstAdj->getNumberOfColumns();
541  double resY = env.getHeight() / inputRstAdj->getNumberOfRows();
542 
543  inputParams.m_pixelSizeXRelation = inputRstRef->getGrid()->getResolutionX() / resX;
544  inputParams.m_pixelSizeYRelation = inputRstRef->getGrid()->getResolutionY() / resY;
545 
546  }
547  else
548  {
549  inputParams.m_pixelSizeXRelation = inputRstRef->getGrid()->getResolutionX() / m_ui->m_resXLineEdit->text().toDouble();
550  inputParams.m_pixelSizeYRelation = inputRstRef->getGrid()->getResolutionY() / m_ui->m_resYLineEdit->text().toDouble();
551  }
552 
553  if(!(inputRstRef->getExtent()->within(auxEnvelope1) && inputRstAdj->getExtent()->within(auxEnvelope2)))
554  inputParams.m_subSampleOptimizationRescaleFactor = 1.;
555 
557 
558  // Looking for manual inserted tie-points for an initial estimate
559  unsigned int manualTPNumber = 0;
560  te::qt::widgets::TiePointData::TPContainerT::const_iterator itB = m_tiePoints.begin();
561  const te::qt::widgets::TiePointData::TPContainerT::const_iterator itE = m_tiePoints.end();
562  double coordDiffX = 0;
563  double coordDiffY = 0;
564 
565  while(itB != itE)
566  {
567  if(itB->second.m_acqType == TiePointData::ManualAcquisitionT)
568  {
569  coordDiffX = itB->second.m_tiePoint.first.x - itB->second.m_tiePoint.second.x;
570  coordDiffY = itB->second.m_tiePoint.first.y - itB->second.m_tiePoint.second.y;
571 
572  ++manualTPNumber;
573  }
574 
575  ++itB;
576  }
577 
578  // Executing the algorithm
579 
580  QApplication::setOverrideCursor(Qt::WaitCursor);
581 
582  try
583  {
584  te::rp::TiePointsLocator algorithmInstance;
585 
586  if(algorithmInstance.initialize(inputParams))
587  {
588  if(algorithmInstance.execute(outputParams))
589  {
590  const unsigned int tpsNmb = (unsigned int)outputParams.m_tiePoints.size();
591 
592  if(tpsNmb)
593  {
594  TiePointData auxTpData;
596 
597  int initialId = (int)m_tiePoints.size();
598 
599  for(unsigned int tpIdx = 0; tpIdx < tpsNmb; ++tpIdx)
600  {
601  ++m_tiePointIdCounter;
602  auxTpData.m_tiePoint = outputParams.m_tiePoints[ tpIdx ];
603  m_tiePoints[ m_tiePointIdCounter ] = auxTpData;
604  }
605 
606  tiePointsTableUpdate();
607 
608  disconnect(m_ui->m_tiePointsTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onTiePointsTableWidgetItemSelectionChanged()));
609 
610  createSelection(initialId, (int)tpsNmb);
611 
612  connect(m_ui->m_tiePointsTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onTiePointsTableWidgetItemSelectionChanged()));
613 
614  transformationInfoUpdate();
615  }
616  else
617  {
618  QMessageBox::warning(this, tr("Warning"), tr("None tie points was located."));
619  }
620  }
621  else
622  {
623  QMessageBox::warning(this, tr("Warning"), te::rp::Module::getLastLogStr().c_str());
624  }
625  }
626  else
627  {
628  QMessageBox::warning(this, tr("Warning"), te::rp::Module::getLastLogStr().c_str());
629  }
630  }
631  catch(...)
632  {
633  QApplication::restoreOverrideCursor();
634 
635  QMessageBox::warning(this, tr("Warning"), tr("Error locating tie points."));
636  }
637 
638  QApplication::restoreOverrideCursor();
639 }
640 
642 {
643  m_ui->m_tiePointsTableWidget->selectAll();
644 }
645 
647 {
648  m_ui->m_tiePointsTableWidget->clearSelection();
649 }
650 
652 {
653  const int rowCount = m_ui->m_tiePointsTableWidget->rowCount();
654 
655  for( int row = 0 ; row < rowCount ; ++row )
656  {
657  QTableWidgetItem* itemPtr = m_ui->m_tiePointsTableWidget->item(row, 0);
658 
659  if(itemPtr->isSelected())
660  {
661  unsigned int tpID = itemPtr->text().toUInt();
662 
663  te::qt::widgets::TiePointData::TPContainerT::iterator deletionIt = m_tiePoints.find(tpID);
664 
665  assert(deletionIt != m_tiePoints.end());
666 
667  m_tiePoints.erase(deletionIt);
668  }
669  }
670 
671  if(m_tiePoints.empty())
672  {
673  m_tiePointIdCounter = 0;
674  }
675 
676  m_tiePointsSelected.clear();
677 
678  tiePointsTableUpdate();
679 }
680 
682 {
683  if((!m_ui->m_x1LineEdit->text().isEmpty()) && (!m_ui->m_y1LineEdit->text().isEmpty()) &&
684  (!m_ui->m_x2LineEdit->text().isEmpty()) && (!m_ui->m_y2LineEdit->text().isEmpty()))
685  {
686  TiePointData tpD;
688  tpD.m_tiePoint.first.x = m_ui->m_x1LineEdit->text().toDouble();
689  tpD.m_tiePoint.first.y = m_ui->m_y1LineEdit->text().toDouble();
690  tpD.m_tiePoint.second.x = m_ui->m_x2LineEdit->text().toDouble();
691  tpD.m_tiePoint.second.y = m_ui->m_y2LineEdit->text().toDouble();
692 
693  ++m_tiePointIdCounter;
694  m_tiePoints[m_tiePointIdCounter] = tpD;
695 
696  tiePointsTableUpdate();
697  }
698 }
699 
701 {
702  transformationInfoUpdate();
703 }
704 
706 {
707  tiePointsTableUpdate();
708 }
709 
711 {
712  emit doneAcquiredTiePoints();
713 }
714 
716 {
717  drawTiePoints();
718 }
719 
721 {
722  drawTiePoints();
723 }
724 
726 {
727  refCoordPicked(x, y);
728 
729  drawTiePoints();
730 }
731 
733 {
734  adjCoordPicked(x, y);
735 
736  drawTiePoints();
737 }
738 
740 {
741  drawTiePoints();
742 }
743 
745 {
746  te::qt::widgets::SRSManagerDialog srsDialog(this);
747  srsDialog.setWindowTitle(tr("Choose the SRS"));
748 
749  if(srsDialog.exec() == QDialog::Accepted)
750  {
751  std::pair<int, std::string> srid = srsDialog.getSelectedSRS();
752 
753  QString strSRID;
754  strSRID.setNum(srid.first);
755  m_ui->m_sridLineEdit->setText(strSRID);
756  }
757 }
758 
760 {
761  // building the geometric transformation
762  te::gm::GTParameters transParams;
763 
764  te::qt::widgets::TiePointData::TPContainerT::const_iterator tPIt = m_tiePoints.begin();
765  const te::qt::widgets::TiePointData::TPContainerT::const_iterator tPItEnd = m_tiePoints.end();
766 
767  while( tPIt != tPItEnd )
768  {
769  transParams.m_tiePoints.push_back(tPIt->second.m_tiePoint);
770  ++tPIt;
771  }
772 
773  std::string geoTransfName = m_tiePointParameters->getTransformationName();
774 
775  std::auto_ptr<te::gm::GeometricTransformation> transfPtr(te::gm::GTFactory::make(geoTransfName));
776 
777  if(transfPtr.get())
778  {
779  if(!transfPtr->initialize(transParams))
780  transfPtr.reset();
781  }
782 
783  // updating the tie points table
784  m_ui->m_tiePointsTableWidget->blockSignals( true );
785  m_ui->m_tiePointsTableWidget->setSortingEnabled( false );
786 
787  m_ui->m_tiePointsTableWidget->setRowCount(0);
788 
789  double currTPError = 0;
790 
791  tPIt = m_tiePoints.begin();
792 
793  while( tPIt != tPItEnd )
794  {
795  int newrow = m_ui->m_tiePointsTableWidget->rowCount();
796  m_ui->m_tiePointsTableWidget->insertRow(newrow);
797 
798  const te::gm::GTParameters::TiePoint& currTP = tPIt->second.m_tiePoint;
799  currTPError = transfPtr.get() ? transfPtr->getDirectMappingError(currTP) : 0.0;
800 
801  //tie point id
802  QTableWidgetItem* itemId = new QTableWidgetItem;
803  itemId->setData(Qt::EditRole, tPIt->first);
804  itemId->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
805  m_ui->m_tiePointsTableWidget->setItem(newrow, 0, itemId);
806 
807  //tie point current tie point error
808  QTableWidgetItem* itemError = new QTableWidgetItem;
809  itemError->setData(Qt::EditRole, currTPError);
810  itemError->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
811  m_ui->m_tiePointsTableWidget->setItem(newrow, 1, itemError);
812 
813  //acquisition type
814  QString type;
815  if(tPIt->second.m_acqType == TiePointData::ManualAcquisitionT)
816  {
817  type = tr("Manual");
818  }
819  else
820  {
821  type = tr("Automatic");
822  }
823 
824  QTableWidgetItem* itemType = new QTableWidgetItem(type);
825  itemType->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
826  m_ui->m_tiePointsTableWidget->setItem(newrow, 2, itemType);
827 
828  //ref x coord
829  QTableWidgetItem* itemRefX = new QTableWidgetItem;
830  itemRefX->setData(Qt::EditRole, currTP.first.x);
831  itemRefX->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
832  m_ui->m_tiePointsTableWidget->setItem(newrow, 3, itemRefX);
833 
834  //ref y coord
835  QTableWidgetItem* itemRefY = new QTableWidgetItem;
836  itemRefY->setData(Qt::EditRole, currTP.first.y);
837  itemRefY->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
838  m_ui->m_tiePointsTableWidget->setItem(newrow, 4, itemRefY);
839 
840  //adj x coord
841  QTableWidgetItem* itemAdjX = new QTableWidgetItem;
842  itemAdjX->setData(Qt::EditRole, currTP.second.x);
843  itemAdjX->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
844  m_ui->m_tiePointsTableWidget->setItem(newrow, 5, itemAdjX);
845 
846  //adj y coord
847  QTableWidgetItem* itemAdjY = new QTableWidgetItem;
848  itemAdjY->setData(Qt::EditRole, currTP.second.y);
849  itemAdjY->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
850  m_ui->m_tiePointsTableWidget->setItem(newrow, 6, itemAdjY);
851 
852  //check if this item was selected
853  std::set<int>::iterator it = m_tiePointsSelected.find(tPIt->first);
854 
855  if(it != m_tiePointsSelected.end())
856  {
857  m_ui->m_tiePointsTableWidget->selectRow(newrow);
858  }
859 
860  ++tPIt;
861  }
862 
863  m_ui->m_tiePointsTableWidget->setSortingEnabled(true);
864  m_ui->m_tiePointsTableWidget->blockSignals( false );
865  m_ui->m_tiePointsTableWidget->resizeColumnsToContents();
866 
867  transformationInfoUpdate();
868 }
869 
871 {
872  // creating the transformations parameters
873  te::gm::GTParameters transParamsAllTP;
874  te::gm::GTParameters transParamsSelectedTP;
875  te::gm::GTParameters transParamsUnselectedTP;
876 
877  m_tiePointsSelected.clear();
878 
879  const int rowCount = m_ui->m_tiePointsTableWidget->rowCount();
880 
881  for(int row = 0; row < rowCount; ++row)
882  {
883  QTableWidgetItem* itemPtr = m_ui->m_tiePointsTableWidget->item(row, 0);
884 
885  int id = itemPtr->text().toUInt();
886 
887  te::qt::widgets::TiePointData::TPContainerT::iterator it = m_tiePoints.find(id);
888 
889  assert(it != m_tiePoints.end());
890 
891  const te::gm::GTParameters::TiePoint& tiePoint = it->second.m_tiePoint;
892 
893  if( itemPtr->isSelected() )
894  {
895  it->second.m_selected = true;
896 
897  transParamsSelectedTP.m_tiePoints.push_back(tiePoint);
898 
899  m_tiePointsSelected.insert(id);
900  }
901  else
902  {
903  it->second.m_selected = false;
904 
905  transParamsUnselectedTP.m_tiePoints.push_back(tiePoint);
906  }
907 
908  transParamsAllTP.m_tiePoints.push_back(tiePoint);
909  }
910 
911  // instantiating the transformations
912  std::string geoTransfName = m_tiePointParameters->getTransformationName();
913 
914  std::auto_ptr<te::gm::GeometricTransformation> transfAllTPPtr(te::gm::GTFactory::make(geoTransfName));
915  if(transfAllTPPtr.get())
916  if(!transfAllTPPtr->initialize(transParamsAllTP))
917  transfAllTPPtr.reset();
918 
919  std::auto_ptr<te::gm::GeometricTransformation> transfSelectedTPPtr(te::gm::GTFactory::make(geoTransfName));
920  if(transfSelectedTPPtr.get())
921  if(!transfSelectedTPPtr->initialize(transParamsSelectedTP))
922  transfSelectedTPPtr.reset();
923 
924  std::auto_ptr<te::gm::GeometricTransformation> transfUnselectedTPPtr(te::gm::GTFactory::make(geoTransfName));
925  if(transfUnselectedTPPtr.get())
926  if(!transfUnselectedTPPtr->initialize(transParamsUnselectedTP))
927  transfUnselectedTPPtr.reset();
928 
929  // updating widgets
930  m_ui->m_tiePointsNumberLineEdit->setText(QString::number(m_tiePoints.size()));
931 
932  if(transfAllTPPtr.get())
933  m_ui->m_transformationRMSEAllLineEdit->setText(QString::number(transfAllTPPtr->getDirectMapRMSE()));
934  else
935  m_ui->m_transformationRMSEAllLineEdit->setText("N/A");
936 
937  if(transfSelectedTPPtr.get())
938  m_ui->m_transformationRMSESelectedLineEdit->setText(QString::number(transfSelectedTPPtr->getDirectMapRMSE()));
939  else
940  m_ui->m_transformationRMSESelectedLineEdit->setText("N/A");
941 
942  if(transfUnselectedTPPtr.get())
943  m_ui->m_transformationRMSEunselectedLineEdit->setText(QString::number(transfUnselectedTPPtr->getDirectMapRMSE()));
944  else
945  m_ui->m_transformationRMSEunselectedLineEdit->setText("N/A");
946 
947  //emit signal
948  emit tiePointsUpdated();
949 }
950 
952 {
953  //reference
954  QGridLayout* layoutRef = new QGridLayout(m_ui->m_refWidget);
955 
956  m_refNavigator = new te::qt::widgets::RasterNavigatorWidget(m_ui->m_refWidget);
957  m_refNavigator->setWindowTitle(tr("Reference"));
958  m_refNavigator->setMinimumSize(550, 400);
959  m_refNavigator->hideGeomTool(true);
960  m_refNavigator->hideInfoTool(true);
961  m_refNavigator->hideBoxTool(true);
962 
963  layoutRef->addWidget(m_refNavigator);
964  layoutRef->setContentsMargins(0,0,0,0);
965 
966  connect(m_refNavigator, SIGNAL(mapDisplayExtentChanged()), this, SLOT(onRefMapDisplayExtentChanged()));
967  connect(m_refNavigator, SIGNAL(pointPicked(double, double)), this, SLOT(onRefPointPicked(double, double)));
968 
969  //adjust
970  QGridLayout* layoutAdj = new QGridLayout(m_ui->m_adjWidget);
971 
972  m_adjNavigator = new te::qt::widgets::RasterNavigatorWidget(m_ui->m_adjWidget);
973  m_adjNavigator->setWindowTitle(tr("Adjust"));
974  m_adjNavigator->setMinimumSize(550, 400);
975  m_adjNavigator->hideGeomTool(true);
976  m_adjNavigator->hideInfoTool(true);
977  m_adjNavigator->hideBoxTool(true);
978 
979  layoutAdj->addWidget(m_adjNavigator);
980  layoutAdj->setContentsMargins(0,0,0,0);
981 
982  connect(m_adjNavigator, SIGNAL(mapDisplayExtentChanged()), this, SLOT(onAdjMapDisplayExtentChanged()));
983  connect(m_adjNavigator, SIGNAL(pointPicked(double, double)), this, SLOT(onAdjPointPicked(double, double)));
984 }
985 
987 {
988  //get displays
989  te::qt::widgets::MapDisplay* refDisplay = m_refNavigator->getDisplay();
990  refDisplay->getDraftPixmap()->fill(QColor(0, 0, 0, 0));
991  const te::gm::Envelope& refMapExt = refDisplay->getExtent();
992  te::qt::widgets::Canvas refCanvasInstance(refDisplay->getDraftPixmap());
993  refCanvasInstance.setWindow(refMapExt.m_llx, refMapExt.m_lly, refMapExt.m_urx, refMapExt.m_ury);
994 
995  te::qt::widgets::MapDisplay* adjDisplay = m_adjNavigator->getDisplay();
996  adjDisplay->getDraftPixmap()->fill(QColor(0, 0, 0, 0));
997  const te::gm::Envelope& adjMapExt = adjDisplay->getExtent();
998  te::qt::widgets::Canvas adjCanvasInstance(adjDisplay->getDraftPixmap());
999  adjCanvasInstance.setWindow(adjMapExt.m_llx, adjMapExt.m_lly, adjMapExt.m_urx, adjMapExt.m_ury);
1000 
1001  //get rasters
1002  if(!m_refLayer.get())
1003  return;
1004  std::auto_ptr<te::da::DataSet> dsRef = m_refLayer->getData();
1005  if(!dsRef.get())
1006  return;
1007  std::size_t rpos = te::da::GetFirstPropertyPos(dsRef.get(), te::dt::RASTER_TYPE);
1008  std::auto_ptr<te::rst::Raster> rstRef = dsRef->getRaster(rpos);
1009  if(!rstRef.get())
1010  return;
1011 
1012  if(!m_adjLayer.get())
1013  return;
1014  std::auto_ptr<te::da::DataSet> dsAdj = m_adjLayer->getData();
1015  if(!dsAdj.get())
1016  return;
1017  rpos = te::da::GetFirstPropertyPos(dsAdj.get(), te::dt::RASTER_TYPE);
1018  std::auto_ptr<te::rst::Raster> rstAdj = dsAdj->getRaster(rpos);
1019  if(!rstAdj.get())
1020  return;
1021 
1022  //get tie points
1023  te::qt::widgets::TiePointData::TPContainerT tpc = getTiePointContainer();
1024 
1025  te::qt::widgets::TiePointData::TPContainerT::const_iterator it = tpc.begin();
1026 
1027  while(it != tpc.end())
1028  {
1029  int id = it->first;
1030 
1031  te::qt::widgets::TiePointData tpd = it->second;
1032 
1033  refCanvasInstance.setPointColor(te::color::RGBAColor(0,0,0, TE_TRANSPARENT));
1034  adjCanvasInstance.setPointColor(te::color::RGBAColor(0,0,0, TE_TRANSPARENT));
1035 
1036  //configure mark
1037  if(tpd.m_selected)
1038  {
1039  refCanvasInstance.setPointPattern(m_rgbaMarkSelected, PATTERN_SIZE, PATTERN_SIZE);
1040  adjCanvasInstance.setPointPattern(m_rgbaMarkSelected, PATTERN_SIZE, PATTERN_SIZE);
1041  }
1042  else
1043  {
1044  refCanvasInstance.setPointPattern(m_rgbaMarkUnselected, PATTERN_SIZE, PATTERN_SIZE);
1045  adjCanvasInstance.setPointPattern(m_rgbaMarkUnselected, PATTERN_SIZE, PATTERN_SIZE);
1046  }
1047 
1048  //ref coord
1049  te::gm::Coord2D refCoord = it->second.m_tiePoint.first;
1050  te::gm::Coord2D refGeoCoord;
1051  rstRef->getGrid()->gridToGeo(refCoord.x, refCoord.y, refGeoCoord.x, refGeoCoord.y );
1052 
1053  te::gm::Point refPoint(refGeoCoord.x, refGeoCoord.y);
1054  refCanvasInstance.draw(&refPoint);
1055 
1056  //ref text
1057  QMatrix matrix = refCanvasInstance.getMatrix();
1058  QPointF pointCanvas = matrix.map(QPointF(refGeoCoord.x, refGeoCoord.y));
1059  pointCanvas.setX(pointCanvas.x() + 8);
1060  QPointF pointGeo = matrix.inverted().map(pointCanvas);
1061  refPoint.setX(pointGeo.x());
1062  refPoint.setY(pointGeo.y());
1063  refCanvasInstance.drawText(&refPoint, QString::number(id).toStdString());
1064 
1065  //adj coord
1066  te::gm::Coord2D adjCoord = it->second.m_tiePoint.second;
1067  te::gm::Coord2D adjGeoCoord;
1068  rstAdj->getGrid()->gridToGeo(adjCoord.x, adjCoord.y, adjGeoCoord.x, adjGeoCoord.y );
1069 
1070  te::gm::Point adjPoint(adjGeoCoord.x, adjGeoCoord.y);
1071  adjCanvasInstance.draw(&adjPoint);
1072 
1073  //adj text
1074  matrix = adjCanvasInstance.getMatrix();
1075  pointCanvas = matrix.map(QPointF(adjGeoCoord.x, adjGeoCoord.y));
1076  pointCanvas.setX(pointCanvas.x() + 8);
1077  pointGeo = matrix.inverted().map(pointCanvas);
1078  adjPoint.setX(pointGeo.x());
1079  adjPoint.setY(pointGeo.y());
1080  adjCanvasInstance.drawText(&adjPoint, QString::number(id).toStdString());
1081 
1082  ++it;
1083  }
1084 
1085  //draw ref coord if exist
1086  te::gm::Coord2D refCoord;
1087  if(getReferenceTiePointCoord(refCoord))
1088  {
1089  refCanvasInstance.setPointColor(te::color::RGBAColor(0,0,0, TE_TRANSPARENT));
1090  refCanvasInstance.setPointPattern(m_rgbaMarkRef, PATTERN_SIZE, PATTERN_SIZE);
1091 
1092  te::gm::Coord2D refGeoCoord;
1093  rstRef->getGrid()->gridToGeo(refCoord.x, refCoord.y, refGeoCoord.x, refGeoCoord.y );
1094 
1095  te::gm::Point refPoint(refGeoCoord.x, refGeoCoord.y);
1096  refCanvasInstance.draw(&refPoint);
1097  }
1098 
1099  refDisplay->repaint();
1100  adjDisplay->repaint();
1101 }
1102 
1104 {
1105  QImage* img = te::qt::widgets::GetImage(rgba, PATTERN_SIZE, PATTERN_SIZE);
1106 
1107  QPixmap p = QPixmap::fromImage(*img);
1108 
1109  delete img;
1110 
1111  return p;
1112 }
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-points (te::gm::GTParameters::TiePoint::first are raster 1 line/column indexes...
std::vector< TiePoint > m_tiePoints
Tie points.
Definition: GTParameters.h:95
double y
y-coordinate.
Definition: Coord2D.h:114
std::vector< unsigned int > m_inRaster2Bands
Bands to be used from the input raster 2.
te::se::Mark * m_markRef
Represents the mark of a reference tie point.
bool m_enableProgress
Enable/Disable the progress interface (default:false).
unsigned int m_raster2TargetAreaLineStart
The first line of the raster 2 target area to process (default:0 - The entire raster will be consider...
double x
x-coordinate.
Definition: Coord2D.h:113
This file has the TiePointLocatorWidget class.
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.
double m_subSampleOptimizationRescaleFactor
Sub-sampled optimization tie-points search rescale factor (Tie-ponts will be searched into a subsabmp...
te::rst::Raster const * m_inRaster2Ptr
Input raster 2.
void tiePointsTableUpdate()
Uptate the tie-points table widget.
double m_urx
Upper right corner x-coordinate.
Definition: Envelope.h:346
TiePointLocatorWidget(QWidget *parent=0, Qt::WindowFlags f=0)
A widget to control the display of a set of layers.
Definition: MapDisplay.h:66
This file has the TiePointLocatorParametersWidget class.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
te::qt::widgets::TiePointLocatorParametersWidget * m_tiePointParameters
Tie Point parameters widget.
void createSelection(int initialIdx, int nPos)
std::pair< Coord2D, Coord2D > TiePoint
Tie point type definition.
Definition: GTParameters.h:59
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
Ui::TiePointLocatorWidgetForm * getForm() const
void getOutputResolution(double &resX, double &resY)
te::se::Mark * m_markSelected
Represents the mark of a selected tie point.
unsigned int m_raster1TargetAreaHeight
The raster 1 target area height (default:0 - The entire raster will be considered).
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
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 const std::string & getLastLogStr()
Returns the last log string generated by this module.
Definition: Module.h:53
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
double m_pixelSizeXRelation
The pixel resolution relation m_pixelSizeXRelation = raster1_pixel_res_x / raster2_pixel_res_x (defau...
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Definition: Raster.cpp:208
std::vector< unsigned int > m_inRaster1Bands
Bands to be used from the input raster 1.
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
Grid * getGrid()
It returns the raster grid.
Definition: Raster.cpp:94
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.
#define PATTERN_SIZE
te::rst::Raster const * m_inRaster1Ptr
Input raster 1.
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.
Ui::TiePointLocatorParametersWidgetForm * getWidgetForm()
Tie points locator.
This class is used to define a widget for tie point parameters acquirement.
unsigned int m_raster1TargetAreaWidth
The raster 1 target area width (default:0 - The entire raster will be considered).
void setX(const double &x)
It sets the Point x-coordinate value.
Definition: Point.h:143
double m_pixelSizeYRelation
The pixel resolution relation m_pixelSizeYRelation = raster1_pixel_res_y / raster2_pixel_res_y (defau...
virtual QPixmap * getDraftPixmap() const
It returns the map display draft pixmap.
Definition: MapDisplay.cpp:222
unsigned int m_raster1TargetAreaLineStart
The first line of the raster 1 target area to process (default:0 - The entire raster will be consider...
TEQTWIDGETSEXPORT QImage * GetImage(te::color::RGBAColor **img, int width, int height)
It creates a QImage from an RGBA color array.
Definition: Utils.cpp:69
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...
unsigned int m_raster2TargetAreaColStart
The first column of the raster 2 target area to process (default:0 - The entire raster will be consid...
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
unsigned int m_raster2TargetAreaHeight
The raster 2 target area height (default:0 - The entire raster will be considered).
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
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.
TiePointAcquisitionType m_acqType
Acquisition type.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Definition: Utils.cpp:481
void setY(const double &y)
It sets the Point y-coordinate value.
Definition: Point.h:157
A dialog used to build a SRSManagerDialog element.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
Definition: Envelope.cpp:92
void setReferenceLayer(te::map::AbstractLayerPtr layer)
This method is used to set the selected layer used to be the reference layer.
unsigned int m_raster1TargetAreaColStart
The first column of the raster 2 target area to process (default:0 - The entire raster will be consid...
unsigned int m_raster2TargetAreaWidth
The raster 2 target area width (default:0 - The entire raster will be considered).
const std::pair< int, std::string > & getSelectedSRS() const
Returns the selected SRS in the window.
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