67 auto info = GetInfo<element::RoadInfoElevation>(s);
68 if (info ==
nullptr) {
71 return info->GetPolynomial();
76 auto *lane = section.GetLane(lane_id);
77 if (lane !=
nullptr) {
89 std::vector<Lane*> result;
91 for (
auto &lane_section : lane_sections) {
92 for (
auto & lane_pair : lane_section.GetLanes()) {
93 result.emplace_back(&lane_pair.second);
100 std::vector<const Lane*> result;
102 for (
const auto &lane_section : lane_sections) {
103 for (
const auto & lane_pair : lane_section.GetLanes()) {
104 result.emplace_back(&lane_pair.second);
125 Lane *ptr = upper->second.GetLane(lane_id);
126 if (ptr !=
nullptr) {
139 auto rlower = std::make_reverse_iterator(lower);
143 Lane *ptr = rlower->second.GetLane(lane_id);
144 if (ptr !=
nullptr) {
158 Lane *ptr = it->second.GetLane(
id);
159 if (ptr !=
nullptr) {
160 return &(it->second);
171 Lane *ptr = it->second.GetLane(
id);
172 if (ptr !=
nullptr) {
173 return &(it->second);
187 offset =
static_cast<float>(lane_offset->GetPolynomial().Evaluate(clamped_s));
196 p.
location.
z =
static_cast<float>(elevation_info.Evaluate(s));
197 p.
pitch = elevation_info.Tangent(s);
210 p.location.z =
static_cast<float>(elevation_info.Evaluate(s));
211 p.pitch = elevation_info.Tangent(s);
217 std::pair<double, double> last = { 0.0, std::numeric_limits<double>::max() };
220 decltype(geom_info_list)::iterator nearest_geom = geom_info_list.end();
222 for (
auto g = geom_info_list.begin(); g != geom_info_list.end(); ++g) {
224 auto dist = (*g)->GetGeometry().DistanceTo(loc);
225 if (dist.second < last.second) {
231 for (
auto g = geom_info_list.begin();
232 g != geom_info_list.end() && g != nearest_geom;
235 last.first += (*g)->GetGeometry().GetLength();
244 uint32_t lane_type)
const {
246 std::map<LaneId, const Lane *> lanes(
GetLanesAt(s));
249 std::make_reverse_iterator(lanes.lower_bound(0)), lanes.rend());
252 lanes.lower_bound(1), lanes.end());
255 std::pair<const Lane *, double> result =
256 std::make_pair(
nullptr, std::numeric_limits<double>::max());
259 for (
const auto &lane : right_lanes) {
261 const auto half_width =
static_cast<float>(lane_width_info->GetPolynomial().Evaluate(s)) * 0.5f;
267 if (current_dist <= result.second) {
270 if ((
static_cast<uint32_t
>(lane.second->GetType()) & lane_type) > 0) {
271 result.first = &(*lane.second);
272 result.second = current_dist;
281 current_dp = dp_lane_zero;
282 for (
const auto &lane : left_lanes) {
284 const auto half_width = -
static_cast<float>(lane_width_info->GetPolynomial().Evaluate(s)) * 0.5f;
290 if (current_dist <= result.second) {
293 if ((
static_cast<uint32_t
>(lane.second->GetType()) & lane_type) > 0) {
294 result.first = &(*lane.second);
295 result.second = current_dist;
308 std::map<LaneId, const Lane *> map;
310 for (
auto &&lane : lane_section.GetLanes()) {
311 map[lane.first] = &(lane.second);
#define DEBUG_ASSERT(predicate)
Describes a Cubic Polynomial so: f(x) = a + bx + cx^2 + dx^3
static T Clamp(T a, T min=T(0), T max=T(1))
static auto Distance(const Vector3D &a, const Vector3D &b)
std::map< LaneId, Lane > & GetLanes()
RoadId GetPredecessor() const
const std::pair< double, double > GetNearestPoint(const geom::Location &loc) const
Returns a pair containing:
std::vector< Road * > GetPrevs() const
Lane * GetPrevLane(const double s, const LaneId lane_id)
std::vector< Road * > _nexts
Lane & GetLaneById(SectionId section_id, LaneId lane_id)
LaneSectionMap _lane_sections
RoadId GetSuccessor() const
std::map< LaneId, const Lane * > GetLanesAt(const double s) const
Get all lanes at a given s
std::vector< Road * > GetNexts() const
LaneSection * GetStartSection(LaneId id)
Get the start section (from road coordinates s) given a lane id
Lane * GetNextLane(const double s, const LaneId lane_id)
const geom::CubicPolynomial & GetElevationOn(const double s) const
Lane & GetLaneByDistance(double s, LaneId lane_id)
std::vector< Road * > _prevs
auto GetLaneSectionsAt(const double s)
const std::pair< const Lane *, double > GetNearestLane(const double s, const geom::Location &loc, uint32_t type=static_cast< uint32_t >(Lane::LaneType::Any)) const
Returns a pointer to the nearest lane, given s relative to Road and a location
element::DirectedPoint GetDirectedPointIn(const double s) const
Returns a directed point on the center of the road (lane 0), with the corresponding laneOffset and el...
std::vector< Lane * > GetLanesByDistance(double s)
Get all lanes from all lane sections in a specific s
element::DirectedPoint GetDirectedPointInNoLaneOffset(const double s) const
Returns a directed point on the center of the road (lane 0), with the corresponding laneOffset and el...
JuncId GetJunctionId() const
LaneSection * GetEndSection(LaneId id)
Get the end section (from road coordinates s) given a lane id
std::string GetName() const
const MapData * GetMap() const
LaneSection & GetLaneSectionById(SectionId id)
The lane offset record defines a lateral shift of the lane reference line(which is usually identical ...
Lane Width RecordEach lane within a road’scross section can be provided with severalwidth entries.
This file contains definitions of common data structures used in traffic manager.
void throw_exception(const std::exception &e)
static auto MakeListView(Iterator begin, Iterator end)
void ApplyLateralOffset(float lateral_offset)