osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarth/MaskLayer

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 
00020 #ifndef OSGEARTH_MASK_LAYER_H
00021 #define OSGEARTH_MASK_LAYER_H 1
00022 
00023 #include <osgEarth/Common>
00024 #include <osgEarth/Layer>
00025 #include <osgEarth/Config>
00026 #include <osgEarth/MaskSource>
00027 #include <osg/Node>
00028 
00029 namespace osgEarth
00030 {
00031     class Map;
00032 
00036     class OSGEARTH_EXPORT MaskLayerOptions : public ConfigOptions
00037     {
00038     public:        
00039         MaskLayerOptions( const ConfigOptions& options =ConfigOptions() );
00040 
00041         MaskLayerOptions( const std::string& name, const MaskSourceOptions& driverOptions =MaskSourceOptions() );
00042 
00046         optional<std::string>& name() { return _name; }
00047         const optional<std::string>& name() const { return _name; }
00048 
00052         optional<MaskSourceOptions>& driver() { return _driver; }
00053         const optional<MaskSourceOptions>& driver() const { return _driver; }
00054 
00055     public:
00056         virtual Config getConfig() const;
00057         virtual void mergeConfig( const Config& conf );
00058 
00059     private:
00060         void fromConfig( const Config& conf );
00061         void setDefaults();
00062 
00063         optional<std::string> _name;
00064         optional<MaskSourceOptions> _driver;
00065     };
00066 
00071     class OSGEARTH_EXPORT MaskLayer : public Layer
00072     {
00073     public:
00077         MaskLayer( const MaskLayerOptions& options =MaskLayerOptions() );
00078 
00082         MaskLayer( const std::string& name, const MaskSourceOptions& options );
00083         
00087         MaskLayer(const MaskLayerOptions& options, MaskSource* source );
00088 
00092         MaskSource* getMaskSource() const { return _maskSource.get(); }
00093 
00094     public:
00099         osg::Vec3dArray* getOrCreateBoundary( float heightScale = 1.0, const SpatialReference* srs = NULL, ProgressCallback* progress =0L );
00100 
00101     public:
00102 
00103         void initialize( const std::string& referenceURI, const Map* map );
00104 
00105     private:
00106         std::string _referenceURI;
00107         MaskLayerOptions _initOptions, _runtimeOptions;
00108         osg::ref_ptr<MaskSource> _maskSource;
00109         Revision _maskSourceRev;
00110         osg::ref_ptr<osg::Vec3dArray> _boundary;
00111 
00112         void copyOptions();
00113     };
00114 
00115     typedef std::vector< osg::ref_ptr<MaskLayer> > MaskLayerVector;
00116 }
00117 
00118 #endif // OSGEARTH_MASK_LAYER_H
00119 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines