Exemple #1
0
void
RectangleNode::rebuild()
{    
    std::string currentDecoration = getDecoration();
    clearDecoration();

    // Reset:
    osgEarth::clearChildren( this );
    osgEarth::clearChildren( _xform.get() );
    this->addChild( _xform.get() );

    // construct a local-origin circle.
    GeometryFactory factory;    
    Geometry* geom = factory.createRectangle(osg::Vec3d(0,0,0), _width, _height);
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<Feature> feature = new Feature(geom, 0L); //todo: consider the SRS
        osg::Node* node = compiler.compile( feature.get(), _style, FilterContext(0L) );
        if ( node )
        {
            _xform->addChild( node );
            replaceChild( _xform.get(), applyAltitudePolicy(_xform.get(), _style) );
        }

        applyRenderSymbology( _style );
        setLightingIfNotSet( false );
    }

    setDecoration( currentDecoration );
}
void
RectangleNode::rebuild()
{    
    osgEarth::clearChildren( getPositionAttitudeTransform() );

    // construct a local-origin circle.
    GeometryFactory factory;    
    Geometry* geom = factory.createRectangle(osg::Vec3d(0,0,0), _width, _height);
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<osg::Node> node = compiler.compile( geom, _style, FilterContext() );
        if ( node )
        {
            node = AnnotationUtils::installOverlayParent( node.get(), _style );
            getPositionAttitudeTransform()->addChild( node.get() );
        }

        applyRenderSymbology( _style );
        setLightingIfNotSet( false );
    }
}
Exemple #3
0
void
RectangleNode::rebuild()
{    
    std::string currentDecoration = getDecoration();
    clearDecoration();

    //Remove all children from this node
    //removeChildren( 0, getNumChildren() );
    if ( getRoot()->getNumParents() == 0 )
    {
        this->addChild( getRoot() );
    }

    //Remove all children from the attach point
    getChildAttachPoint()->removeChildren( 0, getChildAttachPoint()->getNumChildren() );

    // construct a local-origin circle.
    GeometryFactory factory;    
    Geometry* geom = factory.createRectangle(osg::Vec3d(0,0,0), _width, _height);
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<Feature> feature = new Feature(geom, 0L); //todo: consider the SRS
        osg::Node* node = compiler.compile( feature.get(), _style, FilterContext(0L) );
        if ( node )
        {
            getChildAttachPoint()->addChild( node );
            getOverlay()->setActive( _draped );
        }

        applyStyle( _style );

        setLightingIfNotSet( false );
    }

    setDecoration( currentDecoration );
}