Road2d.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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 #include "gazebo/util/system.hh"
33 
34 namespace gazebo
35 {
36  namespace rendering
37  {
40 
43  class GZ_RENDERING_VISIBLE Road2d
44  {
46  public: Road2d();
47 
49  public: virtual ~Road2d();
50 
53  public: void Load(VisualPtr _parent);
54 
56  private: void PreRender();
57 
59  private: void OnRoadMsg(ConstRoadPtr &_msg);
60 
62  private: class Segment : public Ogre::SimpleRenderable
63  {
66  public: void Load(msgs::Road _msg);
67 
68 
71  public: virtual Ogre::Real getBoundingRadius() const;
72 
75  public: virtual Ogre::Real getSquaredViewDepth(
76  const Ogre::Camera* cam) const;
77 
79  public: std::string name;
80 
82  public: std::vector<ignition::math::Vector3d> points;
83 
85  public: double width;
86 
88  public: std::string texture;
89  };
90 
93  typedef std::list<boost::shared_ptr<msgs::Road const> > RoadMsgs_L;
94 
96  private: RoadMsgs_L msgs;
97 
99  private: std::vector<Road2d::Segment*> segments;
100 
102  private: VisualPtr parent;
103 
105  private: transport::NodePtr node;
106 
108  private: transport::SubscriberPtr sub;
109 
111  private: std::vector<event::ConnectionPtr> connections;
112  };
114  }
115 }
116 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
Forward declarations for transport.
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
Definition: Road2d.hh:43
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:112