27 #include "../dataaccess/datasource/DataSourceTransactor.h" 28 #include "../dataaccess/query/SQLDialect.h" 29 #include "../common/StringUtils.h" 30 #include "../core/translator/Translator.h" 37 #include <ogrsf_frmts.h> 73 return std::unique_ptr<te::da::DataSourceTransactor>(
new Transactor(
this));
83 m_ogrDS = (GDALDataset*)GDALOpenEx(
m_uri.
uri().c_str(), GDAL_OF_READONLY,
nullptr,
nullptr,
nullptr);
114 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpenEx(
m_uri.
uri().c_str(), GDAL_OF_READONLY,
nullptr,
nullptr,
nullptr));
162 throw Exception(
TE_TR(
"The create() method is not supported by the WFS driver!"));
167 throw Exception(
TE_TR(
"The drop() method is not supported by the WFS driver!"));
172 if (connInfo.empty())
179 std::string path = aux.
path();
183 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpen(path.c_str(), GA_ReadOnly));
194 return std::vector<std::string>();
203 throw Exception(
TE_TR(
"The connection information is invalid. Missing the path parameter!"));
210 OGRLayer* wfsMetadata =
m_ogrDS->GetLayerByName(
"WFSLayerMetadata");
212 if(wfsMetadata ==
nullptr)
213 throw Exception(
TE_TR(
"Could not retrieve the metadata from WFS server!"));
216 wfsMetadata->ResetReading();
217 while((f = wfsMetadata->GetNextFeature()) !=
nullptr)
220 info.
m_name = f->GetFieldAsString(
"layer_name");
221 info.
m_title = f->GetFieldAsString(
"title");
222 info.
m_abstract = f->GetFieldAsString(
"abstract");
std::string path() const
Retrieving the path.
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
Implementation of the transactor for the WFS driver.
te::da::SQLDialect * dialect
std::vector< std::string > getDataSourceNames(const std::string &connInfo)
It gets the data source names available in a driver.
Implementation of the data source for the WFS driver.
static te::da::DataSourceCapabilities sm_capabilities
Base exception class for plugin module.
An exception class for the TerraLib WFS module.
GDALDataset * getOGRDataSource()
#define TE_WFS_DRIVER_IDENTIFIER
The WFS driver identifier string.
It represents the SQL query dialect accepted by a given data source.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
bool isValid() const
Return if the given URI is valid or not.
#define TE_TR(message)
It marks a string in order to get translated.
DataSource(const std::string &connInfo)
void drop(const std::string &connInfo)
It removes the data source with the connection information from a driver.
Implementation of the data source for the WFS driver.
Informations about WFS Layers.
static void setCapabilities(const te::da::DataSourceCapabilities &capabilities)
void create(const std::string &connInfo)
It creates a new data source.
static void setDialect(te::da::SQLDialect *dialect)
std::vector< WFSLayerInfo > m_layersInfo
te::da::DataSourceCapabilities capabilities
void verifyConnectionInfo() const
void close()
It closes the data source and clears all the resources used by its internal communication channel...
const std::string & uri() const
Retrieving the full URI.
~DataSource()
Virtual destructor.
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
A class for representing an Uniform Resource Identifier (URI).
te::core::URI m_uri
The URI used to describe the datasource connection;.
const std::vector< WFSLayerInfo > & getLayersInfo()
std::unique_ptr< te::da::DataSourceTransactor > getTransactor()
It returns the set of parameters used to set up the access channel to the underlying repository...
bool isValid() const
It checks if the data source is valid (available for using).
static te::da::SQLDialect * sm_dialect
Implementation of the transactor for the WFS driver.
void open()
It opens the data source and makes it ready for using.
Utility functions for WFS driver.
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
bool exists(const std::string &connInfo)
Check the existence of a data source in a driver.
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.