robotcameramanager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __ROBOTCAMERAMANAGER_H
00025 #define __ROBOTCAMERAMANAGER_H
00026
00027 #include "camera.h"
00028 #include <osgGA/GUIEventHandler>
00029 #include <osgGA/GUIEventAdapter>
00030 #include <osgGA/GUIActionAdapter>
00031
00032 namespace lpzrobots {
00033
00034
00035
00036
00037
00038
00039 class RobotCameraManager : public osgGA::GUIEventHandler {
00040 struct Overlay {
00041 Overlay(const Camera::CameraImage& image);
00042 ~Overlay();
00043 Camera::CameraImage camImg;
00044 osg::Texture2D* texture;
00045 int overlayW;
00046 int overlayH;
00047 int overlayX;
00048 int overlayY;
00049 osg::Node* overlay;
00050 };
00051 typedef std::vector<Overlay> Overlays;
00052 struct RobotCam {
00053 Camera* cam;
00054 Overlays overlays;
00055 };
00056 typedef std::vector<RobotCam> RobotCams;
00057
00058 public:
00059 RobotCameraManager(int windowWidth, int windowHeight);
00060 virtual void addCamera(Camera* cam);
00061 virtual void removeCamera(Camera* cam);
00062
00063 virtual osg::Group* getDisplay() { return display; }
00064 virtual osg::Group* getOffScreen() { return offscreen; }
00065
00066
00067 virtual bool handle (const osgGA::GUIEventAdapter& ea,
00068 osgGA::GUIActionAdapter& aa,
00069 osg::Object* o, osg::NodeVisitor* nv);
00070 virtual void getUsage (osg::ApplicationUsage &) const;
00071
00072 protected:
00073
00074 virtual void updateView();
00075
00076 osg::ref_ptr<osg::Group> display;
00077 osg::ref_ptr<osg::Group> offscreen;
00078 RobotCams cameras;
00079
00080 bool enabled;
00081 float scale;
00082 int windowWidth;
00083 int windowHeight;
00084 };
00085
00086
00087 }
00088
00089 #endif