osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthUtil/WMS

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 OSGEARTHUTIL_WMS_H
00021 #define OSGEARTHUTIL_WMS_H 1
00022 
00023 #include <osgEarthUtil/Common>
00024 #include <osg/Referenced>
00025 #include <osg/ref_ptr>
00026 #include <osgEarth/Common>
00027 
00028 #include <osgDB/ReaderWriter>
00029 #include <osg/Version>
00030 #if OSG_MIN_VERSION_REQUIRED(2,9,5)
00031 #include <osgDB/Options>
00032 #endif
00033 
00034 
00035 #include <string>
00036 #include <vector>
00037 
00038 namespace osgEarth { namespace Util
00039 {
00043     class OSGEARTHUTIL_EXPORT WMSStyle : public osg::Referenced
00044     {
00045     public:
00046         WMSStyle();
00047         WMSStyle(const std::string& name, const std::string &title);
00048 
00052         const std::string& getName() {return _name;}
00053 
00057         void setName(const std::string &name) {_name = name;}
00058 
00062         const std::string& getTitle() {return _title;}
00063 
00067         void setTitle(const std::string &title) {_title = title;}
00068         
00069     protected:
00070         std::string _name;
00071         std::string _title;
00072     };
00073 
00077     class OSGEARTHUTIL_EXPORT WMSLayer : public osg::Referenced
00078     {
00079     public:
00080         WMSLayer();
00081 
00085         const std::string& getName() {return _name;}
00086 
00090         void setName(const std::string &name) {_name = name;}
00091 
00095         const std::string& getTitle() {return _title;}
00096 
00100         void setTitle(const std::string &title) {_title = title;}
00101 
00105         const std::string& getAbstract() {return _abstract;}
00106 
00110         void setAbstract(const std::string &abstract) {_abstract = abstract;}
00111 
00115         void getLatLonExtents(double &minLon, double &minLat, double &maxLon, double &maxLat);
00116 
00120         void setLatLonExtents(double minLon, double minLat, double maxLon, double maxLat);
00121 
00125         void getExtents(double &minX, double &minY, double &maxX, double &maxY);
00126 
00130         void setExtents(double minX, double minY, double maxX, double maxY);
00131 
00132 
00134         typedef std::vector<WMSStyle> StyleList;
00135 
00139         StyleList& getStyles() {return _styles;}
00140 
00142         typedef std::vector<std::string> SRSList;
00143 
00147         SRSList& getSpatialReferences() {return _spatialReferences;}
00148 
00150         typedef std::vector< osg::ref_ptr<WMSLayer> > LayerList;
00151 
00155         LayerList& getLayers() {return _layers;}
00156 
00160         WMSLayer* getParentLayer() {return _parentLayer;}
00161 
00165         void setParentLayer( WMSLayer* layer ) {_parentLayer = layer;}
00166 
00172         WMSLayer* getLayerByName(const std::string &name);
00173     protected:
00174         std::string _name;
00175         std::string _title;
00176         std::string _abstract;
00177         double _minLon, _minLat, _maxLon, _maxLat;
00178         double _minX, _minY, _maxX, _maxY;
00179         StyleList _styles;
00180         SRSList _spatialReferences;
00181 
00182         LayerList _layers;
00183         WMSLayer* _parentLayer;
00184     };
00185 
00189     class OSGEARTHUTIL_EXPORT WMSCapabilities : public osg::Referenced
00190     {
00191     public:
00192         WMSCapabilities();
00193 
00197         const std::string& getVersion() {return _version;}
00198 
00202         void setVersion(const std::string& version) {_version = version;}
00203 
00205         typedef std::vector<std::string> FormatList;
00206 
00210         FormatList& getFormats() {return _formats;}
00211 
00215         WMSLayer::LayerList& getLayers() {return _layers;}
00216 
00225         std::string suggestExtension();
00226 
00232         WMSLayer* getLayerByName(const std::string &name);
00233 
00234     protected:
00235         FormatList _formats;
00236         WMSLayer::LayerList _layers;
00237         std::string _version;
00238     };
00239 
00240     /*
00241     * Reads Capabilities from a URL or file
00242     */
00243     class OSGEARTHUTIL_EXPORT WMSCapabilitiesReader
00244     {
00245     public:
00246         static WMSCapabilities* read( const std::string &location, const osgDB::ReaderWriter::Options *options );
00247         static WMSCapabilities* read( std::istream &in );
00248     private:
00249         WMSCapabilitiesReader(){}
00250         WMSCapabilitiesReader(const WMSCapabilitiesReader &cr){}
00251     };
00252 
00253 } } // namespace osgEarth::Util
00254 
00255 #endif //OSGEARTHUTIL_WMS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines