osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthDrivers/wms/Capabilities

Go to the documentation of this file.
00001 /* -*-c++-*- */
00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
00003  * Copyright 2008-2010 Pelican Mapping
00004  * http://osgearth.org
00005  *
00006  * osgEarth is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>
00018  */
00019 
00020 #ifndef OSGEARTH_WMS_CAPABILITIES_H
00021 #define OSGEARTH_WMS_CAPABILITIES_H
00022 
00023 #include <osg/Referenced>
00024 #include <osg/ref_ptr>
00025 #include <osgEarth/Common>
00026 
00027 #include <osgDB/ReaderWriter>
00028 #include <osg/Version>
00029 #if OSG_MIN_VERSION_REQUIRED(2,9,5)
00030 #include <osgDB/Options>
00031 #endif
00032 
00033 
00034 #include <string>
00035 #include <vector>
00036 
00037 namespace osgEarth
00038 {
00042     class Style : public osg::Referenced
00043     {
00044     public:
00045         Style();
00046         Style(const std::string& name, const std::string &title);
00047 
00051         const std::string& getName() {return _name;}
00052 
00056         void setName(const std::string &name) {_name = name;}
00057 
00061         const std::string& getTitle() {return _title;}
00062 
00066         void setTitle(const std::string &title) {_title = title;}
00067         
00068     protected:
00069         std::string _name;
00070         std::string _title;
00071     };
00072 
00076     class Layer : public osg::Referenced
00077     {
00078     public:
00079         Layer();
00080 
00084         const std::string& getName() {return _name;}
00085 
00089         void setName(const std::string &name) {_name = name;}
00090 
00094         const std::string& getTitle() {return _title;}
00095 
00099         void setTitle(const std::string &title) {_title = title;}
00100 
00104         const std::string& getAbstract() {return _abstract;}
00105 
00109         void setAbstract(const std::string &abstract) {_abstract = abstract;}
00110 
00114         void getLatLonExtents(double &minLon, double &minLat, double &maxLon, double &maxLat);
00115 
00119         void setLatLonExtents(double minLon, double minLat, double maxLon, double maxLat);
00120 
00124         void getExtents(double &minX, double &minY, double &maxX, double &maxY);
00125 
00129         void setExtents(double minX, double minY, double maxX, double maxY);
00130 
00131 
00133         typedef std::vector<Style> StyleList;
00134 
00138         StyleList& getStyles() {return _styles;}
00139 
00141         typedef std::vector<std::string> SRSList;
00142 
00146         SRSList& getSpatialReferences() {return _spatialReferences;}
00147 
00149         typedef std::vector< osg::ref_ptr<Layer> > LayerList;
00150 
00154         LayerList& getLayers() {return _layers;}
00155 
00159         Layer* getParentLayer() {return _parentLayer;}
00160 
00164         void setParentLayer( Layer* layer ) {_parentLayer = layer;}
00165 
00171         Layer* getLayerByName(const std::string &name);
00172     protected:
00173         std::string _name;
00174         std::string _title;
00175         std::string _abstract;
00176         double _minLon, _minLat, _maxLon, _maxLat;
00177         double _minX, _minY, _maxX, _maxY;
00178         StyleList _styles;
00179         SRSList _spatialReferences;
00180 
00181         LayerList _layers;
00182         Layer* _parentLayer;
00183     };
00184 
00188     class WMSCapabilities : public osg::Referenced
00189     {
00190     public:
00191         WMSCapabilities();
00192 
00196         const std::string& getVersion() {return _version;}
00197 
00201         void setVersion(const std::string& version) {_version = version;}
00202 
00204         typedef std::vector<std::string> FormatList;
00205 
00209         FormatList& getFormats() {return _formats;}
00210 
00214         Layer::LayerList& getLayers() {return _layers;}
00215 
00224         std::string suggestExtension();
00225 
00231         Layer* getLayerByName(const std::string &name);
00232 
00233     protected:
00234         FormatList _formats;
00235         Layer::LayerList _layers;
00236         std::string _version;
00237     };
00238 
00239     /*
00240     * Reads Capabilities from a URL or file
00241     */
00242     class WMSCapabilitiesReader
00243     {
00244     public:
00245         static WMSCapabilities* read( const std::string &location, const osgDB::ReaderWriter::Options *options );
00246         static WMSCapabilities* read( std::istream &in );
00247     private:
00248         WMSCapabilitiesReader(){}
00249         WMSCapabilitiesReader(const WMSCapabilitiesReader &cr){}
00250     };
00251 }
00252 
00253 #endif //OSGEARTH_CAPABILITIES_H
00254 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines