All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ConfigNumberDialog.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/ConfigNumberDialog.cpp
22 
23  \brief A dialog to import table with address to geocoding operation
24 */
25 
26 // TerraLib
27 #include "../../common/Translator.h"
28 #include "../../common/STLUtils.h"
29 #include "../../dataaccess/dataset/DataSetType.h"
30 #include "../../dataaccess/dataset/ObjectIdSet.h"
31 #include "../../dataaccess/datasource/DataSourceCapabilities.h"
32 #include "../../dataaccess/datasource/DataSourceInfo.h"
33 #include "../../dataaccess/datasource/DataSourceInfoManager.h"
34 #include "../../dataaccess/datasource/DataSourceFactory.h"
35 #include "../../dataaccess/datasource/DataSourceManager.h"
36 #include "../../dataaccess/utils/Utils.h"
37 #include "../../datatype/Enums.h"
38 #include "../../datatype/Property.h"
39 #include "../../maptools/AbstractLayer.h"
40 #include "../../qt/af/Utils.h"
41 #include "../../qt/widgets/datasource/selector/DataSourceSelectorDialog.h"
42 #include "../../qt/widgets/layer/utils/DataSet2Layer.h"
43 #include "../../qt/widgets/progress/ProgressViewerDialog.h"
44 #include "../Config.h"
45 #include "../Exception.h"
46 #include "ConfigNumberDialog.h"
47 #include "ui_ConfigNumberDialogForm.h"
48 
49 // Qt
50 #include <QMessageBox>
51 
52 // Boost
53 #include <boost/algorithm/string.hpp>
54 #include <boost/uuid/uuid_io.hpp>
55 
57  : QDialog(parent, f),
58  m_ui(new Ui::ConfigNumberDialogForm)
59 {
60 // add controls
61  m_ui->setupUi(this);
62 
63  connect(m_ui->m_helpPushButton, SIGNAL(clicked()), this, SLOT(onHelpPushButtonClicked()));
64  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
65  connect(m_ui->m_cancelPushButton, SIGNAL(clicked()), this, SLOT(onCancelPushButtonClicked()));
66 
67 }
68 
70 {
71 }
72 
74 {
75  m_selectedLayer = layer;
76  m_ui->m_layerLineEdit->setText(QString(m_selectedLayer->getTitle().c_str()));
77 
78  std::auto_ptr<te::da::DataSetType> dsType = m_selectedLayer->getSchema();
79  std::vector<te::dt::Property*> propVec = dsType->getProperties();
80 
81  int type;
82 
83  for(std::size_t i = 0; i < propVec.size(); ++i)
84  {
85  type = propVec[i]->getType();
86  if(type == te::dt::INT16_TYPE ||
87  type == te::dt::INT32_TYPE ||
88  type == te::dt::INT64_TYPE ||
89  type == te::dt::DOUBLE_TYPE ||
90  type == te::dt::NUMERIC_TYPE)
91  {
92  m_ui->m_iLeftComboBox->addItem(QString(propVec[i]->getName().c_str()));
93  m_ui->m_fLeftComboBox->addItem(QString(propVec[i]->getName().c_str()));
94  m_ui->m_iRightComboBox->addItem(QString(propVec[i]->getName().c_str()));
95  m_ui->m_fRightComboBox->addItem(QString(propVec[i]->getName().c_str()));
96  }
97  }
98 }
99 
101 {
102  return m_ui->m_iLeftComboBox->currentText().toStdString();
103 }
104 
106 {
107  return m_ui->m_fLeftComboBox->currentText().toStdString();
108 }
109 
111 {
112  return m_ui->m_iRightComboBox->currentText().toStdString();
113 }
114 
116 {
117  return m_ui->m_fRightComboBox->currentText().toStdString();
118 }
119 
121 {
122  QMessageBox::information(this, "Help", "Under development");
123 }
124 
126 {
127  this->close();
128 }
129 
131 {
132  reject();
133 }
134 
Associates address number.
void setLayer(te::map::AbstractLayerPtr layer)
std::auto_ptr< Ui::ConfigNumberDialogForm > m_ui
ConfigNumberDialog(QWidget *parent=0, Qt::WindowFlags f=0)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr