overlay_image_display.h
Go to the documentation of this file.
1 // -*- mode: c++; -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 #ifndef JSK_RVIZ_PLUGIN_OVERLAY_IMAGE_DISPLAY_H_
36 #define JSK_RVIZ_PLUGIN_OVERLAY_IMAGE_DISPLAY_H_
37 
38 #ifndef Q_MOC_RUN
39 #include <rviz/display.h>
40 #include <OGRE/OgreTexture.h>
41 #include <OGRE/OgreColourValue.h>
42 #include <OGRE/OgreMaterial.h>
43 
44 #include <QPainter>
45 
51 
53 #include <sensor_msgs/Image.h>
54 
55 #include "overlay_utils.h"
57 #endif
58 
59 namespace jsk_rviz_plugins
60 {
61  class OverlayImageDisplay : public rviz::Display
62  {
63  Q_OBJECT
64  public:
66  virtual ~OverlayImageDisplay();
67 
68  // methods for OverlayPickerTool
69  virtual bool isInRegion(int x, int y);
70  virtual void movePosition(int x, int y);
71  virtual void setPosition(int x, int y);
72  virtual int getX() { return left_; };
73  virtual int getY() { return top_; };
74 
75  protected:
76  boost::mutex mutex_;
79  ImageTransportHintsProperty* transport_hint_property_;
87  int width_, height_, left_, top_;
88  double alpha_;
89 #if ROS_VERSION_MINIMUM(1,12,0)
90  std::shared_ptr<image_transport::ImageTransport> it_;
91 #else
93 #endif
95  sensor_msgs::Image::ConstPtr msg_;
96  bool is_msg_available_;
97  bool require_update_;
98  bool keep_aspect_ratio_;
99  bool overwrite_alpha_;
100 
101  virtual void redraw();
102  virtual void onInitialize();
103  virtual void onEnable();
104  virtual void onDisable();
105  virtual void update(float wall_dt, float ros_dt);
106  virtual void subscribe();
107  virtual void unsubscribe();
108  virtual void setImageSize();
109  virtual void processMessage(const sensor_msgs::Image::ConstPtr& msg);
110  protected Q_SLOTS:
111  void updateTopic();
112  void updateWidth();
113  void updateHeight();
114  void updateLeft();
115  void updateTop();
116  void updateAlpha();
117  void updateKeepAspectRatio();
118  void updateOverwriteAlpha();
119  };
120 
121 }
122 
123 #endif
jsk_rviz_plugins::OverlayImageDisplay::~OverlayImageDisplay
virtual ~OverlayImageDisplay()
Definition: overlay_image_display.cpp:120
jsk_rviz_plugins::OverlayImageDisplay::setPosition
virtual void setPosition(int x, int y)
Definition: overlay_image_display.cpp:367
jsk_rviz_plugins::OverlayImageDisplay::getY
virtual int getY()
Definition: overlay_image_display.h:137
rviz::RosTopicProperty
jsk_rviz_plugins::OverlayImageDisplay::updateWidth
void updateWidth()
Definition: overlay_image_display.cpp:309
boost::shared_ptr< image_transport::ImageTransport >
jsk_rviz_plugins::OverlayImageDisplay::setImageSize
virtual void setImageSize()
Definition: overlay_image_display.cpp:280
jsk_rviz_plugins::OverlayImageDisplay::width_
int width_
Definition: overlay_image_display.h:151
jsk_rviz_plugins::OverlayImageDisplay::getX
virtual int getX()
Definition: overlay_image_display.h:136
rviz::BoolProperty
int_property.h
jsk_rviz_plugins::OverlayImageDisplay::msg_
sensor_msgs::Image::ConstPtr msg_
Definition: overlay_image_display.h:159
jsk_rviz_plugins::OverlayImageDisplay::redraw
virtual void redraw()
Definition: overlay_image_display.cpp:228
jsk_rviz_plugins::OverlayImageDisplay::transport_hint_property_
ImageTransportHintsProperty * transport_hint_property_
Definition: overlay_image_display.h:143
jsk_rviz_plugins::OverlayImageDisplay::updateTopic
void updateTopic()
Definition: overlay_image_display.cpp:274
jsk_rviz_plugins::OverlayImageDisplay::subscribe
virtual void subscribe()
Definition: overlay_image_display.cpp:173
jsk_rviz_plugins::OverlayImageDisplay::updateOverwriteAlpha
void updateOverwriteAlpha()
Definition: overlay_image_display.cpp:348
jsk_rviz_plugins::OverlayImageDisplay::alpha_
double alpha_
Definition: overlay_image_display.h:152
display.h
jsk_rviz_plugins::OverlayImageDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: overlay_image_display.h:149
jsk_rviz_plugins::OverlayImageDisplay::updateAlpha
void updateAlpha()
Definition: overlay_image_display.cpp:335
float_property.h
jsk_rviz_plugins::OverlayImageDisplay::updateKeepAspectRatio
void updateKeepAspectRatio()
Definition: overlay_image_display.cpp:341
rviz::Display
jsk_rviz_plugins::OverlayImageDisplay::require_update_
bool require_update_
Definition: overlay_image_display.h:161
image_transport::Subscriber
rviz::FloatProperty
jsk_rviz_plugins::OverlayImageDisplay::height_property_
rviz::IntProperty * height_property_
Definition: overlay_image_display.h:146
overlay_utils.h
bool_property.h
editable_enum_property.h
jsk_rviz_plugins::OverlayImageDisplay::updateLeft
void updateLeft()
Definition: overlay_image_display.cpp:329
jsk_rviz_plugins::OverlayImageDisplay::is_msg_available_
bool is_msg_available_
Definition: overlay_image_display.h:160
jsk_rviz_plugins::OverlayImageDisplay::unsubscribe
virtual void unsubscribe()
Definition: overlay_image_display.cpp:167
jsk_rviz_plugins::OverlayImageDisplay::height_
int height_
Definition: overlay_image_display.h:151
jsk_rviz_plugins::OverlayImageDisplay::left_property_
rviz::IntProperty * left_property_
Definition: overlay_image_display.h:147
jsk_rviz_plugins::OverlayImageDisplay::width_property_
rviz::IntProperty * width_property_
Definition: overlay_image_display.h:145
jsk_rviz_plugins::OverlayImageDisplay::processMessage
virtual void processMessage(const sensor_msgs::Image::ConstPtr &msg)
Definition: overlay_image_display.cpp:187
bounding_box_sample.x
x
Definition: bounding_box_sample.py:30
jsk_rviz_plugins::OverlayImageDisplay::movePosition
virtual void movePosition(int x, int y)
Definition: overlay_image_display.cpp:361
jsk_rviz_plugins::OverlayImageDisplay::overlay_
OverlayObject::Ptr overlay_
Definition: overlay_image_display.h:141
jsk_rviz_plugins::OverlayImageDisplay::it_
boost::shared_ptr< image_transport::ImageTransport > it_
Definition: overlay_image_display.h:156
jsk_rviz_plugins::OverlayImageDisplay::updateHeight
void updateHeight()
Definition: overlay_image_display.cpp:316
image_transport_hints_property.h
jsk_rviz_plugins::OverlayImageDisplay::keep_aspect_ratio_
bool keep_aspect_ratio_
Definition: overlay_image_display.h:162
bounding_box_sample.y
y
Definition: bounding_box_sample.py:31
jsk_rviz_plugins::OverlayImageDisplay::update
virtual void update(float wall_dt, float ros_dt)
Definition: overlay_image_display.cpp:201
jsk_rviz_plugins::OverlayImageDisplay::mutex_
boost::mutex mutex_
Definition: overlay_image_display.h:137
image_transport.h
jsk_rviz_plugins::OverlayImageDisplay::updateTop
void updateTop()
Definition: overlay_image_display.cpp:323
jsk_rviz_plugins::OverlayImageDisplay::keep_aspect_ratio_property_
rviz::BoolProperty * keep_aspect_ratio_property_
Definition: overlay_image_display.h:144
jsk_rviz_plugins::OverlayImageDisplay::update_topic_property_
rviz::RosTopicProperty * update_topic_property_
Definition: overlay_image_display.h:142
jsk_rviz_plugins::OverlayImageDisplay::onEnable
virtual void onEnable()
Definition: overlay_image_display.cpp:152
jsk_rviz_plugins::OverlayImageDisplay::sub_
image_transport::Subscriber sub_
Definition: overlay_image_display.h:158
jsk_rviz_plugins::OverlayImageDisplay::overwrite_alpha_
bool overwrite_alpha_
Definition: overlay_image_display.h:163
jsk_rviz_plugins::OverlayImageDisplay::isInRegion
virtual bool isInRegion(int x, int y)
Definition: overlay_image_display.cpp:355
jsk_rviz_plugins::OverlayImageDisplay::top_property_
rviz::IntProperty * top_property_
Definition: overlay_image_display.h:148
jsk_rviz_plugins::OverlayImageDisplay::OverlayImageDisplay
OverlayImageDisplay()
Definition: overlay_image_display.cpp:83
jsk_rviz_plugins::OverlayImageDisplay::top_
int top_
Definition: overlay_image_display.h:151
jsk_rviz_plugins::OverlayImageDisplay::onDisable
virtual void onDisable()
Definition: overlay_image_display.cpp:159
jsk_rviz_plugins
Definition: __init__.py:1
jsk_rviz_plugins::OverlayObject::Ptr
boost::shared_ptr< OverlayObject > Ptr
Definition: overlay_utils.h:127
ros_topic_property.h
jsk_rviz_plugins::OverlayImageDisplay::overwrite_alpha_property_
rviz::BoolProperty * overwrite_alpha_property_
Definition: overlay_image_display.h:150
rviz::IntProperty
jsk_rviz_plugins::OverlayImageDisplay::onInitialize
virtual void onInitialize()
Definition: overlay_image_display.cpp:133
jsk_rviz_plugins::OverlayImageDisplay::left_
int left_
Definition: overlay_image_display.h:151


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Dec 13 2024 03:49:56