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