Nick Prudent wrote on Monday, August 27, 2007 10:05 AM:
> Thanks Rafa. That's what I'm already doing...I was hoping for a more
> elegant solution than dynamic casting... 
> 
> I'm surpised there's no such thing as osg::Node::_type where _type is
> a compound of different flags to test against. 
> 
> - Nick -

If you're implementing a NodeVisitor, it defines apply(osg::Switch) so
you don't have to check the type yourself. Other than that, though, yeah
you're stuck with dynamic_cast<>.

> ----------------------------------------
>> Date: Mon, 27 Aug 2007 09:34:04 +0200
>> From: [EMAIL PROTECTED]
>> To: osg-users@lists.openscenegraph.org
>> Subject: Re: [osg-users] Switch Group Detection
>> 
>> Hi Nick,
>> 
>> try this:
>> 
>> osg::Switch *myswitch = dynamic_cast(node);
>> if(myswitch)
>>    // is a switch
>> else
>>   // is not a switch
>> 
>> 
>> Rafa.
>> 
>> 
>> On 8/27/07, Nick Prudent  wrote:
>>> Newbie question:
>>> 
>>> How do you find out if a osg:Group node is a Switch?
>>> Node::asGroup() can be used to determine if thi is a osg::Group,
>>> but what about osg::Switch ? 
>>> 
>>> Thanks,
>>> 
>>> - Nick -



-- 
Bryan Thrall
FlightSafety International
[EMAIL PROTECTED]
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to