Added test for osgPresentatation::Group::getSupportedProperties()

This commit is contained in:
Robert Osfield
2013-09-03 15:50:28 +00:00
parent fdfe3210ce
commit 3c106e4dd7
3 changed files with 37 additions and 0 deletions

View File

@@ -1,4 +1,6 @@
SET(TARGET_SRC osgpresentation.cpp )
SET(TARGET_ADDED_LIBRARIES osgPresentation )
#### end var setup ###
SETUP_EXAMPLE(osgpresentation)

View File

@@ -27,6 +27,37 @@
#include <osgGA/TrackballManipulator>
#include <osgViewer/Viewer>
#include <osg/NodeVisitor>
class PrintSupportedProperties : public osg::NodeVisitor
{
public:
PrintSupportedProperties() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
void apply(osg::Node& node)
{
osgPresentation::Group* pres_group = dynamic_cast<osgPresentation::Group*>(&node);
if (pres_group)
{
OSG_NOTICE<<"osgPresentation object : "<<pres_group->className()<<std::endl;
osgPresentation::PropertyList properties;
if (pres_group->getSupportedProperties(properties))
{
for(osgPresentation::PropertyList::iterator itr = properties.begin();
itr != properties.end();
++itr)
{
osgPresentation::ObjectDescription& od = *itr;
OSG_NOTICE<<" "<<od.first->className()<<" : "<<od.first->getName()<<", description = "<<od.second<<std::endl;
}
}
}
traverse(node);
}
};
int main(int argc, char** argv)
{
@@ -123,6 +154,9 @@ int main(int argc, char** argv)
group->addChild(new osgPresentation::Volume);
PrintSupportedProperties psp;
presentation->accept(psp);
viewer.setSceneData( presentation.get() );

View File

@@ -20,6 +20,7 @@ using namespace osgPresentation;
bool Text::load()
{
OSG_NOTICE<<"Not implemented yet"<<std::endl;
return false;
}