TINGenerationDialog.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/mnt/qt/TINGenerationDialog.cpp
22 
23 \brief A dialog for TIN generation
24 */
25 
26 //terralib
27 #include "../../core/filesystem/FileSystem.h"
28 #include "../../core/translator/Translator.h"
29 #include "../../common/Exception.h"
30 #include "../../common/progress/ProgressManager.h"
31 #include "../../common/UnitsOfMeasureManager.h"
32 #include "../../dataaccess/datasource/DataSourceFactory.h"
33 #include "../../dataaccess/datasource/DataSourceInfoManager.h"
34 #include "../../dataaccess/datasource/DataSourceManager.h"
35 #include "../../dataaccess/utils/Utils.h"
36 #include "../../geometry/GeometryProperty.h"
37 #include "../../maptools/DataSetLayer.h"
38 #include "../../mnt/core/TINGeneration.h"
39 #include "../../mnt/core/Utils.h"
40 #include "../../qt/widgets/progress/ProgressViewerDialog.h"
41 #include "../../qt/widgets/datasource/selector/DataSourceSelectorDialog.h"
42 #include "../../qt/widgets/layer/utils/DataSet2Layer.h"
43 #include "../../qt/widgets/srs/SRSManagerDialog.h"
44 #include "../../qt/widgets/utils/FileDialog.h"
45 #include "../../srs/SpatialReferenceSystemManager.h"
46 
47 #include "LayerSearchDialog.h"
48 #include "TINGenerationDialog.h"
49 #include "ui_TINGenerationDialogForm.h"
50 
51 // Qt
52 #include <QFileDialog>
53 #include <QMessageBox>
54 
55 // BOOST
56 #include <boost/algorithm/string.hpp>
57 #include <boost/filesystem.hpp>
58 #include <boost/lexical_cast.hpp>
59 #include <boost/uuid/random_generator.hpp>
60 #include <boost/uuid/uuid_io.hpp>
61 
63  : QDialog(parent, f),
64  m_ui(new Ui::TINGenerationDialogForm),
65  m_layers(std::list<te::map::AbstractLayerPtr>())
66 {
67  // add controls
68  m_ui->setupUi(this);
69 
70  //signals
71  connect(m_ui->m_isolinesSearchToolButton, SIGNAL(clicked()), this, SLOT(onInputIsolinesToolButtonClicked()));
72  connect(m_ui->m_isolinescomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onIsolinesComboBoxChanged(int)));
73  connect(m_ui->m_sampleSearchToolButton, SIGNAL(clicked()), this, SLOT(onInputSamplesToolButtonClicked()));
74  connect(m_ui->m_samplescomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onSamplesComboBoxChanged(int)));
75 
76  connect(m_ui->m_scalepushButton, SIGNAL(clicked()), this, SLOT(onScalePushButtonClicked()));
77 
78  connect(m_ui->m_yesradioButton, SIGNAL(toggled(bool)), this, SLOT(onYesToggled()));
79  connect(m_ui->m_noradioButton, SIGNAL(toggled(bool)), this, SLOT(onNoToggled()));
80  connect(m_ui->m_breaklinecomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onBreakLinesComboBoxChanged(int)));
81  connect(m_ui->m_breaklineSearchToolButton, SIGNAL(clicked()), this, SLOT(onInputBreaklineToolButtonClicked()));
82 
83  m_ui->m_targetDatasourceToolButton->setIcon(QIcon::fromTheme("datasource"));
84  connect(m_ui->m_targetDatasourceToolButton, SIGNAL(pressed()), this, SLOT(onTargetDatasourceToolButtonPressed()));
85  connect(m_ui->m_targetFileToolButton, SIGNAL(pressed()), this, SLOT(onTargetFileToolButtonPressed()));
86 
87  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
88  connect(m_ui->m_cancelPushButton, SIGNAL(clicked()), this, SLOT(onCancelPushButtonClicked()));
89 
90  m_ui->m_helpPushButton->setNameSpace("dpi.inpe.br.plugins");
91  m_ui->m_helpPushButton->setPageReference("plugins/mnt/DTM_TIN.html");
92 
93  m_ui->m_srsToolButton->setIcon(QIcon::fromTheme("srs"));
94  connect(m_ui->m_srsToolButton, SIGNAL(clicked()), this, SLOT(onSrsToolButtonClicked()));
95 
96  m_ui->m_noradioButton->setChecked(true);
97  m_ui->m_isolinescomboBox->addItem(QString(""), QVariant(""));
98  m_ui->m_samplescomboBox->addItem(QString(""), QVariant(""));
99  m_ui->m_breaklinecomboBox->addItem(QString(""), QVariant(""));
100 
101  m_isosrid = 0;
102  m_samplesrid = 0;
103  m_outsrid = 0;
104 
105 
106 }
107 
109 
110 void te::mnt::TINGenerationDialog::setLayers(std::list<te::map::AbstractLayerPtr> layers)
111 {
112  m_layers = layers;
113 
114  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
115 
116  while (it != m_layers.end())
117  {
118  if (it->get())
119  {
120  if (it->get()->isValid())
121  {
122  std::unique_ptr<te::da::DataSetType> dsType(it->get()->getSchema());
123  mntType type = getMNTType(dsType.get());
124 
125  if (type == SAMPLE)
126  m_ui->m_samplescomboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant(it->get()->getId().c_str()));
127 
128  if (type == ISOLINE)
129  {
130  m_ui->m_isolinescomboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant(it->get()->getId().c_str()));
131  m_ui->m_breaklinecomboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant(it->get()->getId().c_str()));
132  }
133  }
134  }
135  ++it;
136  }
137 }
138 
140 {
141  LayerSearchDialog search(this->parentWidget());
142  search.setLayers(m_layers);
143  QList<mntType> types;
144  types.append(ISOLINE);
145  search.setActive(types);
146 
147  if (search.exec() != QDialog::Accepted)
148  {
149  return;
150  }
151 
152  int index = m_ui->m_isolinescomboBox->findText(search.getLayer().get()->getTitle().c_str());
153  m_ui->m_isolinescomboBox->setCurrentIndex(index);
154 }
155 
157 {
158  m_ui->m_isolinesZcomboBox->clear();
159  m_isolinesLayer = nullptr;
160  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
161  std::string layerID = m_ui->m_isolinescomboBox->itemData(index, Qt::UserRole).toString().toUtf8().data();
162  try{
163  while (it != m_layers.end())
164  {
165  if(layerID == it->get()->getId())
166  {
167  m_isolinesLayer = it->get();
168  std::unique_ptr<te::da::DataSetType> dsType = it->get()->getSchema();
169 
170  te::map::DataSetLayer* dsisoLayer = dynamic_cast<te::map::DataSetLayer*>(m_isolinesLayer.get());
171  if (!dsisoLayer)
172  throw te::common::Exception(TE_TR("Can not execute this operation on this type of layer."));
173 
175  if (!m_isolinesDataSource.get())
176  throw te::common::Exception(TE_TR("The selected input data source can not be accessed."));
177 
178  m_isosrid = dsisoLayer->getSRID();
179 
181 
182  m_isoSetName = dsisoLayer->getDataSetName();
183 
184  std::unique_ptr<te::da::DataSet> inDset = m_isolinesDataSource->getDataSet(m_isoSetName);
185  std::size_t geo_pos = te::da::GetFirstPropertyPos(inDset.get(), te::dt::GEOMETRY_TYPE);
186  inDset->moveFirst();
187  std::unique_ptr<te::gm::Geometry> gin = inDset->getGeometry(geo_pos);
188  if (gin->is3D())
189  {
190  m_ui->m_isolinesZlabel->hide();
191  m_ui->m_isolinesZcomboBox->hide();
192  return;
193  }
194 
195  m_ui->m_isolinesZlabel->show();
196  m_ui->m_isolinesZcomboBox->show();
197 
198  std::vector<te::dt::Property*> props = dsType->getProperties();
199  for (std::size_t i = 0; i < props.size(); ++i)
200  {
201  switch (props[i]->getType())
202  {
203  case te::dt::FLOAT_TYPE:
204  case te::dt::DOUBLE_TYPE:
205  case te::dt::INT16_TYPE:
206  case te::dt::INT32_TYPE:
207  case te::dt::INT64_TYPE:
208  case te::dt::UINT16_TYPE:
209  case te::dt::UINT32_TYPE:
210  case te::dt::UINT64_TYPE:
212  m_ui->m_isolinesZcomboBox->addItem(QString(props[i]->getName().c_str()), QVariant(props[i]->getName().c_str()));
213  break;
214  }
215  }
216  break;
217  }
218  it++;
219  }
220  }
221  catch (const std::exception& e)
222  {
223  QMessageBox::information(this, tr("TIN Generation"), e.what());
224  return;
225  }
226 }
227 
229 {
230  LayerSearchDialog search(this->parentWidget());
231  search.setLayers(m_layers);
232  QList<mntType> types;
233  types.append(SAMPLE);
234  search.setActive(types);
235 
236  if (search.exec() != QDialog::Accepted)
237  {
238  return;
239  }
240 
241  int index = m_ui->m_samplescomboBox->findText(search.getLayer().get()->getTitle().c_str());
242  m_ui->m_samplescomboBox->setCurrentIndex(index);
243 }
244 
246 {
247  try{
248  m_ui->m_samplesZcomboBox->clear();
249  m_samplesLayer = nullptr;
250  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
251  std::string layerID = m_ui->m_samplescomboBox->itemData(index, Qt::UserRole).toString().toUtf8().data();
252  while (it != m_layers.end())
253  {
254  if(layerID == it->get()->getId())
255  {
256  m_samplesLayer = it->get();
257 
258  te::map::DataSetLayer* dssampleLayer = dynamic_cast<te::map::DataSetLayer*>(m_samplesLayer.get());
259  if (!dssampleLayer)
260  throw te::common::Exception(TE_TR("Can not execute this operation on this type of layer."));
261 
263  if (!m_samplesDataSource.get())
264  throw te::common::Exception(TE_TR("The selected input data source can not be accessed."));
265 
266  m_sampleSetName = dssampleLayer->getDataSetName();
267  m_samplesrid = dssampleLayer->getSRID();
269 
270  std::unique_ptr<te::da::DataSet> inDset = m_samplesDataSource->getDataSet(m_sampleSetName);
271  std::size_t geo_pos = te::da::GetFirstPropertyPos(inDset.get(), te::dt::GEOMETRY_TYPE);
272  inDset->moveFirst();
273  std::unique_ptr<te::gm::Geometry> gin = inDset->getGeometry(geo_pos);
274  if (gin->is3D())
275  {
276  m_ui->m_samplesZlabel->hide();
277  m_ui->m_samplesZcomboBox->hide();
278  return;
279  }
280 
281  m_ui->m_samplesZlabel->show();
282  m_ui->m_samplesZcomboBox->show();
283 
284  std::unique_ptr<te::da::DataSetType> dsType = m_samplesLayer->getSchema();
285  std::vector<te::dt::Property*> props = dsType->getProperties();
286 
287  for (std::size_t i = 0; i < props.size(); ++i)
288  {
289  switch (props[i]->getType())
290  {
291  case te::dt::FLOAT_TYPE:
292  case te::dt::DOUBLE_TYPE:
293  case te::dt::INT16_TYPE:
294  case te::dt::INT32_TYPE:
295  case te::dt::INT64_TYPE:
296  case te::dt::UINT16_TYPE:
297  case te::dt::UINT32_TYPE:
298  case te::dt::UINT64_TYPE:
300  m_ui->m_samplesZcomboBox->addItem(QString(props[i]->getName().c_str()), QVariant(props[i]->getName().c_str()));
301  break;
302  }
303  }
304  }
305  it++;
306  }
307  }
308  catch (const std::exception& e)
309  {
310  QMessageBox::information(this, tr("TIN Generation"), e.what());
311  return;
312  }
313 }
314 
316 {
317  m_scale = m_ui->m_scalelineEdit->text().toDouble();
318  m_breaktol = m_tol = (m_scale * 0.4) / 1000;
319  m_distance = m_tol * 20;
320  m_edgeSize = m_tol / 5;
321 
322  m_ui->m_minedgelineEdit->setText(QString::number(m_edgeSize));
323  m_ui->m_tollineEdit->setText(QString::number(m_tol));
324  m_ui->m_breaktollineEdit->setText(QString::number(m_breaktol));
325  m_ui->m_distancelineEdit->setText(QString::number(m_distance));
326 
327 }
328 
330 {
331  m_ui->m_breaklinelabel->setEnabled(true);
332  m_ui->m_breaklinecomboBox->setEnabled(true);
333  m_ui->m_breaktollabel->setEnabled(true);
334  m_ui->m_breaktollineEdit->setEnabled(true);
335 }
336 
338 {
339  m_ui->m_breaklinecomboBox->setCurrentIndex(0);
340  m_ui->m_breaklinelabel->setDisabled(true);
341  m_ui->m_breaklinecomboBox->setDisabled(true);
342  m_ui->m_breaktollabel->setDisabled(true);
343  m_ui->m_breaktollineEdit->setDisabled(true);
344 }
345 
347 {
348  m_breaklinesLayer = nullptr;
349  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
350  std::string layerID = m_ui->m_breaklinecomboBox->itemData(index, Qt::UserRole).toString().toUtf8().data();
351  while (it != m_layers.end())
352  {
353  if(layerID == it->get()->getId())
354  {
355  m_breaklinesLayer = it->get();
356  break;
357  }
358  it++;
359  }
360 }
361 
363 {
364  LayerSearchDialog search(this->parentWidget(), nullptr, false);
365  search.setLayers(m_layers);
366  QList<mntType> types;
367  types.append(ISOLINE);
368  search.setActive(types);
369 
370  if (search.exec() != QDialog::Accepted)
371  {
372  return;
373  }
374 
375  int index = m_ui->m_breaklinecomboBox->findText(search.getLayer().get()->getTitle().c_str());
376  m_ui->m_breaklinecomboBox->setCurrentIndex(index);
377 }
378 
380 {
381  m_ui->m_newLayerNameLineEdit->clear();
382  m_ui->m_newLayerNameLineEdit->setEnabled(true);
384  dlg.exec();
385 
386  std::list<te::da::DataSourceInfoPtr> dsPtrList = dlg.getSelecteds();
387 
388  if (dsPtrList.empty())
389  return;
390 
391  std::list<te::da::DataSourceInfoPtr>::iterator it = dsPtrList.begin();
392 
393  m_ui->m_repositoryLineEdit->setText(QString(it->get()->getTitle().c_str()));
394 
395  m_outputDatasource = *it;
396 
397  m_toFile = false;
398 }
399 
401 {
402  m_ui->m_newLayerNameLineEdit->clear();
403  m_ui->m_repositoryLineEdit->clear();
404 
406 
407  try {
408  fileDialog.exec();
409  }
410  catch (const std::exception& e)
411  {
412  QMessageBox::information(this, tr("TIN Generation"), e.what());
413  return;
414  }
415 
416  m_ui->m_newLayerNameLineEdit->setText(fileDialog.getFileName().c_str());
417  m_ui->m_repositoryLineEdit->setText(fileDialog.getPath().c_str());
418 
419  m_toFile = true;
420  m_ui->m_newLayerNameLineEdit->setEnabled(false);
421 }
422 
424 {
425  //progress
427 
428  try
429  {
430  QApplication::setOverrideCursor(Qt::WaitCursor);
431 
432  if (!m_isolinesLayer.get() && !m_samplesLayer.get())
433  throw te::common::Exception(TE_TR("Select a input layer."));
434 
435  if (m_ui->m_yesradioButton->isChecked() && !m_breaklinesLayer.get())
436  throw te::common::Exception(TE_TR("Select a breakline layer."));
437 
438  bool ok;
439  m_edgeSize = m_ui->m_minedgelineEdit->text().toDouble(&ok);
440  if (!ok)
441  throw te::common::Exception(TE_TR("Define a Minimal Edge Size."));
442 
444 
445  // Checking consistency of the input layer where the buffer will executed
446  if (m_isolinesLayer.get())
447  {
448  m_tol = m_ui->m_tollineEdit->text().toDouble(&ok);
449  if (!ok)
450  throw te::common::Exception(TE_TR("Define a isolines tolerance."));
451 
452  m_distance = m_ui->m_distancelineEdit->text().toDouble(&ok);
453  if (!ok)
454  throw te::common::Exception(TE_TR("Define a distance of isolines points."));
455 
457  }
458  if (m_samplesLayer.get())
459  {
461  }
462 
463  if (m_samplesLayer.get() && m_isolinesLayer.get())
464  {
465  if (m_isosrid != m_samplesrid)
466  throw te::common::Exception(TE_TR("Different SRID."));
467  }
468 
469  if (m_breaklinesLayer.get())
470  {
471  m_breaktol = m_ui->m_breaktollineEdit->text().toDouble(&ok);
472  if (!ok)
473  throw te::common::Exception(TE_TR("Define a breaklines tolerance."));
474 
475  te::map::DataSetLayer* dsbreaklineLayer = dynamic_cast<te::map::DataSetLayer*>(m_breaklinesLayer.get());
476  if (!dsbreaklineLayer)
477  throw te::common::Exception(TE_TR("Can not execute this operation on this type of layer."));
478 
479  te::da::DataSourcePtr inDataSource = te::da::GetDataSource(dsbreaklineLayer->getDataSourceId(), true);
480  if (!inDataSource.get())
481  throw te::common::Exception(TE_TR("The selected input data source can not be accessed."));
482 
483  std::string inDsetNamebreakline = dsbreaklineLayer->getDataSetName();
484  Tin->setBreakLine(inDataSource, inDsetNamebreakline, inDataSource->getDataSetType(inDsetNamebreakline), m_breaktol);
485  }
486 
487  // Checking consistency of output paramenters
488  if (m_ui->m_repositoryLineEdit->text().isEmpty())
489  throw te::common::Exception(TE_TR("Select a repository for the resulting layer."));
490 
491  if (m_ui->m_newLayerNameLineEdit->text().isEmpty())
492  throw te::common::Exception(TE_TR("Define a name for the resulting layer."));
493 
494  std::string outputdataset = m_ui->m_newLayerNameLineEdit->text().toUtf8().data();
495 
496  std::string dsinfo("file://");
497  boost::filesystem::path uri(m_ui->m_repositoryLineEdit->text().toUtf8().data());
498 
499  if (m_toFile)
500  {
501  if (te::core::FileSystem::exists(uri.string()))
502  throw te::common::Exception(TE_TR("Output file already exists. Remove it or select a new name and try again."));
503 
504  std::size_t idx = outputdataset.find(".");
505  if (idx != std::string::npos)
506  outputdataset = outputdataset.substr(0, idx);
507 
508  dsinfo += uri.string();
509 
510  te::da::DataSourcePtr dsOGR(te::da::DataSourceFactory::make("OGR", dsinfo).release());
511  dsOGR->open();
512 
513  if (dsOGR->dataSetExists(outputdataset))
514  throw te::common::Exception(TE_TR("There is already a dataset with the requested name in the output data source. Remove it or select a new name and try again."));
515 
516  Tin->setOutput(dsOGR, outputdataset);
517  }
518  else
519  {
521  if (!aux)
522  throw te::common::Exception(TE_TR("The selected output datasource can not be accessed."));
523 
524  if (aux->dataSetExists(outputdataset))
525  throw te::common::Exception(TE_TR("There is already a dataset with the requested name in the output data source. Remove it or select a new name and try again."));
526 
527  Tin->setOutput(aux, outputdataset);
528  }
529 
530  Tin->setSRID(m_outsrid);
531 
532  if (m_outsrid>0)
533  {
535  if (unitin.get())
536  {
538 
539  if (unitin->getId() != te::common::UOM_Metre)
540  {
541  convertPlanarToAngle(m_tol, unitout);
544  }
545  }
546  }
547 
548  Tin->setParams(m_tol, m_distance, m_edgeSize, m_ui->m_isolinesZcomboBox->currentText().toUtf8().data(), m_ui->m_samplesZcomboBox->currentText().toUtf8().data());
549 
550  int method = m_ui->m_typecomboBox->currentIndex();
551  Tin->setMethod(method);
552 
553  bool result = Tin->run();
554 
555  if (result)
556  {
557  if (m_toFile)
558  {
559  // let's include the new datasource in the managers
560  boost::uuids::basic_random_generator<boost::mt19937> gen;
561  boost::uuids::uuid u = gen();
562  std::string id = boost::uuids::to_string(u);
563 
565  ds->setConnInfo(dsinfo);
566  ds->setTitle(uri.stem().string());
567  ds->setAccessDriver("OGR");
568  ds->setType("OGR");
569  ds->setDescription(uri.string());
570  ds->setId(id);
571 
572  te::da::DataSourcePtr newds = te::da::DataSourceManager::getInstance().get(id, "OGR", ds->getConnInfo());
573  newds->open();
576  }
577 
578  // creating a layer for the result
580 
582 
583  te::da::DataSetTypePtr dt(outDataSource->getDataSetType(outputdataset).release());
584  m_outputLayer = converter(dt);
585  }
586 
587  delete Tin;
588  }
589  catch (const std::exception& e)
590  {
591  QApplication::restoreOverrideCursor();
592  QMessageBox::information(this, tr("TIN Generation"), e.what());
593  return;
594  }
595  QApplication::restoreOverrideCursor();
596  accept();
597 }
598 
600 {
601  reject();
602 }
603 
605 {
606  return m_outputLayer;
607 }
608 
610 {
611  te::qt::widgets::SRSManagerDialog srsDialog(this);
612  srsDialog.setWindowTitle(tr("Choose the SRS"));
613 
614  if (srsDialog.exec() == QDialog::Rejected)
615  return;
616 
617  int newSRID = srsDialog.getSelectedSRS().first;
618 
619  setSRID(newSRID);
620 
621 }
622 
624 {
625  if (newSRID <= 0)
626  {
627  m_ui->m_resSRIDLabel->setText("No SRS defined");
628  }
629  else
630  {
631  std::string name = te::srs::SpatialReferenceSystemManager::getInstance().getName(newSRID);
632  if (name.size())
633  m_ui->m_resSRIDLabel->setText(name.c_str());
634  else
635  m_ui->m_resSRIDLabel->setText(QString("%1").arg(newSRID));
636  }
637  m_outsrid = newSRID;
638 
639 }
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
double m_scale
Triangulation scale.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
TEMNTEXPORT bool convertPlanarToAngle(double &val, te::common::UnitOfMeasurePtr unit)
Defines a component for choose a file.
Definition: FileDialog.h:52
std::list< te::map::AbstractLayerPtr > m_layers
List of layers.
static bool exists(const std::string &path)
Checks if a given path in UTF-8 exists.
Definition: FileSystem.cpp:142
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
te::map::AbstractLayerPtr m_outputLayer
Generated Layer.
te::map::AbstractLayerPtr getLayer()
boost::shared_ptr< DataSource > DataSourcePtr
std::string m_sampleSetName
Samples DataSetLayer name.
A dialog Layer Search.
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
It sets the Datasource that is being used to save TIN.
static te::dt::Date ds(2010, 01, 01)
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
double m_distance
Triangulation lines simplification maximum distance.
void setBreakLine(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetType > inDsetType, double tol)
It sets the BreakLine Datasource that is being used to generate TIN.
void setSRID(int srid)
Definition: Tin.cpp:177
double m_tol
Triangulation lines simplification tolerance.
te::da::DataSourceInfoPtr m_outputDatasource
DataSource information.
static SpatialReferenceSystemManager & getInstance()
It returns a reference to the singleton instance.
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
te::map::AbstractLayerPtr getLayer()
void exec()
This method will open the dialog of file selection and populate the class members with the chosen fil...
Definition: FileDialog.cpp:54
std::string m_isoSetName
Isolines DataSetLayer name.
URI C++ Library.
Definition: Attributes.h:37
static te::dt::TimeDuration dt(20, 30, 50, 11)
A dialog TIN generation.
void setMethod(int method)
double m_breaktol
Triangulation breaklines simplification tolerance.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Class to generate TIN.
Definition: TINGeneration.h:37
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
std::string getPath()
This method will return the chosen path.
Definition: FileDialog.cpp:103
const std::string & getDataSetName() const
Class to define TIN strutures.
Definition: Tin.h:276
const std::list< te::da::DataSourceInfoPtr > & getSelecteds() const
bool run()
Generate TIN \ return true or false.
void setActive(const QList< mntType > &types)
A dialog for selecting a data source.
te::map::AbstractLayerPtr m_samplesLayer
Points layer.
te::da::DataSourcePtr m_samplesDataSource
Samples DataSourcePtr.
A class that represents a data source component.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
te::da::DataSourcePtr m_isolinesDataSource
Isolines DataSourcePtr.
A layer with reference to a dataset.
Definition: DataSetLayer.h:47
std::unique_ptr< Ui::TINGenerationDialogForm > m_ui
std::string getFileName()
This method will return the file name.
Definition: FileDialog.cpp:113
UnitOfMeasurePtr find(unsigned int id) const
Returns a unit of measure identified by its identificaton.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
TEMNTEXPORT te::mnt::mntType getMNTType(const te::da::DataSetType *dt)
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetType > inDsetType, InputType type)
It sets the Datasource that is being used to generate TIN.
te::map::AbstractLayerPtr m_isolinesLayer
Isolines layer.
te::map::AbstractLayerPtr m_breaklinesLayer
BreakLines layer.
A dialog used to build a SRSManagerDialog element.
double m_edgeSize
Triangulation edges minimum size.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
virtual const std::string & getDataSourceId() const
const std::pair< int, std::string > & getSelectedSRS() const
Returns the selected SRS in the window.
TINGenerationDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
Set the layer that can be used.
void setParams(const double &tolerance, const double &maxdist, const double &minedgesize, const std::string &atrz_iso, const std::string &atrz_pt)
It sets the parameters to generate TIN.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr