osgEarth 2.1.1
|
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_SOURCE_H 00021 #define OSGEARTH_MASK_SOURCE_H 1 00022 00023 #include <osgEarth/Common> 00024 #include <osgEarth/Config> 00025 #include <osgEarth/Progress> 00026 #include <osgEarth/Revisioning> 00027 #include <osgEarth/SpatialReference> 00028 #include <osg/Referenced> 00029 00030 namespace osgEarth 00031 { 00032 class Map; 00033 00037 class OSGEARTH_EXPORT MaskSourceOptions : public DriverConfigOptions 00038 { 00039 public: 00040 MaskSourceOptions( const ConfigOptions& options =ConfigOptions() ) : 00041 DriverConfigOptions( options ) { fromConfig(_conf); } 00042 00043 public: // properties 00044 00045 public: 00046 virtual Config getConfig() const; 00047 00048 protected: 00049 virtual void mergeConfig( const Config& conf ); 00050 00051 private: 00052 void fromConfig( const Config& conf ); 00053 }; 00054 00058 class OSGEARTH_EXPORT MaskSource : public virtual Revisioned<osg::Object> 00059 { 00060 public: 00061 MaskSource( const MaskSourceOptions& options =MaskSourceOptions() ); 00062 00066 virtual osg::Vec3dArray* createBoundary( const SpatialReference* srs, ProgressCallback* progress =0L ) =0; 00067 00068 public: 00069 virtual void initialize( const std::string& referenceURI, const Map* map ) { } 00070 00071 const MaskSourceOptions& getOptions() const { return _options; } 00072 public: 00073 00074 // META_Object specialization: 00075 virtual osg::Object* cloneType() const { return 0; } // cloneType() not appropriate 00076 virtual osg::Object* clone(const osg::CopyOp&) const { return 0; } // clone() not appropriate 00077 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MaskSource*>(obj)!=NULL; } 00078 virtual const char* className() const { return "MaskSource"; } 00079 virtual const char* libraryName() const { return "osgEarth"; } 00080 00081 private: 00082 const MaskSourceOptions _options; 00083 00084 friend class Map; 00085 friend class MaskSourceFactory; 00086 }; 00087 00088 //-------------------------------------------------------------------- 00089 00090 class OSGEARTH_EXPORT MaskSourceDriver : public osgDB::ReaderWriter 00091 { 00092 protected: 00093 const MaskSourceOptions& getMaskSourceOptions( const osgDB::ReaderWriter::Options* rwOpt ) const; 00094 }; 00095 00096 //-------------------------------------------------------------------- 00097 00098 class OSGEARTH_EXPORT MaskSourceFactory 00099 { 00100 public: 00101 static MaskSource* create( const MaskSourceOptions& options ); 00102 }; 00103 } 00104 00105 #endif // OSGEARTH_MASK_SOURCE_H