osgEarth 2.1.1
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

osgEarth::Features::FeatureDisplayLayout Class Reference

Inheritance diagram for osgEarth::Features::FeatureDisplayLayout:
Collaboration diagram for osgEarth::Features::FeatureDisplayLayout:

List of all members.

Public Member Functions

 FeatureDisplayLayout (const Config &conf=Config())
optional< float > & tileSizeFactor ()
const optional< float > & tileSizeFactor () const
optional< bool > & cropFeatures ()
const optional< bool > & cropFeatures () const
void addLevel (const FeatureLevel &level)
unsigned getNumLevels () const
const FeatureLevelgetLevel (unsigned i) const
float getMaxRange () const
unsigned chooseLOD (const FeatureLevel &level, double fullExtentRadius) const
Config getConfig () const

Protected Types

typedef std::multimap< float,
FeatureLevel
Levels

Protected Member Functions

void fromConfig (const Config &conf)

Protected Attributes

optional< float > _tileSizeFactor
optional< bool > _cropFeatures
Levels _levels

Detailed Description

Defines a multi-LOD layout for a feature model layer.

Definition at line 66 of file FeatureDisplayLayout.


Member Typedef Documentation

typedef std::multimap<float,FeatureLevel> osgEarth::Features::FeatureDisplayLayout::Levels [protected]

Definition at line 113 of file FeatureDisplayLayout.


Constructor & Destructor Documentation

FeatureDisplayLayout::FeatureDisplayLayout ( const Config conf = Config())

Definition at line 84 of file FeatureDisplayLayout.cpp.

                                                               :
_tileSizeFactor( 15.0f ),
_cropFeatures( false )
{
    fromConfig( conf );
}

Here is the call graph for this function:


Member Function Documentation

void FeatureDisplayLayout::addLevel ( const FeatureLevel level)

Adds a new feature level

Definition at line 113 of file FeatureDisplayLayout.cpp.

{
    _levels.insert( std::make_pair( -level.maxRange(), level ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned FeatureDisplayLayout::chooseLOD ( const FeatureLevel level,
double  fullExtentRadius 
) const

Calculates the "best" quadtree LOD for the specified level, given the radius of the full extent of the dataset.

Definition at line 143 of file FeatureDisplayLayout.cpp.

{
    double radius = fullExtentRadius;    
    unsigned lod = 1;
    for( ; lod < 20; ++lod )
    {
        radius *= 0.5;
        float lodMaxRange = radius * _tileSizeFactor.value();
        
        if ( level.maxRange() >= lodMaxRange )
            break;
    }
    return lod-1;
}

Here is the call graph for this function:

optional<bool>& osgEarth::Features::FeatureDisplayLayout::cropFeatures ( ) [inline]

Whether to crop geometry to fit within the cell extents when chopping a feature level up into grid cells. By default, this is false, meaning that a feature whose centroid falls within the cell will be included. Setting this to true means that if any part of the feature falls within the working cell, it will be cropped to the cell extents and used.

Definition at line 86 of file FeatureDisplayLayout.

{ return _cropFeatures; }
const optional<bool>& osgEarth::Features::FeatureDisplayLayout::cropFeatures ( ) const [inline]

Definition at line 87 of file FeatureDisplayLayout.

{ return _cropFeatures; }
void FeatureDisplayLayout::fromConfig ( const Config conf) [protected]

Definition at line 92 of file FeatureDisplayLayout.cpp.

{
    conf.getIfSet( "tile_size_factor", _tileSizeFactor );
    conf.getIfSet( "crop_features",    _cropFeatures );
    ConfigSet children = conf.children( "level" );
    for( ConfigSet::const_iterator i = children.begin(); i != children.end(); ++i )
        addLevel( FeatureLevel( *i ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Config FeatureDisplayLayout::getConfig ( ) const

Definition at line 102 of file FeatureDisplayLayout.cpp.

{
    Config conf( "layout" );
    conf.addIfSet( "tile_size_factor", _tileSizeFactor );
    conf.addIfSet( "crop_features",    _cropFeatures );
    for( Levels::const_iterator i = _levels.begin(); i != _levels.end(); ++i )
        conf.add( i->second.getConfig() );
    return conf;
}

Here is the call graph for this function:

const FeatureLevel * FeatureDisplayLayout::getLevel ( unsigned  i) const

Gets the nth level

Definition at line 125 of file FeatureDisplayLayout.cpp.

{
    unsigned i = 0;
    for( Levels::const_iterator k = _levels.begin(); k != _levels.end(); ++k )
    {
        if ( n == i++ )
            return &(k->second);
    }
    return 0L;
}
float FeatureDisplayLayout::getMaxRange ( ) const

Gets the maximum range of the schema

Definition at line 137 of file FeatureDisplayLayout.cpp.

{
    return _levels.size() > 0 ? _levels.begin()->second.maxRange() : 0.0f;
}
unsigned FeatureDisplayLayout::getNumLevels ( ) const

Gets the number of feature levels in the schema

Definition at line 119 of file FeatureDisplayLayout.cpp.

{
    return _levels.size();
}
optional<float>& osgEarth::Features::FeatureDisplayLayout::tileSizeFactor ( ) [inline]

The ratio of visibility range to feature tile radius. Default is 15. Increase this to produce more, smaller tiles at a given visibility range; decrease this to procide fewer, larger tiles.

Definition at line 76 of file FeatureDisplayLayout.

{ return _tileSizeFactor; }
const optional<float>& osgEarth::Features::FeatureDisplayLayout::tileSizeFactor ( ) const [inline]

Definition at line 77 of file FeatureDisplayLayout.

{ return _tileSizeFactor; }

Member Data Documentation

Definition at line 112 of file FeatureDisplayLayout.

Definition at line 114 of file FeatureDisplayLayout.

Definition at line 111 of file FeatureDisplayLayout.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines