osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthDrivers/mask_feature/FeatureMaskOptions

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_FEATURE_MASK_OPTIONS
00020 #define OSGEARTH_DRIVER_FEATURE_MASK_OPTIONS 1
00021 
00022 #include <osgEarth/Common>
00023 #include <osgEarth/MaskSource>
00024 #include <osgEarthFeatures/FeatureSource>
00025 
00026 namespace osgEarth { namespace Drivers
00027 {
00028     using namespace osgEarth;
00029     using namespace osgEarth::Features;
00030 
00031     class FeatureMaskOptions : public MaskSourceOptions // NO EXPORT; header only
00032     {
00033     public:
00035         optional<FeatureSourceOptions>& featureOptions() { return _featureOptions; }
00036         const optional<FeatureSourceOptions>& featureOptions() const { return _featureOptions; }
00037 
00039         osg::ref_ptr<FeatureSource>& featureSource() { return _featureSource; }
00040         const osg::ref_ptr<FeatureSource>& featureSource() const { return _featureSource; }
00041 
00042     public:
00043         FeatureMaskOptions( const ConfigOptions& options =ConfigOptions() ) :
00044             MaskSourceOptions( options )
00045         {
00046             setDriver( "feature" );
00047             fromConfig( _conf );
00048         }
00049 
00050     public:
00051         Config getConfig() const {
00052             Config conf = MaskSourceOptions::getConfig();
00053             conf.updateObjIfSet( "features", _featureOptions );
00054             return conf;
00055         }
00056 
00057     protected:
00058         virtual void mergeConfig( const Config& conf ) {
00059             MaskSourceOptions::mergeConfig( conf );
00060             fromConfig( conf );
00061         }
00062 
00063     private:
00064         void fromConfig( const Config& conf ) {
00065             if ( conf.hasChild("features") )
00066                 _featureOptions->merge( conf.child("features") );
00067         }
00068         
00069         optional<FeatureSourceOptions> _featureOptions;
00070         osg::ref_ptr<FeatureSource> _featureSource;
00071     };
00072 
00073 } } // namespace osgEarth::Drivers
00074 
00075 #endif // OSGEARTH_DRIVER_FEATURE_MASK_OPTIONS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines