DataSource.h
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/ws/ogc/wms/dataaccess/DataSource.h
22 
23  \brief Data Source for WS OGC WMS
24 
25  \author Emerson Moraes
26 */
27 
28 #ifndef __TERRALIB_WS_OGC_WMS_DATAACCESS_DATASOURCE_H
29 #define __TERRALIB_WS_OGC_WMS_DATAACCESS_DATASOURCE_H
30 
31 // STL
32 #include <map>
33 #include <string>
34 #include <memory>
35 
36 //Terralib
37 #include "Config.h"
38 #include "../client/WMSClient.h"
39 #include "../client/DataTypes.h"
40 #include "../../../../dataaccess/datasource/DataSource.h"
41 #include "../../../../dataaccess/datasource/DataSourceCapabilities.h"
42 
43 namespace te
44 {
45  namespace ws
46  {
47  namespace ogc
48  {
49  namespace wms
50  {
51  namespace da
52  {
53  /*!
54  \class DataSource
55 
56  \brief Implementation of the data source for the WMS driver.
57  */
59  {
60  public:
61  DataSource(const std::string& connInfo);
62 
64 
66 
67  std::string getType() const;
68 
69  std::unique_ptr<te::da::DataSourceTransactor> getTransactor();
70 
71  void open();
72 
73  void close();
74 
75  bool isOpened() const;
76 
77  bool isValid() const;
78 
80 
82 
84 
86 
87  /*!
88  \brief It execute a WMS GetMap and save the result image on disk.
89  The request will be based on WMSGetMapRequest setted to this WMSLayer.
90 
91  \return std::string with saved image path.
92  */
93  const std::string saveGetMap(const te::ws::ogc::wms::WMSGetMapRequest &request, const std::string& filename);
94 
96 
97  std::shared_ptr<te::ws::ogc::WMSClient> getWMSClient();
98 
99  protected:
100 
101  void create(const std::string& connInfo);
102 
103  void drop(const std::string& connInfo);
104 
105  bool exists(const std::string& connInfo);
106 
107  std::vector<std::string> getDataSourceNames(const std::string& connInfo);
108 
109  std::vector<te::core::EncodingType> getEncodings(const std::string& connInfo);
110 
111  private:
112 
113  void verifyConnectionInfo() const;
114 
115  private:
116 
117  std::shared_ptr<te::ws::ogc::WMSClient> m_wms;
120  };
121  } // end namespace da
122  } // end namespace wms
123  } // end namespace ogc
124  } // end namespace ws
125 } // end namespace te
126 
127 #endif // __TERRALIB_WS_OGC_WMS_DATAACCESS_DATASOURCE_H
te::ws::ogc::wms::da::DataSource
Implementation of the data source for the WMS driver.
Definition: DataSource.h:59
te::ws::ogc::wms::da::DataSource::open
void open()
It opens the data source and makes it ready for using.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::da::SQLDialect
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:56
te::ws::ogc::wms::WMSGetFeatureInfoResponse
The WMSGetMapResponse WMS 1.3.0 struct.
Definition: DataTypes.h:353
TEOGCWMSDATAACCESSEXPORT
#define TEOGCWMSDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:71
te::ws::ogc::wms::da::DataSource::sm_capabilities
static te::da::DataSourceCapabilities sm_capabilities
Definition: DataSource.h:119
te::ws::ogc::wms::WMSGetMapRequest
The WMSGetMapRequest WMS 1.3.0 struct.
Definition: DataTypes.h:287
te::ws::ogc::wms::da::DataSource::setCapabilities
static void setCapabilities(const te::da::DataSourceCapabilities &capabilities)
te::ws::ogc::wms::da::DataSource::saveGetMap
const std::string saveGetMap(const te::ws::ogc::wms::WMSGetMapRequest &request, const std::string &filename)
It execute a WMS GetMap and save the result image on disk. The request will be based on WMSGetMapRequ...
te::ws::ogc::wms::da::DataSource::exists
bool exists(const std::string &connInfo)
Check the existence of a data source in a driver.
te::ws::ogc::wms::da::DataSource::getMap
te::ws::ogc::wms::WMSGetMapResponse getMap(const te::ws::ogc::wms::WMSGetMapRequest &request)
te::ws::ogc::wms::da::DataSource::getDialect
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
te::ws::ogc::wms::da::DataSource::~DataSource
~DataSource()
Virtual destructor.
te::ws::ogc::wms::da::DataSource::m_isOpened
bool m_isOpened
Definition: DataSource.h:118
te::ws::ogc::wms::da::DataSource::drop
void drop(const std::string &connInfo)
It removes the data source with the connection information from a driver.
te::ws::ogc::wms::da::DataSource::getEncodings
std::vector< te::core::EncodingType > getEncodings(const std::string &connInfo)
capabilities
te::da::DataSourceCapabilities capabilities
Definition: PostGISCapabilities.h:129
te::ws::ogc::wms::da::DataSource::isOpened
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
te::ws::ogc::wms::da::DataSource::getDataSourceNames
std::vector< std::string > getDataSourceNames(const std::string &connInfo)
It gets the data source names available in a driver.
te::ws::ogc::wms::da::DataSource::getTransactor
std::unique_ptr< te::da::DataSourceTransactor > getTransactor()
It returns the set of parameters used to set up the access channel to the underlying repository.
te::ws::ogc::wms::WMSGetFeatureInfoRequest
The WMSGetFeatureInfoRequest WMS 1.3.0 struct.
Definition: DataTypes.h:330
te::ws::ogc::wms::da::DataSource::getType
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS,...
te::ws::ogc::wms::da::DataSource::m_wms
std::shared_ptr< te::ws::ogc::WMSClient > m_wms
Definition: DataSource.h:117
te::ws::ogc::wms::da::DataSource::DataSource
DataSource(const std::string &connInfo)
te::core::URI
A class to store the proxy information that must be used to access data located in URIs.
Definition: URI.h:50
te::ws::ogc::wms::da::DataSource::getCapabilities
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
te::ws::ogc::wms::WMSGetMapResponse
The WMSGetMapResponse WMS 1.3.0 struct.
Definition: DataTypes.h:317
te::ws::ogc::wms::da::DataSource::verifyConnectionInfo
void verifyConnectionInfo() const
te::da::DataSourceCapabilities
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
Definition: DataSourceCapabilities.h:56
te::ws::ogc::wms::da::DataSource::getFeatureInfo
const te::ws::ogc::wms::WMSGetFeatureInfoResponse getFeatureInfo(const te::ws::ogc::wms::WMSGetFeatureInfoRequest &request)
te::da::DataSource
An abstract class for data providers like a DBMS, Web Services or a regular file.
Definition: DataSource.h:120
te::ws::ogc::wms::da::DataSource::DataSource
DataSource(const te::core::URI &uri)
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::ws::ogc::wms::da::DataSource::getWMSClient
std::shared_ptr< te::ws::ogc::WMSClient > getWMSClient()
te::ws::ogc::wms::da::DataSource::close
void close()
It closes the data source and clears all the resources used by its internal communication channel.
te::ws::ogc::wms::da::DataSource::create
void create(const std::string &connInfo)
It creates a new data source.
te::ws::ogc::wms::da::DataSource::isValid
bool isValid() const
It checks if the data source is valid (available for using).