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 }
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 { return message_; }
76 
77  MarkerID getID() { return MarkerID(message_->ns, message_->id); }
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();
91  const Ogre::Quaternion& getOrientation();
92 
93  virtual S_MaterialPtr getMaterials() { return S_MaterialPtr(); }
94 
95 protected:
96  bool transform(const MarkerConstPtr& message, Ogre::Vector3& pos, Ogre::Quaternion& orient, Ogre::Vector3& scale);
97  virtual void onNewMessage(const MarkerConstPtr& old_message, const MarkerConstPtr& new_message) = 0;
98 
99  void extractMaterials( Ogre::Entity *entity, S_MaterialPtr &materials );
100 
103 
104  Ogre::SceneNode* scene_node_;
105 
106  MarkerConstPtr message_;
107 
109 
111 };
113 
114 }
115 
116 #endif
Ogre::SceneNode * scene_node_
Definition: marker_base.h:104
std::string getStringID()
Definition: marker_base.h:78
MarkerDisplay * owner_
Definition: marker_base.h:101
virtual S_MaterialPtr getMaterials()
Definition: marker_base.h:93
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:110
ros::Time expiration_
Definition: marker_base.h:108
TFSIMD_FORCE_INLINE Vector3()
DisplayContext * context_
Definition: marker_base.h:102
MarkerConstPtr message_
Definition: marker_base.h:106
MarkerID getID()
Definition: marker_base.h:77
visualization_msgs::Marker::ConstPtr MarkerConstPtr
Definition: marker_base.h:63
const MarkerConstPtr & getMessage() const
Definition: marker_base.h:75
boost::weak_ptr< InteractiveObject > InteractiveObjectWPtr
boost::shared_ptr< MarkerBase > MarkerBasePtr
std::set< Ogre::MaterialPtr > S_MaterialPtr
Definition: marker_base.h:57
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 Wed Aug 28 2019 04:01:51