osgEarth 2.1.1
Public Member Functions | Protected Member Functions | Protected Attributes

osgEarth::Features::FeatureListSource Class Reference

Inheritance diagram for osgEarth::Features::FeatureListSource:
Collaboration diagram for osgEarth::Features::FeatureListSource:

List of all members.

Public Member Functions

 FeatureListSource ()
virtual FeatureCursorcreateFeatureCursor (const Symbology::Query &query)
virtual bool isWritable () const
virtual bool deleteFeature (FeatureID fid)
virtual int getFeatureCount () const
virtual FeaturegetFeature (FeatureID fid)
virtual bool insertFeature (Feature *feature)
virtual Geometry::Type getGeometryType () const
FeatureListgetFeatures ()
virtual bool hasEmbeddedStyles () const
virtual const char * className () const
virtual const char * libraryName () const
virtual void initialize (const std::string &referenceURI)

Protected Member Functions

virtual const FeatureProfilecreateFeatureProfile ()

Protected Attributes

FeatureList _features
osg::ref_ptr< FeatureProfile_profile

Detailed Description

Definition at line 33 of file FeatureListSource.


Constructor & Destructor Documentation

FeatureListSource::FeatureListSource ( )

Definition at line 23 of file FeatureListSource.cpp.

                                    :
FeatureSource()
{
    _profile = new FeatureProfile(GeoExtent(osgEarth::SpatialReference::create("epsg:4326"), -180, -90, 180, 90));
}

Here is the call graph for this function:


Member Function Documentation

virtual const char* osgEarth::Features::FeatureListSource::className ( ) const [inline, virtual]

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 55 of file FeatureListSource.

{ return "FeatureListSource"; }
FeatureCursor * FeatureListSource::createFeatureCursor ( const Symbology::Query query) [virtual]

Creates a cursor that iterates over all the features corresponding to the specified query.

Caller takes ownership of the returned object.

Implements osgEarth::Features::FeatureSource.

Definition at line 30 of file FeatureListSource.cpp.

{
    //Create a copy of all of the features before returning the cursor.
    //The processing filters in osgEarth can modify the features as they are operating and we don't want our original data destroyed.
    FeatureList cursorFeatures;
    for (FeatureList::iterator itr = _features.begin(); itr != _features.end(); ++itr)
    {
        Feature* feature = new osgEarth::Features::Feature(*(itr->get()), osg::CopyOp::DEEP_COPY_ALL);        
        cursorFeatures.push_back( feature );
    }    
    return new FeatureListCursor( cursorFeatures );
}
const FeatureProfile * FeatureListSource::createFeatureProfile ( ) [protected, virtual]

Creates and returns a metadata structure describing the features in a named feature class. This method is called by the public function getFeatureProfile() in this same object to create the metadata structure.

Implements osgEarth::Features::FeatureSource.

Definition at line 49 of file FeatureListSource.cpp.

{    
    return _profile.get();
}
bool FeatureListSource::deleteFeature ( FeatureID  fid) [virtual]

Deletes the feature with the given FID

Returns:
True on success; false on failure or if the source is read-only

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 55 of file FeatureListSource.cpp.

{
    for (FeatureList::iterator itr = _features.begin(); itr != _features.end(); ++itr) 
    {
        if (itr->get()->getFID() == fid)
        {
            _features.erase( itr );
            dirty();
            return true;
        }
    }
    return false;
}

Here is the call graph for this function:

Feature * FeatureListSource::getFeature ( FeatureID  fid) [virtual]

Gets the Feature with the given FID

Returns:
The Feature with the given FID or NULL if not found.

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 70 of file FeatureListSource.cpp.

{
    for (FeatureList::iterator itr = _features.begin(); itr != _features.end(); ++itr) 
    {
        if (itr->get()->getFID() == fid)
        {
            return itr->get();
        }
    }
    return NULL;
}
virtual int osgEarth::Features::FeatureListSource::getFeatureCount ( ) const [inline, virtual]

Gets the number of features in this FeatureSource

Returns:
The number of features or -1 if the number of features cannot be determined.

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 42 of file FeatureListSource.

{ return _features.size(); }
FeatureList& osgEarth::Features::FeatureListSource::getFeatures ( ) [inline]

Definition at line 47 of file FeatureListSource.

{ return _features; }
virtual Geometry::Type osgEarth::Features::FeatureListSource::getGeometryType ( ) const [inline, virtual]

Gets the Geometry type of the FeatureSource

Returns:
The Geometry type of the FeatureSource

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 45 of file FeatureListSource.

virtual bool osgEarth::Features::FeatureListSource::hasEmbeddedStyles ( ) const [inline, virtual]

Returns true if this source creates features with embedded style information. By default, this is false (features are not expected to carry their own style definitions).

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 51 of file FeatureListSource.

{ return false; }
void FeatureListSource::initialize ( const std::string &  referenceURI) [virtual]

Initialize the FeatureSource. The profile should be computed and set here using setProfile()

Implements osgEarth::Features::FeatureSource.

Definition at line 44 of file FeatureListSource.cpp.

{
}
bool FeatureListSource::insertFeature ( Feature feature) [virtual]

Inserts the given feature into the FeatureSource

Returns:
True if the feature was inserted, false if not

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 82 of file FeatureListSource.cpp.

{
    _features.push_back( feature );
    dirty();
    return true;
}

Here is the call graph for this function:

virtual bool osgEarth::Features::FeatureListSource::isWritable ( ) const [inline, virtual]

Whether this FeatureSource supports inserting and deleting features

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 40 of file FeatureListSource.

{ return true; }
virtual const char* osgEarth::Features::FeatureListSource::libraryName ( ) const [inline, virtual]

Reimplemented from osgEarth::Features::FeatureSource.

Definition at line 56 of file FeatureListSource.

{ return "osgEarthFeatures"; }

Member Data Documentation

Definition at line 63 of file FeatureListSource.

Definition at line 64 of file FeatureListSource.


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