27 #include "../../../../core/translator/Translator.h" 28 #include "../../../../core/uri/URI.h" 29 #include "../../../../core/uri/Utils.h" 30 #include "../../../../dataaccess/datasource/DataSource.h" 31 #include "../../../../dataaccess/datasource/DataSourceFactory.h" 32 #include "../../../../dataaccess/datasource/DataSourceInfo.h" 33 #include "../../../../dataaccess/datasource/DataSourceManager.h" 34 #include "../../../widgets/Exception.h" 36 #include "ui_WCSConnectorDialogForm.h" 39 #include <boost/algorithm/string/case_conv.hpp> 40 #include <boost/uuid/random_generator.hpp> 41 #include <boost/uuid/uuid_io.hpp> 42 #include <boost/lexical_cast.hpp> 45 #include <QMessageBox> 49 m_ui(new
Ui::WCSConnectorDialogForm)
82 if(!connInfo.
uri().empty())
83 m_ui->m_serverLineEdit->setText(QString::fromUtf8(connInfo.
uri().c_str()));
85 m_ui->m_datasourceTitleLineEdit->setText(QString::fromUtf8(
m_datasource->getTitle().c_str()));
87 m_ui->m_datasourceDescriptionTextEdit->setText(QString::fromUtf8(
m_datasource->getDescription().c_str()));
97 throw te::qt::widgets::Exception(
TE_TR(
"Sorry! No data access driver loaded for WCS data sources!"));
108 throw te::qt::widgets::Exception(
TE_TR(
"Could not open WCS data source due to an unknown error!"));
110 QString title =
m_ui->m_datasourceTitleLineEdit->text().trimmed();
113 title =
m_ui->m_serverLineEdit->text().trimmed();
122 boost::uuids::basic_random_generator<boost::mt19937> gen;
123 boost::uuids::uuid u = gen();
124 std::string dsId = boost::uuids::to_string(u);
129 m_datasource->setDescription(
m_ui->m_datasourceDescriptionTextEdit->toPlainText().trimmed().toUtf8().data());
138 m_datasource->setDescription(
m_ui->m_datasourceDescriptionTextEdit->toPlainText().trimmed().toUtf8().data());
141 catch(
const std::exception& e)
143 QMessageBox::warning(
this,
144 tr(
"TerraLib Qt Components"),
150 QMessageBox::warning(
this,
151 tr(
"TerraLib Qt Components"),
152 tr(
"Unknown error while opening WCS data source!"));
165 throw te::qt::widgets::Exception(
TE_TR(
"Sorry! No data access driver loaded for WCS data sources!"));
171 throw te::qt::widgets::Exception(
TE_TR(
"Could not open WCS server!"));
175 QMessageBox::information(
this,
176 tr(
"TerraLib Qt Components"),
177 tr(
"Data source is ok!"));
181 catch(
const std::exception& e)
183 QMessageBox::warning(
this,
184 tr(
"TerraLib Qt Components"),
189 QMessageBox::warning(
this,
190 tr(
"TerraLib Qt Components"),
191 tr(
"Unknown error while testing WCS data source!"));
197 QMessageBox::warning(
this,
198 tr(
"TerraLib Qt Components"),
199 tr(
"Not implemented yet!\nWe will provide it soon!"));
206 std::string strURI(
"WCS:");
208 qstr =
m_ui->m_serverLineEdit->text().trimmed();
211 throw te::qt::widgets::Exception(
TE_TR(
"Please select a feature file first!"));
213 strURI += qstr.toUtf8().data();
void openPushButtonPressed()
const std::string getConnectionInfo() const
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
static bool find(const std::string &dsType)
boost::shared_ptr< DataSource > DataSourcePtr
void set(const te::da::DataSourceInfoPtr &ds)
static te::dt::Date ds(2010, 01, 01)
#define TE_TR(message)
It marks a string in order to get translated.
WCSConnectorDialog(QWidget *parent=0, Qt::WindowFlags f=0)
const te::da::DataSourcePtr & getDriver() const
void testPushButtonPressed()
std::auto_ptr< Ui::WCSConnectorDialogForm > m_ui
const std::string & uri() const
Retrieving the full URI.
A class for representing an Uniform Resource Identifier (URI).
const te::da::DataSourceInfoPtr & getDataSource() const
te::da::DataSourcePtr m_driver
A class that represents a data source component.
te::da::DataSourceInfoPtr m_datasource
void helpPushButtonPressed()
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr