3 #include <unordered_map> 43 using Map = std::unordered_map<Id, T>;
65 bool exists(
Id id)
const;
73 ConstPrimitiveT
get(
Id id)
const;
147 bool empty()
const {
return elements_.empty(); }
153 size_t size()
const {
return elements_.size(); }
155 using ConstSearchFunction = std::function<bool(const internal::SearchBoxT<T>& box,
const ConstPrimitiveT& prim)>;
220 return nearestUntil(point.basicPoint2d(), func);
223 return nearestUntil(point.basicPoint2d(), func);
246 void remove(
Id element);
252 std::unique_ptr<Tree> tree_;
256 #ifndef LANELET_LAYER_DEFINITION 343 return laneletLayer.
empty() && areaLayer.empty() && regulatoryElementLayer.empty() && polygonLayer.empty() &&
344 lineStringLayer.empty() && pointLayer.empty();
349 return laneletLayer.
size() + areaLayer.size() + regulatoryElementLayer.size() + polygonLayer.size() +
350 lineStringLayer.size() + pointLayer.size();
503 template <
typename PrimitiveT>
541 template <
typename PrimitiveT>
550 template <
typename T>
552 using Type =
typename T::PrimitiveT;
554 template <
typename T>
556 using Type =
typename T::ConstPrimitiveT;
559 template <
typename T>
578 template <
typename PrimT>
580 template <
typename PrimT>
584 #ifndef LANELET_LAYER_DEFINITION 587 #define EXTERN_FIND_NEAREST(PRIM) extern template std::vector<std::pair<double, PRIM>> findNearest(PrimitiveLayer<PRIM>&, const BasicPoint2d&, unsigned) 589 #define EXTERN_CONST_FIND_NEAREST(PRIM) extern template std::vector<std::pair<double, traits::ConstPrimitiveType<PRIM>>> findNearest(const PrimitiveLayer<PRIM>&, const BasicPoint2d&, unsigned) 603 #undef EXTERN_FIND_NEAREST 604 #undef EXTERN_CONST_FIND_NEAREST LaneletSubmap & operator=(LaneletMap &&rhs)
OptConstPrimitiveT nearestUntil(const ConstPoint2d &point, const ConstSearchFunction &func) const
Each primitive in lanelet2 has its own layer in the map.
typename Owned< PrimitiveT >::Type OwnedT
std::vector< ConstLayerPrimitive< PrimitiveT > > findUsages(const PrimitiveLayer< PrimitiveT > &layer, Id id)
Id getId()
returns a unique id by incrementing a counter each time this is called.
traits::ConstPrimitiveType< RegulatoryElementPtr > ConstPrimitiveT
std::shared_ptr< RegulatoryElement > RegulatoryElementPtr
PrimitiveVec nearest(const Point2d &point, unsigned n)
auto basicPoint() noexcept
get a mutable reference to the 2d point data
auto find(ContainerT &&c, const ValueT &val)
friend class LaneletSubmap
typename PrimitiveLayer< PrimitiveT >::ConstPrimitiveT ConstLayerPrimitive
std::unordered_map< Id, RegulatoryElementPtr > Map
Optional< ConstPrimitiveT > OptConstPrimitiveT
LaneletSubmapUPtr createSubmap(const Lanelets &fromLanelets, const Areas &fromAreas)
Specialized map layer for Area.
PointLayer pointLayer
access to the points
AreaLayer areaLayer
access to areas
std::vector< ConstPrimitiveT > findUsages(const traits::ConstPrimitiveType< traits::OwnedT< PrimitiveT >> &primitive) const
finds usages of an owned type within this layer
The famous (mutable) lanelet class.
std::vector< Lanelet > Lanelets
std::shared_ptr< const LaneletMap > LaneletMapConstPtr
LaneletSubmapConstUPtr createConstSubmap(const ConstLanelets &fromLanelets, const ConstAreas &fromAreas)
std::function< bool(const internal::SearchBoxT< RegulatoryElementPtr > &box, const ConstPrimitiveT &prim)> ConstSearchFunction
LaneletMapLayers()=default
Container for all layers of a lanelet map. Used by both LaneletMap and LaneletSubmap.
std::vector< Point3d > Points3d
std::vector< Polygon3d > Polygons3d
std::unique_ptr< LaneletMap > LaneletMapUPtr
std::unique_ptr< const LaneletSubmap > LaneletSubmapConstUPtr
A normal 3d linestring with mutable data.
LaneletLayer laneletLayer
access to the lanelets within this map
boost::optional< T > Optional
friend class LaneletSubmap
std::vector< ConstPrimitiveT > ConstPrimitiveVec
ConstPrimitiveVec nearest(const Point2d &point, unsigned n) const
bool empty() const
returns whether this layer contains something
ConstLanelets findUsagesInLanelets(const LaneletMapLayers &map, const ConstPoint3d &p)
RegulatoryElementLayer regulatoryElementLayer
access to regElems
size_t size() const noexcept
Returns the total number of elements in all layers.
ConstAreas findUsagesInAreas(const LaneletMapLayers &map, const ConstPoint3d &p)
typename SearchBox< T >::Type SearchBoxT
Optional< PrimitiveT > OptPrimitiveT
A LaneletSubmap only contains the elemets that have be expleicitly added to it.
typename PrimitiveTraits< PrimitiveT >::ConstType ConstPrimitiveType
Utility for determinig the matching const type for a primitive.
std::shared_ptr< const RegulatoryElement > RegulatoryElementConstPtr
friend class LaneletMapLayers
Specialized map layer for Lanelet.
typename T::PrimitiveT Type
#define EXTERN_FIND_NEAREST(PRIM)
std::function< bool(const internal::SearchBoxT< RegulatoryElementPtr > &box, const PrimitiveT &prim)> SearchFunction
LaneletSubmap(LaneletMap &&rhs) noexcept
Constructs a submap from a moved-from LaneletMap.
Axis-Aligned bounding box in 2d.
size_t size() const
returns number of elements in this layer
A mutable clockwise oriented, open (ie start point != end point) polygon in 3d.
typename LayerPrimitive< T >::Type LayerPrimitiveType
LaneletMapUPtr createMap(const Lanelets &fromLanelets, const Areas &fromAreas)
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > BasicPoint2d
a simple 2d-point
Famous Area class that represents a basic area as element of the map.
RegulatoryElementPtr PrimitiveT
std::vector< std::pair< double, traits::ConstPrimitiveType< PrimT > > > findNearest(const PrimitiveLayer< PrimT > &map, const BasicPoint2d &pt, unsigned count)
std::vector< Area > Areas
A general rule or limitation for a lanelet (abstract base class)
typename T::ConstPrimitiveT Type
std::unique_ptr< const LaneletMap > LaneletMapConstUPtr
PolygonLayer polygonLayer
access to the polygons
friend class LaneletMapLayers
std::vector< PrimitiveT > PrimitiveVec
Basic element for accessing and managing the elements of a map.
LineStringLayer lineStringLayer
access to the lineStrings
std::unique_ptr< LaneletSubmap > LaneletSubmapUPtr
std::vector< LineString3d > LineStrings3d
LaneletMapConstUPtr createConstMap(const ConstLanelets &fromLanelets, const ConstAreas &fromAreas)
bool empty() const noexcept
Returns whether all layers of this object are empty.
std::vector< ConstArea > ConstAreas
#define EXTERN_CONST_FIND_NEAREST(PRIM)
OptPrimitiveT nearestUntil(const Point2d &point, const SearchFunction &func)
std::vector< ConstLanelet > ConstLanelets
std::vector< boost::variant< ConstLanelet, ConstArea > > regelemObjects_
In order to not let lanelets/areas referenced by regelems get out of scope, we keep a reference to th...