src
rviz
default_plugin
markers
marker_base.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009, Willow Garage, Inc.
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* * Neither the name of the Willow Garage, Inc. nor the names of its
14
* contributors may be used to endorse or promote products derived from
15
* this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
* POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30
#ifndef RVIZ_MARKER_BASE_H
31
#define RVIZ_MARKER_BASE_H
32
33
#include <
rviz/selection/forwards.h
>
34
#include <
rviz/interactive_object.h
>
35
36
#include <visualization_msgs/Marker.h>
37
38
#include <
ros/time.h
>
39
40
#include <boost/shared_ptr.hpp>
41
42
#include <OgrePrerequisites.h>
43
44
namespace
rviz
45
{
46
class
DisplayContext;
47
class
MarkerDisplay;
48
class
MarkerSelectionHandler;
49
50
typedef
std::pair<std::string, int32_t>
MarkerID
;
51
typedef
std::set<Ogre::MaterialPtr>
S_MaterialPtr
;
52
53
class
MarkerBase
54
{
55
public
:
56
typedef
visualization_msgs::Marker
Marker
;
57
typedef
visualization_msgs::Marker::ConstPtr
MarkerConstPtr
;
58
59
MarkerBase
(
MarkerDisplay
* owner,
DisplayContext
* context, Ogre::SceneNode* parent_node);
60
61
virtual
~MarkerBase
();
62
63
void
setMessage
(
const
Marker
& message);
64
void
setMessage
(
const
MarkerConstPtr
& message);
65
bool
expired
();
66
67
void
updateFrameLocked
();
68
69
const
MarkerConstPtr
&
getMessage
()
const
70
{
71
return
message_
;
72
}
73
74
MarkerID
getID
()
75
{
76
return
MarkerID
(
message_
->ns,
message_
->id);
77
}
78
std::string
getStringID
()
79
{
80
std::stringstream ss;
81
ss <<
message_
->ns <<
"/"
<<
message_
->id;
82
return
ss.str();
83
}
84
86
void
setInteractiveObject
(
InteractiveObjectWPtr
object
);
87
88
virtual
void
setPosition
(
const
Ogre::Vector3& position);
89
virtual
void
setOrientation
(
const
Ogre::Quaternion& orientation);
90
const
Ogre::Vector3&
getPosition
()
const
;
91
const
Ogre::Quaternion&
getOrientation
()
const
;
92
93
virtual
S_MaterialPtr
getMaterials
()
94
{
95
return
S_MaterialPtr
();
96
}
97
98
protected
:
99
bool
transform
(
const
MarkerConstPtr
& message,
100
Ogre::Vector3& pos,
101
Ogre::Quaternion& orient,
102
Ogre::Vector3& scale);
103
virtual
void
onNewMessage
(
const
MarkerConstPtr
& old_message,
const
MarkerConstPtr
& new_message) = 0;
104
105
void
extractMaterials
(Ogre::Entity* entity,
S_MaterialPtr
& materials);
106
107
MarkerDisplay
*
owner_
;
108
DisplayContext
*
context_
;
109
110
Ogre::SceneNode*
scene_node_
;
111
112
MarkerConstPtr
message_
;
113
114
ros::Time
expiration_
;
115
116
boost::shared_ptr<MarkerSelectionHandler>
handler_
;
117
};
118
typedef
boost::shared_ptr<MarkerBase>
MarkerBasePtr
;
119
120
}
// namespace rviz
121
122
#endif
rviz::MarkerBase::context_
DisplayContext * context_
Definition:
marker_base.h:108
rviz::MarkerBase::getStringID
std::string getStringID()
Definition:
marker_base.h:78
rviz::S_MaterialPtr
std::set< Ogre::MaterialPtr > S_MaterialPtr
Definition:
marker_base.h:51
rviz::MarkerDisplay
Displays "markers" sent in by other ROS nodes on the "visualization_marker" topic.
Definition:
marker_display.h:70
rviz::MarkerBase::onNewMessage
virtual void onNewMessage(const MarkerConstPtr &old_message, const MarkerConstPtr &new_message)=0
rviz::MarkerBase::Marker
visualization_msgs::Marker Marker
Definition:
marker_base.h:56
rviz::MarkerBase::setPosition
virtual void setPosition(const Ogre::Vector3 &position)
Definition:
marker_base.cpp:124
boost::shared_ptr
forwards.h
rviz::MarkerBase
Definition:
marker_base.h:53
time.h
interactive_object.h
rviz::MarkerBase::scene_node_
Ogre::SceneNode * scene_node_
Definition:
marker_base.h:110
rviz::MarkerBase::setOrientation
virtual void setOrientation(const Ogre::Quaternion &orientation)
Definition:
marker_base.cpp:129
rviz::MarkerBase::handler_
boost::shared_ptr< MarkerSelectionHandler > handler_
Definition:
marker_base.h:116
rviz::MarkerBase::getOrientation
const Ogre::Quaternion & getOrientation() const
Definition:
marker_base.cpp:139
rviz::MarkerBase::expired
bool expired()
Definition:
marker_base.cpp:82
rviz::MarkerBase::setInteractiveObject
void setInteractiveObject(InteractiveObjectWPtr object)
Associate an InteractiveObject with this MarkerBase.
Definition:
marker_base.cpp:116
rviz::MarkerBase::MarkerBase
MarkerBase(MarkerDisplay *owner, DisplayContext *context, Ogre::SceneNode *parent_node)
Definition:
marker_base.cpp:49
rviz::MarkerBase::transform
bool transform(const MarkerConstPtr &message, Ogre::Vector3 &pos, Ogre::Quaternion &orient, Ogre::Vector3 &scale)
Definition:
marker_base.cpp:87
rviz
Definition:
add_display_dialog.cpp:54
rviz::MarkerBasePtr
boost::shared_ptr< MarkerBase > MarkerBasePtr
Definition:
interactive_marker_display.h:55
rviz::MarkerBase::setMessage
void setMessage(const Marker &message)
Definition:
marker_base.cpp:59
rviz::MarkerBase::~MarkerBase
virtual ~MarkerBase()
Definition:
marker_base.cpp:54
rviz::MarkerBase::getMaterials
virtual S_MaterialPtr getMaterials()
Definition:
marker_base.h:93
rviz::MarkerBase::getPosition
const Ogre::Vector3 & getPosition() const
Definition:
marker_base.cpp:134
rviz::DisplayContext
Pure-virtual base class for objects which give Display subclasses context in which to work.
Definition:
display_context.h:81
rviz::MarkerBase::getMessage
const MarkerConstPtr & getMessage() const
Definition:
marker_base.h:69
ros::Time
rviz::MarkerID
std::pair< std::string, int32_t > MarkerID
Definition:
interactive_marker_display.h:58
rviz::MarkerBase::message_
MarkerConstPtr message_
Definition:
marker_base.h:112
rviz::MarkerBase::owner_
MarkerDisplay * owner_
Definition:
marker_base.h:107
rviz::MarkerBase::updateFrameLocked
void updateFrameLocked()
Definition:
marker_base.cpp:76
rviz::MarkerBase::getID
MarkerID getID()
Definition:
marker_base.h:74
rviz::MarkerBase::extractMaterials
void extractMaterials(Ogre::Entity *entity, S_MaterialPtr &materials)
Definition:
marker_base.cpp:144
rviz::MarkerBase::MarkerConstPtr
visualization_msgs::Marker::ConstPtr MarkerConstPtr
Definition:
marker_base.h:57
rviz::MarkerBase::expiration_
ros::Time expiration_
Definition:
marker_base.h:114
rviz::InteractiveObjectWPtr
boost::weak_ptr< InteractiveObject > InteractiveObjectWPtr
Definition:
interactive_object.h:59
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:09