27 #include "../../../../core/translator/Translator.h" 28 #include "../../../../dataaccess/datasource/DataSource.h" 29 #include "../../../../dataaccess/datasource/DataSourceFactory.h" 30 #include "../../../../dataaccess/datasource/DataSourceManager.h" 31 #include "../../../../dataaccess/datasource/DataSourceInfo.h" 32 #include "../../../widgets/Exception.h" 34 #include "ui_WFSConnectorDialogForm.h" 37 #include <boost/algorithm/string/case_conv.hpp> 38 #include <boost/uuid/random_generator.hpp> 39 #include <boost/uuid/uuid_io.hpp> 40 #include <boost/lexical_cast.hpp> 43 #include <QMessageBox> 47 m_ui(new
Ui::WFSConnectorDialogForm)
78 if (!connInfo.
uri().empty())
79 m_ui->m_serverLineEdit->setText(QString::fromUtf8(connInfo.
uri().c_str()));
81 m_ui->m_datasourceTitleLineEdit->setText(QString::fromUtf8(
m_datasource->getTitle().c_str()));
83 m_ui->m_dataSourceDescriptionTextEdit->setText(QString::fromUtf8(
m_datasource->getDescription().c_str()));
93 throw te::qt::widgets::Exception(
TE_TR(
"Sorry! No data access driver loaded for WFS data sources!"));
104 throw te::qt::widgets::Exception(
TE_TR(
"Could not open WFS data source due to an unknown error!"));
106 QString title =
m_ui->m_datasourceTitleLineEdit->text().trimmed();
109 title =
m_ui->m_serverLineEdit->text().trimmed();
118 boost::uuids::basic_random_generator<boost::mt19937> gen;
119 boost::uuids::uuid u = gen();
120 std::string dsId = boost::uuids::to_string(u);
125 m_datasource->setDescription(
m_ui->m_dataSourceDescriptionTextEdit->toPlainText().trimmed().toUtf8().data());
134 m_datasource->setDescription(
m_ui->m_dataSourceDescriptionTextEdit->toPlainText().trimmed().toUtf8().data());
137 catch(
const std::exception& e)
139 QMessageBox::warning(
this,
140 tr(
"TerraLib Qt Components"),
145 QMessageBox::warning(
this,
146 tr(
"TerraLib Qt Components"),
147 tr(
"Unknown error while opening WFS data source!"));
159 throw te::qt::widgets::Exception(
TE_TR(
"Sorry! No data access driver loaded for WFS data sources!"));
164 if(ds.get() ==
nullptr)
165 throw te::qt::widgets::Exception(
TE_TR(
"Could not open WFS server!"));
169 QMessageBox::information(
this,
170 tr(
"TerraLib Qt Components"),
171 tr(
"Data source is ok!"));
175 catch(
const std::exception& e)
177 QMessageBox::warning(
this,
178 tr(
"TerraLib Qt Components"),
183 QMessageBox::warning(
this,
184 tr(
"TerraLib Qt Components"),
185 tr(
"Unknown error while testing WFS data source!"));
191 QMessageBox::warning(
this,
192 tr(
"TerraLib Qt Components"),
193 tr(
"Not implemented yet!\nWe will provide it soon!"));
200 std::string strURI(
"WFS:");
203 qstr =
m_ui->m_serverLineEdit->text().trimmed();
205 throw te::qt::widgets::Exception(
TE_TR(
"Please define the server address first!"));
207 strURI += qstr.toUtf8().data();
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
static bool find(const std::string &dsType)
te::da::DataSourceInfoPtr m_datasource
std::unique_ptr< Ui::WFSConnectorDialogForm > m_ui
const std::string getConnectionInfo() const
boost::shared_ptr< DataSource > DataSourcePtr
const te::da::DataSourcePtr & getDriver() const
te::da::DataSourcePtr m_driver
static te::dt::Date ds(2010, 01, 01)
#define TE_TR(message)
It marks a string in order to get translated.
WFSConnectorDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void helpPushButtonPressed()
const te::da::DataSourceInfoPtr & getDataSource() const
void set(const te::da::DataSourceInfoPtr &ds)
const std::string & uri() const
Retrieving the full URI.
A class for representing an Uniform Resource Identifier (URI).
void openPushButtonPressed()
A dialog window for showing the WFS connector widget.
A class that represents a data source component.
void testPushButtonPressed()
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr