69 mutable std::shared_ptr<CompoundPolygon3d>
polygon_;
101 : data_{std::make_shared<LaneletSequenceData>(std::move(ls))} {}
123 bool empty() const noexcept {
return data_->lanelets().empty(); }
126 size_t size() const noexcept {
return data_->lanelets().size(); }
141 return inverted() ? constData()->rightBound().
invert() : constData()->leftBound();
150 return inverted() ? constData()->leftBound().
invert() : constData()->rightBound();
160 template <
typename RegElemT>
163 [](
const auto& elem) {
return elem.template regulatoryElementsAs<RegElemT>(); });
182 return inverted() ? constData()->centerline().
invert() : constData()->centerline();
216 assert(idx < data_->
lanelets().size());
217 return *std::next(
begin(), idx);
238 void resetCache() { data_ = std::make_shared<LaneletSequenceData>(data_->lanelets()); }
241 std::shared_ptr<const LaneletSequenceData>
data_;
242 bool inverted_{
false};
265 auto ids = obj.
ids();
269 std::copy(ids.begin(), ids.end(), std::ostream_iterator<Id>(stream,
" "));
272 stream <<
", inverted";
274 return stream <<
"]";
iterator begin() const noexcept
Returns iterator to the first lanelet (or to the last, if inverted)
CompoundPolygon3d polygon() const
Get the bounding polygon around all lanelets. Result is cached.
const CompoundLineString3d & leftBound() const
LaneletSequenceData(ConstLanelets lanelets)
Constructs a new, valid LaneletData object.
CompoundLineString3d centerline3d() const
std::shared_ptr< const LaneletSequenceData > LaneletSequenceDataConstPtr
void resetCache()
call this function if one of the contained Lanelets was modified to give this object the opportunity ...
Ids ids() const
returns the ids of all lanelets in order
A Compound linestring in 3d (returns Point3d)
CompoundLineString2d rightBound2d() const
get the right bound in 2d. To be used over rightBound where geometric calculations are required...
bool empty() const noexcept
Returns wether this holds any lanelets.
auto transform(Iterator begin, Iterator end, const Func f)
std::ostream & operator<<(std::ostream &stream, const Attribute &obj)
iterator end(bool inverted) const noexcept
VectorT concatenate(ContainerT &&c)
const ConstLanelet & operator[](size_t idx) const
Access an individual lanelet.
bool operator==(const Attribute &lhs, const Attribute &rhs)
LaneletSequence(const LaneletSequences &ls)
Create a compound lanelet from other compound lanelets.
iterator end() const noexcept
Returns iterator to the last lanelet (or to the first, if inverted)
std::shared_ptr< const LaneletSequenceData > data_
internal data
LaneletSequence(LaneletSequenceDataConstPtr data, bool inverted)
CompoundLineString3d rightBound3d() const
get the combined right bounds of all lanelets
std::shared_ptr< CompoundLineString3d > centerline_
combined centerline
const ConstLanelets & lanelets() const
CompoundLineString3d centerline() const
computes the centerline. Result is cached
CompoundLineString3d leftBound3d() const
const CompoundLineString3d & rightBound() const
CompoundLineString3d invert() const noexcept
create a new, inverted linestring from this one
bool inverted() const
returns out if this is an inverted lanelets.
size_t size() const noexcept
Returns number of lanelets.
const CompoundLineString3d & leftBound3d() const
bool has(const LaneletSequence &ll, Id id)
returns true if element of a primitive has a matching Id
Combines multiple linestrings to one polygon in 3d.
ConstLanelets lanelets() const
returns the lanelets that are part of this object
bool operator!=(const Attribute &lhs, const Attribute &rhs)
CompoundLineString2d rightBound2d() const
CompoundPolygon3d polygon3d() const
returns the surface covered by the lanelets as 3-dimensional polygon. The result of the computation i...
CompoundPolygon2d polygon2d() const
returns the surface covered by the lanelets as 2-dimensional polygon.
CompoundLineString3d leftBound() const
get the combined left bounds of all lanelets
A Compound linestring in 2d (returns Point2d)
const CompoundLineString3d & rightBound3d() const
A collection of Lanelets.
const CompoundLineString3d leftBound_
< Cached data
CompoundLineString2d leftBound2d() const
get the left bound in 2d. To be used over leftBound where geometric calculations are required...
CompoundLineString3d rightBound() const
get the combined right bounds of all lanelets
CompoundLineString2d leftBound2d() const
iterator begin(bool inverted) const noexcept
auto concatenate(ContainerT &&c)
overload assuming that c is a container of containers. The return type will be the type of the inner ...
Common data management class for LaneletSequences.
LaneletSequenceDataConstPtr constData() const
returns the internal data on the linestrings managed by this object
std::vector< RegulatoryElementConstPtr > RegulatoryElementConstPtrs
std::vector< LaneletSequence > LaneletSequences
const ConstLanelets lanelets_
CompoundLineString3d centerline() const
get the centerline of this lanelet
LaneletSequence invert() const
returns the respective inverted LaneletSequence
BoundingBox2d to2D(const BoundingBox3d &primitive)
std::shared_ptr< CompoundPolygon3d > polygon_
combined polygon
LaneletSequence(ConstLanelets ls=ConstLanelets())
Construct from a vector of ConstLineString3d.
Combines multiple linestrings to one polygon in 2d.
Container invert(const Container &cont)
internal::ReverseAndForwardIterator< ConstLanelets::const_iterator > iterator
std::vector< std::shared_ptr< const RegElemT > > regulatoryElementsAs() const
get all regulatory elements of type RegElemT
CompoundLineString2d centerline2d() const
const CompoundLineString3d rightBound_
std::vector< ConstLanelet > ConstLanelets