CARLA
LaneSection.h
Go to the documentation of this file.
1 // Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
10 #include "carla/NonCopyable.h"
11 #include "carla/road/Lane.h"
13 #include "carla/road/RoadTypes.h"
14 
15 #include <map>
16 #include <vector>
17 
18 namespace carla {
19 namespace road {
20 
21  class Road;
22  class MapBuilder;
23 
24  class LaneSection : private MovableNonCopyable {
25  public:
26 
27  explicit LaneSection(SectionId id, double s) : _id(id), _s(s) {}
28 
29  double GetDistance() const;
30 
31  double GetLength() const;
32 
33  Road *GetRoad() const;
34 
35  Lane *GetLane(const LaneId id);
36 
37  const Lane *GetLane(const LaneId id) const;
38 
39  bool ContainsLane(LaneId id) const {
40  return (_lanes.find(id) != _lanes.end());
41  }
42 
43  SectionId GetId() const;
44 
45  std::map<LaneId, Lane> &GetLanes();
46 
47  const std::map<LaneId, Lane> &GetLanes() const;
48 
49  std::vector<Lane *> GetLanesOfType(Lane::LaneType type);
50 
51  private:
52 
53  friend MapBuilder;
54 
55  const SectionId _id = 0u;
56 
57  const double _s = 0.0;
58 
59  Road *_road = nullptr;
60 
61  std::map<LaneId, Lane> _lanes;
62 
64  };
65 
66 } // road
67 } // carla
Road * GetRoad() const
Definition: LaneSection.cpp:23
geom::CubicPolynomial _lane_offset
Definition: LaneSection.h:63
double GetDistance() const
Definition: LaneSection.cpp:13
Describes a Cubic Polynomial so: f(x) = a + bx + cx^2 + dx^3.
LaneSection(SectionId id, double s)
Definition: LaneSection.h:27
std::vector< Lane * > GetLanesOfType(Lane::LaneType type)
Definition: LaneSection.cpp:55
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
uint32_t SectionId
Definition: RoadTypes.h:21
std::map< LaneId, Lane > _lanes
Definition: LaneSection.h:61
double GetLength() const
Definition: LaneSection.cpp:17
Inherit (privately) to suppress copy construction and assignment.
SectionId GetId() const
Definition: LaneSection.cpp:27
LaneType
Can be used as flags.
Definition: Lane.h:29
int32_t LaneId
Definition: RoadTypes.h:19
std::map< LaneId, Lane > & GetLanes()
Definition: LaneSection.cpp:47
bool ContainsLane(LaneId id) const
Definition: LaneSection.h:39
const SectionId _id
Definition: LaneSection.h:55
Lane * GetLane(const LaneId id)
Definition: LaneSection.cpp:31