osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthDrivers/feature_wfs/WFSFeatureOptions

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 #ifndef OSGEARTH_DRIVER_WFS_FEATURE_SOURCE_OPTIONS
00020 #define OSGEARTH_DRIVER_WFS_FEATURE_SOURCE_OPTIONS 1
00021 
00022 #include <osgEarth/Common>
00023 #include <osgEarthFeatures/FeatureSource>
00024 
00025 namespace osgEarth { namespace Drivers
00026 {
00027     using namespace osgEarth;
00028     using namespace osgEarth::Features;
00029 
00030     class WFSFeatureOptions : public FeatureSourceOptions // NO EXPORT; header only
00031     {
00032     public:
00033         optional<URI>& url() { return _url; }
00034         const optional<URI>& url() const { return _url; }
00035         
00036         optional<Config>& geometryProfileOptions() { return _geometryProfileConf; }
00037         const optional<Config>& geometryProfileOptions() const { return _geometryProfileConf; }
00038 
00039         optional<std::string>& typeName() { return _typename; }
00040         const optional<std::string>& typeName() const { return _typename; }
00041 
00042         optional<unsigned int>& maxFeatures() { return _maxFeatures; }
00043         const optional<unsigned int>& maxFeatures() const { return _maxFeatures;}
00044 
00045         optional<std::string>& outputFormat() { return _outputFormat; }
00046         const optional<std::string>& outputFormat() const { return _outputFormat; }
00047 
00048 
00049 
00050     public:
00051         WFSFeatureOptions( const ConfigOptions& opt =ConfigOptions() ) : FeatureSourceOptions( opt ) {
00052             fromConfig( _conf );
00053         }
00054 
00055     public:
00056         Config getConfig() const {
00057             Config conf = FeatureSourceOptions::getConfig();
00058             conf.updateIfSet( "url", _url ); 
00059             conf.updateIfSet( "geometry_profile", _geometryProfileConf );
00060             conf.updateIfSet( "typename", _typename );
00061             conf.updateIfSet( "outputformat", _outputFormat);
00062             conf.updateIfSet( "maxfeatures", _maxFeatures );
00063             return conf;
00064         }
00065 
00066     protected:
00067         void mergeConfig( const Config& conf ) {
00068             FeatureSourceOptions::mergeConfig( conf );
00069             fromConfig( conf );
00070         }
00071 
00072     private:
00073         void fromConfig( const Config& conf ) {
00074             conf.getIfSet( "url", _url );
00075             conf.getIfSet( "geometry_profile", _geometryProfileConf );
00076             conf.getIfSet( "typename", _typename);
00077             conf.getIfSet( "outputformat", _outputFormat );
00078             conf.getIfSet( "maxfeatures", _maxFeatures );
00079         }
00080 
00081         optional<URI>         _url;        
00082         optional<std::string> _typename;
00083         optional<Config>      _geometryProfileConf;
00084         optional<std::string> _outputFormat;
00085         optional<unsigned>    _maxFeatures;            
00086     };
00087 
00088 } } // namespace osgEarth::Drivers
00089 
00090 #endif // OSGEARTH_DRIVER_WFS_FEATURE_SOURCE_OPTIONS
00091 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines