src
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
46
#include <
rviz/properties/ros_topic_property.h
>
47
#include <
rviz/properties/int_property.h
>
48
#include <
rviz/properties/bool_property.h
>
49
#include <
rviz/properties/color_property.h
>
50
#include <
rviz/properties/float_property.h
>
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
:
64
OverlayMenuDisplay
();
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_
;
84
OverlayObject::Ptr
overlay_
;
85
ros::Subscriber
sub_
;
86
rviz::RosTopicProperty
*
update_topic_property_
;
87
rviz::IntProperty
*
left_property_
;
88
rviz::IntProperty
*
top_property_
;
89
rviz::BoolProperty
*
keep_centered_property_
;
90
rviz::BoolProperty
*
overtake_fg_color_properties_property_
;
91
rviz::BoolProperty
*
overtake_bg_color_properties_property_
;
92
rviz::ColorProperty
*
bg_color_property_
;
93
rviz::FloatProperty
*
bg_alpha_property_
;
94
rviz::ColorProperty
*
fg_color_property_
;
95
rviz::FloatProperty
*
fg_alpha_property_
;
96
AnimationState
animation_state_
;
97
bool
require_update_texture_
;
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_
;
103
bool
overtake_fg_color_properties_
;
104
bool
overtake_bg_color_properties_
;
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
();
135
void
updateKeepCentered
();
136
void
updateOvertakeFGColorProperties
();
137
void
updateOvertakeBGColorProperties
();
138
void
updateFGColor
();
139
void
updateFGAlpha
();
140
void
updateBGColor
();
141
void
updateBGAlpha
();
142
};
143
144
}
145
146
#endif
147
jsk_rviz_plugins::OverlayMenuDisplay::drawAreaWidth
virtual int drawAreaWidth(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg)
Definition:
overlay_menu_display.cpp:235
jsk_rviz_plugins::OverlayMenuDisplay::OverlayMenuDisplay
OverlayMenuDisplay()
Definition:
overlay_menu_display.cpp:56
jsk_rviz_plugins::OverlayMenuDisplay::updateFGAlpha
void updateFGAlpha()
Definition:
overlay_menu_display.cpp:551
jsk_rviz_plugins::OverlayMenuDisplay::bg_alpha_property_
rviz::FloatProperty * bg_alpha_property_
Definition:
overlay_menu_display.h:93
jsk_rviz_plugins::OverlayMenuDisplay::onEnable
virtual void onEnable()
Definition:
overlay_menu_display.cpp:136
jsk_rviz_plugins::OverlayMenuDisplay::subscribe
virtual void subscribe()
Definition:
overlay_menu_display.cpp:157
jsk_rviz_plugins::OverlayMenuDisplay::left_
int left_
Definition:
overlay_menu_display.h:99
jsk_rviz_plugins::OverlayMenuDisplay::OPENED
Definition:
overlay_menu_display.h:70
jsk_rviz_plugins::OverlayMenuDisplay::current_menu_
jsk_rviz_plugins::OverlayMenu::ConstPtr current_menu_
Definition:
overlay_menu_display.h:100
jsk_rviz_plugins::OverlayMenuDisplay::setPosition
virtual void setPosition(int x, int y)
Definition:
overlay_menu_display.cpp:594
jsk_rviz_plugins::OverlayMenuDisplay::font
virtual QFont font()
Definition:
overlay_menu_display.cpp:222
jsk_rviz_plugins::OverlayMenuDisplay::top_
int top_
Definition:
overlay_menu_display.h:99
jsk_rviz_plugins::OverlayMenuDisplay::CLOSED
Definition:
overlay_menu_display.h:69
jsk_rviz_plugins::OverlayMenuDisplay::redraw
virtual void redraw()
Definition:
overlay_menu_display.cpp:405
jsk_rviz_plugins::OverlayMenuDisplay::updateOvertakeBGColorProperties
void updateOvertakeBGColorProperties()
Definition:
overlay_menu_display.cpp:520
jsk_rviz_plugins
Definition:
__init__.py:1
jsk_rviz_plugins::OverlayMenuDisplay::update_topic_property_
rviz::RosTopicProperty * update_topic_property_
Definition:
overlay_menu_display.h:86
jsk_rviz_plugins::OverlayMenuDisplay::updateFGColor
void updateFGColor()
Definition:
overlay_menu_display.cpp:540
overlay_utils.h
int_property.h
jsk_rviz_plugins::OverlayMenuDisplay::overtake_bg_color_properties_property_
rviz::BoolProperty * overtake_bg_color_properties_property_
Definition:
overlay_menu_display.h:91
jsk_rviz_plugins::OverlayMenuDisplay::fg_color_
QColor fg_color_
Definition:
overlay_menu_display.h:106
jsk_rviz_plugins::OverlayMenuDisplay::left_property_
rviz::IntProperty * left_property_
Definition:
overlay_menu_display.h:87
jsk_rviz_plugins::OverlayMenuDisplay::mutex_
boost::mutex mutex_
Definition:
overlay_menu_display.h:80
jsk_rviz_plugins::OverlayMenuDisplay::updateKeepCentered
void updateKeepCentered()
Definition:
overlay_menu_display.cpp:489
jsk_rviz_plugins::OverlayMenuDisplay::CLOSING
Definition:
overlay_menu_display.h:72
bool_property.h
rviz::FloatProperty
jsk_rviz_plugins::OverlayMenuDisplay::bg_color_property_
rviz::ColorProperty * bg_color_property_
Definition:
overlay_menu_display.h:92
jsk_rviz_plugins::OverlayMenuDisplay::fontMetrics
virtual QFontMetrics fontMetrics()
Definition:
overlay_menu_display.cpp:229
rviz::RosTopicProperty
rviz::IntProperty
jsk_rviz_plugins::OverlayMenuDisplay::drawAreaHeight
virtual int drawAreaHeight(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg)
Definition:
overlay_menu_display.cpp:254
jsk_rviz_plugins::OverlayMenuDisplay::isNeedToRedraw
virtual bool isNeedToRedraw()
Definition:
overlay_menu_display.cpp:344
jsk_rviz_plugins::OverlayMenuDisplay::next_menu_
jsk_rviz_plugins::OverlayMenu::ConstPtr next_menu_
Definition:
overlay_menu_display.h:101
boost::shared_ptr< OverlayObject >
jsk_rviz_plugins::OverlayMenuDisplay::keep_centered_
bool keep_centered_
Definition:
overlay_menu_display.h:98
jsk_rviz_plugins::OverlayMenuDisplay::top_property_
rviz::IntProperty * top_property_
Definition:
overlay_menu_display.h:88
rviz::ColorProperty
jsk_rviz_plugins::OverlayMenuDisplay::animation_t_
double animation_t_
Definition:
overlay_menu_display.h:102
jsk_rviz_plugins::OverlayMenuDisplay::onDisable
virtual void onDisable()
Definition:
overlay_menu_display.cpp:144
jsk_rviz_plugins::OverlayMenuDisplay::~OverlayMenuDisplay
virtual ~OverlayMenuDisplay()
Definition:
overlay_menu_display.cpp:106
display.h
rviz::Display
jsk_rviz_plugins::OverlayMenuDisplay::sub_
ros::Subscriber sub_
Definition:
overlay_menu_display.h:85
jsk_rviz_plugins::OverlayMenuDisplay::animation_state_
AnimationState animation_state_
Definition:
overlay_menu_display.h:96
jsk_rviz_plugins::OverlayMenuDisplay::update
virtual void update(float wall_dt, float ros_dt)
Definition:
overlay_menu_display.cpp:263
ros::Subscriber
jsk_rviz_plugins::OverlayMenuDisplay::overtake_fg_color_properties_property_
rviz::BoolProperty * overtake_fg_color_properties_property_
Definition:
overlay_menu_display.h:90
jsk_rviz_plugins::OverlayMenuDisplay::getY
virtual int getY()
Definition:
overlay_menu_display.h:80
jsk_rviz_plugins::OverlayMenuDisplay::updateLeft
void updateLeft()
Definition:
overlay_menu_display.cpp:477
jsk_rviz_plugins::OverlayMenuDisplay::prepareOverlay
virtual void prepareOverlay()
Definition:
overlay_menu_display.cpp:360
jsk_rviz_plugins::OverlayMenuDisplay::keep_centered_property_
rviz::BoolProperty * keep_centered_property_
Definition:
overlay_menu_display.h:89
jsk_rviz_plugins::OverlayMenuDisplay::openingAnimation
virtual void openingAnimation()
Definition:
overlay_menu_display.cpp:377
jsk_rviz_plugins::OverlayMenuDisplay::require_update_texture_
bool require_update_texture_
Definition:
overlay_menu_display.h:97
jsk_rviz_plugins::OverlayMenuDisplay::isInRegion
virtual bool isInRegion(int x, int y)
Definition:
overlay_menu_display.cpp:578
jsk_rviz_plugins::OverlayMenuDisplay::processMessage
virtual void processMessage(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg)
Definition:
overlay_menu_display.cpp:168
jsk_rviz_plugins::OverlayMenuDisplay
Definition:
overlay_menu_display.h:60
jsk_rviz_plugins::OverlayMenuDisplay::getX
virtual int getX()
Definition:
overlay_menu_display.h:79
jsk_rviz_plugins::OverlayMenuDisplay::getMenuString
virtual std::string getMenuString(const jsk_rviz_plugins::OverlayMenu::ConstPtr &msg, size_t index)
Definition:
overlay_menu_display.cpp:348
float_property.h
jsk_rviz_plugins::OverlayMenuDisplay::updateOvertakeFGColorProperties
void updateOvertakeFGColorProperties()
Definition:
overlay_menu_display.cpp:500
jsk_rviz_plugins::OverlayMenuDisplay::updateTop
void updateTop()
Definition:
overlay_menu_display.cpp:483
color_property.h
jsk_rviz_plugins::OverlayMenuDisplay::bg_color_
QColor bg_color_
Definition:
overlay_menu_display.h:105
jsk_rviz_plugins::OverlayMenuDisplay::fg_color_property_
rviz::ColorProperty * fg_color_property_
Definition:
overlay_menu_display.h:94
jsk_rviz_plugins::OverlayMenuDisplay::AnimationState
AnimationState
Definition:
overlay_menu_display.h:67
jsk_rviz_plugins::OverlayMenuDisplay::onInitialize
virtual void onInitialize()
Definition:
overlay_menu_display.cpp:121
rviz::BoolProperty
jsk_rviz_plugins::OverlayMenuDisplay::updateTopic
void updateTopic()
Definition:
overlay_menu_display.cpp:470
jsk_rviz_plugins::OverlayMenuDisplay::movePosition
virtual void movePosition(int x, int y)
Definition:
overlay_menu_display.cpp:585
jsk_rviz_plugins::OverlayMenuDisplay::OPENING
Definition:
overlay_menu_display.h:71
jsk_rviz_plugins::OverlayMenuDisplay::updateBGAlpha
void updateBGAlpha()
Definition:
overlay_menu_display.cpp:570
jsk_rviz_plugins::OverlayMenuDisplay::updateBGColor
void updateBGColor()
Definition:
overlay_menu_display.cpp:559
ros_topic_property.h
jsk_rviz_plugins::OverlayMenuDisplay::unsubscribe
virtual void unsubscribe()
Definition:
overlay_menu_display.cpp:152
jsk_rviz_plugins::OverlayMenuDisplay::overlay_
OverlayObject::Ptr overlay_
Definition:
overlay_menu_display.h:84
jsk_rviz_plugins::OverlayMenuDisplay::setMenuLocation
virtual void setMenuLocation()
Definition:
overlay_menu_display.cpp:455
jsk_rviz_plugins::OverlayMenuDisplay::overtake_bg_color_properties_
bool overtake_bg_color_properties_
Definition:
overlay_menu_display.h:104
jsk_rviz_plugins::OverlayMenuDisplay::overtake_fg_color_properties_
bool overtake_fg_color_properties_
Definition:
overlay_menu_display.h:103
jsk_rviz_plugins::OverlayMenuDisplay::isNeedToResize
virtual bool isNeedToResize()
Definition:
overlay_menu_display.cpp:183
jsk_rviz_plugins::OverlayMenuDisplay::fg_alpha_property_
rviz::FloatProperty * fg_alpha_property_
Definition:
overlay_menu_display.h:95
jsk_rviz_plugins
Author(s): Kei Okada
, Yohei Kakiuchi
, Shohei Fujii
, Ryohei Ueda
autogenerated on Thu Jun 1 2023 02:45:58