CARLA
 
载入中...
搜索中...
未找到
MapData.h
浏览该文件的文档.
1// Copyright (c) 2017 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/Iterator.h"
11#include "carla/ListView.h"
12#include "carla/NonCopyable.h"
15#include "carla/road/Junction.h"
16#include "carla/road/Road.h"
18#include "carla/road/Signal.h"
19
20#include <boost/iterator/transform_iterator.hpp>
21
22#include <unordered_map>
23
24namespace carla {
25namespace road {
26
27 class Lane;
28
29 class MapData : private MovableNonCopyable {
30 public:
31
33 return _geo_reference;
34 }
35
36 std::unordered_map<RoadId, Road> &GetRoads();
37
38 const std::unordered_map<RoadId, Road> &GetRoads() const {
39 return _roads;
40 }
41
42 std::unordered_map<JuncId, Junction> &GetJunctions();
43
44 const std::unordered_map<JuncId, Junction> &GetJunctions() const {
45 return _junctions;
46 }
47
48 bool ContainsRoad(RoadId id) const {
49 return (_roads.find(id) != _roads.end());
50 }
51
52 Road &GetRoad(const RoadId id);
53
54 const Road &GetRoad(const RoadId id) const;
55
57
58 const Junction *GetJunction(JuncId id) const;
59
60 template <typename T>
61 auto GetRoadInfo(const RoadId id, const double s) {
62 return GetRoad(id).template GetInfo<T>(s);
63 }
64
65 template <typename T>
67 const RoadId road_id,
68 const SectionId section_id,
69 const LaneId lane_id,
70 const double s) {
71 return GetRoad(road_id).GetLaneById(section_id, lane_id).template GetInfo<T>(s);
72 }
73
74 size_t GetRoadCount() const {
75 return _roads.size();
76 }
77
78 const std::unordered_map<SignId, std::unique_ptr<Signal>> &GetSignals() const {
79 return _signals;
80 }
81
82 const std::unordered_map<ContId, std::unique_ptr<Controller>>& GetControllers() const {
83 return _controllers;
84 }
85
86 private:
87
88 friend class MapBuilder;
89
90 MapData() = default;
91
93
94 std::unordered_map<RoadId, Road> _roads;
95
96 std::unordered_map<JuncId, Junction> _junctions;
97
98 std::unordered_map<SignId, std::unique_ptr<Signal>> _signals;
99
100 std::unordered_map<ContId, std::unique_ptr<Controller>> _controllers;
101 };
102
103} // namespace road
104} // namespace carla
Inherit (privately) to suppress copy construction and assignment.
std::unordered_map< RoadId, Road > _roads
Definition MapData.h:94
const geom::GeoLocation & GetGeoReference() const
Definition MapData.h:32
std::unordered_map< RoadId, Road > & GetRoads()
Definition MapData.cpp:13
const std::unordered_map< RoadId, Road > & GetRoads() const
Definition MapData.h:38
size_t GetRoadCount() const
Definition MapData.h:74
Road & GetRoad(const RoadId id)
Definition MapData.cpp:21
auto GetRoadInfo(const RoadId id, const double s)
Definition MapData.h:61
const std::unordered_map< JuncId, Junction > & GetJunctions() const
Definition MapData.h:44
std::unordered_map< ContId, std::unique_ptr< Controller > > _controllers
Definition MapData.h:100
std::unordered_map< JuncId, Junction > _junctions
Definition MapData.h:96
geom::GeoLocation _geo_reference
Definition MapData.h:92
bool ContainsRoad(RoadId id) const
Definition MapData.h:48
std::unordered_map< JuncId, Junction > & GetJunctions()
Definition MapData.cpp:17
const std::unordered_map< SignId, std::unique_ptr< Signal > > & GetSignals() const
Definition MapData.h:78
const std::unordered_map< ContId, std::unique_ptr< Controller > > & GetControllers() const
Definition MapData.h:82
auto GetLaneInfo(const RoadId road_id, const SectionId section_id, const LaneId lane_id, const double s)
Definition MapData.h:66
Junction * GetJunction(JuncId id)
Definition MapData.cpp:29
std::unordered_map< SignId, std::unique_ptr< Signal > > _signals
Definition MapData.h:98
Lane & GetLaneById(SectionId section_id, LaneId lane_id)
Definition Road.cpp:110
uint32_t SectionId
Definition RoadTypes.h:21
int32_t JuncId
Definition RoadTypes.h:17
int32_t LaneId
Definition RoadTypes.h:19
uint32_t RoadId
Definition RoadTypes.h:15
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133