osgEarth 2.1.1
|
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 |
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.
Definition at line 29 of file FeatureNode.cpp.
: DrapeableNode( mapNode, draped ), _feature ( feature ) { init(); }
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 ); } }
void FeatureNode::setFeature | ( | Feature * | feature | ) |
Definition at line 64 of file FeatureNode.cpp.
void FeatureNode::setStyle | ( | const Style & | style | ) |
Definition at line 71 of file FeatureNode.cpp.
osg::ref_ptr<Feature> osgEarth::Features::FeatureNode::_feature [protected] |
Definition at line 51 of file FeatureNode.
optional<Style> osgEarth::Features::FeatureNode::_style [protected] |
Definition at line 52 of file FeatureNode.