LabelNode With BBoxSymbol

classic Classic list List threaded Threaded
2 messages Options
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view

LabelNode With BBoxSymbol


If you add a BBoxSymbol to a dynamic LabelNode, setting the text causes the geometry to become a small square.  It seems it's because in LabelNode.cpp, lines 194-199 set up the BboxDrawable if necessary and add it before the text node, making it drawable 0:

const BBoxSymbol* bboxsymbol = _style.get<BBoxSymbol>();
if ( bboxsymbol && text )
    osg::Drawable* bboxGeom = new BboxDrawable( Utils::getBoundingBox(text), *bboxsymbol );

And on line 141, the code assumes drawable 0 of _geode is the Text drawable failing the test on line 142:

osgText::Text* d = dynamic_cast<osgText::Text*>(_geode->getDrawable(0));
if ( d )

If you recreate the LabelNode with a BBoxSymbol everytime you want to see it, there are still issues because the BboxDrawable shows up in front of the Text drawable.

My workaround is recreate the LabelNode everytime and change the Z values in lines 45-48 of BboxDrawable.cpp to -0.0001.  If the plan is to just use BboxDrawables for LabelNodes (as it seems) this change would fix the latter problem.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view

Re: LabelNode With BBoxSymbol

Thanks for the bug report; will you please enter a GitHub issue? Thanks.
Glenn Waldron / Pelican Mapping