ClusterLabelVisual.hpp
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Robot Operating System code by the University of Osnabrück
5  * Copyright (c) 2015, University of Osnabrück
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  * 1. Redistributions of source code must retain the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  *
21  * 3. Neither the name of the copyright holder nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
33  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  *
39  *
40  * ClusterLabelVisual.hpp
41  *
42  *
43  * authors:
44  *
45  * Kristin Schmidt <krschmidt@uni-osnabrueck.de>
46  */
47 
48 #ifndef CLUSTER_LABEL_VISUAL_HPP
49 #define CLUSTER_LABEL_VISUAL_HPP
50 
51 #include <Types.hpp>
52 
53 #include <ros/ros.h>
54 
55 #include <rviz/display.h>
56 
57 #include <mesh_msgs/MeshGeometryStamped.h>
58 #include <mesh_msgs/MeshGeometry.h>
59 #include <OGRE/OgreColourValue.h>
60 #include <OGRE/OgrePrerequisites.h>
61 #include <OGRE/OgreMesh.h>
62 #include <OGRE/OgreSubMesh.h>
63 
64 #include <memory>
65 #include <vector>
66 
67 namespace Ogre
68 {
69 // Forward declaration
70 class SceneNode;
71 class Mesh;
72 } // End namespace Ogre
73 
74 namespace rviz_map_plugin
75 {
81 {
82 public:
89  ClusterLabelVisual(rviz::DisplayContext* context, std::string labelId);
90 
98  ClusterLabelVisual(rviz::DisplayContext* context, std::string labelId, std::shared_ptr<Geometry> geometry);
99 
104 
112  ClusterLabelVisual(const ClusterLabelVisual&) = delete;
113 
120 
124  void reset();
125 
131  void setGeometry(std::shared_ptr<Geometry> geometry);
132 
138  void setFacesInCluster(const std::vector<uint32_t>& faces);
139 
146  void setColor(Ogre::ColourValue facesColor, float alpha = 1.0f);
147 
153  std::vector<uint32_t> getFaces()
154  {
155  return m_faces;
156  };
157 
158 private:
159  void initMaterial();
160 
162  Ogre::SceneNode* m_sceneNode;
163  std::string m_labelId;
164 
165  Ogre::MeshPtr m_mesh;
166  Ogre::SubMesh* m_subMesh;
167  Ogre::MaterialPtr m_material;
168 
169  Ogre::ColourValue m_color;
170 
171  std::shared_ptr<Geometry> m_geometry;
172  std::vector<uint32_t> m_faces;
173 };
174 
175 } // end namespace rviz_map_plugin
176 
177 #endif
Ogre
ros.h
rviz_map_plugin::ClusterLabelVisual::setColor
void setColor(Ogre::ColourValue facesColor, float alpha=1.0f)
Sets the color.
Definition: ClusterLabelVisual.cpp:256
rviz_map_plugin::ClusterLabelVisual::m_material
Ogre::MaterialPtr m_material
Definition: ClusterLabelVisual.hpp:167
rviz_map_plugin::ClusterLabelVisual::m_labelId
std::string m_labelId
Definition: ClusterLabelVisual.hpp:163
display.h
rviz_map_plugin::ClusterLabelVisual::m_faces
std::vector< uint32_t > m_faces
Definition: ClusterLabelVisual.hpp:172
rviz_map_plugin::ClusterLabelVisual::m_geometry
std::shared_ptr< Geometry > m_geometry
Definition: ClusterLabelVisual.hpp:171
f
f
rviz_map_plugin::ClusterLabelVisual::operator=
ClusterLabelVisual & operator=(const ClusterLabelVisual &)=delete
Disabling the copy assignment operator.
rviz_map_plugin::ClusterLabelVisual::initMaterial
void initMaterial()
Definition: ClusterLabelVisual.cpp:267
rviz::DisplayContext
rviz_map_plugin::ClusterLabelVisual::m_color
Ogre::ColourValue m_color
Definition: ClusterLabelVisual.hpp:169
rviz_map_plugin::ClusterLabelVisual::setFacesInCluster
void setFacesInCluster(const std::vector< uint32_t > &faces)
Sets the faces, that are in the shown cluster.
Definition: ClusterLabelVisual.cpp:198
Types.hpp
rviz_map_plugin::ClusterLabelVisual::m_subMesh
Ogre::SubMesh * m_subMesh
Definition: ClusterLabelVisual.hpp:166
rviz_map_plugin::ClusterLabelVisual::setGeometry
void setGeometry(std::shared_ptr< Geometry > geometry)
Sets the geometry.
Definition: ClusterLabelVisual.cpp:194
rviz_map_plugin::ClusterLabelVisual
Visual to show a labeled cluster.
Definition: ClusterLabelVisual.hpp:80
rviz_map_plugin::ClusterLabelVisual::m_displayContext
rviz::DisplayContext * m_displayContext
Definition: ClusterLabelVisual.hpp:161
rviz_map_plugin::ClusterLabelVisual::~ClusterLabelVisual
~ClusterLabelVisual()
Destructor.
Definition: ClusterLabelVisual.cpp:160
rviz_map_plugin::ClusterLabelVisual::reset
void reset()
Deletes the material.
Definition: ClusterLabelVisual.cpp:185
rviz_map_plugin::ClusterLabelVisual::ClusterLabelVisual
ClusterLabelVisual(rviz::DisplayContext *context, std::string labelId)
Constructor.
Definition: ClusterLabelVisual.cpp:62
rviz_map_plugin::ClusterLabelVisual::getFaces
std::vector< uint32_t > getFaces()
Returns the faces.
Definition: ClusterLabelVisual.hpp:153
rviz_map_plugin
Definition: ClusterLabelDisplay.hpp:120
rviz_map_plugin::ClusterLabelVisual::m_mesh
Ogre::MeshPtr m_mesh
Definition: ClusterLabelVisual.hpp:165
rviz_map_plugin::ClusterLabelVisual::m_sceneNode
Ogre::SceneNode * m_sceneNode
Definition: ClusterLabelVisual.hpp:162


rviz_map_plugin
Author(s): Sebastian Pütz , Kristin Schmidt , Jan Philipp Vogtherr , Malte kleine Piening
autogenerated on Sun Jan 21 2024 04:06:25