overlay_menu_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_MENU_DISPLAY_H_
36 #define JSK_RVIZ_PLUGIN_OVERLAY_MENU_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 
52 #include <std_msgs/ColorRGBA.h>
53 #include <jsk_rviz_plugins/OverlayMenu.h>
54 
55 #include "overlay_utils.h"
56 #endif
57 
58 namespace jsk_rviz_plugins
59 {
60  class OverlayMenuDisplay : public rviz::Display
61  {
62  Q_OBJECT
63  public:
65  virtual ~OverlayMenuDisplay();
66 
67  enum AnimationState
68  {
69  CLOSED,
70  OPENED,
71  OPENING,
72  CLOSING,
73  };
74 
75  // methods for OverlayPickerTool
76  virtual bool isInRegion(int x, int y);
77  virtual void movePosition(int x, int y);
78  virtual void setPosition(int x, int y);
79  virtual int getX() { return left_; };
80  virtual int getY() { return top_; };
81 
82  protected:
83  boost::mutex mutex_;
98  bool keep_centered_;
99  int left_, top_;
100  jsk_rviz_plugins::OverlayMenu::ConstPtr current_menu_;
101  jsk_rviz_plugins::OverlayMenu::ConstPtr next_menu_;
102  double animation_t_;
105  QColor bg_color_;
106  QColor fg_color_;
107 
108  virtual void prepareOverlay();
109  virtual void openingAnimation();
110  virtual std::string getMenuString(
111  const jsk_rviz_plugins::OverlayMenu::ConstPtr& msg,
112  size_t index);
113  virtual QFont font();
114  virtual QFontMetrics fontMetrics();
115  virtual int drawAreaWidth(
116  const jsk_rviz_plugins::OverlayMenu::ConstPtr& msg);
117  virtual int drawAreaHeight(
118  const jsk_rviz_plugins::OverlayMenu::ConstPtr& msg);
119  virtual bool isNeedToResize();
120  virtual bool isNeedToRedraw();
121  virtual void redraw();
122  virtual void onInitialize();
123  virtual void onEnable();
124  virtual void onDisable();
125  virtual void update(float wall_dt, float ros_dt);
126  virtual void subscribe();
127  virtual void unsubscribe();
128  virtual void processMessage
129  (const jsk_rviz_plugins::OverlayMenu::ConstPtr& msg);
130  virtual void setMenuLocation();
131  protected Q_SLOTS:
132  void updateTopic();
133  void updateLeft();
134  void updateTop();
138  void updateFGColor();
139  void updateFGAlpha();
140  void updateBGColor();
141  void updateBGAlpha();
142  };
143 
144 }
145 
146 #endif
147 
jsk_rviz_plugins::OverlayMenuDisplay::getMenuString
virtual std::string getMenuString(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg, size_t index)
Definition: overlay_menu_display.cpp:380
jsk_rviz_plugins::OverlayMenuDisplay::animation_t_
double animation_t_
Definition: overlay_menu_display.h:166
jsk_rviz_plugins::OverlayMenuDisplay::prepareOverlay
virtual void prepareOverlay()
Definition: overlay_menu_display.cpp:392
jsk_rviz_plugins::OverlayMenuDisplay::OPENED
@ OPENED
Definition: overlay_menu_display.h:134
jsk_rviz_plugins::OverlayMenuDisplay::openingAnimation
virtual void openingAnimation()
Definition: overlay_menu_display.cpp:409
jsk_rviz_plugins::OverlayMenuDisplay::updateTop
void updateTop()
Definition: overlay_menu_display.cpp:515
jsk_rviz_plugins::OverlayMenuDisplay::sub_
ros::Subscriber sub_
Definition: overlay_menu_display.h:149
rviz::RosTopicProperty
jsk_rviz_plugins::OverlayMenuDisplay::processMessage
virtual void processMessage(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg)
Definition: overlay_menu_display.cpp:200
jsk_rviz_plugins::OverlayMenuDisplay::updateTopic
void updateTopic()
Definition: overlay_menu_display.cpp:502
jsk_rviz_plugins::OverlayMenuDisplay::update
virtual void update(float wall_dt, float ros_dt)
Definition: overlay_menu_display.cpp:295
jsk_rviz_plugins::OverlayMenuDisplay::getY
virtual int getY()
Definition: overlay_menu_display.h:144
jsk_rviz_plugins::OverlayMenuDisplay::updateOvertakeFGColorProperties
void updateOvertakeFGColorProperties()
Definition: overlay_menu_display.cpp:532
jsk_rviz_plugins::OverlayMenuDisplay::isInRegion
virtual bool isInRegion(int x, int y)
Definition: overlay_menu_display.cpp:610
jsk_rviz_plugins::OverlayMenuDisplay::movePosition
virtual void movePosition(int x, int y)
Definition: overlay_menu_display.cpp:617
jsk_rviz_plugins::OverlayMenuDisplay::AnimationState
AnimationState
Definition: overlay_menu_display.h:131
rviz::BoolProperty
int_property.h
display.h
jsk_rviz_plugins::OverlayMenuDisplay::onInitialize
virtual void onInitialize()
Definition: overlay_menu_display.cpp:153
jsk_rviz_plugins::OverlayMenuDisplay::updateFGAlpha
void updateFGAlpha()
Definition: overlay_menu_display.cpp:583
float_property.h
rviz::ColorProperty
jsk_rviz_plugins::OverlayMenuDisplay::bg_color_
QColor bg_color_
Definition: overlay_menu_display.h:169
jsk_rviz_plugins::OverlayMenuDisplay::setMenuLocation
virtual void setMenuLocation()
Definition: overlay_menu_display.cpp:487
rviz::Display
rviz::FloatProperty
jsk_rviz_plugins::OverlayMenuDisplay::updateBGColor
void updateBGColor()
Definition: overlay_menu_display.cpp:591
overlay_utils.h
bool_property.h
jsk_rviz_plugins::OverlayMenuDisplay::overlay_
OverlayObject::Ptr overlay_
Definition: overlay_menu_display.h:148
jsk_rviz_plugins::OverlayMenuDisplay::bg_alpha_property_
rviz::FloatProperty * bg_alpha_property_
Definition: overlay_menu_display.h:157
jsk_rviz_plugins::OverlayMenuDisplay::redraw
virtual void redraw()
Definition: overlay_menu_display.cpp:437
jsk_rviz_plugins::OverlayMenuDisplay::updateOvertakeBGColorProperties
void updateOvertakeBGColorProperties()
Definition: overlay_menu_display.cpp:552
jsk_rviz_plugins::OverlayMenuDisplay::updateBGAlpha
void updateBGAlpha()
Definition: overlay_menu_display.cpp:602
jsk_rviz_plugins::OverlayMenuDisplay::updateFGColor
void updateFGColor()
Definition: overlay_menu_display.cpp:572
jsk_rviz_plugins::OverlayMenuDisplay::update_topic_property_
rviz::RosTopicProperty * update_topic_property_
Definition: overlay_menu_display.h:150
jsk_rviz_plugins::OverlayMenuDisplay::CLOSING
@ CLOSING
Definition: overlay_menu_display.h:136
bounding_box_sample.x
x
Definition: bounding_box_sample.py:26
jsk_rviz_plugins::OverlayMenuDisplay::unsubscribe
virtual void unsubscribe()
Definition: overlay_menu_display.cpp:184
jsk_rviz_plugins::OverlayMenuDisplay::overtake_bg_color_properties_
bool overtake_bg_color_properties_
Definition: overlay_menu_display.h:168
jsk_rviz_plugins::OverlayMenuDisplay::overtake_fg_color_properties_
bool overtake_fg_color_properties_
Definition: overlay_menu_display.h:167
jsk_rviz_plugins::OverlayMenuDisplay::onEnable
virtual void onEnable()
Definition: overlay_menu_display.cpp:168
jsk_rviz_plugins::OverlayMenuDisplay::overtake_bg_color_properties_property_
rviz::BoolProperty * overtake_bg_color_properties_property_
Definition: overlay_menu_display.h:155
jsk_rviz_plugins::OverlayMenuDisplay::fg_color_
QColor fg_color_
Definition: overlay_menu_display.h:170
jsk_rviz_plugins::OverlayMenuDisplay::fg_alpha_property_
rviz::FloatProperty * fg_alpha_property_
Definition: overlay_menu_display.h:159
jsk_rviz_plugins::OverlayMenuDisplay::left_
int left_
Definition: overlay_menu_display.h:163
jsk_rviz_plugins::OverlayMenuDisplay::setPosition
virtual void setPosition(int x, int y)
Definition: overlay_menu_display.cpp:626
jsk_rviz_plugins::OverlayMenuDisplay::drawAreaWidth
virtual int drawAreaWidth(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg)
Definition: overlay_menu_display.cpp:267
bounding_box_sample.y
y
Definition: bounding_box_sample.py:27
jsk_rviz_plugins::OverlayMenuDisplay::isNeedToResize
virtual bool isNeedToResize()
Definition: overlay_menu_display.cpp:215
jsk_rviz_plugins::OverlayMenuDisplay::subscribe
virtual void subscribe()
Definition: overlay_menu_display.cpp:189
jsk_rviz_plugins::OverlayMenuDisplay::updateKeepCentered
void updateKeepCentered()
Definition: overlay_menu_display.cpp:521
jsk_rviz_plugins::OverlayMenuDisplay::OverlayMenuDisplay
OverlayMenuDisplay()
Definition: overlay_menu_display.cpp:88
jsk_rviz_plugins::OverlayMenuDisplay::top_
int top_
Definition: overlay_menu_display.h:163
jsk_rviz_plugins::OverlayMenuDisplay::font
virtual QFont font()
Definition: overlay_menu_display.cpp:254
jsk_rviz_plugins::OverlayMenuDisplay::bg_color_property_
rviz::ColorProperty * bg_color_property_
Definition: overlay_menu_display.h:156
jsk_rviz_plugins::OverlayMenuDisplay::animation_state_
AnimationState animation_state_
Definition: overlay_menu_display.h:160
jsk_rviz_plugins::OverlayMenuDisplay::mutex_
boost::mutex mutex_
Definition: overlay_menu_display.h:144
jsk_rviz_plugins::OverlayMenuDisplay::isNeedToRedraw
virtual bool isNeedToRedraw()
Definition: overlay_menu_display.cpp:376
jsk_rviz_plugins::OverlayMenuDisplay::left_property_
rviz::IntProperty * left_property_
Definition: overlay_menu_display.h:151
jsk_rviz_plugins::OverlayMenuDisplay::keep_centered_
bool keep_centered_
Definition: overlay_menu_display.h:162
jsk_rviz_plugins::OverlayMenuDisplay::~OverlayMenuDisplay
virtual ~OverlayMenuDisplay()
Definition: overlay_menu_display.cpp:138
jsk_rviz_plugins::OverlayMenuDisplay::OPENING
@ OPENING
Definition: overlay_menu_display.h:135
jsk_rviz_plugins::OverlayMenuDisplay::updateLeft
void updateLeft()
Definition: overlay_menu_display.cpp:509
jsk_rviz_plugins::OverlayMenuDisplay::current_menu_
jsk_rviz_plugins::OverlayMenu::ConstPtr current_menu_
Definition: overlay_menu_display.h:164
jsk_rviz_plugins::OverlayMenuDisplay::require_update_texture_
bool require_update_texture_
Definition: overlay_menu_display.h:161
jsk_rviz_plugins::OverlayMenuDisplay::fontMetrics
virtual QFontMetrics fontMetrics()
Definition: overlay_menu_display.cpp:261
jsk_rviz_plugins::OverlayMenuDisplay::drawAreaHeight
virtual int drawAreaHeight(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg)
Definition: overlay_menu_display.cpp:286
jsk_rviz_plugins::OverlayMenuDisplay::overtake_fg_color_properties_property_
rviz::BoolProperty * overtake_fg_color_properties_property_
Definition: overlay_menu_display.h:154
jsk_rviz_plugins::OverlayMenuDisplay::next_menu_
jsk_rviz_plugins::OverlayMenu::ConstPtr next_menu_
Definition: overlay_menu_display.h:165
jsk_rviz_plugins::OverlayMenuDisplay::top_property_
rviz::IntProperty * top_property_
Definition: overlay_menu_display.h:152
jsk_rviz_plugins::OverlayMenuDisplay::onDisable
virtual void onDisable()
Definition: overlay_menu_display.cpp:176
jsk_rviz_plugins::OverlayMenuDisplay::keep_centered_property_
rviz::BoolProperty * keep_centered_property_
Definition: overlay_menu_display.h:153
jsk_rviz_plugins
Definition: __init__.py:1
color_property.h
jsk_rviz_plugins::OverlayObject::Ptr
boost::shared_ptr< OverlayObject > Ptr
Definition: overlay_utils.h:126
jsk_rviz_plugins::OverlayMenuDisplay::fg_color_property_
rviz::ColorProperty * fg_color_property_
Definition: overlay_menu_display.h:158
ros_topic_property.h
ros::Subscriber
jsk_rviz_plugins::OverlayMenuDisplay::getX
virtual int getX()
Definition: overlay_menu_display.h:143
rviz::IntProperty
jsk_rviz_plugins::OverlayMenuDisplay::CLOSED
@ CLOSED
Definition: overlay_menu_display.h:133


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