HUDCamera.h
Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2013 University of Jaume-I.
00003  * All rights reserved. This program and the accompanying materials
00004  * are made available under the terms of the GNU Public License v3.0
00005  * which accompanies this distribution, and is available at
00006  * http://www.gnu.org/licenses/gpl.html
00007  * 
00008  * Contributors:
00009  *     Mario Prats
00010  *     Javier Perez
00011  */
00012 
00013 #ifndef HUDCAMERA_H_
00014 #define HUDCAMERA_H_
00015 
00016 #include "SimulatorConfig.h"
00017 #include "CustomWidget.h"
00018 
00019 #include <osg/Image>
00020 
00022 class HUDCamera : public CustomWidget
00023 {
00024   osg::ref_ptr<osgWidget::Widget> widget;
00025 
00026   class widgetUpdateCallback : public osg::Drawable::UpdateCallback
00027   {
00028     osg::ref_ptr<osg::Image> image;
00029   public:
00030     widgetUpdateCallback(osg::Image *i) :
00031         osg::Drawable::UpdateCallback()
00032     {
00033       this->image = i;
00034     }
00035     virtual void update(osg::NodeVisitor *nv, osg::Drawable *d)
00036     {
00037       (static_cast<osgWidget::Widget*>(d))->setImage(image, true, false);
00038     }
00039   };
00040 
00041 public:
00042   unsigned int width, height; 
00043   unsigned int posx, posy; 
00044   double scale; 
00045 
00046   osg::ref_ptr<osg::Image> osg_image; //The osg::Image object where to store the ROS image
00047   bool ready_; //true if images have been acquired
00048 
00050   HUDCamera(unsigned int width, unsigned int height, unsigned int posx = 0, unsigned int posy = 0, double scale = 1,
00051             int blackWhite = 0);
00052 
00053   bool ready()
00054   {
00055     return ready_;
00056   }
00057 
00058   //Interface to be implemented by widgets. Build a widget window with the data to be displayed
00059   osg::ref_ptr<osgWidget::Window> getWidgetWindow();
00060 
00061   ~HUDCamera();
00062 };
00063 
00064 #endif /* HUDCAMERA_H_ */


uwsim
Author(s): Mario Prats , Javier Perez
autogenerated on Fri Aug 28 2015 13:28:58