osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Features::FeatureNode Class Reference

Inheritance diagram for osgEarth::Features::FeatureNode:
Collaboration diagram for osgEarth::Features::FeatureNode:

List of all members.

Public Member Functions

 FeatureNode (MapNode *mapNode, Feature *feature, bool draped=true)
void setFeature (Feature *feature)
void setStyle (const Style &style)
void init ()

Protected Attributes

osg::ref_ptr< Feature_feature
optional< Style_style

Detailed Description

A node that renders a single feature. This convenience node assumes that the geometry in the Feature is in the same SRS as the Map in the MapNode.

Definition at line 39 of file FeatureNode.


Constructor & Destructor Documentation

FeatureNode::FeatureNode ( MapNode mapNode,
Feature feature,
bool  draped = true 
)

Definition at line 29 of file FeatureNode.cpp.

                                                                          :
DrapeableNode( mapNode, draped ),
_feature     ( feature )
{
    init();
}

Here is the call graph for this function:


Member Function Documentation

void FeatureNode::init ( )

Definition at line 37 of file FeatureNode.cpp.

{
    if ( _feature.valid() && _feature->getGeometry() )
    {
        GeometryCompilerOptions options;
        options.maxGranularity() = 1.0;
        GeometryCompiler compiler( options );
        Session* session = new Session( _mapNode->getMap() );
        GeoExtent extent(_mapNode->getMap()->getProfile()->getSRS(), _feature->getGeometry()->getBounds());
        FeatureProfile* profile = new FeatureProfile(extent);
        FilterContext context( session, profile, extent );

        // Clone the Feature before rendering as the GeometryCompiler and it's filters can change the coordinates
        // of the geometry when performing localization or converting to geocentric.
        osg::ref_ptr< Feature > clone = new osgEarth::Features::Feature(*_feature.get(), osg::CopyOp::DEEP_COPY_ALL);        

        osg::Node* node;
        if ( _style.isSet() )
            node = compiler.compile( clone.get(), *_style, context );
        else
            node = compiler.compile( clone.get(), *clone->style(), context );

        setNode( node );
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FeatureNode::setFeature ( Feature feature)

Definition at line 64 of file FeatureNode.cpp.

{
    _feature = feature;
    init();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FeatureNode::setStyle ( const Style style)

Definition at line 71 of file FeatureNode.cpp.

{
    _style = style;
    init();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 51 of file FeatureNode.

Definition at line 52 of file FeatureNode.


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