osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthFeatures/FeatureDisplayLayout

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 OSGEARTHFEATURES_FEATURE_DISPLAY_LAYOUT_H
00021 #define OSGEARTHFEATURES_FEATURE_DISPLAY_LAYOUT_H 1
00022 
00023 #include <osgEarthFeatures/Common>
00024 #include <osgEarthFeatures/Feature>
00025 #include <osgEarthFeatures/Filter>
00026 #include <osgEarthSymbology/Style>
00027 #include <osg/Geode>
00028 #include <vector>
00029 
00030 namespace osgEarth { namespace Features
00031 {
00032     using namespace osgEarth;
00033 
00037     class OSGEARTHFEATURES_EXPORT FeatureLevel
00038     {
00039     public:
00040         FeatureLevel( const Config& config );
00041         FeatureLevel( float minRange, float maxRange );
00042         FeatureLevel( float minRange, float maxRange, const StyleSelector& oneSelector );
00043 
00044         float minRange() const { return _minRange; }
00045         float maxRange() const { return _maxRange; }
00046 
00047         //optional<unsigned>& lod() { return _lod; }
00048         //const optional<unsigned>& lod() const { return _lod; }
00049 
00050         const StyleSelectorVector& selectors() const { return _selectors; }
00051 
00052     public:
00053         Config getConfig() const;
00054 
00055     protected:
00056         void fromConfig( const Config& conf );
00057 
00058         float               _minRange, _maxRange;
00059         StyleSelectorVector _selectors;
00060         optional<unsigned>  _lod;
00061     };
00062 
00066     class OSGEARTHFEATURES_EXPORT FeatureDisplayLayout : public osg::Referenced
00067     {
00068     public:
00069         FeatureDisplayLayout( const Config& conf =Config() );
00070 
00076         optional<float>& tileSizeFactor() { return _tileSizeFactor; }
00077         const optional<float>& tileSizeFactor() const { return _tileSizeFactor; }
00078 
00086         optional<bool>& cropFeatures() { return _cropFeatures; }
00087         const optional<bool>& cropFeatures() const { return _cropFeatures; }
00088 
00090         void addLevel( const FeatureLevel& level );
00091 
00093         unsigned getNumLevels() const;
00094 
00096         const FeatureLevel* getLevel( unsigned i ) const;
00097 
00099         float getMaxRange() const;
00100 
00105         unsigned chooseLOD( const FeatureLevel& level, double fullExtentRadius ) const;
00106 
00107     public:
00108         Config getConfig() const;
00109 
00110     protected:
00111         optional<float> _tileSizeFactor;
00112         optional<bool>  _cropFeatures;
00113         typedef std::multimap<float,FeatureLevel> Levels;
00114         Levels _levels;
00115 
00116         void fromConfig( const Config& conf );
00117     };
00118 
00119 } } // namespace osgEarth::Features
00120 
00121 #endif // OSGEARTHFEATURES_FEATURE_DISPLAY_LAYOUT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines