osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthDrivers/worldwind/WorldWindOptions

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_WORLDWIND_DRIVEROPTIONS
00020 #define OSGEARTH_DRIVER_WORLDWIND_DRIVEROPTIONS 1
00021 
00022 #include <osgEarth/Common>
00023 #include <osgEarth/TileSource>
00024 
00025 
00026 namespace osgEarth { namespace Drivers
00027 {
00028     using namespace osgEarth;
00029 
00030     class WorldWindOptions : public TileSourceOptions // NO EXPORT; header only
00031     {
00032     public:
00033         optional<int>& maxLOD() { return _maxLOD; }
00034         const optional<int>& maxLOD() const { return _maxLOD; }
00035 
00036         optional<std::string>& elevationCachePath() { return _elevationCachePath; }
00037         const optional<std::string>& elevationCachePath() const { return _elevationCachePath; }
00038 
00039         optional<std::string>& elevationURL() { return _elevationURL; }
00040         const optional<std::string>& elevationURL() const { return _elevationURL; }
00041 
00042         // image support NYI ... use the "tileservice" plugin instead
00043         //optional<std::string>& imageURL() { return _imageURL; }
00044         //const optional<std::string>& imageURL() const { return _imageURL; }
00045 
00046     public:
00047         WorldWindOptions( const TileSourceOptions& opt =TileSourceOptions() ) : TileSourceOptions( opt ),
00048             _maxLOD( 11 ),
00049             _elevationURL( "http://worldwind25.arc.nasa.gov/wwelevation/wwelevation.aspx?T=srtm30pluszip" ),
00050             _imageURL( "http://s0.tileservice.worldwindcentral.com/getTile?" )
00051         {
00052             setDriver( "worldwind" );
00053             fromConfig( _conf );
00054         }
00055 
00056     public:
00057         Config getConfig() const {
00058             Config conf = TileSourceOptions::getConfig();
00059             conf.updateIfSet("image_url", _imageURL);
00060             conf.updateIfSet("elevation_url", _elevationURL);
00061             conf.updateIfSet("max_lod", _maxLOD);
00062             conf.updateIfSet("elevation_cache", _elevationCachePath);
00063             return conf;
00064         }
00065 
00066     protected:
00067         void mergeConfig( const Config& conf ) {
00068             TileSourceOptions::mergeConfig( conf );
00069             fromConfig( conf );
00070         }
00071 
00072     private:
00073         void fromConfig( const Config& conf ) {
00074             conf.getIfSet("image_url", _imageURL);
00075             conf.getIfSet("elevation_url", _elevationURL);
00076             conf.getIfSet("max_lod", _maxLOD);
00077             conf.getIfSet("elevation_cache", _elevationCachePath);
00078             conf.getIfSet("worldwind_cache", _elevationCachePath); // back compat
00079         }
00080 
00081         optional<std::string> _imageURL;
00082         optional<std::string> _elevationURL;
00083         optional<std::string> _elevationCachePath;
00084         optional<int>         _maxLOD;
00085     };
00086 
00087 } } // namespace osgEarth::Drivers
00088 
00089 #endif // OSGEARTH_DRIVER_WMS_DRIVEROPTIONS
00090 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines