osgEarth 2.1.1
|
Public Member Functions | |
FilterContext (Session *session=0L, const FeatureProfile *profile=0L, const GeoExtent &workingExtent=GeoExtent::INVALID) | |
FilterContext (const FilterContext &rhs) | |
void | setResourceCache (ResourceCache *value) |
Session * | getSession () |
const Session * | getSession () const |
const FeatureProfile * | profile () const |
osg::ref_ptr< const FeatureProfile > & | profile () |
optional< GeoExtent > & | extent () |
const optional< GeoExtent > & | extent () const |
bool | isGeocentric () const |
bool & | isGeocentric () |
bool | hasReferenceFrame () const |
osg::Vec3d | toLocal (const osg::Vec3d &world) const |
void | toLocal (Geometry *geom) const |
osg::Vec3d | toWorld (const osg::Vec3d &local) const |
void | toWorld (Geometry *geom) const |
osg::Vec3d | toMap (const osg::Vec3d &local) const |
osg::Vec3d | fromMap (const osg::Vec3d &map) const |
const osg::Matrixd & | referenceFrame () const |
const osg::Matrix & | inverseReferenceFrame () const |
void | setReferenceFrame (const osg::Matrixd &in) |
ResourceCache * | resourceCache () |
OptimizerHints & | optimizerHints () |
std::string | toString () const |
Protected Attributes | |
osg::ref_ptr< Session > | _session |
osg::ref_ptr< const FeatureProfile > | _profile |
bool | _isGeocentric |
optional< GeoExtent > | _extent |
osg::Matrixd | _referenceFrame |
osg::Matrixd | _inverseReferenceFrame |
OptimizerHints | _optimizerHints |
osg::ref_ptr< ResourceCache > | _resourceCache |
Context within which a chain of filters is executed.
Definition at line 40 of file FilterContext.
FilterContext::FilterContext | ( | Session * | session = 0L , |
const FeatureProfile * | profile = 0L , |
||
const GeoExtent & | workingExtent = GeoExtent::INVALID |
||
) |
Definition at line 24 of file FilterContext.cpp.
: _session ( session ), _profile ( profile ), _extent ( workingExtent, workingExtent ), _isGeocentric( false ) { _resourceCache = new ResourceCache(); }
FilterContext::FilterContext | ( | const FilterContext & | rhs | ) |
Definition at line 35 of file FilterContext.cpp.
: _profile ( rhs._profile.get() ), _session ( rhs._session.get() ), _isGeocentric ( rhs._isGeocentric ), _extent ( rhs._extent ), _referenceFrame ( rhs._referenceFrame ), _inverseReferenceFrame( rhs._inverseReferenceFrame ), _optimizerHints ( rhs._optimizerHints ), _resourceCache ( rhs._resourceCache ) { //nop }
The spatial extent of the working cell
Definition at line 73 of file FilterContext.
{ return _extent; }
Definition at line 74 of file FilterContext.
{ return _extent; }
osg::Vec3d FilterContext::fromMap | ( | const osg::Vec3d & | map | ) | const |
Converts a map coordinate to a context-local point.
Definition at line 88 of file FilterContext.cpp.
{ osg::Vec3d world; if ( _isGeocentric ) _extent->getSRS()->transformToECEF( point, world ); return toLocal(world); }
const Session* osgEarth::Features::FilterContext::getSession | ( | ) | const [inline] |
Definition at line 62 of file FilterContext.
{ return _session.get(); }
Session* osgEarth::Features::FilterContext::getSession | ( | ) | [inline] |
Access to the Session under which this filter context operates
Definition at line 61 of file FilterContext.
{ return _session.get(); }
bool osgEarth::Features::FilterContext::hasReferenceFrame | ( | ) | const [inline] |
Whether this context has a non-identity reference frame
Definition at line 85 of file FilterContext.
{ return !_referenceFrame.isIdentity(); }
const osg::Matrix& osgEarth::Features::FilterContext::inverseReferenceFrame | ( | ) | const [inline] |
Multiplying by the inverse reference frame takes a point from local coords into world coords.
Definition at line 125 of file FilterContext.
{ return _inverseReferenceFrame; }
bool& osgEarth::Features::FilterContext::isGeocentric | ( | ) | [inline] |
Definition at line 80 of file FilterContext.
{ return _isGeocentric; }
bool osgEarth::Features::FilterContext::isGeocentric | ( | ) | const [inline] |
Whether to assume a geocentric coordinate system for geographic profiles.
Definition at line 79 of file FilterContext.
{ return _isGeocentric; }
OptimizerHints& osgEarth::Features::FilterContext::optimizerHints | ( | ) | [inline] |
Hints to the OSG optimizer. Filters that use this context can explicity ask to include or exclude optimizer options via this mechanism.
Definition at line 144 of file FilterContext.
{ return _optimizerHints; }
const FeatureProfile* osgEarth::Features::FilterContext::profile | ( | ) | const [inline] |
The spatial profile of the feature data in this context.
Definition at line 67 of file FilterContext.
{ return _profile.get(); }
osg::ref_ptr<const FeatureProfile>& osgEarth::Features::FilterContext::profile | ( | ) | [inline] |
Definition at line 68 of file FilterContext.
{ return _profile; }
const osg::Matrixd& osgEarth::Features::FilterContext::referenceFrame | ( | ) | const [inline] |
Multiplying by the reference frame takes a point from world coords into local coords.
Definition at line 120 of file FilterContext.
{ return _referenceFrame; }
ResourceCache* osgEarth::Features::FilterContext::resourceCache | ( | ) | [inline] |
Accesses the shared resource cache where filters can store data.
Definition at line 138 of file FilterContext.
{ return _resourceCache.get(); }
void osgEarth::Features::FilterContext::setReferenceFrame | ( | const osg::Matrixd & | in | ) | [inline] |
Sets the reference frame (and its inverse)
Definition at line 130 of file FilterContext.
{ _referenceFrame = in; _inverseReferenceFrame.invert( _referenceFrame ); // = osg::Matrixd::inverse( _referenceFrame ); }
void osgEarth::Features::FilterContext::setResourceCache | ( | ResourceCache * | value | ) | [inline] |
Assigns a resource cache to use. One is created automatically if you don't assign one.
Definition at line 54 of file FilterContext.
{ _resourceCache = value; }
osg::Vec3d osgEarth::Features::FilterContext::toLocal | ( | const osg::Vec3d & | world | ) | const [inline] |
Converts from world coordiantes into local coordinates
Definition at line 90 of file FilterContext.
{ return world * _referenceFrame; }
void FilterContext::toLocal | ( | Geometry * | geom | ) | const |
Converts a Geometry from world coords to local coords
Definition at line 49 of file FilterContext.cpp.
{ if ( hasReferenceFrame() ) { GeometryIterator gi( geom ); while( gi.hasMore() ) { Geometry* g = gi.next(); for( osg::Vec3dArray::iterator i = g->begin(); i != g->end(); ++i ) *i = *i * _referenceFrame; } } }
osg::Vec3d FilterContext::toMap | ( | const osg::Vec3d & | local | ) | const |
Converts a context-local point to a map coordinate.
Definition at line 79 of file FilterContext.cpp.
{ osg::Vec3d world = toWorld(point); if ( _isGeocentric ) _extent->getSRS()->transformFromECEF( world, world ); return world; }
std::string FilterContext::toString | ( | ) | const |
Dump as a string
Definition at line 97 of file FilterContext.cpp.
{ std::stringstream buf; buf << std::fixed << "CONTEXT: [" << "profile extent = " << profile()->getExtent().toString() << ", working extent = " << extent()->toString() << ", geocentric = " << osgEarth::toString(_isGeocentric) << "]"; std::string str = buf.str(); return str; }
void FilterContext::toWorld | ( | Geometry * | geom | ) | const |
Converts a Geometry from local coords to world coords
Definition at line 64 of file FilterContext.cpp.
{ if ( hasReferenceFrame() ) { GeometryIterator gi( geom ); while( gi.hasMore() ) { Geometry* g = gi.next(); for( osg::Vec3dArray::iterator i = g->begin(); i != g->end(); ++i ) *i = *i * _inverseReferenceFrame; } } }
osg::Vec3d osgEarth::Features::FilterContext::toWorld | ( | const osg::Vec3d & | local | ) | const [inline] |
Converts from local (reference frame) coordinates into world coordinates
Definition at line 100 of file FilterContext.
{ return local * _inverseReferenceFrame; }
optional<GeoExtent> osgEarth::Features::FilterContext::_extent [protected] |
Definition at line 153 of file FilterContext.
osg::Matrixd osgEarth::Features::FilterContext::_inverseReferenceFrame [protected] |
Definition at line 155 of file FilterContext.
bool osgEarth::Features::FilterContext::_isGeocentric [protected] |
Definition at line 152 of file FilterContext.
Definition at line 156 of file FilterContext.
osg::ref_ptr<const FeatureProfile> osgEarth::Features::FilterContext::_profile [protected] |
Definition at line 151 of file FilterContext.
osg::Matrixd osgEarth::Features::FilterContext::_referenceFrame [protected] |
Definition at line 154 of file FilterContext.
osg::ref_ptr<ResourceCache> osgEarth::Features::FilterContext::_resourceCache [protected] |
Definition at line 157 of file FilterContext.
osg::ref_ptr<Session> osgEarth::Features::FilterContext::_session [protected] |
Definition at line 150 of file FilterContext.