CARLA
载入中...
搜索中...
未找到
LibCarla
source
carla
road
element
LaneMarking.cpp
浏览该文件的文档.
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
#include "
carla/road/element/LaneMarking.h
"
8
9
#include "
carla/Exception.h
"
10
#include "
carla/StringUtil.h
"
11
#include "
carla/road/element/RoadInfoMarkRecord.h
"
12
13
namespace
carla
{
14
namespace
road {
15
namespace
element {
16
17
static
LaneMarking::Type
GetType
(std::string str) {
18
StringUtil::ToLower
(str);
19
if
(str ==
"broken"
) {
20
return
LaneMarking::Type::Broken
;
21
}
else
if
(str ==
"solid"
) {
22
return
LaneMarking::Type::Solid
;
23
}
else
if
(str ==
"solid solid"
) {
24
return
LaneMarking::Type::SolidSolid
;
25
}
else
if
(str ==
"solid broken"
) {
26
return
LaneMarking::Type::SolidBroken
;
27
}
else
if
(str ==
"broken solid"
) {
28
return
LaneMarking::Type::BrokenSolid
;
29
}
else
if
(str ==
"broken broken"
) {
30
return
LaneMarking::Type::BrokenBroken
;
31
}
else
if
(str ==
"botts dots"
) {
32
return
LaneMarking::Type::BottsDots
;
33
}
else
if
(str ==
"grass"
) {
34
return
LaneMarking::Type::Grass
;
35
}
else
if
(str ==
"curb"
) {
36
return
LaneMarking::Type::Curb
;
37
}
else
if
(str ==
"none"
) {
38
return
LaneMarking::Type::None
;
39
}
else
{
40
return
LaneMarking::Type::Other
;
41
}
42
}
43
44
static
LaneMarking::Color
GetColor
(std::string str) {
45
StringUtil::ToLower
(str);
46
if
(str ==
"standard"
) {
47
return
LaneMarking::Color::Standard
;
48
}
else
if
(str ==
"blue"
) {
49
return
LaneMarking::Color::Blue
;
50
}
else
if
(str ==
"green"
) {
51
return
LaneMarking::Color::Green
;
52
}
else
if
(str ==
"red"
) {
53
return
LaneMarking::Color::Red
;
54
}
else
if
(str ==
"white"
) {
55
return
LaneMarking::Color::White
;
56
}
else
if
(str ==
"yellow"
) {
57
return
LaneMarking::Color::Yellow
;
58
}
else
{
59
return
LaneMarking::Color::Other
;
60
}
61
}
62
63
static
LaneMarking::LaneChange
GetLaneChange
(
RoadInfoMarkRecord::LaneChange
lane_change) {
64
switch
(lane_change) {
65
case
RoadInfoMarkRecord::LaneChange::Increase
:
66
return
LaneMarking::LaneChange::Right
;
67
case
RoadInfoMarkRecord::LaneChange::Decrease
:
68
return
LaneMarking::LaneChange::Left
;
69
case
RoadInfoMarkRecord::LaneChange::Both
:
70
return
LaneMarking::LaneChange::Both
;
71
default
:
72
return
LaneMarking::LaneChange::None
;
73
}
74
}
75
76
LaneMarking::LaneMarking
(
const
RoadInfoMarkRecord
&info)
77
: type(
GetType
(info.
GetType
())),
78
color(
GetColor
(info.
GetColor
())),
79
lane_change(
GetLaneChange
(info.
GetLaneChange
())),
80
width(info.GetWidth()) {}
81
82
}
// namespace element
83
}
// namespace road
84
}
// namespace carla
Exception.h
LaneMarking.h
RoadInfoMarkRecord.h
StringUtil.h
carla::StringUtil::ToLower
static void ToLower(WritableRangeT &str)
Definition
StringUtil.h:36
carla::road::element::RoadInfoMarkRecord
Each lane within a road cross section can be provided with several road markentries.
Definition
RoadInfoMarkRecord.h:25
carla::road::element::RoadInfoMarkRecord::LaneChange
LaneChange
Can be used as flags
Definition
RoadInfoMarkRecord.h:29
carla::road::element::RoadInfoMarkRecord::LaneChange::Both
@ Both
carla::road::element::RoadInfoMarkRecord::LaneChange::Decrease
@ Decrease
carla::road::element::RoadInfoMarkRecord::LaneChange::Increase
@ Increase
carla::road::element::GetType
static LaneMarking::Type GetType(std::string str)
Definition
LaneMarking.cpp:17
carla::road::element::GetLaneChange
static LaneMarking::LaneChange GetLaneChange(RoadInfoMarkRecord::LaneChange lane_change)
Definition
LaneMarking.cpp:63
carla::road::element::GetColor
static LaneMarking::Color GetColor(std::string str)
Definition
LaneMarking.cpp:44
carla
This file contains definitions of common data structures used in traffic manager.
Definition
Carla.cpp:133
carla::road::element::LaneMarking::LaneChange
LaneChange
Can be used as flags.
Definition
LaneMarking.h:50
carla::road::element::LaneMarking::LaneChange::Both
@ Both
carla::road::element::LaneMarking::LaneChange::None
@ None
carla::road::element::LaneMarking::LaneChange::Right
@ Right
carla::road::element::LaneMarking::LaneChange::Left
@ Left
carla::road::element::LaneMarking::LaneMarking
LaneMarking(const RoadInfoMarkRecord &info)
Definition
LaneMarking.cpp:76
carla::road::element::LaneMarking::Type
Type
Definition
LaneMarking.h:20
carla::road::element::LaneMarking::Type::BrokenBroken
@ BrokenBroken
carla::road::element::LaneMarking::Type::Curb
@ Curb
carla::road::element::LaneMarking::Type::BottsDots
@ BottsDots
carla::road::element::LaneMarking::Type::Other
@ Other
carla::road::element::LaneMarking::Type::None
@ None
carla::road::element::LaneMarking::Type::BrokenSolid
@ BrokenSolid
carla::road::element::LaneMarking::Type::Grass
@ Grass
carla::road::element::LaneMarking::Type::Broken
@ Broken
carla::road::element::LaneMarking::Type::SolidSolid
@ SolidSolid
carla::road::element::LaneMarking::Type::Solid
@ Solid
carla::road::element::LaneMarking::Type::SolidBroken
@ SolidBroken
carla::road::element::LaneMarking::Color
Color
Definition
LaneMarking.h:39
carla::road::element::LaneMarking::Color::White
@ White
carla::road::element::LaneMarking::Color::Yellow
@ Yellow
carla::road::element::LaneMarking::Color::Other
@ Other
carla::road::element::LaneMarking::Color::Blue
@ Blue
carla::road::element::LaneMarking::Color::Green
@ Green
carla::road::element::LaneMarking::Color::Standard
@ Standard
carla::road::element::LaneMarking::Color::Red
@ Red
制作者
1.10.0