osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarth/CompositeTileSource

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_COMPOSITE_TILE_SOURCE_H
00020 #define OSGEARTH_COMPOSITE_TILE_SOURCE_H 1
00021 
00022 #include <osgEarth/Common>
00023 #include <osgEarth/TileSource>
00024 #include <osgEarth/ImageLayer>
00025 
00026 namespace osgEarth
00027 {
00031     class OSGEARTH_EXPORT CompositeTileSourceOptions : public TileSourceOptions
00032     {
00033     public:
00034         CompositeTileSourceOptions( const TileSourceOptions& options =TileSourceOptions() );
00035 
00037         void add( const TileSourceOptions& options );
00038 
00040         void add( TileSource* source );
00041 
00043         void add( const ImageLayerOptions& options );
00044 
00046         void add( TileSource* source, const ImageLayerOptions& options );
00047 
00048     public:
00049         virtual Config getConfig() const;
00050 
00051     protected:
00052         virtual void mergeConfig( const Config& conf );
00053 
00054     private:
00055         void fromConfig( const Config& conf );
00056 
00057         struct Component {
00058             optional<TileSourceOptions>         _tileSourceOptions;
00059             optional<osg::ref_ptr<TileSource> > _tileSourceInstance;
00060             optional<ImageLayerOptions>         _imageLayerOptions;
00061         };
00062 
00063         typedef std::vector<Component> ComponentVector;
00064         ComponentVector _components;
00065 
00066         friend class CompositeTileSource;
00067     };
00068 
00069     //--------------------------------------------------------------------
00070 
00075     class OSGEARTH_EXPORT CompositeTileSource : public TileSource
00076     {
00077     public:
00079         CompositeTileSource( const TileSourceOptions& options =TileSourceOptions() );
00080 
00081     public: // TileSource overrides
00082         
00084                 virtual osg::Image* createImage( const TileKey& key, ProgressCallback* progress =0 );
00085 
00087         virtual bool isDynamic() const { return _dynamic; }
00088         
00090                 virtual void initialize( const std::string& referenceURI, const Profile* overrideProfile =0L );
00091 
00092     protected:
00093         CompositeTileSourceOptions _options;
00094         bool _initialized;
00095         bool _dynamic;
00096        
00097 
00098         CompositeTileSourceOptions::ComponentVector _components;
00099     };
00100 }
00101 
00102 #endif // OSGEARTH_COMPOSITE_TILE_SOURCE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines