Added PrintProperties visitor
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include <osgPresentation/Slide>
|
||||
#include <osgPresentation/Presentation>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
using namespace osgPresentation;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -120,9 +122,62 @@ void PlayAction::apply(osgPresentation::Element& element)
|
||||
element.play();
|
||||
}
|
||||
|
||||
struct PrintValueVisitor: public osg::ValueObject::GetValueVisitor
|
||||
{
|
||||
PrintValueVisitor(std::ostream& output) : _output(output) {}
|
||||
|
||||
template<typename T>
|
||||
void print(const T& value) { _output << value; }
|
||||
|
||||
virtual void apply(bool value) { print(value); }
|
||||
virtual void apply(char value) { print(value); }
|
||||
virtual void apply(unsigned char value) { print(value); }
|
||||
virtual void apply(short value) { print(value); }
|
||||
virtual void apply(unsigned short value) { print(value); }
|
||||
virtual void apply(int value) { print(value); }
|
||||
virtual void apply(unsigned int value) { print(value); }
|
||||
virtual void apply(float value) { print(value); }
|
||||
virtual void apply(double value) { print(value); }
|
||||
virtual void apply(const std::string& value) { print(value); }
|
||||
virtual void apply(const osg::Vec2f& value) { print(value); }
|
||||
virtual void apply(const osg::Vec3f& value) { print(value); }
|
||||
virtual void apply(const osg::Vec4f& value) { print(value); }
|
||||
virtual void apply(const osg::Vec2d& value) { print(value); }
|
||||
virtual void apply(const osg::Vec3d& value) { print(value); }
|
||||
virtual void apply(const osg::Vec4d& value) { print(value); }
|
||||
virtual void apply(const osg::Quat& value) { print(value); }
|
||||
virtual void apply(const osg::Plane& value) { print(value); }
|
||||
virtual void apply(const osg::Matrixf& value) { print(value); }
|
||||
virtual void apply(const osg::Matrixd& value) { print(value); }
|
||||
|
||||
std::ostream& _output;
|
||||
};
|
||||
|
||||
void PrintProperties::apply(osgPresentation::Group& group)
|
||||
{
|
||||
_output<<"PrintProperties osgPresentation object : "<<group.className()<<std::endl;
|
||||
osg::UserDataContainer* udc = group.getUserDataContainer();
|
||||
if (udc)
|
||||
{
|
||||
PrintValueVisitor pvv(_output);
|
||||
|
||||
for(unsigned i=0; i<udc->getNumUserObjects(); ++i)
|
||||
{
|
||||
osg::ValueObject* value_object = dynamic_cast<osg::ValueObject*>(udc->getUserObject(i));
|
||||
if (value_object)
|
||||
{
|
||||
_output<<" "<<value_object->className()<<" : "<<value_object->getName()<<" : ";
|
||||
value_object->get(pvv);
|
||||
_output<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
traverse(group);
|
||||
}
|
||||
|
||||
void PrintSupportedProperties::apply(osgPresentation::Group& group)
|
||||
{
|
||||
_output<<"osgPresentation object : "<<group.className()<<std::endl;
|
||||
_output<<"PrintSupportedProperties osgPresentation object : "<<group.className()<<std::endl;
|
||||
osgPresentation::PropertyList properties;
|
||||
if (group.getSupportedProperties(properties))
|
||||
{
|
||||
@@ -135,5 +190,6 @@ void PrintSupportedProperties::apply(osgPresentation::Group& group)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
traverse(group);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ SET(TARGET_SRC
|
||||
Group.cpp
|
||||
Element.cpp
|
||||
Text.cpp
|
||||
Model.cpp
|
||||
|
||||
deprecated/AnimationMaterial.cpp
|
||||
deprecated/CompileSlideCallback.cpp
|
||||
|
||||
Reference in New Issue
Block a user