CARLA
Loading...
Searching...
No Matches
RoadInfoMarkRecord.h
Go to the documentation of this file.
1// Copyright (c) 2026 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
11#include <string>
12#include <vector>
13#include <memory>
14
15namespace carla {
16namespace road {
17namespace element {
18
19 /// Each lane within a road cross section can be provided with several road
20 /// markentries. The road mark information defines the style of the line at
21 /// the lane’s outer border. For left lanes, this is the left border, for
22 /// right lanes the right one. The style of the line separating left and right
23 /// lanes is determined by the road mark entry for lane zero (i.e. the center
24 /// lane)
25 class RoadInfoMarkRecord final : public RoadInfo {
26 public:
27
28 /// Can be used as flags
29 enum class LaneChange : uint8_t {
30 None = 0x00, //00
31 Increase = 0x01, //01
32 Decrease = 0x02, //10
33 Both = 0x03 //11
34 };
35
37 double s,
38 int road_mark_id)
39 : RoadInfo(s),
40 _road_mark_id(road_mark_id),
41 _type(""),
42 _weight(""),
43 _color("white"),
44 _material("standard"),
45 _width(0.15),
47 _height(0.0),
48 _type_name(""),
49 _type_width(0.0),
50 _is_rht(true) {}
51
53 double s,
54 int road_mark_id,
55 std::string type,
56 std::string weight,
57 std::string color,
58 std::string material,
59 double width,
60 LaneChange lane_change,
61 double height,
62 std::string type_name,
63 double type_width,
64 bool is_rht)
65 : RoadInfo(s),
66 _road_mark_id(road_mark_id),
67 _type(type),
68 _weight(weight),
69 _color(color),
70 _material(material),
71 _width(width),
72 _lane_change(lane_change),
73 _height(height),
74 _type_name(type_name),
75 _type_width(type_width),
76 _is_rht(is_rht) {}
77
79 v.Visit(*this);
80 }
81
82 /// Unique identifer for the road mark.
83 int GetRoadMarkId() const {
84 return _road_mark_id;
85 }
86
87 /// Type of the road mark.
88 const std::string &GetType() const {
89 return _type;
90 }
91
92 /// Weight of the road mark.
93 const std::string &GetWeight() const {
94 return _weight;
95 }
96
97 /// Color of the road mark.
98 const std::string &GetColor() const {
99 return _color;
100 }
101
102 /// Material of the road mark (identifiers to be defined, use "standard" for
103 /// the moment.
104 const std::string &GetMaterial() const {
105 return _material;
106 }
107
108 /// Width of the road mark –optional.
109 double GetWidth() const {
110 return _width;
111 }
112
113 /// Allow a lane change in the indicated direction taking into account that
114 /// lanes are numbered in ascending order from right to left. If the
115 /// attribute is missing, “both” is assumed to be valid.
117 return _lane_change;
118 }
119
120 /// Physical distance of top edge of road mark from reference plane of the
121 /// lane.
122 double GetHeight() const {
123 return _height;
124 }
125
126 /// Name of the road mark type if it has one.
127 const std::string &GetTypeName() const {
128 return _type_name;
129 }
130
131 /// Width of the road mark type if it has one.
132 double GetTypeWidth() const {
133 return _type_width;
134 }
135
136 bool isRHT() const {
137 return _is_rht;
138 }
139
140 std::vector<std::unique_ptr<RoadInfoMarkTypeLine>> &GetLines() {
141 return _lines;
142 }
143
144 private:
145
146 const int _road_mark_id;
147
148 const std::string _type;
149
150 const std::string _weight;
151
152 const std::string _color;
153
154 const std::string _material;
155
156 const double _width;
157
159
160 const double _height;
161
162 const std::string _type_name;
163
164 const double _type_width;
165
167
168 std::vector<std::unique_ptr<RoadInfoMarkTypeLine>> _lines;
169 };
170
171} // namespace element
172} // namespace road
173} // namespace carla
std::map< std::string, unsigned int > road
Each lane within a road cross section can be provided with several road markentries.
const std::string & GetWeight() const
Weight of the road mark.
const std::string & GetTypeName() const
Name of the road mark type if it has one.
int GetRoadMarkId() const
Unique identifer for the road mark.
std::vector< std::unique_ptr< RoadInfoMarkTypeLine > > & GetLines()
const std::string & GetType() const
Type of the road mark.
double GetTypeWidth() const
Width of the road mark type if it has one.
std::vector< std::unique_ptr< RoadInfoMarkTypeLine > > _lines
void AcceptVisitor(RoadInfoVisitor &v) final
const std::string & GetColor() const
Color of the road mark.
double GetHeight() const
Physical distance of top edge of road mark from reference plane of the lane.
LaneChange GetLaneChange() const
Allow a lane change in the indicated direction taking into account that lanes are numbered in ascendi...
const std::string & GetMaterial() const
Material of the road mark (identifiers to be defined, use "standard" for the moment.
RoadInfoMarkRecord(double s, int road_mark_id, std::string type, std::string weight, std::string color, std::string material, double width, LaneChange lane_change, double height, std::string type_name, double type_width, bool is_rht)
double GetWidth() const
Width of the road mark –optional.
RoadInfoMarkRecord(double s, int road_mark_id)
This file contains definitions of common data structures used in traffic manager.