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 
35 
36 #include <visualization_msgs/Marker.h>
37 
38 #include <ros/time.h>
39 
40 #include <boost/shared_ptr.hpp>
41 
42 namespace Ogre
43 {
44 class SceneNode;
45 class Vector3;
46 class Quaternion;
47 class Entity;
48 } // namespace Ogre
49 
50 namespace rviz
51 {
52 class DisplayContext;
53 class MarkerDisplay;
54 class MarkerSelectionHandler;
55 
56 typedef std::pair<std::string, int32_t> MarkerID;
57 typedef std::set<Ogre::MaterialPtr> S_MaterialPtr;
58 
60 {
61 public:
62  typedef visualization_msgs::Marker Marker;
63  typedef visualization_msgs::Marker::ConstPtr MarkerConstPtr;
64 
65  MarkerBase(MarkerDisplay* owner, DisplayContext* context, Ogre::SceneNode* parent_node);
66 
67  virtual ~MarkerBase();
68 
69  void setMessage(const Marker& message);
70  void setMessage(const MarkerConstPtr& message);
71  bool expired();
72 
73  void updateFrameLocked();
74 
75  const MarkerConstPtr& getMessage() const
76  {
77  return message_;
78  }
79 
80  MarkerID getID()
81  {
82  return MarkerID(message_->ns, message_->id);
83  }
84  std::string getStringID()
85  {
86  std::stringstream ss;
87  ss << message_->ns << "/" << message_->id;
88  return ss.str();
89  }
90 
92  void setInteractiveObject(InteractiveObjectWPtr object);
93 
94  virtual void setPosition(const Ogre::Vector3& position);
95  virtual void setOrientation(const Ogre::Quaternion& orientation);
96  const Ogre::Vector3& getPosition();
97  const Ogre::Quaternion& getOrientation();
98 
99  virtual S_MaterialPtr getMaterials()
100  {
101  return S_MaterialPtr();
102  }
103 
104 protected:
105  bool transform(const MarkerConstPtr& message,
106  Ogre::Vector3& pos,
107  Ogre::Quaternion& orient,
108  Ogre::Vector3& scale);
109  virtual void onNewMessage(const MarkerConstPtr& old_message, const MarkerConstPtr& new_message) = 0;
110 
111  void extractMaterials(Ogre::Entity* entity, S_MaterialPtr& materials);
112 
115 
116  Ogre::SceneNode* scene_node_;
117 
118  MarkerConstPtr message_;
119 
121 
123 };
125 
126 } // namespace rviz
127 
128 #endif
Ogre::SceneNode * scene_node_
Definition: marker_base.h:116
std::string getStringID()
Definition: marker_base.h:84
MarkerDisplay * owner_
Definition: marker_base.h:113
virtual S_MaterialPtr getMaterials()
Definition: marker_base.h:99
std::pair< std::string, int32_t > MarkerID
Pure-virtual base class for objects which give Display subclasses context in which to work...
boost::shared_ptr< MarkerSelectionHandler > handler_
Definition: marker_base.h:122
ros::Time expiration_
Definition: marker_base.h:120
DisplayContext * context_
Definition: marker_base.h:114
MarkerConstPtr message_
Definition: marker_base.h:118
MarkerID getID()
Definition: marker_base.h:80
visualization_msgs::Marker::ConstPtr MarkerConstPtr
Definition: marker_base.h:63
boost::weak_ptr< InteractiveObject > InteractiveObjectWPtr
boost::shared_ptr< MarkerBase > MarkerBasePtr
std::set< Ogre::MaterialPtr > S_MaterialPtr
Definition: marker_base.h:57
const MarkerConstPtr & getMessage() const
Definition: marker_base.h:75
Displays "markers" sent in by other ROS nodes on the "visualization_marker" topic.
visualization_msgs::Marker Marker
Definition: marker_base.h:62


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat May 27 2023 02:06:24