osgEarth 2.1.1
Public Member Functions | Private Member Functions | Private Attributes

anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor Struct Reference

Inheritance diagram for anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor:
Collaboration diagram for anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor:

List of all members.

Public Member Functions

 VirtualFeatureCursor (const FeatureSourceMappingVector &sources, const Query &query)
bool hasMore () const
FeaturenextFeature ()

Private Member Functions

void advance ()

Private Attributes

FeatureSourceMappingVector _sources
Query _query
FeatureSourceMappingVector::iterator _si
osg::ref_ptr< FeatureCursor_si_cursor
osg::ref_ptr< Feature_nextFeature
osg::ref_ptr< Feature_lastFeatureReturned

Detailed Description

Cursor that will iterate over multiple feature sources with predicate filtering

Definition at line 34 of file VirtualFeatureSource.cpp.


Constructor & Destructor Documentation

anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::VirtualFeatureCursor ( const FeatureSourceMappingVector sources,
const Query &  query 
) [inline]

Definition at line 36 of file VirtualFeatureSource.cpp.

                                                                                              :
          _sources(sources), _query(query)
        {
            _si = _sources.begin();
            advance();
        }

Member Function Documentation

void anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::advance ( ) [inline, private]

Definition at line 60 of file VirtualFeatureSource.cpp.

        {
            _nextFeature = 0L;

            while ( !_nextFeature.valid() )
            {
                // check to see if we are completely done:
                if ( _si == _sources.end() )
                    return;

                // if we're at the beginning, create the first cursor:
                if ( _si == _sources.begin() && !_si_cursor.valid() )
                {
                    _si_cursor = _si->_source->createFeatureCursor( _query );
                }

                while ( !_si_cursor.valid() || !_si_cursor->hasMore() )
                {
                    // if the current cursor is done, advance to the next source.
                    // if there is no next source, we are done.
                    if ( ++_si == _sources.end() )
                        return;

                    // make a cursor for the next source
                    _si_cursor = _si->_source->createFeatureCursor( _query );
                }

                // here, we have a valid cursor with pending data:
                Feature* f = _si_cursor->nextFeature();

                // test against the predicate. (a NULL predicate always accepts the feature)
                if ( !_si->_predicate.valid() || _si->_predicate->acceptFeature( f ) )
                    _nextFeature = f;
            }
        }
bool anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::hasMore ( ) const [inline, virtual]

Implements osgEarth::Features::FeatureCursor.

Definition at line 43 of file VirtualFeatureSource.cpp.

        {
            return _nextFeature.valid();
        }
Feature* anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::nextFeature ( ) [inline, virtual]

Implements osgEarth::Features::FeatureCursor.

Definition at line 48 of file VirtualFeatureSource.cpp.


Member Data Documentation

osg::ref_ptr<Feature> anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::_lastFeatureReturned [private]

Definition at line 102 of file VirtualFeatureSource.cpp.

osg::ref_ptr<Feature> anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::_nextFeature [private]

Definition at line 101 of file VirtualFeatureSource.cpp.

Query anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::_query [private]

Definition at line 98 of file VirtualFeatureSource.cpp.

FeatureSourceMappingVector::iterator anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::_si [private]

Definition at line 99 of file VirtualFeatureSource.cpp.

osg::ref_ptr<FeatureCursor> anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::_si_cursor [private]

Definition at line 100 of file VirtualFeatureSource.cpp.

FeatureSourceMappingVector anonymous_namespace{VirtualFeatureSource.cpp}::VirtualFeatureCursor::_sources [private]

Definition at line 97 of file VirtualFeatureSource.cpp.


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