A class to retrieve information and data from a Web Map Service. More...
#include <WMSClient.h>
Public Member Functions | |
| const te::ws::ogc::wms::WMSCapabilities & | getCapabilities () const |
| Return the WMSCapabilities member. More... | |
| const te::ws::ogc::wms::WMSGetFeatureInfoResponse | getFeatureInfo (const te::ws::ogc::wms::WMSGetFeatureInfoRequest &request) const |
| It execute a WMS GetFeatureInfo and returns a WMSGetFeatureInfoResponse with the result. More... | |
| const te::ws::ogc::wms::WMSGetMapResponse | getMap (const te::ws::ogc::wms::WMSGetMapRequest &request) const |
| Return the WMSGetMapResponse member. More... | |
| std::string | makeFileRequest (const std::string url, const std::string fileName) const |
| Executes a request on a WMS server. More... | |
| 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 WMSGetMapRequest setted to this WMSLayer. More... | |
| void | setCapabilities (const te::ws::ogc::wms::WMSCapabilities &capabilities) |
| void | setCurlWrapper (te::ws::core::CurlWrapper *curlWrapper) |
| Sets the TerraLib CurlWrapper to be used internally. More... | |
| void | updateCapabilities () |
| Method to get the capabilities from a WMS server and store in m_capabilities member. More... | |
| WMSClient (const std::string usrDataDir="", const std::string uri="", const std::string version="1.3.0") | |
| Class constructor. It initializes the m_uri and m_version class members. More... | |
| ~WMSClient () | |
| Default destructor. More... | |
Private Member Functions | |
| std::string | build111GetFeatureInfoURL (const te::ws::ogc::wms::WMSGetFeatureInfoRequest &request) const |
| std::string | build111GetMapRequestURL (const te::ws::ogc::wms::WMSGetMapRequest &request) const |
| std::string | build130GetFeatureInfoURL (const te::ws::ogc::wms::WMSGetFeatureInfoRequest &request) const |
| std::string | build130GetMapRequestURL (const te::ws::ogc::wms::WMSGetMapRequest &request) const |
| std::string | buildGetFeatureInfoURL (const te::ws::ogc::wms::WMSGetFeatureInfoRequest &request) const |
| std::string | buildGetMapRequestURL (const te::ws::ogc::wms::WMSGetMapRequest &request) const |
Private Attributes | |
| te::ws::ogc::wms::WMSCapabilities | m_capabilities |
| std::shared_ptr< te::ws::core::CurlWrapper > | m_curl |
| std::string | m_dataDir |
| std::unique_ptr< te::ws::ogc::wms::XMLParser > | m_parser |
| te::core::URI | m_uri |
| std::string | m_version |
A class to retrieve information and data from a Web Map Service.
Definition at line 57 of file WMSClient.h.
| te::ws::ogc::WMSClient::WMSClient | ( | const std::string | usrDataDir = "", |
| const std::string | uri = "", |
||
| const std::string | version = "1.3.0" |
||
| ) |
Class constructor. It initializes the m_uri and m_version class members.
| usrDataDir | Directory to store used temporary XML and images from WMS server. |
| uri | The adress of WMS server. |
| version | The WMS version. |
Definition at line 18 of file WMSClient.cpp.
References te::core::FileSystem::createDirectories(), te::core::FileSystem::exists(), te::core::URI::host(), te::ws::core::HTTP_BASIC, te::core::FileSystem::isDirectory(), m_curl, m_dataDir, m_parser, m_uri, m_version, te::common::AbstractFactory< XMLParser, std::string >::make(), te::core::URI::password(), te::core::URI::path(), te::core::URI::port(), te::core::URI::query(), te::core::URI::scheme(), te::core::URI::user(), and ~WMSClient().
|
default |
Default destructor.
Referenced by WMSClient().
|
private |
Definition at line 486 of file WMSClient.cpp.
References te::ws::ogc::wms::WMSGetMapRequest::m_boundingBox, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_exceptions, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_featureCount, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_getMap, te::ws::ogc::wms::WMSGetMapRequest::m_height, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_i, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_infoFormat, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_j, te::ws::ogc::wms::WMSGetMapRequest::m_layers, te::ws::ogc::wms::BoundingBox::m_maxX, te::ws::ogc::wms::BoundingBox::m_maxY, te::ws::ogc::wms::BoundingBox::m_minX, te::ws::ogc::wms::BoundingBox::m_minY, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_queryLayers, te::ws::ogc::wms::WMSGetMapRequest::m_srs, te::ws::ogc::wms::WMSGetMapRequest::m_styles, m_uri, m_version, te::ws::ogc::wms::WMSGetMapRequest::m_width, and te::core::URI::uri().
Referenced by buildGetFeatureInfoURL().
|
private |
Definition at line 290 of file WMSClient.cpp.
References te::ws::ogc::wms::WMSGetMapRequest::m_bgColor, te::ws::ogc::wms::WMSGetMapRequest::m_boundingBox, te::ws::ogc::wms::WMSGetMapRequest::m_format, te::ws::ogc::wms::WMSGetMapRequest::m_height, te::ws::ogc::wms::WMSGetMapRequest::m_layers, te::ws::ogc::wms::BoundingBox::m_maxX, te::ws::ogc::wms::BoundingBox::m_maxY, te::ws::ogc::wms::BoundingBox::m_minX, te::ws::ogc::wms::BoundingBox::m_minY, te::ws::ogc::wms::WMSGetMapRequest::m_srs, te::ws::ogc::wms::WMSGetMapRequest::m_styles, te::ws::ogc::wms::WMSGetMapRequest::m_time, te::ws::ogc::wms::WMSGetMapRequest::m_transparent, m_uri, m_version, te::ws::ogc::wms::WMSGetMapRequest::m_width, and te::core::URI::uri().
Referenced by buildGetMapRequestURL().
|
private |
Definition at line 383 of file WMSClient.cpp.
References te::ws::core::IsInvertedEPSG(), te::ws::ogc::wms::WMSGetMapRequest::m_boundingBox, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_exceptions, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_featureCount, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_getMap, te::ws::ogc::wms::WMSGetMapRequest::m_height, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_i, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_infoFormat, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_j, te::ws::ogc::wms::WMSGetMapRequest::m_layers, te::ws::ogc::wms::BoundingBox::m_maxX, te::ws::ogc::wms::BoundingBox::m_maxY, te::ws::ogc::wms::BoundingBox::m_minX, te::ws::ogc::wms::BoundingBox::m_minY, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_queryLayers, te::ws::ogc::wms::WMSGetMapRequest::m_srs, te::ws::ogc::wms::WMSGetMapRequest::m_styles, m_uri, m_version, te::ws::ogc::wms::WMSGetMapRequest::m_width, and te::core::URI::uri().
Referenced by buildGetFeatureInfoURL().
|
private |
Definition at line 198 of file WMSClient.cpp.
References te::ws::core::IsInvertedEPSG(), te::ws::ogc::wms::WMSGetMapRequest::m_bgColor, te::ws::ogc::wms::WMSGetMapRequest::m_boundingBox, te::ws::ogc::wms::WMSGetMapRequest::m_format, te::ws::ogc::wms::WMSGetMapRequest::m_height, te::ws::ogc::wms::WMSGetMapRequest::m_layers, te::ws::ogc::wms::BoundingBox::m_maxX, te::ws::ogc::wms::BoundingBox::m_maxY, te::ws::ogc::wms::BoundingBox::m_minX, te::ws::ogc::wms::BoundingBox::m_minY, te::ws::ogc::wms::WMSGetMapRequest::m_srs, te::ws::ogc::wms::WMSGetMapRequest::m_styles, te::ws::ogc::wms::WMSGetMapRequest::m_time, te::ws::ogc::wms::WMSGetMapRequest::m_transparent, m_uri, m_version, te::ws::ogc::wms::WMSGetMapRequest::m_width, and te::core::URI::uri().
Referenced by buildGetMapRequestURL().
|
private |
Definition at line 366 of file WMSClient.cpp.
References build111GetFeatureInfoURL(), build130GetFeatureInfoURL(), and m_version.
Referenced by getFeatureInfo().
|
private |
Definition at line 180 of file WMSClient.cpp.
References build111GetMapRequestURL(), build130GetMapRequestURL(), and m_version.
Referenced by getMap(), and saveGetMap().
| const te::ws::ogc::wms::WMSCapabilities & te::ws::ogc::WMSClient::getCapabilities | ( | ) | const |
Return the WMSCapabilities member.
The WMSCapabilities will be empty until the updateCapabilities() method its called.
Definition at line 108 of file WMSClient.cpp.
References m_capabilities.
Referenced by BOOST_AUTO_TEST_CASE(), and main().
| const te::ws::ogc::wms::WMSGetFeatureInfoResponse te::ws::ogc::WMSClient::getFeatureInfo | ( | const te::ws::ogc::wms::WMSGetFeatureInfoRequest & | request | ) | const |
It execute a WMS GetFeatureInfo and returns a WMSGetFeatureInfoResponse with the result.
Definition at line 147 of file WMSClient.cpp.
References buildGetFeatureInfoURL(), m_curl, te::ws::ogc::wms::WMSGetFeatureInfoResponse::m_featureInfoContent, te::ws::ogc::wms::WMSGetFeatureInfoRequest::m_infoFormat, and te::ws::ogc::wms::WMSGetFeatureInfoResponse::m_infoFormat.
Referenced by main().
| const te::ws::ogc::wms::WMSGetMapResponse te::ws::ogc::WMSClient::getMap | ( | const te::ws::ogc::wms::WMSGetMapRequest & | request | ) | const |
Return the WMSGetMapResponse member.
Make the GetMapRequest and return the server answer as a WMSGetMapResponse.
Definition at line 118 of file WMSClient.cpp.
References buildGetMapRequestURL(), te::ws::ogc::wms::WMSGetMapResponse::m_buffer, m_curl, te::ws::ogc::wms::WMSGetMapRequest::m_format, te::ws::ogc::wms::WMSGetMapResponse::m_format, and te::ws::ogc::wms::WMSGetMapResponse::m_size.
Referenced by BOOST_AUTO_TEST_CASE(), and main().
| std::string te::ws::ogc::WMSClient::makeFileRequest | ( | const std::string | url, |
| const std::string | fileName | ||
| ) | const |
Executes a request on a WMS server.
| url | The complete url of request |
Definition at line 166 of file WMSClient.cpp.
References m_curl, and m_dataDir.
Referenced by saveGetMap(), and updateCapabilities().
| const std::string te::ws::ogc::WMSClient::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 WMSGetMapRequest setted to this WMSLayer.
Definition at line 137 of file WMSClient.cpp.
References buildGetMapRequestURL(), and makeFileRequest().
Referenced by BOOST_AUTO_TEST_CASE().
| void te::ws::ogc::WMSClient::setCapabilities | ( | const te::ws::ogc::wms::WMSCapabilities & | capabilities | ) |
Definition at line 113 of file WMSClient.cpp.
References capabilities, and m_capabilities.
| void te::ws::ogc::WMSClient::setCurlWrapper | ( | te::ws::core::CurlWrapper * | curlWrapper | ) |
Sets the TerraLib CurlWrapper to be used internally.
By default it is an instance of te::ws::core::CurlWrapper class.
| curlWrapper | Wrapper to be used. |
Definition at line 175 of file WMSClient.cpp.
References m_curl.
| void te::ws::ogc::WMSClient::updateCapabilities | ( | ) |
Method to get the capabilities from a WMS server and store in m_capabilities member.
To access the information contained in the m_capabilities, use the getCapabilities() method.
According to version negotiation, the client must try to request with the higher supported version. If server response with an other version, client must try to request with an lower version.
Definition at line 67 of file WMSClient.cpp.
References m_capabilities, m_curl, m_parser, m_uri, m_version, te::common::AbstractFactory< XMLParser, std::string >::make(), makeFileRequest(), TE_TR, and te::core::URI::uri().
Referenced by BOOST_AUTO_TEST_CASE(), te::ws::ogc::wms::da::DataSource::exists(), and main().
|
private |
Definition at line 154 of file WMSClient.h.
Referenced by getCapabilities(), setCapabilities(), and updateCapabilities().
|
private |
Definition at line 155 of file WMSClient.h.
Referenced by getFeatureInfo(), getMap(), makeFileRequest(), setCurlWrapper(), updateCapabilities(), and WMSClient().
|
private |
Definition at line 152 of file WMSClient.h.
Referenced by makeFileRequest(), and WMSClient().
|
private |
Definition at line 156 of file WMSClient.h.
Referenced by updateCapabilities(), and WMSClient().
|
private |
Definition at line 153 of file WMSClient.h.
Referenced by build111GetFeatureInfoURL(), build111GetMapRequestURL(), build130GetFeatureInfoURL(), build130GetMapRequestURL(), updateCapabilities(), and WMSClient().
|
private |
Definition at line 151 of file WMSClient.h.
Referenced by build111GetFeatureInfoURL(), build111GetMapRequestURL(), build130GetFeatureInfoURL(), build130GetMapRequestURL(), buildGetFeatureInfoURL(), buildGetMapRequestURL(), updateCapabilities(), and WMSClient().