#ifndef OSGINVOKER_H_H6T4R8HU #define OSGINVOKER_H_H6T4R8HU #include #include #include #include #include "CompositeDisplay.h" #include #include #include #ifdef BUILD_AS_PLUGINS #include "uscxml/plugins/Plugins.h" #endif namespace uscxml { class OSGInvoker : public InvokerImpl, public Arabica::DOM::Events::EventListener { public: OSGInvoker(); virtual ~OSGInvoker(); virtual boost::shared_ptr create(InterpreterImpl* interpreter); virtual std::set getNames() { std::set names; names.insert("3d"); names.insert("scenegraph"); names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#3d"); return names; } virtual Data getDataModelVariables(); virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); virtual void invoke(const InvokeRequest& req); virtual void handleEvent(Arabica::DOM::Events::Event& event); virtual void runOnMainThread(); protected: void processDisplay(const Arabica::DOM::Node& element); void updateDisplay(osg::Node* node, Arabica::DOM::Events::Event& event); void processViewport(const Arabica::DOM::Node& element); void updateViewport(osg::Node* node, Arabica::DOM::Events::Event& event); void processCamera(const Arabica::DOM::Node& element); void updateCamera(osg::Node* node, Arabica::DOM::Events::Event& event); void processTranslation(const Arabica::DOM::Node& element); void updateTranslation(osg::Node* node, Arabica::DOM::Events::Event& event); void processRotation(const Arabica::DOM::Node& element); void updateRotation(osg::Node* node, Arabica::DOM::Events::Event& event); static osg::Matrix rotationFromElement(const Arabica::DOM::Node& element); void processScale(const Arabica::DOM::Node& element); void updateScale(osg::Node* node, Arabica::DOM::Events::Event& event); void processNode(const Arabica::DOM::Node& element); void updateNode(osg::Node* node, Arabica::DOM::Events::Event& event); void processChildren(const std::set& validChildren, const Arabica::DOM::Node& element); void getViewport(const Arabica::DOM::Node& element, unsigned int& x, unsigned int& y, unsigned int& width, unsigned int& height, int& screenId); void getViewport(const Arabica::DOM::Node& element, unsigned int& x, unsigned int& y, unsigned int& width, unsigned int& height, CompositeDisplay* display); void getViewport(const Arabica::DOM::Node& element, unsigned int& x, unsigned int& y, unsigned int& width, unsigned int& height, unsigned int fullWidth, unsigned int fullHeight); osgViewer::View* getView(const Arabica::DOM::Node& element); std::map, CompositeDisplay*> _displays; typedef std::map, CompositeDisplay*> _displays_t; std::map, osgViewer::View*> _views; typedef std::map, osgViewer::View*> _views_t; std::map, osg::Node*> _nodes; typedef std::map, osg::Node*> _nodes_t; tthread::recursive_mutex _mutex; }; #ifdef BUILD_AS_PLUGINS PLUMA_INHERIT_PROVIDER(OSGInvoker, InvokerImpl); #endif } #endif /* end of include guard: OSGINVOKER_H_H6T4R8HU */