overlay_image_display.h
Go to the documentation of this file.
00001 // -*- mode: c++; -*-
00002 /*********************************************************************
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2014, JSK Lab
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/o2r other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of the JSK Lab nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
00034  *********************************************************************/
00035 #ifndef JSK_RVIZ_PLUGIN_OVERLAY_IMAGE_DISPLAY_H_
00036 #define JSK_RVIZ_PLUGIN_OVERLAY_IMAGE_DISPLAY_H_
00037 
00038 #include <rviz/display.h>
00039 #include <OGRE/OgreTexture.h>
00040 #include <OGRE/OgreColourValue.h>
00041 #include <OGRE/OgreMaterial.h>
00042 
00043 #include <QPainter>
00044 
00045 #include <rviz/properties/ros_topic_property.h>
00046 #include <rviz/properties/int_property.h>
00047 #include <rviz/properties/float_property.h>
00048 
00049 #include <image_transport/image_transport.h>
00050 #include <sensor_msgs/Image.h>
00051 
00052 #include "overlay_utils.h"
00053 
00054 namespace jsk_rviz_plugins
00055 {
00056   class OverlayImageDisplay : public rviz::Display
00057   {
00058     Q_OBJECT
00059   public:
00060     OverlayImageDisplay();
00061     virtual ~OverlayImageDisplay();
00062 
00063   protected:
00064     boost::mutex mutex_;
00065     OverlayObject::Ptr overlay_;
00066     rviz::RosTopicProperty* update_topic_property_;
00067     rviz::IntProperty* width_property_;
00068     rviz::IntProperty* height_property_;
00069     rviz::IntProperty* left_property_;
00070     rviz::IntProperty* top_property_;
00071     rviz::FloatProperty* alpha_property_;
00072     int width_, height_, left_, top_;
00073     double alpha_;
00074     boost::shared_ptr<image_transport::ImageTransport> it_;
00075     image_transport::Subscriber sub_;
00076     sensor_msgs::Image::ConstPtr msg_;
00077     bool is_msg_available_;
00078     bool require_update_;
00079 
00080     virtual void redraw();
00081     virtual void onInitialize();
00082     virtual void onEnable();
00083     virtual void onDisable();
00084     virtual void update(float wall_dt, float ros_dt);
00085     virtual void subscribe();
00086     virtual void unsubscribe();
00087     virtual void processMessage(const sensor_msgs::Image::ConstPtr& msg);
00088   protected Q_SLOTS:
00089     void updateTopic();
00090     void updateWidth();
00091     void updateHeight();
00092     void updateLeft();
00093     void updateTop();
00094     void updateAlpha();
00095   };
00096 
00097 }
00098 
00099 #endif
00100 


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Sun Sep 13 2015 22:29:03