Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: WMS Client Driver 4 : * Purpose: Declaration of GDALWMSMetaDataset class 5 : * Author: Even Rouault, <even dot rouault at spatialys.com> 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2011-2013, Even Rouault <even dot rouault at spatialys.com> 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef WMS_METADATASET_H_INCLUDED 14 : #define WMS_METADATASET_H_INCLUDED 15 : 16 : #include "gdal_pam.h" 17 : #include "cpl_string.h" 18 : #include "cpl_http.h" 19 : #include <map> 20 : 21 : class WMSCTileSetDesc 22 : { 23 : public: 24 : CPLString osLayers{}; 25 : CPLString osSRS{}; 26 : CPLString osMinX{}, osMinY{}, osMaxX{}, osMaxY{}; 27 : double dfMinX{}, dfMinY{}, dfMaxX{}, dfMaxY{}; 28 : int nResolutions{}; 29 : double dfMinResolution{}; 30 : CPLString osFormat{}; 31 : CPLString osStyle{}; 32 : int nTileWidth{}, nTileHeight{}; 33 : }; 34 : 35 : /************************************************************************/ 36 : /* ==================================================================== */ 37 : /* GDALWMSMetaDataset */ 38 : /* ==================================================================== */ 39 : /************************************************************************/ 40 : 41 3 : class GDALWMSMetaDataset final : public GDALPamDataset 42 : { 43 : private: 44 : CPLString osGetURL{}; 45 : CPLString osVersion{}; 46 : CPLString osXMLEncoding{}; 47 : char **papszSubDatasets{nullptr}; 48 : 49 : CPL_DISALLOW_COPY_ASSIGN(GDALWMSMetaDataset) 50 : 51 : typedef std::pair<CPLString, CPLString> WMSCKeyType; 52 : std::map<WMSCKeyType, WMSCTileSetDesc> osMapWMSCTileSet{}; 53 : 54 : void AddSubDataset(const char *pszName, const char *pszDesc); 55 : 56 : void AddSubDataset(const char *pszLayerName, const char *pszTitle, 57 : const char *pszAbstract, const char *pszSRS, 58 : const char *pszMinX, const char *pszMinY, 59 : const char *pszMaxX, const char *pszMaxY, 60 : const std::string &osFormat, 61 : const std::string &osTransparent); 62 : 63 : void 64 : ExploreLayer(CPLXMLNode *psXML, const CPLString &osFormat, 65 : const CPLString &osTransparent, 66 : const CPLString &osPreferredSRS, const char *pszSRS = nullptr, 67 : const char *pszMinX = nullptr, const char *pszMinY = nullptr, 68 : const char *pszMaxX = nullptr, const char *pszMaxY = nullptr); 69 : 70 : // tiledWMS only 71 : void AddTiledSubDataset(const char *pszTiledGroupName, const char *pszTitle, 72 : const char *const *papszChanges); 73 : 74 : // tiledWMS only 75 : void AnalyzeGetTileServiceRecurse(CPLXMLNode *psXML, 76 : GDALOpenInfo *poOpenInfo); 77 : 78 : // WMS-C only 79 : void AddWMSCSubDataset(WMSCTileSetDesc &oWMSCTileSetDesc, 80 : const char *pszTitle, 81 : const CPLString &osTransparent); 82 : 83 : // WMS-C only 84 : void ParseWMSCTileSets(CPLXMLNode *psXML); 85 : 86 : public: 87 : GDALWMSMetaDataset(); 88 : virtual ~GDALWMSMetaDataset(); 89 : 90 : virtual char **GetMetadataDomainList() override; 91 : virtual char **GetMetadata(const char *pszDomain = "") override; 92 : 93 : static GDALDataset * 94 : AnalyzeGetCapabilities(CPLXMLNode *psXML, 95 : const std::string &osFormat = std::string(), 96 : const std::string &osTransparent = std::string(), 97 : const std::string &osPreferredSRS = std::string()); 98 : static GDALDataset *AnalyzeTileMapService(CPLXMLNode *psXML); 99 : 100 : static GDALDataset *DownloadGetCapabilities(GDALOpenInfo *poOpenInfo); 101 : 102 : // tiledWMS only 103 : static GDALDataset *DownloadGetTileService(GDALOpenInfo *poOpenInfo); 104 : // tiledWMS only 105 : static GDALDataset *AnalyzeGetTileService(CPLXMLNode *psXML, 106 : GDALOpenInfo *poOpenInfo); 107 : }; 108 : 109 : #endif // WMS_METADATASET_H_INCLUDED