GeometricOpDialog.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
4  applications.
5 
6  TerraLib is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License,
9  or (at your option) any later version.
10 
11  TerraLib is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with TerraLib. See COPYING. If not, write to
18  TerraLib Team at <terralib-team@terralib.org>.
19  */
20 
21 /*!
22  \file terralib/vp/qt/GeometricOpDialog.cpp
23 
24  \brief A Qt dialog that allows users to run the basic geographic operations
25  defined by VP module.
26 */
27 
28 // TerraLib
29 #include "../Enums.h"
30 #include "../../core/filesystem/FileSystem.h"
31 #include "../../core/logger/Logger.h"
32 #include "../../common/progress/ProgressManager.h"
33 #include "../../dataaccess/dataset/DataSet.h"
34 #include "../../dataaccess/dataset/DataSetType.h"
35 #include "../../dataaccess/dataset/DataSetTypeConverter.h"
36 #include "../../dataaccess/datasource/DataSourceCapabilities.h"
37 #include "../../dataaccess/datasource/DataSourceInfo.h"
38 #include "../../dataaccess/datasource/DataSourceInfoManager.h"
39 #include "../../dataaccess/datasource/DataSourceFactory.h"
40 #include "../../dataaccess/datasource/DataSourceManager.h"
41 #include "../../dataaccess/utils/Utils.h"
42 
43 #include "../../geometry/GeometryProperty.h"
44 #include "../../geometry/Utils.h"
45 
46 #include "../../maptools/AbstractLayer.h"
47 
48 #include "../../qt/widgets/datasource/selector/DataSourceSelectorDialog.h"
49 #include "../../qt/widgets/progress/ProgressViewerDialog.h"
50 #include "../../qt/widgets/layer/utils/DataSet2Layer.h"
51 #include "../../qt/widgets/srs/SRSManagerDialog.h"
52 #include "../../qt/widgets/utils/FileDialog.h"
53 
54 #include "../../srs/SpatialReferenceSystemManager.h"
55 
56 #include "../Config.h"
57 #include "../Exception.h"
58 
59 #include "GeometricOpDialog.h"
60 #include "ui_GeometricOpDialogForm.h"
61 #include "Utils.h"
62 #include "../GeometricOp.h"
63 #include "../GeometricOpMemory.h"
64 #include "../GeometricOpQuery.h"
65 
66 // STL
67 #include <cassert>
68 
69 // Qt
70 #include <QFileDialog>
71 #include <QMessageBox>
72 
73 // Boost
74 #include <boost/algorithm/string.hpp>
75 #include <boost/filesystem.hpp>
76 #include <boost/uuid/random_generator.hpp>
77 #include <boost/uuid/uuid_io.hpp>
78 
80  : QDialog(parent, f),
81  m_ui(new Ui::GeometricOpDialogForm),
82  m_layers(std::list<te::map::AbstractLayerPtr>()),
83  m_selectedLayer(nullptr)
84 {
85  m_ui->setupUi(this);
86 
87  // icons
88  QSize iconSize(32, 32);
89 
90  m_ui->m_convexHullCheckBox->setIconSize(iconSize);
91  m_ui->m_convexHullCheckBox->setIcon(QIcon::fromTheme("vp-convex-hull-hint"));
92 
93  m_ui->m_centroidCheckBox->setIconSize(iconSize);
94  m_ui->m_centroidCheckBox->setIcon(QIcon::fromTheme("vp-centroid-hint"));
95 
96  m_ui->m_mbrCheckBox->setIconSize(iconSize);
97  m_ui->m_mbrCheckBox->setIcon(QIcon::fromTheme("vp-mbr-hint"));
98 
99  m_ui->m_areaCheckBox->setIconSize(iconSize);
100  m_ui->m_areaCheckBox->setIcon(QIcon::fromTheme("vp-area-hint"));
101 
102  m_ui->m_lineCheckBox->setIconSize(iconSize);
103  m_ui->m_lineCheckBox->setIcon(QIcon::fromTheme("vp-line-length-hint"));
104 
105  m_ui->m_perimeterCheckBox->setIconSize(iconSize);
106  m_ui->m_perimeterCheckBox->setIcon(QIcon::fromTheme("vp-perimeter-hint"));
107 
108  m_ui->m_targetDatasourceToolButton->setIcon(QIcon::fromTheme("datasource"));
109 
110  m_ui->m_srsToolButton->setIcon(QIcon::fromTheme("srs"));
111 
112  connect(m_ui->m_inputLayerComboBox, SIGNAL(currentIndexChanged(int)), this,
113  SLOT(onLayerComboBoxChanged(int)));
114  connect(m_ui->m_attributesComboBox, SIGNAL(currentIndexChanged(int)), this,
115  SLOT(onAttributeComboBoxChanged(int)));
116  connect(m_ui->m_byObjectRadioButton, SIGNAL(toggled(bool)), this,
117  SLOT(onAllObjectsToggled()));
118  connect(m_ui->m_allLayerRadioButton, SIGNAL(toggled(bool)), this,
120  connect(m_ui->m_byAttributeRadioButton, SIGNAL(toggled(bool)), this,
122  connect(m_ui->m_targetDatasourceToolButton, SIGNAL(pressed()), this,
124  connect(m_ui->m_targetFileToolButton, SIGNAL(pressed()), this,
126  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this,
127  SLOT(onOkPushButtonClicked()));
128  connect(m_ui->m_cancelPushButton, SIGNAL(clicked()), this,
129  SLOT(onCancelPushButtonClicked()));
130  connect(m_ui->m_srsToolButton, SIGNAL(clicked()), this,
131  SLOT(onSrsToolButtonClicked()));
132 
133  m_ui->m_helpPushButton->setNameSpace("dpi.inpe.br.plugins");
134  m_ui->m_helpPushButton->setPageReference("plugins/vp/vp_geometricOper.html");
135 
137  m_ui->m_newLayerNameLineEdit->setEnabled(true);
138 }
139 
141 
142 void te::vp::GeometricOpDialog::setLayers(std::list<te::map::AbstractLayerPtr> layers)
143 {
144  m_layers = layers;
145 
146  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
147 
148  while(it != m_layers.end())
149  {
150  std::unique_ptr<te::da::DataSetType> dsType = it->get()->getSchema();
151  if(dsType.get() && dsType->hasGeom())
152  {
153  m_ui->m_inputLayerComboBox->addItem(
154  QString(it->get()->getTitle().c_str()),
155  QVariant(it->get()->getId().c_str()));
156  }
157  ++it;
158  }
159 }
160 
162 {
163  return m_selectedLayer;
164 }
165 
166 std::vector<te::map::AbstractLayerPtr> te::vp::GeometricOpDialog::getOutLayer()
167 {
168  return m_outputLayer;
169 }
170 
172 {
173  return m_ui->m_convexHullCheckBox->isChecked();
174 }
175 
177 {
178  return m_ui->m_centroidCheckBox->isChecked();
179 }
180 
182 {
183  return m_ui->m_mbrCheckBox->isChecked();
184 }
185 
187 {
188  return m_ui->m_areaCheckBox->isChecked();
189 }
190 
192 {
193  return m_ui->m_lineCheckBox->isChecked();
194 }
195 
197 {
198  return m_ui->m_perimeterCheckBox->isChecked();
199 }
200 
202  te::gm::GeomType type)
203 {
204  switch(type)
205  {
206  case te::gm::PointType:
207  case te::gm::PointMType:
208  case te::gm::PointZType:
209  case te::gm::PointZMType:
210  case te::gm::PointKdType:
215  m_ui->m_areaCheckBox->setEnabled(false);
216  m_ui->m_lineCheckBox->setEnabled(false);
217  m_ui->m_perimeterCheckBox->setEnabled(false);
218  m_ui->m_byObjectRadioButton->setEnabled(false);
219  m_ui->m_byAttributeRadioButton->setEnabled(false);
220  m_ui->m_allLayerRadioButton->setChecked(true);
221  break;
230  m_ui->m_areaCheckBox->setEnabled(false);
231  m_ui->m_lineCheckBox->setEnabled(true);
232  m_ui->m_perimeterCheckBox->setEnabled(false);
233  m_ui->m_byObjectRadioButton->setEnabled(true);
234  m_ui->m_byAttributeRadioButton->setEnabled(true);
235  m_ui->m_byObjectRadioButton->setChecked(true);
236  break;
237  default:
238  m_ui->m_areaCheckBox->setEnabled(true);
239  m_ui->m_lineCheckBox->setEnabled(false);
240  m_ui->m_perimeterCheckBox->setEnabled(true);
241  m_ui->m_byObjectRadioButton->setEnabled(true);
242  m_ui->m_byAttributeRadioButton->setEnabled(true);
243  m_ui->m_byObjectRadioButton->setChecked(true);
244  break;
245  }
246 }
247 
250 {
251  if(m_ui->m_byObjectRadioButton->isChecked())
252  return te::vp::ALL_OBJ;
253  if(m_ui->m_allLayerRadioButton->isChecked())
254  return te::vp::AGGREG_OBJ;
255  if(m_ui->m_byAttributeRadioButton->isChecked())
257 
258  return te::vp::ALL_OBJ;
259 }
260 
262 {
263  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
264  std::string layerID =
265  m_ui->m_inputLayerComboBox->itemData(index, Qt::UserRole)
266  .toString()
267  .toUtf8()
268  .data();
269 
270  m_ui->m_propertiesListWidget->clear();
271  m_ui->m_attributesComboBox->clear();
272 
273  while(it != m_layers.end())
274  {
275  if(layerID == it->get()->getId())
276  {
277  std::size_t type;
278  te::map::AbstractLayerPtr selectedLayer = it->get();
279  m_selectedLayer = selectedLayer;
280  std::unique_ptr<const te::map::LayerSchema> schema(selectedLayer->getSchema());
281 
282  int srid = selectedLayer->getSRID();
283  if(srid > 0)
284  {
285  m_ui->m_layerSRIDLabel->setText(te::srs::SpatialReferenceSystemManager::getInstance().getName(srid).c_str());
286  m_ui->m_resSRIDLabel->setText(te::srs::SpatialReferenceSystemManager::getInstance().getName(srid).c_str());
287  m_newSRID = srid;
288  }
289  else
290  m_ui->m_layerSRIDLabel->setText("No SRS defined");
291 
292  if(schema->size() == 0)
293  return;
294 
295  const std::vector<te::dt::Property*>& properties = schema->getProperties();
296 
297  for(size_t i = 0; i < properties.size(); ++i)
298  {
299  type = properties[i]->getType();
300 
301  if(type == te::dt::GEOMETRY_TYPE)
302  {
303  te::gm::GeometryProperty* geomProperty =
304  dynamic_cast<te::gm::GeometryProperty*>(properties[i]->clone());
305 
306  te::gm::GeomType geomType = geomProperty->getGeometryType();
307  enableOperations(geomType);
308  }
309  else
310  {
311  m_ui->m_propertiesListWidget->addItem(
312  properties[i]->getName().c_str());
313 
314  m_ui->m_attributesComboBox->addItem(properties[i]->getName().c_str());
315  }
316  }
317  return;
318  }
319  ++it;
320  }
321 }
322 
324 {
325  if(m_ui->m_byAttributeRadioButton->isChecked())
326  m_attribute = m_ui->m_attributesComboBox->itemText(index).toUtf8().data();
327  else
328  m_attribute = "";
329 }
330 
332 {
333  m_ui->m_attributesComboBox->setEnabled(false);
335 }
336 
338 {
339  m_ui->m_attributesComboBox->setEnabled(false);
341 }
342 
344 {
345  m_ui->m_attributesComboBox->setEnabled(true);
346 }
347 
349 {
350  m_ui->m_newLayerNameLineEdit->clear();
351  m_ui->m_newLayerNameLineEdit->setEnabled(true);
353  dlg.exec();
354 
355  std::list<te::da::DataSourceInfoPtr> dsPtrList = dlg.getSelecteds();
356 
357  if(dsPtrList.empty())
358  return;
359 
360  std::list<te::da::DataSourceInfoPtr>::iterator it = dsPtrList.begin();
361 
362  m_ui->m_repositoryLineEdit->setText(QString(it->get()->getTitle().c_str()));
363 
364  m_outputDatasource = *it;
365 
366  m_toFile = false;
367 }
368 
370 {
371  m_ui->m_newLayerNameLineEdit->clear();
372  m_ui->m_repositoryLineEdit->clear();
373 
375 
376  try {
377  fileDialog.exec();
378  }
379  catch (te::common::Exception& ex) {
380  QMessageBox::warning(this, tr("File information"), ex.what());
381  return;
382  }
383 
384  m_ui->m_repositoryLineEdit->setText(fileDialog.getPath().c_str());
385  m_ui->m_newLayerNameLineEdit->setText(fileDialog.getFileName().c_str());
386 
387  m_toFile = true;
388  m_ui->m_newLayerNameLineEdit->setEnabled(false);
389 }
390 
392 {
393  // Progress bar
395 
396  try
397  {
398  te::map::DataSetLayer* dsLayer =
399  dynamic_cast<te::map::DataSetLayer*>(m_selectedLayer.get());
400 
401  te::da::DataSourcePtr inDataSource =
402  te::da::GetDataSource(dsLayer->getDataSourceId(), true);
403 
404 
405  // Get the selected properties of input layer
406  std::vector<std::string> geoProps;
407  QList<QListWidgetItem*> selection = m_ui->m_propertiesListWidget->selectedItems();
408  for(int i = 0; i < selection.size(); ++i)
409  geoProps.push_back(selection.at(i)->text().toUtf8().data());
410 
411 
412  // Get checked operations
413  m_ops.clear();
414 
415  if(hasConvexHull())
416  m_ops.push_back(te::vp::CONVEX_HULL);
417 
418  if(hasCentroid())
419  m_ops.push_back(te::vp::CENTROID);
420 
421  if(hasMBR())
422  m_ops.push_back(te::vp::MBR);
423 
424  if(hasLine())
425  m_ops.push_back(te::vp::LINE);
426 
427  if(hasArea())
428  m_ops.push_back(te::vp::AREA);
429 
430  if(hasPerimeter())
431  m_ops.push_back(te::vp::PERIMETER);
432 
433  // Verify if it has at least one operation checked.
434  if(m_ops.empty())
435  {
436  QMessageBox::information(this, tr("Geometric Operation"),
437  tr("Check at least one operation."));
438 
439  return;
440  }
441 
442  // Verify if the projection is lat/long
444  {
445  if(hasArea() || hasPerimeter() || hasLine())
446  {
447  int reply = QMessageBox::question(this, tr("Geometric Operation"),
448  tr("The tabular operations will be calculated with Geographic SRS. Would you like to continue?"),
449  QMessageBox::No, QMessageBox::Yes);
450 
451  if(reply == QMessageBox::No)
452  {
453  return;
454  }
455  }
456  }
457 
458 
459  // Get the strategy (All objects / All layer dissolved / Dissolved by attribute)
461 
462  // Get the selected property if the operation is by attribute
463  if(strategy == te::vp::AGGREG_BY_ATTRIBUTE)
464  m_attribute = m_ui->m_attributesComboBox->currentText().toUtf8().data();
465 
466  // Get the output layer name.
467  std::string outputdataset =
468  m_ui->m_newLayerNameLineEdit->text().toUtf8().data();
469 
470  std::vector<std::string> outputDSetNames;
471 
472  // Verify output datasource
473  if(m_toFile)
474  {
475  std::string path = m_ui->m_repositoryLineEdit->text().toUtf8().data();
476  boost::filesystem::path uri(path);
477 
478  bool ops_selected = false;
479 
480  if(hasConvexHull())
481  {
482  std::vector<std::string> splitedName;
483  boost::split(splitedName, outputdataset, boost::is_any_of("."));
484 
485  boost::filesystem::path uri_file(path + "/" + splitedName[0] + "_convex_hull.shp");
486 
487  if(te::core::FileSystem::exists(uri_file.string()))
488  {
489  QMessageBox::information(
490  this, tr("Geometric Operation"),
491  tr("The convex hull output file already "
492  "exists. Remove it or select a new name and "
493  "try again."));
494 
495  return;
496  }
497 
498  ops_selected = true;
499  }
500  if(hasCentroid())
501  {
502  std::vector<std::string> splitedName;
503  boost::split(splitedName, outputdataset, boost::is_any_of("."));
504 
505  boost::filesystem::path uri_file(path + "/" + splitedName[0] + "_centroid.shp");
506 
507  if(te::core::FileSystem::exists(uri_file.string()))
508  {
509  QMessageBox::information(
510  this, tr("Geometric Operation"),
511  tr("The centroid output file already exists. "
512  "Remove it or select a new name and try "
513  "again."));
514 
515  return;
516  }
517 
518  ops_selected = true;
519  }
520  if(hasMBR())
521  {
522  std::vector<std::string> splitedName;
523  boost::split(splitedName, outputdataset, boost::is_any_of("."));
524 
525  boost::filesystem::path uri_file(path + "/" + splitedName[0] + "_mbr.shp");
526 
527  if(te::core::FileSystem::exists(uri_file.string()))
528  {
529  QMessageBox::information(
530  this, tr("Geometric Operation"),
531  tr("The mbr output file already exists. Remove "
532  "it or select a new name and try again."));
533 
534  return;
535  }
536 
537  ops_selected = true;
538  }
539  if(!ops_selected)
540  {
541  std::vector<std::string> splitedName;
542  boost::split(splitedName, outputdataset, boost::is_any_of("."));
543 
544  boost::filesystem::path uri_file(path + "/" + splitedName[0] + ".shp");
545 
546  if(te::core::FileSystem::exists(uri_file.string()))
547  {
548  QMessageBox::information(
549  this, tr("Geometric Operation"),
550  tr("Output file already exists. Remove it or "
551  "select a new name and try again."));
552 
553  return;
554  }
555  }
556 
557  std::size_t idx = outputdataset.find(".");
558  if (idx != std::string::npos)
559  outputdataset=outputdataset.substr(0,idx);
560 
561  std::string dsinfo("file://");
562  dsinfo += uri.string();
563  std::unique_ptr<te::da::DataSource> dsOGR = te::da::DataSourceFactory::make("OGR", dsinfo);
564  dsOGR->open();
565 
566  std::unique_ptr<te::da::DataSetTypeConverter> converter(
567  new te::da::DataSetTypeConverter(dsLayer->getSchema().get(),
568  dsOGR->getCapabilities(),
569  dsOGR->getEncoding()));
570 
572  dsLayer->getSRID());
573 
574  this->setCursor(Qt::WaitCursor);
575 
576  // sera feito por algum tipo de factory
577  te::vp::GeometricOp* geomOp = nullptr;
578 
579  // select a strategy based on the capabilities of the input datasource
580  const te::da::DataSourceCapabilities dsCapabilities =
581  inDataSource->getCapabilities();
582 
583  if(dsCapabilities.supportsPreparedQueryAPI() &&
585  {
586  geomOp = new te::vp::GeometricOpQuery();
587  }
588  else
589  {
590  geomOp = new te::vp::GeometricOpMemory();
591  }
592 
593  geomOp->setInput(inDataSource, dsLayer->getDataSetName(), std::move(converter));
594  geomOp->setOutput(std::move(dsOGR), outputdataset);
595  geomOp->setParams(geoProps, m_ops, strategy, m_attribute, m_newSRID);
596 
597  bool result;
598 
599  if(!geomOp->paramsAreValid())
600  result = false;
601  else
602  result = geomOp->run();
603 
604  if(!result)
605  {
606  this->setCursor(Qt::ArrowCursor);
607  QMessageBox::information(
608  this, tr("Geometric Operation"),
609  tr("Error: could not generate the operation, check the log file."));
610 
611  return;
612  }
613 
614  outputDSetNames = geomOp->GetOutputDSetNames();
615 
616  delete geomOp;
617 
618  // let's include the new datasource in the managers
619  boost::uuids::basic_random_generator<boost::mt19937> gen;
620  boost::uuids::uuid u = gen();
621  std::string id = boost::uuids::to_string(u);
622 
624  ds->setConnInfo(dsinfo);
625  ds->setTitle(uri.stem().string());
626  ds->setAccessDriver("OGR");
627  ds->setType("OGR");
628  ds->setDescription(uri.string());
629  ds->setId(id);
630 
631  te::da::DataSourcePtr newds =
633  ds->getConnInfo());
634  newds->open();
637  }
638  else
639  {
640  std::unique_ptr<te::da::DataSource> trgDs =
642  m_outputDatasource->getConnInfo());
643  trgDs->open();
644 
645  if(!trgDs.get())
646  {
647  QMessageBox::information(
648  this, tr("Geometric Operation"),
649  tr("The selected output datasource can not be accessed."));
650 
651  return;
652  }
653 
654  if(trgDs->dataSetExists(outputdataset))
655  {
656  QMessageBox::information(
657  this, tr("Geometric Operation"),
658  tr("Dataset already exists. Remove it or select "
659  "a new name and try again."));
660 
661  return;
662  }
663 
664  std::unique_ptr<te::da::DataSetTypeConverter> converter(
665  new te::da::DataSetTypeConverter(dsLayer->getSchema().get(),
666  trgDs->getCapabilities(),
667  trgDs->getEncoding()));
668 
670  dsLayer->getSRID());
671 
672  this->setCursor(Qt::WaitCursor);
673 
674  te::vp::GeometricOp* geomOp = nullptr;
675 
676  // select a strategy based on the capabilities of the input datasource
677  const te::da::DataSourceCapabilities dsCapabilities =
678  inDataSource->getCapabilities();
679 
680  if(dsCapabilities.supportsPreparedQueryAPI() &&
682  {
683  geomOp = new te::vp::GeometricOpQuery();
684  }
685  else
686  {
687  geomOp = new te::vp::GeometricOpMemory();
688  }
689 
690  geomOp->setInput(inDataSource, dsLayer->getDataSetName(), std::move(converter));
691  geomOp->setOutput(std::move(trgDs), outputdataset);
692  geomOp->setParams(geoProps, m_ops, strategy, m_attribute, m_newSRID);
693 
694  bool result;
695  if(!geomOp->paramsAreValid())
696  result = false;
697  else
698  result = geomOp->run();
699 
700  if(!result)
701  {
702  this->setCursor(Qt::ArrowCursor);
703  QMessageBox::information(
704  this, tr("Geometric Operation"),
705  tr("Error: could not generate the operation."));
706 
707  return;
708  }
709 
710  outputDSetNames = geomOp->GetOutputDSetNames();
711 
712  delete geomOp;
713  }
714 
715  // creating a layer for the result
716  te::da::DataSourcePtr outDataSource =
718 
719  // force to close database connection to refresh dataSets.
720  outDataSource->close();
721  outDataSource->open();
722 
724 
725  for(std::size_t i = 0; i < outputDSetNames.size(); ++i)
726  {
728  outDataSource->getDataSetType(outputDSetNames[i]).release());
729  if(dt)
730  m_outputLayer.push_back(converter(dt));
731  }
732  }
733  catch(const std::exception& e)
734  {
735  this->setCursor(Qt::ArrowCursor);
736  QMessageBox::information(this, tr("Geometric Operation"), e.what());
737 
738 #ifdef TERRALIB_LOGGER_ENABLED
739  std::string str = "Geometric Operation - ";
740  str += e.what();
741  TE_CORE_LOG_DEBUG("vp", str);
742 #endif
743 
744  return;
745  }
746 
747  this->setCursor(Qt::ArrowCursor);
748 
749  accept();
750 }
751 
753 {
754  reject();
755 }
756 
758 {
759  te::qt::widgets::SRSManagerDialog srsDialog(this);
760  srsDialog.setWindowTitle(tr("Choose the SRS"));
761 
762  if(srsDialog.exec() == QDialog::Rejected)
763  return;
764 
765  m_newSRID = srsDialog.getSelectedSRS().first;
766 
767  if (m_newSRID <= 0)
768  {
769  m_ui->m_resSRIDLabel->setText("No SRS defined");
770  }
771  else
772  {
774  m_ui->m_resSRIDLabel->setText(name.c_str());
775  }
776 }
A Qt dialog that allows users to run the basic geometric operations defined by VP module...
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
std::vector< te::map::AbstractLayerPtr > getOutLayer()
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
Geometric property.
Defines a component for choose a file.
Definition: FileDialog.h:52
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
std::unique_ptr< Ui::GeometricOpDialogForm > m_ui
Qt Dialog Form.
static bool exists(const std::string &path)
Checks if a given path in UTF-8 exists.
Definition: FileSystem.cpp:142
std::vector< std::string > GetOutputDSetNames()
Definition: GeometricOp.cpp:74
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetTypeConverter > converter)
Definition: GeometricOp.cpp:31
The geographic operation Line.
boost::shared_ptr< DataSource > DataSourcePtr
std::string m_attribute
Properties related to the selected Layer to do the dissolve before operation.
TEDATAACCESSEXPORT void AssociateDataSetTypeConverterSRID(DataSetTypeConverter *converter, const int &inputSRID, const int &outputSRID=TE_UNKNOWN_SRS)
The geographic operation Minimum Bounding Rectangle.
void setParams(std::vector< std::string > selectedProps, std::vector< te::vp::GeometricOperation > operations, te::vp::GeometricOpObjStrategy objStrategy, std::string attribute, int newSRID)
Definition: GeometricOp.cpp:40
void onAttributeComboBoxChanged(int index)
virtual const char * what() const
It outputs the exception message.
#define TE_CORE_LOG_DEBUG(channel, message)
Use this tag in order to log a message to a specified logger with the DEBUG level.
Definition: Logger.h:225
void setOutput(std::unique_ptr< da::DataSource > outDsrc, std::string dsname)
Definition: GeometricOp.cpp:53
std::unique_ptr< LayerSchema > getSchema() const
It returns the layer schema.
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)
const QueryCapabilities & getQueryCapabilities() const
te::da::DataSourceInfoPtr m_outputDatasource
DataSource information.
GeometricOpObjStrategy
Defines the strategy used for the processing of the input geometries.
An converter for DataSetType.
te::map::AbstractLayerPtr m_selectedLayer
Selected layer to operation.
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
The geographic operation Area.
Aggregate all objects.
static SpatialReferenceSystemManager & getInstance()
It returns a reference to the singleton instance.
te::map::AbstractLayerPtr getInLayer()
GeometricOpDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void exec()
This method will open the dialog of file selection and populate the class members with the chosen fil...
Definition: FileDialog.cpp:54
URI C++ Library.
Definition: Attributes.h:37
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
static te::dt::TimeDuration dt(20, 30, 50, 11)
Aggregate objects by attribute.
bool IsProjectionLatLong(const int &srid)
The geographic operation Perimeter.
bool supportsSpatialSQLDialect() const
Utility functions for the data access module.
The geographic operation Centroid.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
bool m_toFile
Flag to indicate if the output will be stored in a file.
std::string getPath()
This method will return the chosen path.
Definition: FileDialog.cpp:103
std::list< te::map::AbstractLayerPtr > m_layers
List of layers.
const std::string & getDataSetName() const
std::vector< te::map::AbstractLayerPtr > m_outputLayer
Generated Layer.
const std::list< te::da::DataSourceInfoPtr > & getSelecteds() const
void onLayerComboBoxChanged(int index)
std::vector< te::vp::GeometricOperation > m_ops
Operations selected to be executed.
virtual bool paramsAreValid()
Definition: GeometricOp.cpp:60
A dialog for selecting a data source.
The geographic operation Convex Hull.
A class that represents a data source component.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
A layer with reference to a dataset.
Definition: DataSetLayer.h:47
std::string getFileName()
This method will return the file name.
Definition: FileDialog.cpp:113
te::vp::GeometricOpObjStrategy getObjectStrategy()
A dialog used to build a SRSManagerDialog element.
void enableOperations(te::gm::GeomType type)
All objects individually.
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.
int m_newSRID
newSRID to compure tabular operations (Area, Perimeter, Line).
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
virtual bool run()=0