ToolMap
Loading...
Searching...
No Matches
tmwms.h
1//
2// Created by lsc on 23.05.25.
3//
4
5#ifndef TMWMS_H
6#define TMWMS_H
7
8#include <wx/wxprec.h>
9
10#ifndef WX_PRECOMP
11#include <wx/wx.h>
12#endif
13#include <curl/curl.h>
14#include <wx/xml/xml.h>
15#include <wx/file.h>
16#include <wx/filename.h>
17
19 private:
20 wxString m_wms_url = wxEmptyString;
21 wxFileName m_wms_xml_file;
22
23 static size_t WriteToFile(void* ptr, size_t size, size_t nmemb, void* userdata);
24
25 public:
26 explicit tmWMSBrowser(const wxString& wms_url);
27
28 bool DownloadCapabilities(const wxString & output_xml_file_name, const wxString &lang=wxEmptyString);
29 bool GetLayers(wxArrayString& layers_names,
30 wxArrayString& layers_titles,
31 wxArrayString& layers_abstracts, wxArrayString &layers_crs);;
32
33 wxString GetWMSUrl() const {return m_wms_url;}
34 wxString GetWMSCapabilitiesURL(const wxString & lang = wxEmptyString) const {
35 return m_wms_url + "&REQUEST=GetCapabilities" + (lang.IsEmpty() ? "" : "&lang=" + lang);
36 }
37};
38
43 private:
44 wxString m_wms_url = wxEmptyString;
45
46 public:
47 explicit tmWMSFileXML(const wxString& wms_url);
48
49 bool CreateXML(const wxString & layer_name, const wxString& output_xml_file_name, const wxString &projection_epsg);
50 wxString GetWMSUrl() const {return m_wms_url;}
51
52 wxString GetWMSLayerURL(const wxString & layer_name, const wxString & projection_epsg) const {
53 return m_wms_url + "&REQUEST=GetMap&LAYERS=" + layer_name + "&CRS=" + projection_epsg;
54 }
55};
56
57#endif // TMWMS_H
Definition tmwms.h:18
bool DownloadCapabilities(const wxString &output_xml_file_name, const wxString &lang=wxEmptyString)
Download and store the XML file containing the WMS capabilities (Layers and other information)
Definition tmwms.cpp:13
bool GetLayers(wxArrayString &layers_names, wxArrayString &layers_titles, wxArrayString &layers_abstracts, wxArrayString &layers_crs)
Get the layers names, titles and abstracts from the XML capabilities.
Definition tmwms.cpp:45
Definition tmwms.h:42