DifferenceDialog.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/vp/qt/DifferenceDialog.cpp
22 
23  \brief Difference operation dialog.
24 */
25 
26 // TerraLib
27 #include "../../core/filesystem/FileSystem.h"
28 #include "../../core/logger/Logger.h"
29 #include "../../core/translator/Translator.h"
30 #include "../../common/progress/ProgressManager.h"
31 #include "../../common/StringUtils.h"
32 
33 #include "../../dataaccess/dataset/DataSet.h"
34 #include "../../dataaccess/dataset/DataSetType.h"
35 
36 #include "../../dataaccess/datasource/DataSourceCapabilities.h"
37 #include "../../dataaccess/datasource/DataSourceInfo.h"
38 #include "../../dataaccess/datasource/DataSourceInfoManager.h"
39 #include "../../dataaccess/datasource/DataSourceManager.h"
40 #include "../../dataaccess/datasource/DataSourceFactory.h"
41 
42 #include "../../dataaccess/utils/Utils.h"
43 
44 #include "../../datatype/Property.h"
45 #include "../../datatype/SimpleData.h"
46 
47 #include "../../geometry/GeometryProperty.h"
48 
49 #include "../../qt/widgets/datasource/selector/DataSourceSelectorDialog.h"
50 #include "../../qt/widgets/layer/utils/DataSet2Layer.h"
51 #include "../../qt/widgets/progress/ProgressViewerDialog.h"
52 #include "../../qt/widgets/utils/DoubleListWidget.h"
53 #include "../../qt/widgets/utils/FileDialog.h"
54 
55 #include "../ComplexData.h"
56 #include "../Exception.h"
57 #include "../Difference.h"
58 #include "../Utils.h"
59 
60 #include "DifferenceDialog.h"
61 #include "ui_DifferenceDialogForm.h"
62 #include "Utils.h"
63 
64 // Qt
65 #include <QFileDialog>
66 #include <QGridLayout>
67 #include <QMessageBox>
68 
69 // BOOST
70 #include <boost/filesystem.hpp>
71 #include <boost/uuid/random_generator.hpp>
72 #include <boost/uuid/uuid_io.hpp>
73 
74 
76 
77 te::vp::DifferenceDialog::DifferenceDialog(QWidget* parent, Qt::WindowFlags f)
78  : QDialog(parent, f),
79  m_ui(new Ui::DifferenceDialogForm),
80  m_layers(std::list<te::map::AbstractLayerPtr>())
81 {
82 // add controls
83  m_ui->setupUi(this);
84 
85  m_ui->m_imgLabel->setPixmap(QIcon::fromTheme("vp-difference-hint").pixmap(112, 48));
86  m_ui->m_targetDatasourceToolButton->setIcon(QIcon::fromTheme("datasource"));
87 
88  //add double list widget to this form
89  m_doubleListWidget.reset(new te::qt::widgets::DoubleListWidget(m_ui->m_specificParamsTabWidget->widget(0)));
90  m_doubleListWidget->setLeftLabel("");
91  m_doubleListWidget->setRightLabel("");
92 
93  QGridLayout* layout = new QGridLayout(m_ui->m_specificParamsTabWidget->widget(0));
94  layout->addWidget(m_doubleListWidget.get());
95  layout->setContentsMargins(0, 0, 0, 0);
96 
97  QSize iconSize(96, 48);
98 
99  m_ui->m_singleRadioButton->setIconSize(iconSize);
100  m_ui->m_singleRadioButton->setIcon(QIcon::fromTheme("vp-single-objects"));
101 
102  m_ui->m_multiRadioButton->setIconSize(iconSize);
103  m_ui->m_multiRadioButton->setIcon(QIcon::fromTheme("vp-multi-objects"));
104 
105  connect(m_ui->m_inputLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onInputLayerComboBoxChanged(int)));
106  connect(m_ui->m_differenceLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDifferenceLayerComboBoxChanged(int)));
107  connect(m_ui->m_targetDatasourceToolButton, SIGNAL(pressed()), this, SLOT(onTargetDatasourceToolButtonPressed()));
108  connect(m_ui->m_targetFileToolButton, SIGNAL(pressed()), this, SLOT(onTargetFileToolButtonPressed()));
109  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
110  connect(m_ui->m_cancelPushButton, SIGNAL(clicked()), this, SLOT(onCancelPushButtonClicked()));
111 
112  m_ui->m_helpPushButton->setNameSpace("dpi.inpe.br.plugins");
113  m_ui->m_helpPushButton->setPageReference("plugins/vp/vp_difference.html");
114 }
115 
117 
118 void te::vp::DifferenceDialog::setLayers(std::list<te::map::AbstractLayerPtr> layers)
119 {
120  std::list<te::map::AbstractLayerPtr>::iterator it = layers.begin();
121 
122  while (it != layers.end())
123  {
124  std::unique_ptr<te::da::DataSetType> dsType = it->get()->getSchema();
125  if (dsType->hasGeom())
126  {
127  m_layers.push_back(*it);
128  }
129 
130  ++it;
131  }
132 
134 
136 
138 }
139 
141 {
142  return m_layerResult;
143 }
144 
146 {
147  std::vector<std::string> outVec = m_doubleListWidget->getOutputValues();
148  std::vector<std::string> result;
149 
150  for (std::size_t i = 0; i < outVec.size(); ++i)
151  {
152  std::vector<std::string> tok;
153  te::common::Tokenize(outVec[i], tok, ": ");
154 
155  result.push_back(tok[1]);
156  }
157 
158  return result;
159 }
160 
162 {
163  if (m_ui->m_singleRadioButton->isChecked())
164  return false;
165 
166  return true;
167 }
168 
170 {
171  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
172 
173  disconnect(m_ui->m_inputLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onInputLayerComboBoxChanged(int)));
174 
175  while (it != m_layers.end())
176  {
177  m_ui->m_inputLayerComboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant::fromValue(*it));
178  ++it;
179  }
180 
181  connect(m_ui->m_inputLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onInputLayerComboBoxChanged(int)));
182 
183  QVariant varLayer = m_ui->m_inputLayerComboBox->itemData(m_ui->m_inputLayerComboBox->currentIndex(), Qt::UserRole);
184  te::map::AbstractLayerPtr layer = varLayer.value<te::map::AbstractLayerPtr>();
185 
186  m_inputSelectedLayer = layer;
187 }
188 
190 {
191  int currIndex = m_ui->m_inputLayerComboBox->currentIndex();
192 
193  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
194 
195  disconnect(m_ui->m_differenceLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDifferenceLayerComboBoxChanged(int)));
196 
197  while (it != m_layers.end())
198  {
199  m_ui->m_differenceLayerComboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant::fromValue(*it));
200  ++it;
201  }
202 
203  m_ui->m_differenceLayerComboBox->removeItem(currIndex);
204 
205  connect(m_ui->m_differenceLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDifferenceLayerComboBoxChanged(int)));
206 
207  QVariant varLayer = m_ui->m_differenceLayerComboBox->itemData(m_ui->m_differenceLayerComboBox->currentIndex(), Qt::UserRole);
208  te::map::AbstractLayerPtr layer = varLayer.value<te::map::AbstractLayerPtr>();
209 
211 }
212 
214 {
215  std::vector<std::string> inputValues;
216 
217  std::unique_ptr<te::da::DataSetType> inputSchema;
218 
220  inputSchema = m_inputSelectedLayer->getSchema();
221  else
222  return;
223 
224  std::vector<te::dt::Property*> inputProps = inputSchema->getProperties();
225  for (std::size_t i = 0; i < inputProps.size(); ++i)
226  {
227  if (inputProps[i]->getType() != te::dt::GEOMETRY_TYPE)
228  {
229  std::string name = inputSchema->getTitle();
230 
231  if (name.empty())
232  name = inputSchema->getName();
233 
234  inputValues.push_back(name + ": " + inputProps[i]->getName());
235  }
236  }
237 
238  m_doubleListWidget->setInputValues(inputValues);
239 }
240 
242 {
243  QVariant varLayer = m_ui->m_inputLayerComboBox->itemData(index, Qt::UserRole);
244  te::map::AbstractLayerPtr layer = varLayer.value<te::map::AbstractLayerPtr>();
245 
246  m_ui->m_differenceLayerComboBox->clear();
247  m_doubleListWidget->clearOutputValues();
248 
249  m_inputSelectedLayer = layer;
250 
252 
254 }
255 
257 {
258  QVariant varLayer = m_ui->m_differenceLayerComboBox->itemData(index, Qt::UserRole);
259  te::map::AbstractLayerPtr layer = varLayer.value<te::map::AbstractLayerPtr>();
260 
262 }
263 
265 {
266  m_ui->m_newLayerNameLineEdit->clear();
267  m_ui->m_newLayerNameLineEdit->setEnabled(true);
269  dlg.exec();
270 
271  std::list<te::da::DataSourceInfoPtr> dsPtrList = dlg.getSelecteds();
272 
273  if (dsPtrList.empty())
274  return;
275 
276  std::list<te::da::DataSourceInfoPtr>::iterator it = dsPtrList.begin();
277 
278  m_ui->m_repositoryLineEdit->setText(QString(it->get()->getTitle().c_str()));
279 
280  m_outputDatasource = *it;
281 
282  m_toFile = false;
283 }
284 
286 {
287  m_ui->m_newLayerNameLineEdit->clear();
288  m_ui->m_repositoryLineEdit->clear();
289 
290 
292 
293  try {
294  fileDialog.exec();
295  }
296  catch (te::common::Exception& ex) {
297  QMessageBox::warning(this, tr("File information"), ex.what());
298  return;
299  }
300 
301  m_ui->m_repositoryLineEdit->setText(fileDialog.getPath().c_str());
302  m_ui->m_newLayerNameLineEdit->setText(fileDialog.getFileName().c_str());
303 
304  m_toFile = true;
305  m_ui->m_newLayerNameLineEdit->setEnabled(false);
306 }
307 
309 {
310 // Validate Input Layer.
311  if (m_ui->m_inputLayerComboBox->currentText().isEmpty())
312  {
313  QMessageBox::warning(this, TE_TR("Difference"), TE_TR("Select an input layer."));
314  return;
315  }
316 
317 // Validate DataSource.
318  te::da::DataSourcePtr inputDataSource = te::da::GetDataSource(m_inputSelectedLayer->getDataSourceId(), true);
319  if (!inputDataSource.get())
320  {
321  QMessageBox::information(this, "Difference", "The selected input data source can not be accessed.");
322  return;
323  }
324 
325 
326 // Validate Difference Layer.
327  if (m_ui->m_differenceLayerComboBox->currentText().isEmpty())
328  {
329  QMessageBox::warning(this, TE_TR("Difference"), TE_TR("Select a layer to do the difference."));
330  return;
331  }
332 
333 // Validate DataSource.
334  te::da::DataSourcePtr differenceDataSource = te::da::GetDataSource(m_differenceSelectedLayer->getDataSourceId(), true);
335  if (!differenceDataSource.get())
336  {
337  QMessageBox::information(this, "Difference", "The selected difference data source can not be accessed.");
338  return;
339  }
340 
341 // Get output attributes.
342  std::vector<std::string> attributesVec = this->getSelectedProperties();
343  std::map<std::string, te::dt::AbstractData*> specificParams;
344 
345  if (!attributesVec.empty())
346  {
347  specificParams["ATTRIBUTES"] = new te::vp::ComplexData<std::vector<std::string> >(attributesVec);
348  }
349 
350 // Verify if the result is Single or Multi Geometry type
351  specificParams["IS_COLLECTION"] = new te::dt::SimpleData<bool, te::dt::BOOLEAN_TYPE>(this->isCollection());
352 
353 
354 // Validade output repository.
355  if(m_ui->m_repositoryLineEdit->text().isEmpty())
356  {
357  QMessageBox::warning(this, tr("Difference"), tr("Select a repository for the resulting layer."));
358  return;
359  }
360 
361  if(m_ui->m_newLayerNameLineEdit->text().isEmpty())
362  {
363  QMessageBox::warning(this, tr("Difference"), tr("Define a name for the resulting layer."));
364  return;
365  }
366 
367  if ((m_inputSelectedLayer->getSRID() == TE_UNKNOWN_SRS && m_differenceSelectedLayer->getSRID() != TE_UNKNOWN_SRS) ||
369  {
370  int ret = QMessageBox::question(this, "Difference", "The two layers have incompatible SRS. The result might be incorrect. Do you wish to continue?", QMessageBox::No, QMessageBox::Yes);
371  if (ret == QMessageBox::No)
372  return;
373  }
374 
375  // Verify if "Input Only Selected objects" is checked.
376  bool inputIsChecked = false;
377 
378  if (m_ui->m_inputOnlySelectedCheckBox->isChecked())
379  inputIsChecked = true;
380 
381 
382  // Verify if "Difference Only Selected objects" is checked.
383  bool differenceIsChecked = false;
384 
385  if (m_ui->m_diffOnlySelectedCheckBox->isChecked())
386  differenceIsChecked = true;
387 
388 
389 // Progress
391 
392  try
393  {
394 // Declare the input parameters
395  te::vp::InputParams structInputParams1;
396  te::vp::InputParams structInputParams2;
397 
398 
399 // Set the inputLayer parameters
400  structInputParams1.m_inputDataSource = inputDataSource;
401  structInputParams1.m_inputDataSetType = m_inputSelectedLayer->getSchema().release();
402 
403 // Set the differenceLayer parameters
404  structInputParams2.m_inputDataSource = differenceDataSource;
405  structInputParams2.m_inputDataSetType = m_differenceSelectedLayer->getSchema().release();
406 
407 
408 // Verify SRID
409  te::gm::GeometryProperty* geomInputProp = te::da::GetFirstGeomProperty(structInputParams1.m_inputDataSetType);
410 
411  int inputSRID = 0;
412 
413  if (!geomInputProp)
414  {
415  QMessageBox::information(this, "Difference", "Problem to get geometry property of input layer.");
416 
417  return;
418  }
419 
420  if (m_inputSelectedLayer->getSRID() != geomInputProp->getSRID())
421  inputSRID = m_inputSelectedLayer->getSRID();
422 
423 
425 
426  int differenceSRID = 0;
427 
428  if (!geomDiffProp)
429  {
430  QMessageBox::information(this, "Difference", "Problem to get geometry property of difference layer.");
431 
432  return;
433  }
434 
435  if (m_differenceSelectedLayer->getSRID() != geomDiffProp->getSRID())
436  differenceSRID = m_differenceSelectedLayer->getSRID();
437 
438 
439 // Select a strategy based on the capabilities of the input datasource
440  const te::da::DataSourceCapabilities inputDSCapabilities = inputDataSource->getCapabilities();
441  const te::da::DataSourceCapabilities differenceDSCapabilities = differenceDataSource->getCapabilities();
442 
443  bool isQuery = false;
444 
445  te::da::Select* inputSelect = nullptr;
446  te::da::Select* differenceSelect = nullptr;
447 
448  if ((inputDSCapabilities.getQueryCapabilities().supportsSpatialSQLDialect() &&
449  differenceDSCapabilities.getQueryCapabilities().supportsSpatialSQLDialect()) &&
450  (inputDataSource->getId() == differenceDataSource->getId()) &&
451  (m_inputSelectedLayer->getSRID() == m_differenceSelectedLayer->getSRID()))
452  {
453  isQuery = true;
454 
455 // Get Select Query using AbstractLayerPtr to process by spatial database.
456  inputSelect = te::vp::GetSelectQueryFromLayer(m_inputSelectedLayer, inputIsChecked, inputSRID);
457  differenceSelect = te::vp::GetSelectQueryFromLayer(m_differenceSelectedLayer, differenceIsChecked, differenceSRID);
458 
459  if (inputSelect)
460  structInputParams1.m_inputQuery = inputSelect;
461 
462  if (differenceSelect)
463  structInputParams2.m_inputQuery = differenceSelect;
464  }
465  else
466  {
467 
468 // Get DataSet and DataSetType using AbstractLayerPtr to process by memory, using GEOS.
469  te::vp::DataStruct inputData = te::vp::GetDataStructFromLayer(m_inputSelectedLayer, inputIsChecked, inputSRID);
470 
471  if (inputData.m_dataSet)
472  structInputParams1.m_inputDataSet = inputData.m_dataSet;
473 
474  if (inputData.m_dataSetType)
475  structInputParams1.m_inputDataSetType = inputData.m_dataSetType;
476 
477 
478  te::vp::DataStruct differenceData = te::vp::GetDataStructFromLayer(m_differenceSelectedLayer, differenceIsChecked, differenceSRID);
479 
480  if (differenceData.m_dataSet)
481  structInputParams2.m_inputDataSet = differenceData.m_dataSet;
482 
483  if (differenceData.m_dataSetType)
484  structInputParams2.m_inputDataSetType = differenceData.m_dataSetType;
485  }
486 
487 
488  m_inputParams.push_back(structInputParams1);
489  m_inputParams.push_back(structInputParams2);
490 
491 
492 // Get the output dataset name.
493  std::string outputdataset = m_ui->m_newLayerNameLineEdit->text().toUtf8().data();
494 
495 // Return of operation result.
496  bool res = true;
497 
498  if (m_toFile)
499  {
500  boost::filesystem::path uri(m_ui->m_repositoryLineEdit->text().toUtf8().data());
501 
502  if (te::core::FileSystem::exists(uri.string()))
503  {
504  QMessageBox::information(this, "Difference", "Output file already exists. Remove it and try again. ");
505 
506  return;
507  }
508 
509  std::size_t idx = outputdataset.find(".");
510  if(idx != std::string::npos)
511  outputdataset = outputdataset.substr(0, idx);
512 
513  std::string dsinfo("file://");
514  dsinfo += uri.string();
515 
516  te::da::DataSourcePtr dsOGR(te::da::DataSourceFactory::make("OGR", dsinfo).release());
517 
518  dsOGR->open();
519 
520  this->setCursor(Qt::WaitCursor);
521 
522 // Set parameters (Input/Output).
526  m_params->setOutputDataSetName(outputdataset);
527  m_params->setSpecificParams(specificParams);
528 
530 
531  if (isQuery)
532  {
533  res = difference.executeQuery(m_params);
534  }
535  else
536  {
537  res = difference.executeMemory(m_params);
538  }
539 
540  if(!res)
541  {
542  dsOGR->close();
543 
544  QMessageBox::information(this, "Difference", "Error: could not generate the difference.");
545 
546  this->setCursor(Qt::ArrowCursor);
547 
548  reject();
549  }
550 
551  // let's include the new datasource in the managers
552  boost::uuids::basic_random_generator<boost::mt19937> gen;
553  boost::uuids::uuid u = gen();
554  std::string ds_id = boost::uuids::to_string(u);
555 
557  ds->setConnInfo(dsinfo);
558  ds->setTitle(uri.stem().string());
559  ds->setAccessDriver("OGR");
560  ds->setType("OGR");
561  ds->setDescription(uri.string());
562  ds->setId(ds_id);
563 
564  te::da::DataSourcePtr newds = te::da::DataSourceManager::getInstance().get(ds_id, "OGR", ds->getConnInfo());
565  newds->open();
568 
569  if (!m_outputDatasource)
570  {
571  QMessageBox::information(this, "Difference", "The output data source can not be accessed.");
572 
573  this->setCursor(Qt::ArrowCursor);
574 
575  return;
576  }
577 
578  delete m_params;
579  }
580  else
581  {
583  if (!aux.get())
584  {
585  QMessageBox::information(this, "Difference", "The output data source can not be accessed.");
586 
587  return;
588  }
589 
590  std::string name = te::common::Convert2LCase(outputdataset);
591 
592  if (aux->dataSetExists(name))
593  {
594  QMessageBox::information(this, "Difference", "Dataset already exists. Remove it or select a new name and try again.");
595 
596  return;
597  }
598 
599  this->setCursor(Qt::WaitCursor);
600 
601 // Set parameters (Input/Output).
605  m_params->setOutputDataSetName(outputdataset);
606  m_params->setSpecificParams(specificParams);
607 
609 
610  if(isQuery)
611  {
612  res = difference.executeQuery(m_params);
613  }
614  else
615  {
616  res = difference.executeMemory(m_params);
617  }
618 
619  delete m_params;
620 
621  if(!res)
622  {
623  this->setCursor(Qt::ArrowCursor);
624  QMessageBox::information(this, "Difference", "Error: could not generate the difference.");
625  reject();
626  }
627  }
628 
629 // creating a layer for the result
631 
633 
634  te::da::DataSetTypePtr dt(outDataSource->getDataSetType(outputdataset).release());
635  m_layerResult = converter(dt);
636  }
637  catch(const std::exception& e)
638  {
639  this->setCursor(Qt::ArrowCursor);
640  QMessageBox::warning(this, tr("Difference"), e.what());
641 
642  std::string str = "Vector Processing - Difference - ";
643  str += e.what();
644  TE_LOG_ERROR(str);
645 
646  return;
647  }
648 
649  this->setCursor(Qt::ArrowCursor);
650  accept();
651 }
652 
654 {
655  reject();
656 }
657 
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
Geometric property.
A structure to hold the input parameters of vector processing.
Definition: InputParams.h:50
Defines a component for choose a file.
Definition: FileDialog.h:52
te::da::DataSetType * m_dataSetType
static bool exists(const std::string &path)
Checks if a given path in UTF-8 exists.
Definition: FileSystem.cpp:142
te::da::Select * GetSelectQueryFromLayer(te::map::AbstractLayerPtr layer, bool onlySelectedObjects, int srid=0)
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
te::map::AbstractLayerPtr m_inputSelectedLayer
Input layer selected.
DataStruct GetDataStructFromLayer(te::map::AbstractLayerPtr layer, bool onlySelectedObjects, int srid=0)
void onDifferenceLayerComboBoxChanged(int index)
boost::shared_ptr< DataSource > DataSourcePtr
std::string Convert2LCase(const std::string &value)
It converts a string to lower case.
Definition: StringUtils.h:202
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
te::map::AbstractLayerPtr getLayer()
Q_DECLARE_METATYPE(te::map::AbstractLayerPtr) te
te::map::AbstractLayerPtr m_layerResult
Generated Layer.
virtual const char * what() const
It outputs the exception message.
std::vector< std::string > getSelectedProperties()
void onInputLayerComboBoxChanged(int index)
te::da::DataSourceInfoPtr m_outputDatasource
DataSource information.
void setOutputDataSetName(const std::string &outputDataSetName)
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
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
te::da::DataSourcePtr m_inputDataSource
Is Required.
Definition: InputParams.h:81
te::da::Select * m_inputQuery
Is required for operations in spatial database.
Definition: InputParams.h:85
void setOutputDataSource(te::da::DataSourcePtr outputDataSource)
const QueryCapabilities & getQueryCapabilities() const
std::list< te::map::AbstractLayerPtr > m_layers
The vector layers in Layer Explorer.
Get a list of AbstractLayer filtered by the name;.
bool executeQuery(te::vp::AlgorithmParams *mainParams)
Definition: Difference.cpp:305
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
It tokenizes a given string with a delimiter of your own choice.
Definition: StringUtils.h:221
te::vp::AlgorithmParams * m_params
Algorithm parameters.
std::vector< te::vp::InputParams > m_inputParams
A vector of input parameters.
A template for complex data types.
Definition: ComplexData.h:52
int getSRID() const
It returns the spatial reference system identifier associated to this property.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
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::unique_ptr< Ui::DifferenceDialogForm > m_ui
URI C++ Library.
Definition: Attributes.h:37
static te::dt::TimeDuration dt(20, 30, 50, 11)
bool supportsSpatialSQLDialect() const
te::da::DataSetType * m_inputDataSetType
Is required.
Definition: InputParams.h:82
std::unique_ptr< te::qt::widgets::DoubleListWidget > m_doubleListWidget
Utility functions for the data access module.
te::gm::Geometry * difference(te::gm::Geometry *g1, te::gm::Geometry *g2)
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
te::map::AbstractLayerPtr m_differenceSelectedLayer
Difference layer selected.
std::string getPath()
This method will return the chosen path.
Definition: FileDialog.cpp:103
te::da::DataSet * m_inputDataSet
Is required for operations in memory.
Definition: InputParams.h:84
const std::list< te::da::DataSourceInfoPtr > & getSelecteds() const
A dialog for selecting a data source.
#define TE_LOG_ERROR(message)
Use this tag in order to log a message to the TerraLib default logger with the ERROR level...
Definition: Logger.h:337
bool executeMemory(te::vp::AlgorithmParams *mainParams)
Definition: Difference.cpp:92
A class that represents a data source component.
void setInputParams(const std::vector< te::vp::InputParams > &setInputParams)
std::string getFileName()
This method will return the file name.
Definition: FileDialog.cpp:113
bool m_toFile
The result is in a file?
A template for atomic data types (integers, floats, strings and others).
Definition: SimpleData.h:59
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
Set the layer that can be used.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void setSpecificParams(const std::map< std::string, te::dt::AbstractData * > &specificParams)
Difference operation dialog.
te::da::DataSet * m_dataSet
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr