osgEarth 2.1.1
|
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 FeatureLevel * | getLevel (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 |
Defines a multi-LOD layout for a feature model layer.
Definition at line 66 of file FeatureDisplayLayout.
typedef std::multimap<float,FeatureLevel> osgEarth::Features::FeatureDisplayLayout::Levels [protected] |
Definition at line 113 of file FeatureDisplayLayout.
Definition at line 84 of file FeatureDisplayLayout.cpp.
: _tileSizeFactor( 15.0f ), _cropFeatures( false ) { fromConfig( conf ); }
void FeatureDisplayLayout::addLevel | ( | const FeatureLevel & | level | ) |
Adds a new feature level
Definition at line 113 of file FeatureDisplayLayout.cpp.
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; }
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 ) ); }
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; }
const FeatureLevel * FeatureDisplayLayout::getLevel | ( | unsigned | i | ) | const |
Gets the nth level
Definition at line 125 of file FeatureDisplayLayout.cpp.
float FeatureDisplayLayout::getMaxRange | ( | ) | const |
Gets the maximum range of the schema
Definition at line 137 of file FeatureDisplayLayout.cpp.
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; }
optional<bool> osgEarth::Features::FeatureDisplayLayout::_cropFeatures [protected] |
Definition at line 112 of file FeatureDisplayLayout.
Definition at line 114 of file FeatureDisplayLayout.
optional<float> osgEarth::Features::FeatureDisplayLayout::_tileSizeFactor [protected] |
Definition at line 111 of file FeatureDisplayLayout.