Ejemplo n.º 1
0
osg::Node*
FeatureModelSource::createNodeImplementation(const Map*            map,
                                             const osgDB::Options* dbOptions,
                                             ProgressCallback*     progress )
{
    // user must provide a valid map.
    if ( !map )
    {
        OE_WARN << LC << "NULL Map is illegal when building feature data." << std::endl;
        return 0L;
    }

    // make sure the feature source initialized properly:
    if ( !_features.valid() || !_features->getFeatureProfile() )
    {
        OE_WARN << LC << "Invalid feature source" << std::endl;
        return 0L;
    }

    // create a feature node factory:
    FeatureNodeFactory* factory = createFeatureNodeFactory();
    if ( !factory )
    {
        OE_WARN << LC << "Unable to create a feature node factory!" << std::endl;
        return 0L;
    }

    // Session holds data that's shared across the life of the FMG
    Session* session = new Session( map, _options.styles().get(), _features.get(), dbOptions );

    // Graph that will render feature models. May included paged data.
    FeatureModelGraph* graph = new FeatureModelGraph( session, _options, factory );

    // install any post-merge operations on the FMG so it can call them during paging:
    const NodeOperationVector& ops = postProcessors();
    for( NodeOperationVector::const_iterator i = ops.begin(); i != ops.end(); ++i )
    {
        graph->addPostMergeOperation( i->get() );
    }

    // then run the ops on the staring graph:
    firePostProcessors( graph );

    return graph;
}
Ejemplo n.º 2
0
osg::Node*
FeatureModelSource::createNode( ProgressCallback* progress )
{
    if ( !_factory.valid() )
        _factory = createFeatureNodeFactory();

    if ( !_factory.valid() )
        return 0L;

    if ( !_map.valid() )
        return 0L;

    if ( !_features.valid() || !_features->getFeatureProfile() )
    {
        OE_WARN << LC << "Invalid feature source" << std::endl;
        return 0L;
    }

    // Session holds data that's shared across the life of the FMG
    Session* session = new Session( 
        _map.get(), 
        _options.styles().get(),
        _features.get(),
        _dbOptions.get() );

    // Graph that will render feature models. May included paged data.
    FeatureModelGraph* graph = new FeatureModelGraph( 
        session,
        _options, 
        _factory.get() );

    // install any post-merge operations on the FMG so it can call them during paging:
    const NodeOperationVector& ops = postProcessors();
    for( NodeOperationVector::const_iterator i = ops.begin(); i != ops.end(); ++i )
        graph->addPostMergeOperation( i->get() );

    // then run the ops on the staring graph:
    firePostProcessors( graph );

    return graph;
}