CARLA
载入中...
搜索中...
未找到
Unreal
CarlaUE4
Plugins
Carla
Source
Carla
MapGen
RoadSegmentDescription.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
9
#include "
GraphTypes.h
"
10
#include "
Util/NonCopyable.h
"
11
12
#include <vector>
13
14
namespace
MapGen
{
15
16
class
RoadSegmentDescription
:
private
NonCopyable
17
{
18
public
:
19
20
void
Add
(
const
GraphHalfEdge
&Edge) {
21
if
(Angle ==
nullptr
) {
22
Angle = MakeUnique<float>(Edge.Angle);
23
}
else
if
(*Angle != Edge.Angle) {
/// @todo Use a scale.
24
Angle =
nullptr
;
25
}
26
_vect
.emplace_back(&Edge);
27
}
28
29
const
GraphHalfEdge
&
operator[]
(
size_t
i)
const
{
30
return
*
_vect
[i];
31
}
32
33
size_t
Size
()
const
{
34
return
_vect
.size();
35
}
36
37
bool
IsStraight
()
const
{
38
return
Angle.IsValid();
39
}
40
41
/// @return nullptr if the road segment is not straight.
42
const
float
*
GetAngle
()
const
{
43
return
Angle.Get();
44
}
45
46
private
:
47
48
TUniquePtr<float> Angle =
nullptr
;
49
50
std::vector<const GraphHalfEdge *>
_vect
;
51
};
52
53
}
// namespace MapGen
GraphTypes.h
NonCopyable.h
GraphHalfEdge
MapGen::RoadSegmentDescription
Definition
RoadSegmentDescription.h:17
MapGen::RoadSegmentDescription::_vect
std::vector< const GraphHalfEdge * > _vect
Definition
RoadSegmentDescription.h:50
MapGen::RoadSegmentDescription::Add
void Add(const GraphHalfEdge &Edge)
Definition
RoadSegmentDescription.h:20
MapGen::RoadSegmentDescription::operator[]
const GraphHalfEdge & operator[](size_t i) const
Definition
RoadSegmentDescription.h:29
MapGen::RoadSegmentDescription::Size
size_t Size() const
Definition
RoadSegmentDescription.h:33
MapGen::RoadSegmentDescription::IsStraight
bool IsStraight() const
Definition
RoadSegmentDescription.h:37
MapGen::RoadSegmentDescription::GetAngle
const float * GetAngle() const
Definition
RoadSegmentDescription.h:42
NonCopyable
Definition
Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Util/NonCopyable.h:3
MapGen
Definition
CityAreaDescription.h:13
制作者
1.10.0