SplineDisplay.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Software License Agreement (BSD License) *
3  * Copyright (C) 2016 by George Todoran <george.todoran@tuwien.ac.at> *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions *
7  * are met: *
8  * *
9  * 1. Redistributions of source code must retain the above copyright *
10  * notice, this list of conditions and the following disclaimer. *
11  * 2. Redistributions in binary form must reproduce the above copyright *
12  * notice, this list of conditions and the following disclaimer in *
13  * the documentation and/or other materials provided with the *
14  * distribution. *
15  * 3. Neither the name of the copyright holder nor the names of its *
16  * contributors may be used to endorse or promote products derived *
17  * from this software without specific prior written permission. *
18  * *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY *
29  * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
30  * POSSIBILITY OF SUCH DAMAGE. *
31  ***************************************************************************/
32 
33 #ifndef SPLINE_DISPLAY_H
34 #define SPLINE_DISPLAY_H
35 
36 #ifndef Q_MOC_RUN
37 #include <boost/circular_buffer.hpp>
38 
40 #include <tuw_nav_msgs/Spline.h>
42 #endif
43 
45 
46 namespace Ogre
47 {
48 class SceneNode;
49 }
50 
51 namespace rviz
52 {
53 class ColorProperty;
54 class EnumProperty;
55 class FloatProperty;
56 class IntProperty;
57 }
58 
59 // All the source in this plugin is in its own namespace. This is not
60 // required but is good practice.
61 namespace tuw_nav_rviz_plugin
62 {
63 
64 class SplineVisual;
65 
66 // Here we declare our new subclass of rviz::Display. Every display
67 // which can be listed in the "Displays" panel is a subclass of
68 // rviz::Display.
69 class SplineDisplay: public rviz::MessageFilterDisplay<tuw_nav_msgs::Spline>
70 {
71 Q_OBJECT
72 public:
73  // Constructor. pluginlib::ClassLoader creates instances by calling
74  // the default constructor, so make sure you have one.
75  SplineDisplay();
76  virtual ~SplineDisplay();
77 
78  // Overrides of protected virtual functions from Display. As much
79  // as possible, when Displays are not enabled, they should not be
80  // subscribed to incoming data and should not show anything in the
81  // 3D view. These functions are where these connections are made
82  // and broken.
83 protected:
84  virtual void onInitialize();
85 
86  // A helper to clear this display back to the initial state.
87  virtual void reset();
88 
89  // These Qt slots get connected to signals indicating changes in the user-editable properties.
90 private Q_SLOTS:
91  void updatePathColor();
92  void updateShape();
93  void updatePathScale();
94  void updatePathPointsNr();
95 
96  void updateOrientColor();
97  void updateOrientShape();
98  void updateOrientScale();
99  void updateOrientPointsNr();
100 
101  void updateHistoryLength();
102 
103  // Function to handle an incoming ROS message.
104 private:
105  void processMessage( const tuw_nav_msgs::Spline::ConstPtr& msg );
106 
107  // Storage for the list of visuals. It is a circular buffer where
108  // data gets popped from the front (oldest) and pushed to the back (newest)
109  boost::circular_buffer<boost::shared_ptr<SplineVisual> > visuals_;
110 
111  // User-editable property variables.
116 
120 
122 };
123 
124 } // end namespace marker_rviz_plugin
125 
126 #endif // SPLINE_DISPLAY_H
127 // %EndTag(FULL_SOURCE)%
boost::circular_buffer< boost::shared_ptr< SplineVisual > > visuals_
rviz::ColorProperty * color_path_property_
rviz::EnumProperty * shape_property_
rviz::IntProperty * points_nr_orient_property_
rviz::IntProperty * history_length_property_
rviz::FloatProperty * scale_path_property_
rviz::ColorProperty * color_orient_property_
rviz::FloatProperty * scale_orient_property_
rviz::IntProperty * points_nr_path_property_


tuw_nav_rviz_plugin
Author(s):
autogenerated on Sun Aug 28 2016 03:53:55