WCSClient.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/wcs/client/WCSClient.h
22 
23  \brief WS Client for OGC WCS
24 
25  \author Vinicius Campanha
26 */
27 
28 #ifndef __TERRALIB_WS_OGC_WCS_CLIENT_WCS_H
29 #define __TERRALIB_WS_OGC_WCS_CLIENT_WCS_H
30 
31 // STL
32 #include <memory>
33 #include <vector>
34 #include <map>
35 #include <string>
36 
37 // TerraLib
38 #include "../../../../dataaccess/dataset/DataSet.h"
39 #include "../../../../common/progress/TaskProgress.h"
40 #include "../../../../core/uri/URI.h"
41 #include "../../../core/CurlWrapper.h"
42 #include "XMLParser.h"
43 #include "DataTypes.h"
44 
45 
46 namespace te
47 {
48  namespace ws
49  {
50  namespace ogc
51  {
52 
53  /*!
54  \class WCSClient
55 
56  \brief A class to retrieve information and data from a Web Coverage Service.
57  */
59  {
60  public:
61 
62  /*!
63  \brief Class constructor. It initializes the m_uri and m_version class members
64 
65  \param usrDataDir Directory to store used temporary XML and images from WCS server.
66  \param uri The adress of WCS server.
67  \param version The WCS version.
68  */
69  WCSClient(const std::string usrDataDir = "",const std::string uri = "", const std::string version = "2.0.1");
70 
71  /*!
72  \brief Default destructor.
73  */
74  ~WCSClient();
75 
76  /*!
77  \brief Method to get the capabilities from a WCS server and store in m_capabilities member
78 
79  To access the information contained in the m_capabilities, use the getCapabilities() method.
80 
81  */
82  void updateCapabilities();
83 
84  /*!
85  \brief Method to get the information about a coverage in the WCS server
86 
87  \param coverage The name of the coverage to describe
88 
89  \return Return the information of the coverage in the WCS
90  */
91  te::ws::ogc::wcs::CoverageDescription describeCoverage(const std::string coverage);
92 
93  /*!
94  \brief Method to get the coverage from the WCS server
95 
96  \param coverage The struct with the desire coverage parameters
97 
98  \return Returns a DataSet that contains the coverage
99  */
100  std::string getCoverage(const te::ws::ogc::wcs::CoverageRequest coverageRequest, te::common::TaskProgress* taskProgress = 0) const;
101 
102  /*!
103  \brief Executes a request on a WCS server
104 
105  \param url The complete url of request
106 
107  \return Returns a path to a file
108  */
109  std::string makeFileRequest(const std::string url, const std::string fileName, te::common::TaskProgress* taskProgress = 0) const;
110 
111 
112  /*!
113  \brief Return the m_capabilities member.
114 
115  The m_capabilities will be empty until the updateCapabilities() method its called.
116 
117  \return Returns a path to a file
118  */
119  const te::ws::ogc::wcs::Capabilities& getCapabilities() const;
120 
121  /*!
122  * \brief Sets the TerraLib CurlWrapper to be used internally.
123  *
124  * By default it is an instance of te::ws::core::CurlWrapper class.
125  *
126  * \param curlWrapper Wrapper to be used.
127  */
128  void setCurlWrapper(te::ws::core::CurlWrapper* curlWrapper);
129 
130  private:
131 
132  std::string getFileExtension(const std::string& format) const;
133 
134  private:
135  std::string m_version;
136  std::string m_dataDir;
139  std::shared_ptr<te::ws::core::CurlWrapper> m_curl;
140  std::map<std::string, te::ws::ogc::wcs::CoverageDescription> m_descriptionMap;
142  };
143  }
144  }
145 }
146 
147 #endif // __TERRALIB_WS_OGC_WCS_CLIENT_WCS_H
148 
te::ws::ogc::wcs::Capabilities m_capabilities
Definition: WCSClient.h:138
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
te::ws::ogc::wcs::XMLParser m_parser
Definition: WCSClient.h:141
std::string m_version
Definition: WCSClient.h:135
An abstraction to Lib Curl functions.
Definition: CurlWrapper.h:61
te::core::URI m_uri
Definition: WCSClient.h:137
std::string m_dataDir
Definition: WCSClient.h:136
A class responsible to parse WCS XML files to WCS TerraLib data types.
Definition: XMLParser.h:58
#define TEOGCWCSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:62
URI C++ Library.
A struct to set the parameters of requested coverage.
Definition: DataTypes.h:129
A class to retrieve information and data from a Web Coverage Service.
Definition: WCSClient.h:58
A class for representing an Uniform Resource Identifier (URI).
Definition: URI.h:49
std::map< std::string, te::ws::ogc::wcs::CoverageDescription > m_descriptionMap
Definition: WCSClient.h:140
Specifies containers for WCS data types.
Parse the WCS XML to a WCS struct.
std::shared_ptr< te::ws::core::CurlWrapper > m_curl
Definition: WCSClient.h:139