MainWindowDialog.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/addressgeocoding/MainWindowDialog.cpp
22 
23  \brief A dialog for Address Geocoding operation
24 */
25 
26 // TerraLib
27 #include "../../common/CharEncodingConv.h"
28 #include "../../common/Logger.h"
29 #include "../../common/progress/ProgressManager.h"
30 #include "../../common/Translator.h"
31 #include "../../common/STLUtils.h"
32 #include "../../dataaccess/dataset/DataSetType.h"
33 #include "../../dataaccess/dataset/ObjectIdSet.h"
34 #include "../../dataaccess/datasource/DataSourceCapabilities.h"
35 #include "../../dataaccess/datasource/DataSourceInfo.h"
36 #include "../../dataaccess/datasource/DataSourceInfoManager.h"
37 #include "../../dataaccess/datasource/DataSourceFactory.h"
38 #include "../../dataaccess/datasource/DataSourceManager.h"
39 #include "../../dataaccess/utils/Utils.h"
40 #include "../../datatype/Enums.h"
41 #include "../../datatype/Property.h"
42 #include "../../maptools/AbstractLayer.h"
43 #include "../../qt/af/Utils.h"
44 #include "../../qt/widgets/datasource/selector/DataSourceSelectorDialog.h"
45 #include "../../qt/widgets/layer/utils/DataSet2Layer.h"
46 #include "../../qt/widgets/progress/ProgressViewerDialog.h"
47 #include "../../qt/widgets/Utils.h"
48 #include "../AddressGeocodingOp.h"
49 #include "../Config.h"
50 #include "../Exception.h"
51 #include "MainWindowDialog.h"
53 #include "ConfigInputLayerDialog.h"
54 #include "ui_MainWindowDialogForm.h"
55 
56 // Qt
57 #include <QFileDialog>
58 #include <QMessageBox>
59 #include <QSettings>
60 
61 // Boost
62 #include <boost/algorithm/string.hpp>
63 #include <boost/filesystem.hpp>
64 #include <boost/uuid/random_generator.hpp>
65 #include <boost/uuid/uuid_io.hpp>
66 
68  : QDialog(parent, f),
69  m_ui(new Ui::MainWindowDialogForm),
70  m_layers(std::list<te::map::AbstractLayerPtr>()),
71  m_newColumnLayer(0)
72 {
73 // add controls
74  m_ui->setupUi(this);
75 
76 // add icons
77  m_ui->m_imgLabel->setPixmap(QIcon::fromTheme("addressgeocoding-hint").pixmap(112,48));
78  m_ui->m_targetDatasourceToolButton->setIcon(QIcon::fromTheme("datasource"));
79  m_ui->m_targetDataSourceAddressToolButton->setIcon(QIcon::fromTheme("datasource"));
80  m_ui->m_editAddressFileToolButton->setIcon(QIcon::fromTheme("preferences-system"));
81  m_ui->m_removeAddressFileToolButton->setIcon(QIcon::fromTheme("delete"));
82 
83  connect(m_ui->m_inputLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLayerComboBoxChanged(int)));
84  connect(m_ui->m_iLeftComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onInitialLeftComboBoxChanged(int)));
85  connect(m_ui->m_fLeftComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onFinalLeftComboBoxChanged(int)));
86  connect(m_ui->m_iRightComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onInitialRightComboBoxChanged(int)));
87  connect(m_ui->m_fRightComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onFinalRightComboBoxChanged(int)));
88  connect(m_ui->m_inputAddressComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onAddressComboBoxChanged(int)));
89 
90  connect(m_ui->m_targetFileToolButton, SIGNAL(pressed()), this, SLOT(onTargetFileToolButtonPressed()));
91  connect(m_ui->m_targetDatasourceToolButton, SIGNAL(pressed()), this, SLOT(onTargetDatasourceToolButtonPressed()));
92 
93  connect(m_ui->m_configureLayerPushButton, SIGNAL(clicked()), this, SLOT(onConfigureLayerClicked()));
94  connect(m_ui->m_targetFileAddressToolButton, SIGNAL(clicked()), this, SLOT(onTargetFileAddressToolButtonPressed()));
95 
96  connect(m_ui->m_removeAddressFileToolButton, SIGNAL(clicked()), this, SLOT(onRemoveAddressToolButtonPressed()));
97  connect(m_ui->m_editAddressFileToolButton, SIGNAL(clicked()), this, SLOT(onEditAddressToolButtonPressed()));
98 
99  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
100  connect(m_ui->m_cancelPushButton, SIGNAL(clicked()), this, SLOT(onCancelPushButtonClicked()));
101 
102  m_ui->m_helpPushButton->setNameSpace("dpi.inpe.br.plugins");
103  m_ui->m_helpPushButton->setPageReference("plugins/addressgeocoding/addressgeocoding.html");
104 
105 // Load the Address file Name.
107  std::map<std::string, std::vector<std::string> >::iterator it = m_mapFields.begin();
108 
109  while(it != m_mapFields.end())
110  {
111  m_ui->m_inputAddressComboBox->addItem(QString(it->first.c_str()));
112  ++it;
113  }
114 }
115 
117 {
118 }
119 
120 void te::addressgeocoding::MainWindowDialog::setLayers(std::list<te::map::AbstractLayerPtr> layers)
121 {
122  m_layers = layers;
123 
124  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
125 
126  while(it != m_layers.end())
127  {
128  std::auto_ptr<te::da::DataSetType> dsType = it->get()->getSchema();
129  std::vector<te::dt::Property*> properties = dsType->getProperties();
130  for(std::size_t i = 0; i < properties.size(); ++i)
131  {
132  std::string name = properties[i]->getName();
133  if(name == "tsvector")
134  m_ui->m_inputLayerComboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant(it->get()->getId().c_str()));
135  }
136 
137  ++it;
138  }
139 }
140 
142 {
143  return m_resultLayer;
144 }
145 
147 {
148  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
149 
150  std::string layerID = m_ui->m_inputLayerComboBox->itemData(index, Qt::UserRole).toString().toStdString();
151 
152  while(it != m_layers.end())
153  {
154  if(layerID == it->get()->getId().c_str())
155  {
156  te::map::AbstractLayerPtr selectedLayer = it->get();
157  m_selectedLayer = selectedLayer;
158 
159  std::auto_ptr<te::da::DataSetType> dsType = m_selectedLayer->getSchema();
160  std::vector<te::dt::Property*> propVec = dsType->getProperties();
161 
162  m_ui->m_iLeftComboBox->clear();
163  m_ui->m_fLeftComboBox->clear();
164  m_ui->m_iRightComboBox->clear();
165  m_ui->m_fRightComboBox->clear();
166 
167  m_ui->m_iLeftComboBox->addItem("");
168  m_ui->m_fLeftComboBox->addItem("");
169  m_ui->m_iRightComboBox->addItem("");
170  m_ui->m_fRightComboBox->addItem("");
171 
172  int type;
173 
174  for(std::size_t i = 0; i < propVec.size(); ++i)
175  {
176  type = propVec[i]->getType();
177  if(type == te::dt::INT16_TYPE ||
178  type == te::dt::INT32_TYPE ||
179  type == te::dt::INT64_TYPE ||
180  type == te::dt::DOUBLE_TYPE ||
181  type == te::dt::NUMERIC_TYPE)
182  {
183  m_ui->m_iLeftComboBox->addItem(QString(propVec[i]->getName().c_str()));
184  m_ui->m_fLeftComboBox->addItem(QString(propVec[i]->getName().c_str()));
185  m_ui->m_iRightComboBox->addItem(QString(propVec[i]->getName().c_str()));
186  m_ui->m_fRightComboBox->addItem(QString(propVec[i]->getName().c_str()));
187  }
188  }
189 
190  return;
191  }
192  ++it;
193  }
194 }
195 
197 {
198  m_initialLeft = m_ui->m_iLeftComboBox->itemText(index).toStdString();
199 }
200 
202 {
203  m_finalLeft = m_ui->m_fLeftComboBox->itemText(index).toStdString();
204 }
205 
207 {
208  m_initialRight = m_ui->m_iRightComboBox->itemText(index).toStdString();
209 }
210 
212 {
213  m_finalRight = m_ui->m_fRightComboBox->itemText(index).toStdString();
214 }
215 
217 {
219  dlg.setLayers(m_layers);
220 
221  if(dlg.exec() == QDialog::Accepted)
222  {
223  m_newColumnLayer = dlg.getLayer();
224  m_layerDataSource = dlg.getDataSource();
225  m_ui->m_inputLayerComboBox->clear();
226  setLayers(m_layers);
227  }
228  return;
229 }
230 
232 {
233  // Load the Address file Name.
234 
235  if(index == -1)
236  {
237  m_ui->m_editAddressFileToolButton->setEnabled(false);
238  m_ui->m_removeAddressFileToolButton->setEnabled(false);
239  return;
240  }
241 
242  GetAddressFilePathToSettings(m_mapFields);
243 
244  std::map<std::string, std::vector<std::string> >::iterator it;
245 
246  std::string value = m_ui->m_inputAddressComboBox->itemText(index).toStdString();
247 
248  it = m_mapFields.find(value);
249  m_addressFile = it->first;
250  std::vector<std::string> vecFields = it->second;
251 
252  m_associatedProps.clear();
253 
254  for(std::size_t i = 0; i < vecFields.size(); ++i)
255  {
256  if(i != 0 && i != 2 && vecFields[i] != "")
257  m_associatedProps.push_back(vecFields[i]);
258  if(i == 0)
259  GetAddressDataSource(vecFields[i]);
260  if(i == 2)
261  m_streetNumber = m_mapFields.begin()->second[i];
262  }
263 
264  m_ui->m_editAddressFileToolButton->setEnabled(true);
265  m_ui->m_removeAddressFileToolButton->setEnabled(true);
266 }
267 
269 {
270  try
271  {
272  QString fileName = QFileDialog::getOpenFileName(this, tr("Open Textual File"), te::qt::widgets::GetFilePathFromSettings("tabular"), tr("dBASE (*.dbf *.DBF);; Comma Separated Value (*.csv *.CSV)"),
273  0, QFileDialog::ReadOnly);
274 
275  GetAddressDataSource(fileName.toStdString());
276 
277  if (fileName.isEmpty())
278  return;
279 
281 
282  if(m_addressDataSource)
283  dlg.setDataSource(m_addressDataSource);
284 
285  if(dlg.exec() == QDialog::Accepted)
286  {
287  m_addressDataSource = dlg.getDataSource();
288  m_addressFile = dlg.getAddressFileName();
289 
290  if(dlg.getStreetType() != "")
291  m_associatedProps.push_back(dlg.getStreetType());
292 
293  if(dlg.getStreetTitle() != "")
294  m_associatedProps.push_back(dlg.getStreetTitle());
295 
296  if(dlg.getStreetName() != "")
297  m_associatedProps.push_back(dlg.getStreetName());
298 
299  if(dlg.getStreetNeighborhood() != "")
300  m_associatedProps.push_back(dlg.getStreetNeighborhood());
301 
302  if(dlg.getStreetPostalCode() != "")
303  m_associatedProps.push_back(dlg.getStreetPostalCode());
304 
305  m_streetNumber = dlg.getStreetNumber();
306 
307  m_ui->m_inputAddressComboBox->addItem(QString(m_addressFile.c_str()));
308  }
309 
310  return;
311  }
312  catch(const std::exception& e)
313  {
314  QMessageBox::warning(this, tr("Address Geocoding"), e.what());
315  }
316 }
317 
319 {
321 
322  if(m_addressDataSource)
323  dlg.setDataSource(m_addressDataSource);
324 
325  std::map<std::string, std::vector<std::string> > mapFields;
326  GetAddressFilePathToSettings(mapFields);
327  std::map<std::string, std::vector<std::string> >::iterator it;
328 
329  std::string value = m_ui->m_inputAddressComboBox->currentText().toStdString();
330 
331  it = mapFields.find(value);
332  m_addressFile = it->first;
333  std::vector<std::string> vecFields = it->second;
334 
335  dlg.setStreetNeighborhood(vecFields[1]);
336  dlg.setStreetNumber(vecFields[2]);
337  dlg.setStreetPostalCode(vecFields[3]);
338  dlg.setStreetName(vecFields[4]);
339  dlg.setStreetTitle(vecFields[5]);
340  dlg.setStreetType(vecFields[6]);
341 
342  if(dlg.exec() == QDialog::Accepted)
343  {
344  m_addressDataSource = dlg.getDataSource();
345  m_addressFile = dlg.getAddressFileName();
346 
347  if(dlg.getStreetType() != "")
348  m_associatedProps.push_back(dlg.getStreetType());
349 
350  if(dlg.getStreetTitle() != "")
351  m_associatedProps.push_back(dlg.getStreetTitle());
352 
353  if(dlg.getStreetName() != "")
354  m_associatedProps.push_back(dlg.getStreetName());
355 
356  if(dlg.getStreetNeighborhood() != "")
357  m_associatedProps.push_back(dlg.getStreetNeighborhood());
358 
359  if(dlg.getStreetPostalCode() != "")
360  m_associatedProps.push_back(dlg.getStreetPostalCode());
361 
362  m_streetNumber = dlg.getStreetNumber();
363 
364  m_ui->m_inputAddressComboBox->addItem(QString(m_addressFile.c_str()));
365  }
366 
367  return;
368 }
369 
371 {
372  QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
373 
374  sett.beginGroup("Address Geocoding");
375 
376  sett.remove(m_ui->m_inputAddressComboBox->currentText());
377  m_ui->m_inputAddressComboBox->removeItem(m_ui->m_inputAddressComboBox->currentIndex());
378 
379  sett.endGroup();
380 }
381 
383 {
384  m_ui->m_newLayerNameLineEdit->clear();
385  m_ui->m_newLayerNameLineEdit->setEnabled(true);
387  dlg.exec();
388 
389  std::list<te::da::DataSourceInfoPtr> dsPtrList = dlg.getSelecteds();
390 
391  if(dsPtrList.size() <= 0)
392  return;
393 
394  std::list<te::da::DataSourceInfoPtr>::iterator it = dsPtrList.begin();
395 
396  m_ui->m_repositoryLineEdit->setText(QString(it->get()->getTitle().c_str()));
397 
398  m_outputDatasource = *it;
399 
400  m_toFile = false;
401 }
402 
404 {
405  m_ui->m_newLayerNameLineEdit->clear();
406  m_ui->m_repositoryLineEdit->clear();
407 
408  QString fileName = QFileDialog::getSaveFileName(this, tr("Save as..."),
409  QString(), tr("Shapefile (*.shp *.SHP);;"),0, QFileDialog::DontConfirmOverwrite);
410 
411  if (fileName.isEmpty())
412  return;
413 
414  boost::filesystem::path outfile(fileName.toStdString());
415  std::string aux = outfile.leaf().string();
416  m_ui->m_newLayerNameLineEdit->setText(aux.c_str());
417  aux = outfile.string();
418  m_ui->m_repositoryLineEdit->setText(aux.c_str());
419 
420  m_toFile = true;
421  m_ui->m_newLayerNameLineEdit->setEnabled(false);
422 }
423 
425 {
426  if(!m_selectedLayer)
427  {
428  QMessageBox::information(this, "Address Geocoding", "Configure an input layer.");
429  return;
430  }
431 
432  if((m_initialLeft == "" || m_finalLeft == "")&&(m_initialRight == "" || m_finalRight == ""))
433  {
434  QMessageBox::information(this, "Address Geocoding", "Associates the number fields with attributes of input layer.");
435  return;
436  }
437 
438  if(m_addressFile == "")
439  {
440  QMessageBox::information(this, "Address Geocoding", "Configure an input address.");
441  return;
442  }
443 
444  if(!m_layerDataSource)
445  {
446  te::map::DataSetLayer* dsLayer = dynamic_cast<te::map::DataSetLayer*>(m_selectedLayer.get());
447  m_layerDataSource = te::da::GetDataSource(dsLayer->getDataSourceId());
448  }
449 
451 
452  addGeoOp->setInput( m_layerDataSource,
453  m_selectedLayer->getTitle(),
454  m_selectedLayer->getSRID(),
455  m_addressDataSource,
456  m_addressFile);
457 
458  addGeoOp->setParams(m_associatedProps,
459  m_streetNumber);
460 
461  addGeoOp->setNumAttributes( m_initialLeft,
462  m_finalLeft,
463  m_initialRight,
464  m_finalRight);
465 
466  std::string outputdataset = m_ui->m_newLayerNameLineEdit->text().toStdString();
467 
468  te::da::DataSourcePtr outputDataSource;
469  bool res;
470 
471  try
472  {
473  if(m_toFile)
474  {
475  boost::filesystem::path uri(m_ui->m_repositoryLineEdit->text().toStdString());
476 
477  if (boost::filesystem::exists(uri))
478  {
479  QMessageBox::information(this, "Address Geocoding", "Output file already exists. Remove it or select a new name and try again.");
480  return;
481  }
482 
483  std::size_t idx = outputdataset.find(".");
484  if (idx != std::string::npos)
485  outputdataset=outputdataset.substr(0,idx);
486 
487  std::map<std::string, std::string> dsinfo;
488  dsinfo["URI"] = uri.string();
489 
490  outputDataSource.reset(te::da::DataSourceFactory::make("OGR").release());
491  outputDataSource->setConnectionInfo(dsinfo);
492  outputDataSource->open();
493  if (outputDataSource->dataSetExists(outputdataset))
494  {
495  QMessageBox::information(this, "Address Geocoding", "There is already a dataset with the requested name in the output data source. Remove it or select a new name and try again.");
496  return;
497  }
498 
499  this->setCursor(Qt::WaitCursor);
500 
501  addGeoOp->setOutput(outputDataSource,
502  outputdataset);
503 
504  if (!addGeoOp->paramsAreValid())
505  res = false;
506  else
507  res = addGeoOp->run();
508 
509  if (!res)
510  {
511  this->setCursor(Qt::ArrowCursor);
512  outputDataSource->close();
513  QMessageBox::information(this, "Address Geocoding", "Error: could not generate the address geocoding.");
514  reject();
515  }
516  outputDataSource->close();
517 
518  delete addGeoOp;
519 
520 // let's include the new datasource in the managers
521  boost::uuids::basic_random_generator<boost::mt19937> gen;
522  boost::uuids::uuid u = gen();
523  std::string id_ds = boost::uuids::to_string(u);
524 
526  ds->setConnInfo(dsinfo);
527  ds->setTitle(uri.stem().string());
528  ds->setAccessDriver("OGR");
529  ds->setType("OGR");
530  ds->setDescription(uri.string());
531  ds->setId(id_ds);
532 
533  te::da::DataSourcePtr newds = te::da::DataSourceManager::getInstance().get(id_ds, "OGR", ds->getConnInfo());
534  newds->open();
536  m_outputDatasource = ds;
537 
538  }
539  else
540  {
541  outputDataSource = te::da::GetDataSource(m_outputDatasource->getId());
542  if (!outputDataSource)
543  {
544  QMessageBox::information(this, "Address Geocoding", "The selected output datasource can not be accessed.");
545  return;
546  }
547 
548  if (outputDataSource->dataSetExists(outputdataset))
549  {
550  QMessageBox::information(this, "Address Geocoding", "Dataset already exists. Remove it or select a new name and try again.");
551  return;
552  }
553  this->setCursor(Qt::WaitCursor);
554 
555  addGeoOp->setOutput(outputDataSource,
556  outputdataset);
557 
558  if (!addGeoOp->paramsAreValid())
559  res = false;
560  else
561  res = addGeoOp->run();
562 
563  delete addGeoOp;
564 
565  if (!res)
566  {
567  this->setCursor(Qt::ArrowCursor);
568  outputDataSource->close();
569  QMessageBox::information(this, "Address Geocoding", "Error: could not generate the address geocoding.");
570  reject();
571  }
572  outputDataSource->close();
573 
574  }
575 
576 // creating a layer for the result
577  te::da::DataSourcePtr outDataSource = te::da::GetDataSource(m_outputDatasource->getId());
578 
579  te::qt::widgets::DataSet2Layer converter(m_outputDatasource->getId());
580 
581  te::da::DataSetTypePtr dt(outDataSource->getDataSetType(outputdataset).release());
582  m_resultLayer = converter(dt);
583 
584  }
585  catch(const std::exception& e)
586  {
587  this->setCursor(Qt::ArrowCursor);
588 
589  QMessageBox::information(this, "Address Geocoding", e.what());
590 
591  //te::common::Logger::logDebug("addressgeocoding", e.what());
592  //te::common::ProgressManager::getInstance().removeViewer(id);
593  return;
594  }
595 
596  this->setCursor(Qt::ArrowCursor);
597 
598  accept();
599 }
600 
602 {
603  reject();
604 }
605 
606 void te::addressgeocoding::MainWindowDialog::GetAddressFilePathToSettings(std::map<std::string, std::vector<std::string> >& mapFields)
607 {
608  QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
609 
610  sett.beginGroup("Address Geocoding");
611  QStringList lst = sett.childGroups();
612 
613  QStringList::iterator it;
614 
615  for(it=lst.begin(); it != lst.end(); ++it)
616  {
617  QString gr = *it;
618 
619  sett.beginGroup(gr);
620 
621  std::vector<std::string> vecFields;
622 
623  std::string fileName = sett.value("fileName").toString().toStdString();
624  vecFields.push_back(sett.value("filePath").toString().toStdString());
625  vecFields.push_back(sett.value("neighborhood").toString().toStdString());
626  vecFields.push_back(sett.value("number").toString().toStdString());
627  vecFields.push_back(sett.value("postalCode").toString().toStdString());
628  vecFields.push_back(sett.value("streetName").toString().toStdString());
629  vecFields.push_back(sett.value("streetTitle").toString().toStdString());
630  vecFields.push_back(sett.value("streetType").toString().toStdString());
631 
632  mapFields.insert(std::pair<std::string, std::vector<std::string> >(fileName, vecFields));
633 
634  sett.endGroup();
635  }
636  sett.endGroup();
637 }
638 
640 {
641  if(QString(filePath.c_str()).isEmpty())
642  return;
643 
644  QFileInfo info(QString(filePath.c_str()));
645  te::qt::widgets::AddFilePathToSettings(info.absolutePath(), "tabular");
646 
647  //Getting the connection info
648  std::string ogrInfo("connection_string=" + filePath);
649  std::map<std::string, std::string> connInfo;
650  connInfo["URI"] = filePath;
651 
652  boost::filesystem::path uri(filePath);
653  std::string file = uri.stem().string();
654 
655  //Creating a DataSource
656  static boost::uuids::basic_random_generator<boost::mt19937> gen;
657  boost::uuids::uuid u = gen();
658 
660  dsInfo->setConnInfo(connInfo);
661  dsInfo->setId(boost::uuids::to_string(u));
662  dsInfo->setTitle(filePath);
663  dsInfo->setDescription("");
664  dsInfo->setAccessDriver("OGR");
665  dsInfo->setType("OGR");
666 
668 
669  m_addressDataSource = te::da::DataSourceFactory::make(dsInfo->getAccessDriver());
670  m_addressDataSource->setConnectionInfo(dsInfo->getConnInfo());
671 
672  m_addressDataSource->setId(boost::uuids::to_string(u));
673  m_addressDataSource->open();
674 }
void setParams(std::vector< std::string > associatedProps, std::string streetNumber)
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
Definition: Utils.cpp:262
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, int inSRID, te::da::DataSourcePtr inAddressDsrc, std::string inAddressDsetName)
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1435
void setDataSource(te::da::DataSourcePtr dataSource)
TEQTWIDGETSEXPORT void AddFilePathToSettings(const QString &path, const QString &typeFile)
Save last used path in QSettings.
Definition: Utils.cpp:367
void setNumAttributes(std::string initialLeft, std::string finalLeft, std::string initialRight, std::string finalRight)
void setStreetPostalCode(std::string streetPostalCode)
void setStreetNeighborhood(std::string streetNeighborhood)
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
Set the layer that can be used.
A dialog configure the input layer to address geocoding operation.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
A dialog to import table with address to geocoding operation.
const std::string & getDataSourceId() const
static std::auto_ptr< DataSource > make(const std::string &dsType)
void setOutput(te::da::DataSourcePtr outDsrc, std::string m_outDsetName)
URI C++ Library.
MainWindowDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void GetAddressFilePathToSettings(std::map< std::string, std::vector< std::string > > &mapFields)
const std::list< te::da::DataSourceInfoPtr > & getSelecteds() const
void GetAddressDataSource(std::string fileName)
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
Set the layer that can be used.
A dialog for selecting a data source.
A class that represents a data source component.
te::map::AbstractLayerPtr getLayer()
Get the generated layer.
std::auto_ptr< Ui::MainWindowDialogForm > m_ui
A layer with reference to a dataset.
Definition: DataSetLayer.h:47
TEQTWIDGETSEXPORT QString GetFilePathFromSettings(const QString &typeFile)
Returns the value of the last saved file path for the typeFile required.
Definition: Utils.cpp:376
std::map< std::string, std::vector< std::string > > m_mapFields
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr