osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthFeatures/LabelSource

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_FEATURES_LABELSOURCE_H
00020 #define OSGEARTH_FEATURES_LABELSOURCE_H 1
00021 
00022 #include <osgEarthFeatures/Common>
00023 #include <osgEarthFeatures/Feature>
00024 #include <osgEarthFeatures/FilterContext>
00025 #include <osgEarth/Config>
00026 #include <osgEarth/Revisioning>
00027 #include <osgEarthSymbology/TextSymbol>
00028 
00029 namespace osgEarth { namespace Features
00030 {  
00031     using namespace osgEarth;
00032     using namespace osgEarth::Symbology;
00033 
00037     class OSGEARTHFEATURES_EXPORT LabelSourceOptions : public DriverConfigOptions
00038     {
00039     public:
00040         LabelSourceOptions( const ConfigOptions& options =ConfigOptions() ) :
00041               DriverConfigOptions( options )
00042               
00043               { fromConfig(_conf); }
00044 
00045     public: // properties
00046 
00047     public:
00048         virtual Config getConfig() const;
00049 
00050     protected:
00051         virtual void mergeConfig( const Config& conf );
00052         
00053     private:
00054         void fromConfig( const Config& conf );
00055     };
00056 
00057     //--------------------------------------------------------------------
00058 
00062     class OSGEARTHFEATURES_EXPORT LabelSource : public virtual Revisioned<osg::Object>
00063     {
00064     public:        
00065         LabelSource( const LabelSourceOptions& options =LabelSourceOptions() )
00066         {
00067             //nop
00068         }
00069 
00073         virtual osg::Node* createNode(
00074             const FeatureList&   input,
00075             const TextSymbol*    symbol,
00076             const FilterContext& context ) =0;
00077 
00078     public:
00079         
00080         // META_Object specialization:
00081         virtual osg::Object* cloneType() const { return 0; } // cloneType() not appropriate
00082         virtual osg::Object* clone(const osg::CopyOp&) const { return 0; } // clone() not appropriate
00083         virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const LabelSource*>(obj)!=NULL; }
00084         virtual const char* className() const { return "LabelSource"; }
00085         virtual const char* libraryName() const { return "osgEarth::Features"; }
00086 
00087     protected:
00088         virtual ~LabelSource() { }
00089     };
00090 
00091     //--------------------------------------------------------------------
00092 
00093     class OSGEARTHFEATURES_EXPORT LabelSourceDriver : public osgDB::ReaderWriter
00094     {
00095     protected:
00096         const LabelSourceOptions& getLabelSourceOptions( const osgDB::ReaderWriter::Options* rwOpt ) const;
00097     };
00098 
00099     //--------------------------------------------------------------------
00100 
00101     class OSGEARTHFEATURES_EXPORT LabelSourceFactory
00102     {   
00103         public:
00104         static LabelSource* create( const LabelSourceOptions& options =LabelSourceOptions() );
00105     };
00106 
00107 } } // namespace osgEarth::Features
00108 
00109 #endif // OSGEARTH_FEATURES_LABELSOURCE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines