CreateCellularSpaceDialog.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/connector/cellspace/CreateCellularSpaceDialog.cpp
22 
23  \brief ....
24 */
25 
26 // TerraLib
27 #include "../../../cellspace/CellSpaceOperations.h"
28 #include "../../../common/Exception.h"
29 #include "../../../common/progress/ProgressManager.h"
30 #include "../../../common/StringUtils.h"
31 #include "../../../core/translator/Translator.h"
32 #include "../../../core/uri/URI.h"
33 #include "../../../core/uri/Utils.h"
34 #include "../../../common/UnitsOfMeasureManager.h"
35 #include "../../../dataaccess/datasource/DataSource.h"
36 #include "../../../dataaccess/datasource/DataSourceFactory.h"
37 #include "../../../dataaccess/datasource/DataSourceInfoManager.h"
38 #include "../../../dataaccess/datasource/DataSourceTransactor.h"
39 #include "../../../dataaccess/datasource/DataSourceManager.h"
40 #include "../../../dataaccess/utils/Utils.h"
41 #include "../../../qt/widgets/layer/utils/DataSet2Layer.h"
42 #include "../../../qt/widgets/help/HelpPushButton.h"
43 #include "../../../qt/widgets/progress/ProgressViewerDialog.h"
44 #include "../../../qt/widgets/srs/SRSManagerDialog.h"
45 #include "../../../qt/widgets/utils/ScopedCursor.h"
46 #include "../../../srs/SpatialReferenceSystemManager.h"
47 #include "../../../srs/Converter.h"
48 #include "../../widgets/datasource/selector/DataSourceSelectorDialog.h"
49 #include "ui_CreateCellularSpaceDialogForm.h"
51 
52 // Qt
53 #include <QFileDialog>
54 #include <QMessageBox>
55 #include <QToolButton>
56 
57 // Boost
58 #include <boost/filesystem.hpp>
59 #include <boost/uuid/random_generator.hpp>
60 #include <boost/uuid/uuid_io.hpp>
61 
64 
65 te::qt::plugins::cellspace::CreateCellularSpaceDialog::CreateCellularSpaceDialog(QWidget* parent, Qt::WindowFlags f)
66  : QDialog(parent, f),
67  m_bbSRID(4618),
68  m_isFile(false),
69  m_outputDataSetName(""),
70  m_ui(new Ui::CreateCellularSpaceDialogForm)
71 {
72 // add controls
73  m_ui->setupUi(this);
74 
75 // Set icons
76  QSize iconSize(32, 32);
77 
78  m_ui->m_imgLabel->setPixmap(QIcon::fromTheme("cellspace-no-mask-hint").pixmap(48, 48));
79  m_ui->m_maskRadioButton->setIconSize(iconSize);
80  m_ui->m_maskRadioButton->setIcon(QIcon::fromTheme("cellspace-mask-hint"));
81  m_ui->m_noMaskRadioButton->setIconSize(iconSize);
82  m_ui->m_noMaskRadioButton->setIcon(QIcon::fromTheme("cellspace-no-mask-hint"));
83  m_ui->m_polygonsRadioButton->setIconSize(iconSize);
84  m_ui->m_polygonsRadioButton->setIcon(QIcon::fromTheme("cellspace-polygons-hint"));
85  m_ui->m_pointsRadioButton->setIconSize(iconSize);
86  m_ui->m_pointsRadioButton->setIcon(QIcon::fromTheme("cellspace-points-hint"));
87  m_ui->m_targetDatasourceToolButton->setIcon(QIcon::fromTheme("datasource"));
88  m_ui->m_srsToolButton->setIcon(QIcon::fromTheme("srs"));
89 
90 // Set validators
91  m_ui->m_llxLineEdit->setValidator(new QDoubleValidator(this));
92  m_ui->m_llyLineEdit->setValidator(new QDoubleValidator(this));
93  m_ui->m_urxLineEdit->setValidator(new QDoubleValidator(this));
94  m_ui->m_uryLineEdit->setValidator(new QDoubleValidator(this));
95  m_ui->m_resXLineEdit->setValidator(new QDoubleValidator(0, 99999999, 8, this));
96  m_ui->m_resYLineEdit->setValidator(new QDoubleValidator(0, 99999999, 8, this));
97 
98  initUnitsOfMeasure();
99 
100  connect(m_ui->m_layersComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLayersComboBoxChanged(int)));
101  connect(m_ui->m_unitComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onUnitComboBoxChanged(int)));
102 
103  connect(m_ui->m_resXLineEdit, SIGNAL(editingFinished()), this, SLOT(onResXLineEditEditingFinished()));
104  connect(m_ui->m_resYLineEdit, SIGNAL(editingFinished()), this, SLOT(onResYLineEditEditingFinished()));
105  connect(m_ui->m_llxLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onEnvelopeChanged(const QString &)));
106  connect(m_ui->m_llyLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onEnvelopeChanged(const QString &)));
107  connect(m_ui->m_urxLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onEnvelopeChanged(const QString &)));
108  connect(m_ui->m_uryLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onEnvelopeChanged(const QString &)));
109 
110  connect(m_ui->m_targetFileToolButton, SIGNAL(clicked()), this, SLOT(onTargetFileToolButtonClicked()));
111  connect(m_ui->m_targetDatasourceToolButton, SIGNAL(clicked()), this, SLOT(onTargetDatasourceToolButtonClicked()));
112  connect(m_ui->m_createPushButton, SIGNAL(clicked()), this, SLOT(onCreatePushButtonClicked()));
113  connect(m_ui->m_srsToolButton, SIGNAL(clicked()), this, SLOT(onSrsToolButtonClicked()));
114 
115  m_ui->m_helpPushButton->setNameSpace("dpi.inpe.br.plugins");
116  m_ui->m_helpPushButton->setPageReference("plugins/cellspace/cellspace.html");
117 }
118 
120  ~CreateCellularSpaceDialog() = default;
121 
122 void te::qt::plugins::cellspace::CreateCellularSpaceDialog::setLayers(std::list<te::map::AbstractLayerPtr> layers)
123 {
124  if (layers.empty())
125  {
126  m_ui->m_noMaskRadioButton->setChecked(true);
127  m_ui->m_maskRadioButton->setEnabled(false);
128  m_ui->m_resSRIDLabel->setText("No SRS defined");
129  m_ui->m_layerSRIDLabel->setText("No SRS defined");
130  m_ui->m_unitComboBox->setCurrentIndex(0);
131  m_bbSRID = 0;
132  return;
133  }
134 
135  std::list<te::map::AbstractLayerPtr>::iterator it = layers.begin();
136  m_bbSRID = it->get()->getSRID();
137  while(it != layers.end())
138  {
139  m_ui->m_layersComboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant::fromValue(*it));
140  ++it;
141  }
142  m_ui->m_layersComboBox->setCurrentIndex(0);
143 }
144 
146 {
147  if(m_isFile)
148  {
149  // let's include the new datasource in the managers
150  boost::uuids::basic_random_generator<boost::mt19937> gen;
151  boost::uuids::uuid u = gen();
152  std::string id_ds = boost::uuids::to_string(u);
153 
154  boost::filesystem::path uri(m_outDataSourceInfo->getConnInfo().host() + m_outDataSourceInfo->getConnInfo().path());
155 
157  ds->setConnInfo(m_outDataSourceInfo->getConnInfo());
158  ds->setTitle(uri.stem().string());
159  ds->setAccessDriver("OGR");
160  ds->setType("OGR");
161  ds->setDescription(uri.string());
162  ds->setId(id_ds);
163 
164  te::da::DataSourcePtr newds = te::da::DataSourceManager::getInstance().get(id_ds, "OGR", ds->getConnInfo());
165  newds->open();
168 
169  m_outputDataSetName = uri.stem().string();
170  }
171 
173  outDataSource->open();
174 
176 
177  te::da::DataSetTypePtr dt(outDataSource->getDataSetType(m_outputDataSetName).release());
178 
179  te::map::AbstractLayerPtr layer = converter(dt);
180 
181  layer->setSRID(m_bbSRID);
182 
183  return layer;
184 }
185 
186 // whenever the reference layer changes the parameters of the new cellular space will bem modified accordingly
188 {
190  if(!layer)
191  return;
192 
193  m_bbSRID = layer->getSRID();
194  int precision = 2;
195  if (m_bbSRID>0)
196  {
198  if (unit->getId() == te::common::UOM_Degree ||
199  unit->getId() == te::common::UOM_Radian)
200  precision = 6;
201  m_ui->m_resSRIDLabel->setText(te::srs::SpatialReferenceSystemManager::getInstance().getName(m_bbSRID).c_str());
202  m_ui->m_layerSRIDLabel->setText(te::srs::SpatialReferenceSystemManager::getInstance().getName(m_bbSRID).c_str());
203  setResolutionUnit(unit);
204  }
205  else
206  {
207  m_ui->m_resSRIDLabel->setText("No SRS defined");
208  m_ui->m_layerSRIDLabel->setText("No SRS defined");
209  m_ui->m_unitComboBox->setCurrentIndex(0);
210  precision = 6;
211  }
212  showEnvelope(layer->getExtent(),precision);
213 
214  if(layer->getSchema()->hasRaster())
215  {
216  m_ui->m_maskRadioButton->setEnabled(false);
217  m_ui->m_noMaskRadioButton->setChecked(true);
218  }
219  else
220  {
221  m_ui->m_maskRadioButton->setEnabled(true);
222  m_ui->m_maskRadioButton->setChecked(true);
223  }
224 
225 }
226 
227 
229 {
230  clearResolution();
231 }
232 
234 {
235  te::qt::widgets::SRSManagerDialog srsDialog(this);
236  srsDialog.setWindowTitle(tr("Choose the SRS"));
237 
238  if(srsDialog.exec() == QDialog::Rejected)
239  return;
240 
241  int newSRID = srsDialog.getSelectedSRS().first;
242 
243  if (m_ui->m_maskRadioButton->isChecked())
244  {
246  if (refLayer &&
247  ((newSRID <= 0 && refLayer->getSRID() > 0) ||
248  (newSRID > 0 && refLayer->getSRID() <= 0) ))
249  m_ui->m_noMaskRadioButton->setChecked(true);
250  }
251 
252  if (newSRID <= 0)
253  {
254  m_ui->m_unitComboBox->setCurrentIndex(0);
255  m_ui->m_resSRIDLabel->setText("No SRS defined");
256  }
257  else
258  {
259  std::string name = te::srs::SpatialReferenceSystemManager::getInstance().getName(newSRID);
260  m_ui->m_resSRIDLabel->setText(name.c_str());
261  if (m_bbSRID > 0)
262  {
264  clearEnvelope();
265  if (env.isValid())
266  {
267  int precision = 2;
269  if (unit->getId() == te::common::UOM_Degree ||
270  unit->getId() == te::common::UOM_Radian)
271  precision = 6;
272 
273  env.transform(m_bbSRID,newSRID);
274  showEnvelope(env, precision);
275  }
276  }
277  }
278  m_bbSRID = newSRID;
280  setResolutionUnit(unit);
281  clearResolution();
282 }
283 
284 // if user change the unit it will have to re-enter resolution
286 {
287  if (m_bbSRID <= 0 && index != 0)
288  {
289  QMessageBox::warning(this, tr("Cellular Spaces"), tr("There is no no spatial reference defined for the new cellular space. It is not possible to select a unit for the resolution."));
290  m_ui->m_unitComboBox->setCurrentIndex(0);
291  return;
292  }
293 
294  if (index == 0)
295  return;
296 
297  clearResolution();
298 
301 
302  if (!resUnit || !bbUnit)
303  return;
304 
305  if (resUnit == bbUnit)
306  return;
307 
308  if ((te::common::UnitsOfMeasureManager::getInstance().areConvertible(bbUnit->getName(), resUnit->getName()) || // units are convertible
309  // accepting an exception to deal with the most common case: bounding box in geographic coordinates
310  // and resolution in meters, kilometers or foot
312  (resUnit->getId() == te::common::UOM_Metre ||
313  resUnit->getId() == te::common::UOM_Foot ||
314  resUnit->getId() == te::common::UOM_Kilometre)) ||
316  (resUnit->getId() == te::common::UOM_Radian ||
317  resUnit->getId() == te::common::UOM_Degree ))))
318  return;
319 
320  QMessageBox::warning(this, tr("Cellular Spaces"), tr("Unable to convert between the selected unit for the resolution and the unit of new cell layer SRS"));
321  m_ui->m_unitComboBox->setItemText(m_ui->m_unitComboBox->currentIndex(), QString(bbUnit->getName().c_str()));
322 }
323 
325 {
327  if(!env.isValid())
328  {
329  QMessageBox::warning(this, tr("Cellular Spaces"), tr("Invalid bounding box."));
330  return;
331  }
332 
333  double resX = m_ui->m_resXLineEdit->text().toDouble();
335 
336  int maxCols = (int)ceil((env.m_urx - env.m_llx)/resX);
337  m_ui->m_colsLineEdit->setText(QString::number(maxCols));
338 }
339 
341 {
343  if(!env.isValid())
344  {
345  QMessageBox::warning(this, tr("Cellular Spaces"), tr("Invalid bounding box."));
346  return;
347  }
348 
349  double resY = m_ui->m_resXLineEdit->text().toDouble();
351 
352  int maxRows = (int)ceil((env.m_ury - env.m_lly)/resY);
353  m_ui->m_rowsLineEdit->setText(QString::number(maxRows));
354 }
355 
357 {
358  m_ui->m_newLayerNameLineEdit->clear();
359  m_ui->m_repositoryLineEdit->clear();
360 
362  dlg.exec();
363 
364  std::list<te::da::DataSourceInfoPtr> dsPtrList = dlg.getSelecteds();
365 
366  if(dsPtrList.empty())
367  return;
368 
369  std::list<te::da::DataSourceInfoPtr>::iterator it = dsPtrList.begin();
370 
371  m_outDataSourceInfo = *it;
372 
373  m_ui->m_repositoryLineEdit->setText(QString(it->get()->getTitle().c_str()));
374 
375  m_isFile = false;
376 
377  m_ui->m_newLayerNameLineEdit->setEnabled(true);
378 }
379 
381 {
382  m_ui->m_newLayerNameLineEdit->clear();
383  m_ui->m_repositoryLineEdit->clear();
384 
385  if (m_ui->m_colsLineEdit->text().isEmpty())
387 
388  if (m_ui->m_rowsLineEdit->text().isEmpty())
390 
391  QString extension;
392 
393  std::string accessDriver;
394 
395  extension = tr("Shapefile (*.shp *.SHP);;");
396  accessDriver = "OGR";
397 
398  QString fileName = QFileDialog::getSaveFileName(this, tr("Save as..."),
399  QString(), extension, nullptr, QFileDialog::DontConfirmOverwrite);
400 
401  if (fileName.isEmpty())
402  return;
403 
404  boost::filesystem::path outfile(fileName.toUtf8().data());
405  std::string aux = outfile.leaf().string();
406  m_ui->m_newLayerNameLineEdit->setText(aux.c_str());
407  aux = outfile.string();
408  m_ui->m_repositoryLineEdit->setText(aux.c_str());
409 
410  m_isFile = true;
411 
412  m_ui->m_newLayerNameLineEdit->setEnabled(false);
413 
414  std::string connInfo("file://");
415  connInfo += m_ui->m_repositoryLineEdit->text().toUtf8().data();
416 
418 
419  m_outDataSourceInfo->setAccessDriver(accessDriver);
420  m_outDataSourceInfo->setConnInfo(connInfo);
421 }
422 
424 {
425  std::string errors;
426  if(!checkList(errors))
427  {
428  QMessageBox::warning(this, tr("Cellular Spaces"), errors.c_str());
429  return;
430  }
431 
432  std::unique_ptr<te::cellspace::CellularSpacesOperations> cellSpaceOp(new te::cellspace::CellularSpacesOperations());
433 
435 
436  if(m_ui->m_polygonsRadioButton->isChecked())
437  {
439  }
440  else
441  {
443  }
444 
445  te::map::AbstractLayerPtr referenceLayer;
446  if (m_ui->m_maskRadioButton->isChecked())
447  referenceLayer = getReferenceLayer();
448 
449  m_outputDataSetName = m_ui->m_newLayerNameLineEdit->text().toUtf8().data();
450 
451 
452  //progress
454 
455  try
456  {
457  te::qt::widgets::ScopedCursor cursor(Qt::WaitCursor);
458  cellSpaceOp->createCellSpace(m_outDataSourceInfo, m_outputDataSetName,
460  type,
461  referenceLayer);
462  }
463  catch(te::common::Exception& e)
464  {
465  this->setCursor(Qt::ArrowCursor);
466  QMessageBox::warning(this, tr("Cellular Spaces"), e.what());
467  reject();
468  return;
469  }
470 
471  this->setCursor(Qt::ArrowCursor);
472  accept();
473 }
474 
476 {
477  m_ui->m_unitComboBox->addItem("UNIT");
478 
481  while (it != itend)
482  {
483  te::common::UnitOfMeasurePtr uptr = it->second;
484  if (it->second->getType() == te::common::Length ||
485  it->second->getType() == te::common::Angle)
486  m_ui->m_unitComboBox->addItem(uptr->getName().c_str(), QVariant::fromValue(uptr));
487  ++it;
488  }
489 
490  if(m_bbSRID > 0)
491  {
493  if (unit.get())
494  setResolutionUnit(unit);
495  return;
496  }
497  m_ui->m_unitComboBox->setCurrentIndex(0);
498 }
499 
501 {
502  m_ui->m_llxLineEdit->setText(QString::number(env.m_llx,'f',precision));
503  m_ui->m_llyLineEdit->setText(QString::number(env.m_lly,'f',precision));
504  m_ui->m_urxLineEdit->setText(QString::number(env.m_urx,'f',precision));
505  m_ui->m_uryLineEdit->setText(QString::number(env.m_ury,'f',precision));
506 }
507 
509 {
510  if (!unit)
511  {
512  m_ui->m_unitComboBox->setCurrentIndex(0);
513  return;
514  }
515 
516  for(int i = 0; i < m_ui->m_unitComboBox->count(); ++i)
517  {
518  std::string name = m_ui->m_unitComboBox->itemText(i).toUtf8().data();
519 
520  if(unit->getName() == name)
521  {
522  m_ui->m_unitComboBox->setCurrentIndex(i);
523  break;
524  }
525  }
526 }
527 
529 {
530  QVariant varUnit = m_ui->m_unitComboBox->itemData(m_ui->m_unitComboBox->currentIndex(), Qt::UserRole);
531  return varUnit.value<te::common::UnitOfMeasurePtr>();
532 }
533 
535 {
536  QVariant varLayer = m_ui->m_layersComboBox->itemData(m_ui->m_layersComboBox->currentIndex(), Qt::UserRole);
537  return varLayer.value<te::map::AbstractLayerPtr>();
538 }
539 
541 {
542  te::gm::Envelope env;
543  env.m_llx = m_ui->m_llxLineEdit->text().toDouble();
544  env.m_lly = m_ui->m_llyLineEdit->text().toDouble();
545  env.m_urx = m_ui->m_urxLineEdit->text().toDouble();
546  env.m_ury = m_ui->m_uryLineEdit->text().toDouble();
547 
548  return env;
549 }
550 
552 {
553  m_ui->m_llxLineEdit->clear();
554  m_ui->m_llyLineEdit->clear();
555  m_ui->m_urxLineEdit->clear();
556  m_ui->m_uryLineEdit->clear();
557 }
558 
559 
561 {
562  double resX = m_ui->m_resXLineEdit->text().toDouble();
563  if (m_bbSRID <=0) // if there is no output SRS defined
564  return resX; // no check to be done
565 
567 
568  return resX;
569 }
570 
572 {
573  double resY = m_ui->m_resYLineEdit->text().toDouble();
574  if (m_bbSRID <=0) // if there is no output SRS defined
575  return resY; // no check to be done
576 
578 
579  return resY;
580 }
581 
582 
586 {
587  // no need to convert
588  if(from == to)
589  return true;
590 
591  if (!from || !to)
592  return false;
593 
594  // check to see if conversion is possible
595  if (te::common::UnitsOfMeasureManager::getInstance().areConvertible(from->getName(), to->getName()))
596  {
597  try
598  {
599  double factor = te::common::UnitsOfMeasureManager::getInstance().getConversion(from->getName(),to->getName());
600  res *= factor;
601  return true;
602  }
603  catch(te::common::Exception& /*e*/)
604  {
605  return false;
606  }
607  }
608 
609  // try to handle the most common: degree <-> meters and its variations
610  if (from->getId() == te::common::UOM_Degree)
611  return (convertAngleToPlanar(res, to));
612 
613  if (to->getId() == te::common::UOM_Degree)
614  return (convertPlanarToAngle(res, from));
615 
616  return false;
617 }
618 
620 {
621  switch (planar->getId())
622  {
624  val *= 111000; // 1 degree = 111.000 meters
625  break;
627  val *= 111; // 1 degree = 111 kilometers
628  break;
630  val *= 364173.24; // 1 feet = 3.28084 meters
631  break;
632  default:
633  return false;
634  }
635  return true;
636 }
637 
639 {
640  switch (planar->getId())
641  {
643  val /= 111000; // 1 degree = 111.000 meters
644  break;
646  val /= 111; // 1 degree = 111 kilometers
647  break;
649  val /= 364173.24; // 1 feet = 3.28084 meters
650  break;
651  default:
652  return false;
653  }
654  return true;
655 }
656 
658 {
659  m_ui->m_resXLineEdit->clear();
660  m_ui->m_resYLineEdit->clear();
661  m_ui->m_colsLineEdit->clear();
662  m_ui->m_rowsLineEdit->clear();
663 }
664 
666 {
667  if (m_bbSRID > 0)
668  {
670  m_ui->m_resSRIDLabel->setText(name.c_str());
671  }
672  else
673  {
674  m_ui->m_resSRIDLabel->setText("No SRS defined");
675  }
676 }
677 
679 {
680  bool noErrors = true;
681  errors = tr("Consistency errors:").toUtf8().data();
682 
684  if(!env.isValid())
685  {
686  errors += "\n - " + std::string(tr("Invalid bounding box").toUtf8().data());
687  noErrors = false;
688  }
689 
690  double resX = getResX();
691  if (resX <= 0. || resX >= env.getWidth())
692  {
693  char txt[40];
694  sprintf(txt,"%.8g",env.getWidth());
695  errors += "\n - " + std::string(tr("X resolution must be greater than 0 and smaller than the bounding box Width ").toUtf8().data()) + txt;
696  noErrors = false;
697  }
698 
699  double resY = getResY();
700  if (resY <= 0. || resY >= env.getHeight())
701  {
702  char txt[40];
703  sprintf(txt,"%.8g",env.getHeight());
704  errors += "\n - " + std::string(tr("Y resolution must be greater than 0 and smaller than the bounding box Height ").toUtf8().data()) + txt;
705  noErrors = false;
706  }
707 
708  std::string name = m_ui->m_newLayerNameLineEdit->text().toUtf8().data();
709  if (name.empty())
710  {
711  errors += "\n - " + std::string(tr("Output layer name is empty").toUtf8().data());
712  noErrors = false;
713  }
714 
715  if (m_ui->m_maskRadioButton->isChecked())
716  {
717  te::map::AbstractLayerPtr referenceLayer = getReferenceLayer();
718  if (!((referenceLayer->getSRID() > 0 && m_bbSRID > 0) ||
719  (referenceLayer->getSRID() <= 0 && m_bbSRID <= 0)))
720  {
721  errors += "\n - " + std::string(tr("Reference layer and output layer have incompatible SRSs. It is not possible to create cells using polygons as masks.").toUtf8().data());
722  noErrors = false;
723  }
724  }
725  return noErrors;
726 }
727 
const_iterator begin() const
It returns an iterator to the beginning of the conteiner.
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
This class provide cellular spaces operations.
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
boost::shared_ptr< DataSource > DataSourcePtr
virtual const char * what() const
It outputs the exception message.
double m_urx
Upper right corner x-coordinate.
double getWidth() const
It returns the envelope width.
static te::dt::Date ds(2010, 01, 01)
const_iterator end() const
It returns an iterator to the end of the conteiner.
bool convertPlanarToAngle(double &val, te::common::UnitOfMeasurePtr planar)
double m_llx
Lower left corner x-coordinate.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
bool unitConvertion(double &res, te::common::UnitOfMeasurePtr from, te::common::UnitOfMeasurePtr to)
An Envelope defines a 2D rectangular region.
std::map< unsigned int, UnitOfMeasurePtr >::const_iterator const_iterator
URI C++ Library.
Definition: Attributes.h:37
static te::dt::TimeDuration dt(20, 30, 50, 11)
double getConversion(const std::string &unitFromName, const std::string &unitToName) const
Calculates a multiplicative factor to convert from a given unit to its base unit and vice-versa...
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
double m_lly
Lower left corner y-coordinate.
std::unique_ptr< Ui::CreateCellularSpaceDialogForm > m_ui
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
const std::list< te::da::DataSourceInfoPtr > & getSelecteds() const
double m_ury
Upper right corner y-coordinate.
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
void showEnvelope(const te::gm::Envelope &env, int precision)
A dialog for selecting a data source.
A class that represents a data source component.
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.
double getHeight() const
It returns the envelope height.
const std::pair< int, std::string > & getSelectedSRS() const
Returns the selected SRS in the window.
bool isValid() const
It tells if the rectangle is valid or not.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
An object that when created shows a cursor during its scope.
Definition: ScopedCursor.h:48
bool convertAngleToPlanar(double &val, te::common::UnitOfMeasurePtr planar)
Q_DECLARE_METATYPE(te::map::AbstractLayerPtr) Q_DECLARE_METATYPE(te