osgEarth 2.1.1
|
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_WFS_H 00021 #define OSGEARTHUTIL_WFS_H 1 00022 00023 #include <osgEarthUtil/Common> 00024 #include <osgEarth/GeoData> 00025 #include <osg/Referenced> 00026 #include <osg/ref_ptr> 00027 #include <osgEarth/Common> 00028 00029 #include <osgDB/ReaderWriter> 00030 #include <osg/Version> 00031 #if OSG_MIN_VERSION_REQUIRED(2,9,5) 00032 #include <osgDB/Options> 00033 #endif 00034 00035 00036 #include <string> 00037 #include <vector> 00038 00039 namespace osgEarth { namespace Util 00040 { 00041 class OSGEARTHUTIL_EXPORT WFSFeatureType : public osg::Referenced 00042 { 00043 public: 00044 WFSFeatureType(); 00045 00046 const std::string& getName() const { return _name;} 00047 void setName(const std::string& name) { _name = name;} 00048 00049 const std::string& getTitle() const { return _title;} 00050 void setTitle(const std::string& title) { _title = title;} 00051 00052 const std::string& getSRS() const { return _srs;} 00053 void setSRS(const std::string& srs) { _srs = srs; } 00054 00055 const std::string& getAbstract() const { return _abstract;} 00056 void setAbstract(const std::string& abstract) { _abstract = abstract; } 00057 00058 const GeoExtent& getExtent() const { return _extent;} 00059 void setExtent(const GeoExtent& extent) { _extent = extent;} 00060 00061 int getMaxLevel() const { return _maxLevel;} 00062 void setMaxLevel( int maxLevel ) { _maxLevel = maxLevel; } 00063 00064 int getFirstLevel() const { return _firstLevel;} 00065 void setFirstLevel( int firstLevel ) { _firstLevel = firstLevel; } 00066 00067 bool getTiled() const { return _tiled;} 00068 void setTiled(bool tiled) { _tiled = tiled;} 00069 00070 private: 00071 std::string _name; 00072 std::string _title; 00073 std::string _srs; 00074 std::string _abstract; 00075 GeoExtent _extent; 00076 bool _tiled; 00077 int _maxLevel; 00078 int _firstLevel; 00079 }; 00080 00081 typedef std::vector< osg::ref_ptr< WFSFeatureType > > FeatureTypeList; 00082 00083 00084 00088 class OSGEARTHUTIL_EXPORT WFSCapabilities : public osg::Referenced 00089 { 00090 public: 00091 WFSCapabilities(); 00092 00096 const std::string& getVersion() const {return _version;} 00097 00101 void setVersion(const std::string& version) {_version = version;} 00102 00103 const std::string& getName() const { return _name; } 00104 void setName(const std::string& name) { _name = name; } 00105 00106 const std::string& getTitle() const { return _title;} 00107 void setTitle(const std::string& title) { _title = title;} 00108 00109 const std::string& getAbstract() const { return _abstract; } 00110 void setAbstract( const std::string& abstract) { _abstract = abstract; } 00111 00112 WFSFeatureType* getFeatureTypeByName(const std::string& name); 00113 00114 FeatureTypeList& getFeatureTypes() { return _featureTypes; } 00115 00116 00117 protected: 00118 FeatureTypeList _featureTypes; 00119 00120 std::string _version; 00121 std::string _name; 00122 std::string _title; 00123 std::string _abstract; 00124 }; 00125 00126 /* 00127 * Reads Capabilities from a URL or file 00128 */ 00129 class OSGEARTHUTIL_EXPORT WFSCapabilitiesReader 00130 { 00131 public: 00132 static WFSCapabilities* read( const std::string &location, const osgDB::ReaderWriter::Options *options ); 00133 static WFSCapabilities* read( std::istream &in ); 00134 private: 00135 WFSCapabilitiesReader(){} 00136 WFSCapabilitiesReader(const WFSCapabilitiesReader &cr){} 00137 }; 00138 00139 } } // namespace osgEarth::Util 00140 00141 #endif //OSGEARTHUTIL_WFS_H