All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Road2d.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _ROAD2D_HH_
18 #define _ROAD2D_HH_
19 
20 #include <string>
21 #include <vector>
22 #include <list>
23 
24 #include "gazebo/msgs/msgs.hh"
25 #include "gazebo/common/Events.hh"
27 
29 #include "gazebo/math/Vector3.hh"
30 #include "gazebo/math/Spline.hh"
32 
33 namespace gazebo
34 {
35  namespace rendering
36  {
39 
42  class Road2d
43  {
45  public: Road2d();
46 
48  public: virtual ~Road2d();
49 
52  public: void Load(VisualPtr _parent);
53 
55  private: void PreRender();
56 
58  private: void OnRoadMsg(ConstRoadPtr &_msg);
59 
61  private: class Segment : public Ogre::SimpleRenderable
62  {
65  public: void Load(msgs::Road _msg);
66 
67 
70  public: virtual Ogre::Real getBoundingRadius() const;
71 
74  public: virtual Ogre::Real getSquaredViewDepth(
75  const Ogre::Camera* cam) const;
76 
78  public: std::string name;
79 
81  public: std::vector<math::Vector3> points;
82 
84  public: double width;
85  };
86 
87 
90  typedef std::list<boost::shared_ptr<msgs::Road const> > RoadMsgs_L;
91 
93  private: RoadMsgs_L msgs;
94 
96  private: std::vector<Road2d::Segment*> segments;
97 
99  private: VisualPtr parent;
100 
102  private: transport::NodePtr node;
103 
105  private: transport::SubscriberPtr sub;
106 
108  private: std::vector<event::ConnectionPtr> connections;
109  };
111  }
112 }
113 #endif