|
osgEarth 2.1.1
|
Inheritance diagram for osgEarth::Features::Session:
Collaboration diagram for osgEarth::Features::Session:Public Member Functions | |
| Session (const Map *map, StyleSheet *styles=0L) | |
| void | setURIContext (const URIContext &value) |
| const URIContext & | uriContext () const |
| MapFrame | createMapFrame (Map::ModelParts parts=Map::TERRAIN_LAYERS) const |
| const MapInfo & | getMapInfo () const |
| void | setStyles (StyleSheet *value) |
| StyleSheet * | styles () const |
| void | putObject (const std::string &key, osg::Referenced *object) |
| template<typename T > | |
| T * | getObject (const std::string &key) |
| void | removeObject (const std::string &key) |
Private Types | |
| typedef std::map< std::string, osg::ref_ptr< osg::Referenced > > | ObjectMap |
Private Attributes | |
| ObjectMap | _objMap |
| Threading::ReadWriteMutex | _objMapMutex |
| URIContext | _uriContext |
| osg::ref_ptr< const Map > | _map |
| MapInfo | _mapInfo |
| osg::ref_ptr< StyleSheet > | _styles |
Session is a state object that exists throughout the life of one or more related feature compilations.
A Session holds shared, re-usable data elements that can be accessed through a FilterContext.
Whereas a FilterContext exists thoughout the life of a single compilation, a Session exists one level above this and governs any number of "related" compilations (e.g., the compilation of many grid cells comprising a single feature layer).
Session implements the URIResolver interface to resolve relative URIs.
typedef std::map<std::string, osg::ref_ptr<osg::Referenced> > osgEarth::Features::Session::ObjectMap [private] |
| Session::Session | ( | const Map * | map, |
| StyleSheet * | styles = 0L |
||
| ) |
Constructs a new Session that is tied to a map
Definition at line 35 of file Session.cpp.
: osg::Referenced( true ), _map ( map ), _mapInfo ( map ) //_resourceCache ( new ResourceCache(true) ) // make is thread-safe. { if ( styles ) setStyles( styles ); else _styles = new StyleSheet(); }
Here is the call graph for this function:| MapFrame Session::createMapFrame | ( | Map::ModelParts | parts = Map::TERRAIN_LAYERS | ) | const |
Gets the underlying map (frame) interface in this session
Definition at line 62 of file Session.cpp.
Here is the caller graph for this function:| const MapInfo& osgEarth::Features::Session::getMapInfo | ( | ) | const [inline] |
| T* osgEarth::Features::Session::getObject | ( | const std::string & | key | ) | [inline] |
Gets an object from the shared Session cache.
Definition at line 99 of file Session.
{
Threading::ScopedReadLock lock( _objMapMutex );
ObjectMap::const_iterator i = _objMap.find(key);
return i != _objMap.end() ? dynamic_cast<T*>( i->second.get() ) : 0L;
}
Here is the caller graph for this function:| void Session::putObject | ( | const std::string & | key, |
| osg::Referenced * | object | ||
| ) |
Session-global resource cache. Careful. Resolves a URI based on the reference URI. You can use this method to create an absolute URI from a relative one, for example. Stores an object in the shared Session cache.
WARNING! Don't store things like nodes in here unless you plan to clone them. This is a multi-threaded store.
Definition at line 68 of file Session.cpp.
{
//if ( dynamic_cast<osg::Node*>( object ) )
//{
// OE_INFO << LC << "*** usage warning: storing an osg::Node in the Session cache is bad news;"
// << " live graph iterators can be invalidated."
// << std::endl;
//}
Threading::ScopedWriteLock lock( _objMapMutex );
_objMap[key] = object;
}
Here is the caller graph for this function:| void Session::removeObject | ( | const std::string & | key | ) |
Definition at line 82 of file Session.cpp.
{
Threading::ScopedWriteLock lock( _objMapMutex );
_objMap.erase( key );
}
| void Session::setStyles | ( | StyleSheet * | value | ) |
The style sheet governing this session.
Definition at line 89 of file Session.cpp.
{
_styles = value ? value : new StyleSheet();
}
Here is the caller graph for this function:| void osgEarth::Features::Session::setURIContext | ( | const URIContext & | value | ) | [inline] |
URI Context for relative path resolution.
Definition at line 58 of file Session.
{ _uriContext = value; }
| StyleSheet* osgEarth::Features::Session::styles | ( | ) | const [inline] |
| const URIContext& osgEarth::Features::Session::uriContext | ( | ) | const [inline] |
Definition at line 59 of file Session.
{ return _uriContext; }
osg::ref_ptr<const Map> osgEarth::Features::Session::_map [private] |
MapInfo osgEarth::Features::Session::_mapInfo [private] |
osg::ref_ptr<StyleSheet> osgEarth::Features::Session::_styles [private] |
1.7.3