LaneletSequence.cpp
Go to the documentation of this file.
2 
3 namespace lanelet {
4 
6  : lanelets_{std::move(lanelets)},
7  leftBound_{utils::transform(lanelets_, [](const auto& l) { return l.leftBound(); })},
8  rightBound_{utils::transform(lanelets_, [](const auto& l) { return l.rightBound(); })} {}
9 
11  auto centerline = std::atomic_load_explicit(&centerline_, std::memory_order_acquire);
12  if (!centerline) {
13  centerline = std::make_shared<CompoundLineString3d>(
14  utils::transform(lanelets_, [](const auto& l) { return l.centerline(); }));
15  std::atomic_store_explicit(&centerline_, centerline, std::memory_order_release);
16  }
17  return *centerline;
18 }
19 
21  auto polygon = std::atomic_load_explicit(&polygon_, std::memory_order_acquire);
22  if (!polygon) {
23  polygon = std::make_shared<CompoundPolygon3d>(CompoundLineStrings3d{leftBound_, rightBound_.invert()});
24  std::atomic_store_explicit(&polygon_, polygon, std::memory_order_release);
25  }
26  return *polygon;
27 }
28 
30  return utils::concatenate(lanelets(), [](const auto& elem) { return elem.regulatoryElements(); });
31 }
32 
33 } // namespace lanelet
lanelet::CompoundPolygon3d
Combines multiple linestrings to one polygon in 3d.
Definition: CompoundPolygon.h:40
lanelet
Definition: Attribute.h:13
lanelet::utils::concatenate
auto concatenate(ContainerT &&c)
overload assuming that c is a container of containers. The return type will be the type of the inner ...
Definition: Utilities.h:260
lanelet::utils::transform
auto transform(Iterator begin, Iterator end, const Func f)
Definition: Utilities.h:176
lanelet::CompoundLineString3d
A Compound linestring in 3d (returns Point3d)
Definition: CompoundLineString.h:285
lanelet::CompoundLineStrings3d
std::vector< CompoundLineString3d > CompoundLineStrings3d
Definition: Forward.h:77
lanelet::LaneletSequence::lanelets
ConstLanelets lanelets() const
returns the lanelets that are part of this object
Definition: LaneletSequence.h:206
lanelet::LaneletSequenceData::centerline
CompoundLineString3d centerline() const
computes the centerline. Result is cached
Definition: LaneletSequence.cpp:10
lanelet::LaneletSequenceData::polygon
CompoundPolygon3d polygon() const
Get the bounding polygon around all lanelets. Result is cached.
Definition: LaneletSequence.cpp:20
lanelet::LaneletSequence::regulatoryElements
RegulatoryElementConstPtrs regulatoryElements() const
get a list of all regulatory elements that affect one of the lanelets
Definition: LaneletSequence.cpp:29
lanelet::LaneletSequenceData::LaneletSequenceData
LaneletSequenceData(ConstLanelets lanelets)
Constructs a new, valid LaneletData object.
Definition: LaneletSequence.cpp:5
LaneletSequence.h
lanelet::LaneletSequenceData::lanelets
const ConstLanelets & lanelets() const
Definition: LaneletSequence.h:39
lanelet::RegulatoryElementConstPtrs
std::vector< RegulatoryElementConstPtr > RegulatoryElementConstPtrs
Definition: Forward.h:195
lanelet::ConstLanelets
std::vector< ConstLanelet > ConstLanelets
Definition: Forward.h:114


lanelet2_core
Author(s): Fabian Poggenhans
autogenerated on Thu Mar 6 2025 03:25:52