overlay_text_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_TEXT_DISPLAY_H_
36 #define JSK_RVIZ_PLUGIN_OVERLAY_TEXT_DISPLAY_H_
37 
38 #include "jsk_rviz_plugins/OverlayText.h"
39 #ifndef Q_MOC_RUN
40 #include <rviz/display.h>
41 #include "overlay_utils.h"
42 #include <OGRE/OgreColourValue.h>
43 #include <OGRE/OgreMaterial.h>
44 #include <std_msgs/ColorRGBA.h>
51 #endif
52 
53 namespace jsk_rviz_plugins
54 {
55  class OverlayTextDisplay
56  : public rviz::Display
57  {
58  Q_OBJECT
59  public:
61  virtual ~OverlayTextDisplay();
62  // methods for OverlayPickerTool
63  virtual bool isInRegion(int x, int y);
64  virtual void movePosition(int x, int y);
65  virtual void setPosition(int x, int y);
66  virtual int getX() { return left_; };
67  virtual int getY() { return top_; };
68  protected:
70 
71  int texture_width_;
72  int texture_height_;
73 
77  bool align_bottom_;
78  bool invert_shadow_;
79  QColor bg_color_;
80  QColor fg_color_;
81  int text_size_;
82  int line_width_;
83  std::string text_;
84  QStringList font_families_;
85  std::string font_;
86  int left_;
87  int top_;
88 
90 
91  virtual void onInitialize();
92  virtual void subscribe();
93  virtual void unsubscribe();
94  virtual void onEnable();
95  virtual void onDisable();
96  virtual void update(float wall_dt, float ros_dt);
97 
116  protected Q_SLOTS:
117  void updateTopic();
121  void updateAlignBottom();
122  void updateInvertShadow();
123  void updateTop();
124  void updateLeft();
125  void updateWidth();
126  void updateHeight();
127  void updateTextSize();
128  void updateFGColor();
129  void updateFGAlpha();
132  void updateFont();
133  void updateLineWidth();
134  private:
135  void processMessage(const jsk_rviz_plugins::OverlayText::ConstPtr& msg);
136  };
137 }
138 
139 #endif
jsk_rviz_plugins::OverlayTextDisplay::fg_color_property_
rviz::ColorProperty * fg_color_property_
Definition: overlay_text_display.h:177
jsk_rviz_plugins::OverlayTextDisplay::updateOvertakePositionProperties
void updateOvertakePositionProperties()
Definition: overlay_text_display.cpp:389
jsk_rviz_plugins::OverlayTextDisplay::fg_color_
QColor fg_color_
Definition: overlay_text_display.h:144
rviz::RosTopicProperty
jsk_rviz_plugins::OverlayTextDisplay::height_property_
rviz::IntProperty * height_property_
Definition: overlay_text_display.h:172
jsk_rviz_plugins::OverlayTextDisplay::bg_color_
QColor bg_color_
Definition: overlay_text_display.h:143
jsk_rviz_plugins::OverlayTextDisplay::updateAlignBottom
void updateAlignBottom()
Definition: overlay_text_display.cpp:465
jsk_rviz_plugins::OverlayTextDisplay::updateTopic
void updateTopic()
Definition: overlay_text_display.cpp:230
jsk_rviz_plugins::OverlayTextDisplay::invert_shadow_property_
rviz::BoolProperty * invert_shadow_property_
Definition: overlay_text_display.h:168
jsk_rviz_plugins::OverlayTextDisplay::top_property_
rviz::IntProperty * top_property_
Definition: overlay_text_display.h:169
boost::shared_ptr< OverlayObject >
jsk_rviz_plugins::OverlayTextDisplay::updateOvertakeBGColorProperties
void updateOvertakeBGColorProperties()
Definition: overlay_text_display.cpp:445
jsk_rviz_plugins::OverlayTextDisplay::overtake_fg_color_properties_property_
rviz::BoolProperty * overtake_fg_color_properties_property_
Definition: overlay_text_display.h:165
jsk_rviz_plugins::OverlayTextDisplay::bg_color_property_
rviz::ColorProperty * bg_color_property_
Definition: overlay_text_display.h:175
jsk_rviz_plugins::OverlayTextDisplay::updateTop
void updateTop()
Definition: overlay_text_display.cpp:482
rviz::BoolProperty
int_property.h
jsk_rviz_plugins::OverlayTextDisplay::updateFont
void updateFont()
Definition: overlay_text_display.cpp:560
jsk_rviz_plugins::OverlayTextDisplay::updateBGAlpha
void updateBGAlpha()
Definition: overlay_text_display.cpp:533
jsk_rviz_plugins::OverlayTextDisplay::updateFGAlpha
void updateFGAlpha()
Definition: overlay_text_display.cpp:552
jsk_rviz_plugins::OverlayTextDisplay::require_update_texture_
bool require_update_texture_
Definition: overlay_text_display.h:162
jsk_rviz_plugins::OverlayTextDisplay::invert_shadow_
bool invert_shadow_
Definition: overlay_text_display.h:142
enum_property.h
jsk_rviz_plugins::OverlayTextDisplay::texture_height_
int texture_height_
Definition: overlay_text_display.h:136
jsk_rviz_plugins::OverlayTextDisplay::overtake_position_properties_property_
rviz::BoolProperty * overtake_position_properties_property_
Definition: overlay_text_display.h:164
display.h
jsk_rviz_plugins::OverlayTextDisplay::update
virtual void update(float wall_dt, float ros_dt)
Definition: overlay_text_display.cpp:260
jsk_rviz_plugins::OverlayTextDisplay::isInRegion
virtual bool isInRegion(int x, int y)
Definition: overlay_text_display.cpp:582
jsk_rviz_plugins::OverlayTextDisplay::texture_width_
int texture_width_
Definition: overlay_text_display.h:135
jsk_rviz_plugins::OverlayTextDisplay::unsubscribe
virtual void unsubscribe()
Definition: overlay_text_display.cpp:217
jsk_rviz_plugins::OverlayTextDisplay::bg_alpha_property_
rviz::FloatProperty * bg_alpha_property_
Definition: overlay_text_display.h:176
jsk_rviz_plugins::OverlayTextDisplay::~OverlayTextDisplay
virtual ~OverlayTextDisplay()
Definition: overlay_text_display.cpp:178
float_property.h
rviz::ColorProperty
jsk_rviz_plugins::OverlayTextDisplay::setPosition
virtual void setPosition(int x, int y)
Definition: overlay_text_display.cpp:594
rviz::Display
jsk_rviz_plugins::OverlayTextDisplay::overlay_
jsk_rviz_plugins::OverlayObject::Ptr overlay_
Definition: overlay_text_display.h:131
rviz::EnumProperty
rviz::FloatProperty
jsk_rviz_plugins::OverlayTextDisplay::onEnable
virtual void onEnable()
Definition: overlay_text_display.cpp:201
jsk_rviz_plugins::OverlayTextDisplay::font_
std::string font_
Definition: overlay_text_display.h:149
jsk_rviz_plugins::OverlayTextDisplay::sub_
ros::Subscriber sub_
Definition: overlay_text_display.h:153
overlay_utils.h
bool_property.h
jsk_rviz_plugins::OverlayTextDisplay::updateOvertakeFGColorProperties
void updateOvertakeFGColorProperties()
Definition: overlay_text_display.cpp:419
jsk_rviz_plugins::OverlayTextDisplay::font_property_
rviz::EnumProperty * font_property_
Definition: overlay_text_display.h:179
bounding_box_sample.x
x
Definition: bounding_box_sample.py:26
jsk_rviz_plugins::OverlayTextDisplay::OverlayTextDisplay
OverlayTextDisplay()
Definition: overlay_text_display.cpp:84
jsk_rviz_plugins::OverlayTextDisplay::movePosition
virtual void movePosition(int x, int y)
Definition: overlay_text_display.cpp:588
jsk_rviz_plugins::OverlayTextDisplay::getX
virtual int getX()
Definition: overlay_text_display.h:130
jsk_rviz_plugins::OverlayTextDisplay::updateWidth
void updateWidth()
Definition: overlay_text_display.cpp:498
jsk_rviz_plugins::OverlayTextDisplay::align_bottom_
bool align_bottom_
Definition: overlay_text_display.h:141
bounding_box_sample.y
y
Definition: bounding_box_sample.py:27
jsk_rviz_plugins::OverlayTextDisplay::updateTextSize
void updateTextSize()
Definition: overlay_text_display.cpp:514
jsk_rviz_plugins::OverlayTextDisplay::updateInvertShadow
void updateInvertShadow()
Definition: overlay_text_display.cpp:473
jsk_rviz_plugins::OverlayTextDisplay::line_width_property_
rviz::IntProperty * line_width_property_
Definition: overlay_text_display.h:174
jsk_rviz_plugins::OverlayTextDisplay::align_bottom_property_
rviz::BoolProperty * align_bottom_property_
Definition: overlay_text_display.h:167
jsk_rviz_plugins::OverlayTextDisplay::getY
virtual int getY()
Definition: overlay_text_display.h:131
jsk_rviz_plugins::OverlayTextDisplay::updateFGColor
void updateFGColor()
Definition: overlay_text_display.cpp:541
jsk_rviz_plugins::OverlayTextDisplay::width_property_
rviz::IntProperty * width_property_
Definition: overlay_text_display.h:171
jsk_rviz_plugins::OverlayTextDisplay::updateHeight
void updateHeight()
Definition: overlay_text_display.cpp:506
jsk_rviz_plugins::OverlayTextDisplay::overtake_bg_color_properties_property_
rviz::BoolProperty * overtake_bg_color_properties_property_
Definition: overlay_text_display.h:166
jsk_rviz_plugins::OverlayTextDisplay::left_
int left_
Definition: overlay_text_display.h:150
jsk_rviz_plugins::OverlayTextDisplay::subscribe
virtual void subscribe()
Definition: overlay_text_display.cpp:222
jsk_rviz_plugins::OverlayTextDisplay::overtake_fg_color_properties_
bool overtake_fg_color_properties_
Definition: overlay_text_display.h:138
jsk_rviz_plugins::OverlayTextDisplay::updateLeft
void updateLeft()
Definition: overlay_text_display.cpp:490
jsk_rviz_plugins::OverlayTextDisplay::update_topic_property_
rviz::RosTopicProperty * update_topic_property_
Definition: overlay_text_display.h:163
jsk_rviz_plugins::OverlayTextDisplay::text_
std::string text_
Definition: overlay_text_display.h:147
jsk_rviz_plugins::OverlayTextDisplay::text_size_
int text_size_
Definition: overlay_text_display.h:145
jsk_rviz_plugins::OverlayTextDisplay::onInitialize
virtual void onInitialize()
Definition: overlay_text_display.cpp:237
jsk_rviz_plugins::OverlayTextDisplay::fg_alpha_property_
rviz::FloatProperty * fg_alpha_property_
Definition: overlay_text_display.h:178
jsk_rviz_plugins::OverlayTextDisplay::updateBGColor
void updateBGColor()
Definition: overlay_text_display.cpp:522
jsk_rviz_plugins::OverlayTextDisplay::processMessage
void processMessage(const jsk_rviz_plugins::OverlayText::ConstPtr &msg)
Definition: overlay_text_display.cpp:340
jsk_rviz_plugins::OverlayTextDisplay::overtake_position_properties_
bool overtake_position_properties_
Definition: overlay_text_display.h:140
jsk_rviz_plugins::OverlayTextDisplay::left_property_
rviz::IntProperty * left_property_
Definition: overlay_text_display.h:170
jsk_rviz_plugins
Definition: __init__.py:1
jsk_rviz_plugins::OverlayTextDisplay::line_width_
int line_width_
Definition: overlay_text_display.h:146
jsk_rviz_plugins::OverlayTextDisplay::top_
int top_
Definition: overlay_text_display.h:151
color_property.h
jsk_rviz_plugins::OverlayTextDisplay::text_size_property_
rviz::IntProperty * text_size_property_
Definition: overlay_text_display.h:173
jsk_rviz_plugins::OverlayTextDisplay::font_families_
QStringList font_families_
Definition: overlay_text_display.h:148
ros_topic_property.h
ros::Subscriber
jsk_rviz_plugins::OverlayTextDisplay::overtake_bg_color_properties_
bool overtake_bg_color_properties_
Definition: overlay_text_display.h:139
jsk_rviz_plugins::OverlayTextDisplay::onDisable
virtual void onDisable()
Definition: overlay_text_display.cpp:209
rviz::IntProperty
jsk_rviz_plugins::OverlayTextDisplay::updateLineWidth
void updateLineWidth()
Definition: overlay_text_display.cpp:574


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Aug 2 2024 08:50:14