1 : /******************************************************************************
2 : * $Id: wmsmetadataset.h 22557 2011-06-22 15:56:00Z rouault $
3 : *
4 : * Project: WMS Client Driver
5 : * Purpose: Declaration of GDALWMSMetaDataset class
6 : * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2011, Even Rouault, <even dot rouault at mines dash paris dot org>
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #ifndef _WMS_METADATASET_H_INCLUDED
31 : #define _WMS_METADATASET_H_INCLUDED
32 :
33 : #include "gdal_pam.h"
34 : #include "cpl_string.h"
35 : #include "cpl_http.h"
36 : #include <map>
37 :
38 : class WMSCTileSetDesc
39 558 : {
40 : public:
41 : CPLString osLayers;
42 : CPLString osSRS;
43 : CPLString osMinX, osMinY, osMaxX, osMaxY;
44 : double dfMinX, dfMinY, dfMaxX, dfMaxY;
45 : int nResolutions;
46 : double dfMinResolution;
47 : CPLString osFormat;
48 : CPLString osStyle;
49 : int nTileWidth, nTileHeight;
50 : };
51 :
52 : /************************************************************************/
53 : /* ==================================================================== */
54 : /* GDALWMSMetaDataset */
55 : /* ==================================================================== */
56 : /************************************************************************/
57 :
58 : class GDALWMSMetaDataset : public GDALPamDataset
59 : {
60 : private:
61 : CPLString osGetURL;
62 : CPLString osVersion;
63 : CPLString osXMLEncoding;
64 : char** papszSubDatasets;
65 :
66 : typedef std::pair<CPLString, CPLString> WMSCKeyType;
67 : std::map<WMSCKeyType, WMSCTileSetDesc> osMapWMSCTileSet;
68 :
69 : void AddSubDataset(const char* pszName,
70 : const char* pszDesc);
71 :
72 : void AddSubDataset(const char* pszLayerName,
73 : const char* pszTitle,
74 : const char* pszAbstract,
75 : const char* pszSRS,
76 : const char* pszMinX,
77 : const char* pszMinY,
78 : const char* pszMaxX,
79 : const char* pszMaxY,
80 : CPLString osFormat,
81 : CPLString osTransparent);
82 :
83 : void ExploreLayer(CPLXMLNode* psXML,
84 : CPLString osFormat,
85 : CPLString osTransparent,
86 : const char* pszSRS = NULL,
87 : const char* pszMinX = NULL,
88 : const char* pszMinY = NULL,
89 : const char* pszMaxX = NULL,
90 : const char* pszMaxY = NULL);
91 :
92 : void AddTiledSubDataset(const char* pszTiledGroupName,
93 : const char* pszTitle);
94 :
95 : void AnalyzeGetTileServiceRecurse(CPLXMLNode* psXML);
96 :
97 : void AddWMSCSubDataset(WMSCTileSetDesc& oWMSCTileSetDesc,
98 : const char* pszTitle,
99 : CPLString osTransparent);
100 :
101 : void ParseWMSCTileSets(CPLXMLNode* psXML);
102 :
103 : public:
104 : GDALWMSMetaDataset();
105 : ~GDALWMSMetaDataset();
106 :
107 : virtual char **GetMetadata( const char * pszDomain = "" );
108 :
109 : static GDALDataset* AnalyzeGetCapabilities(CPLXMLNode* psXML,
110 : CPLString osFormat = "",
111 : CPLString osTransparent = "");
112 : static GDALDataset* AnalyzeGetTileService(CPLXMLNode* psXML);
113 : static GDALDataset* AnalyzeTileMapService(CPLXMLNode* psXML);
114 :
115 : static GDALDataset* DownloadGetCapabilities(GDALOpenInfo *poOpenInfo);
116 : static GDALDataset* DownloadGetTileService(GDALOpenInfo *poOpenInfo);
117 : };
118 :
119 : #endif // _WMS_METADATASET_H_INCLUDED
|