osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Features::FilterContext Class Reference

Collaboration diagram for osgEarth::Features::FilterContext:

List of all members.

Public Member Functions

 FilterContext (Session *session=0L, const FeatureProfile *profile=0L, const GeoExtent &workingExtent=GeoExtent::INVALID)
 FilterContext (const FilterContext &rhs)
void setResourceCache (ResourceCache *value)
SessiongetSession ()
const SessiongetSession () const
const FeatureProfileprofile () 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)
ResourceCacheresourceCache ()
OptimizerHintsoptimizerHints ()
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

Detailed Description

Context within which a chain of filters is executed.

Definition at line 40 of file FilterContext.


Constructor & Destructor Documentation

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)

Member Function Documentation

optional<GeoExtent>& osgEarth::Features::FilterContext::extent ( ) [inline]

The spatial extent of the working cell

Definition at line 73 of file FilterContext.

{ return _extent; }

Here is the caller graph for this function:

const optional<GeoExtent>& osgEarth::Features::FilterContext::extent ( ) const [inline]

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);
}

Here is the call graph for this function:

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(); }

Here is the caller graph for this function:

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(); }

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

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(); }

Here is the caller graph for this function:

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(); }

Here is the caller graph for this function:

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 );
        }      

Here is the call graph for this function:

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

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;
        }
    }
}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

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;
        }
    }
}

Here is the call graph for this function:

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; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 153 of file FilterContext.

Definition at line 155 of file FilterContext.

Definition at line 152 of file FilterContext.

Definition at line 156 of file FilterContext.

Definition at line 151 of file FilterContext.

Definition at line 154 of file FilterContext.

Definition at line 157 of file FilterContext.

Definition at line 150 of file FilterContext.


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