forked from pageldev/libOpenDRIVE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoad.h
More file actions
109 lines (87 loc) · 2.47 KB
/
Road.h
File metadata and controls
109 lines (87 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#pragma once
#include "Geometries/CubicSpline.h"
#include "LaneSection.h"
#include "Lanes.h"
#include "Math.hpp"
#include "RoadObject.h"
#include "Utils.hpp"
#include "XmlNode.h"
#include <map>
#include <memory>
#include <set>
#include <vector>
namespace odr
{
struct RefLine;
struct Crossfall : public CubicSpline
{
enum Side
{
Both,
Left,
Right
};
Crossfall() = default;
double get_crossfall(double s, bool on_left_side) const;
std::map<double, Side> sides;
};
struct RoadLink : public XmlNode
{
enum class ContactPoint
{
None,
Start,
End
};
enum class Type
{
None,
Road,
Junction
};
std::string id = "";
Type type = Type::None;
ContactPoint contact_point = ContactPoint::None;
};
struct RoadNeighbor : public XmlNode
{
std::string id = "";
std::string side = "";
std::string direction = "";
};
struct SpeedRecord : public XmlNode
{
std::string max = "";
std::string unit = "";
};
class Road : public XmlNode, public std::enable_shared_from_this<Road>
{
public:
Road() = default;
virtual ~Road() = default;
ConstLaneSectionSet get_lanesections() const;
LaneSectionSet get_lanesections();
ConstRoadObjectSet get_road_objects() const;
RoadObjectSet get_road_objects();
std::shared_ptr<const LaneSection> get_lanesection(double s) const;
std::shared_ptr<LaneSection> get_lanesection(double s);
Vec3D get_xyz(double s, double t, double h, Vec3D* e_s = nullptr, Vec3D* e_t = nullptr, Vec3D* e_h = nullptr) const;
double length = 0;
std::string id;
std::string junction;
std::string name;
RoadLink predecessor;
RoadLink successor;
std::vector<RoadNeighbor> neighbors;
CubicSpline lane_offset;
CubicSpline superelevation;
Crossfall crossfall;
std::shared_ptr<RefLine> ref_line;
std::map<double, std::shared_ptr<LaneSection>> s_to_lanesection;
std::map<double, std::string> s_to_type;
std::map<double, SpeedRecord> s_to_speed;
std::map<std::string, std::shared_ptr<RoadObject>> id_to_object;
};
using ConstRoadSet = std::set<std::shared_ptr<const Road>, SharedPtrCmp<const Road, std::string, &Road::id>>;
using RoadSet = std::set<std::shared_ptr<Road>, SharedPtrCmp<Road, std::string, &Road::id>>;
} // namespace odr