75 template <
typename RegElemT>
79 template <
typename RegElemT>
197 template <
typename RegElemT>
199 return constData()->regulatoryElementsAs<RegElemT>();
216 using Primitive::innerBounds;
217 using Primitive::outerBound;
218 using Primitive::regulatoryElements;
219 using Primitive::regulatoryElementsAs;
231 void setInnerBounds(
const std::vector<LineStrings3d>& bounds) { data()->setInnerBounds(bounds); }
241 if (regElem ==
nullptr) {
244 data()->regulatoryElements().push_back(std::move(regElem));
249 auto& regElems = data()->regulatoryElements();
250 auto remove =
std::find(regElems.begin(), regElems.end(), regElem);
251 if (
remove != regElems.end()) {
252 regElems.erase(
remove);
259 template <
typename RegElemT>
261 return data()->regulatoryElementsAs<RegElemT>();
279 : areaData_(area.constData()) {}
288 bool expired() const noexcept {
return areaData_.expired(); }
309 Area lock()
const {
return Area(std::const_pointer_cast<AreaData>(areaData_.lock())); }
338 stream <<
" outer: [";
339 std::copy(obId.begin(), obId.end(), std::ostream_iterator<Id>(stream,
","));
344 stream <<
" inner: ";
345 for (
const auto& ib : ibs) {
347 auto ibId = ib.ids();
348 std::copy(ibId.begin(), ibId.end(), std::ostream_iterator<Id>(stream,
","));
357 template <
typename T>
359 return isCategory<T, traits::AreaTag>();
363 template <
typename T,
typename RetT>
364 using IfAr = std::enable_if_t<traits::isAreaT<T>(), RetT>;
ConstInnerBounds innerBounds() const
Id id() const noexcept
get the unique id of this primitive
ConstInnerBounds innerBounds() const
get the linestrings that form the inner bounds
RegulatoryElementConstPtrs regulatoryElements() const
const InnerBounds & innerBounds()
Get the linestrings that form the inner bound.
std::shared_ptr< RegulatoryElement > RegulatoryElementPtr
bool expired() const noexcept
tests whether the WeakArea is still valid
const InnerBounds & innerBounds()
std::vector< ConstLineString3d > ConstLineStrings3d
CompoundPolygons3d innerBoundPolygons_
represents the inner bounds of the area
AttributeMap attributes
attributes of this primitive
auto find(ContainerT &&c, const ValueT &val)
std::vector< RegulatoryElementPtr > RegulatoryElementPtrs
A (basic) 2d polygon with holes insideThis class is thought for geometry calculations, it has no properties of a normal lanelet primitive.
const LineStrings3d & outerBound()
ConstArea(Id id, const LineStrings3d &outerBound, const InnerBounds &innerBounds=InnerBounds(), const AttributeMap &attributes=AttributeMap(), const RegulatoryElementPtrs ®ulatoryElements=RegulatoryElementPtrs())
Constructs a new area.
auto transform(Iterator begin, Iterator end, const Func f)
std::ostream & operator<<(std::ostream &stream, const Attribute &obj)
std::vector< std::shared_ptr< const RegElemT > > regulatoryElementsAs() const
get the regulatoryElements that could be converted to a type
ConstWeakArea(ConstArea area)
HybridMap< Attribute, decltype(AttributeNamesString::Map)&, AttributeNamesString::Map > AttributeMap
void setInnerBounds(const std::vector< LineStrings3d > &bounds)
sets a new inner bound and resets the cache
bool operator==(const Attribute &lhs, const Attribute &rhs)
RegulatoryElementConstPtrs regulatoryElements() const
get a list of regulatory elements that affect this area
Identifies LaneletPrimitives.
bool removeRegulatoryElement(const RegulatoryElementPtr ®Elem)
removes a regulatory element, returns true on success
BasicPolygonWithHoles2d basicPolygonWithHoles2d() const
generates a basic polygon in 2d with holes for this area
RegulatoryElementPtrs & regulatoryElements()
RegulatoryElementPtrs regulatoryElements_
regulatory elements that apply
std::vector< LineStrings3d > InnerBounds
const CompoundPolygons3d & innerBoundPolygons() const
ConstLineStrings3d outerBound() const
Ids ids() const
returns the ids of all linestrings in order
ConstLineStrings3d outerBound() const
Get linestrings that form the outer bound.
A normal 3d linestring with immutable data.
BasicPolygonWithHoles3d basicPolygonWithHoles3d() const
generates a basic polygon in 2d with holes for this area
used internally by RegulatoryElements to avoid cyclic dependencies.
bool has(const ConstArea &ll, Id id)
returns true if element of a regulatory element has a matching Id
const LineStrings3d & outerBound()
Get linestrings that form the outer bound.
std::vector< LineStrings3d > innerBounds_
vector of ls for inner bounds
Area(const AreaDataPtr &data)
void setOuterBound(const LineStrings3d &bound)
sets a new outer bound.
std::vector< std::shared_ptr< RegElemT > > regulatoryElementsAs()
get the regulatoryElements that could be converted to RegElemT
void setInnerBounds(const std::vector< LineStrings3d > &bounds)
Combines multiple linestrings to one polygon in 3d.
BasicPolygon3d basicPolygon() const
std::shared_ptr< const AreaData > AreaDataConstPtr
const std::shared_ptr< const Data > & constData() const
get the internal data of this primitive
void setOuterBound(const LineStrings3d &bound)
Sets a new outer bound and resets the cache.
CompoundPolygon3d outerBoundPolygon_
represents the outer bounds of the area
bool operator!=(const Attribute &lhs, const Attribute &rhs)
CompoundPolygon3d outerBoundPolygon() const
get the outer bound as polygon
A (basic) 2d polygon with holes insideThis class is thought for geometry calculations, it has no properties of a normal lanelet primitive.
Area lock() const
Obtains the original ConstArea.
SharedPtrs in lanelet2 must never point to null. If this is violated, this exception is thrown (usual...
LineStrings3d outerBound_
linestrings that together form the outer bound
std::shared_ptr< const RegulatoryElement > RegulatoryElementConstPtr
Basic Primitive class for all primitives of lanelet2.
Base class for all mutable Primitives of lanelet2.
std::vector< std::shared_ptr< const RegElemT > > regulatoryElementsAs() const
AreaData(Id id, LineStrings3d outerBound, std::vector< LineStrings3d > innerBounds=std::vector< LineStrings3d >(), AttributeMap attributes=AttributeMap(), RegulatoryElementPtrs regulatoryElements=RegulatoryElementPtrs())
Constructs a new, AreaData object.
Common data class for all lanelet primitivesThis class provides the data that all lanelet primitives ...
CompoundPolygons3d innerBoundPolygons() const
get the inner bounds as polygon
const CompoundPolygon3d & outerBoundPolygon() const
Famous Area class that represents a basic area as element of the map.
std::weak_ptr< const AreaData > areaData_
std::vector< RegulatoryElementConstPtr > RegulatoryElementConstPtrs
Common data management class for all Area-Typed objects.
ConstArea lock() const
Obtains the original ConstArea.
std::shared_ptr< AreaData > AreaDataPtr
std::vector< std::shared_ptr< RegElemT > > regulatoryElementsAs()
const RegulatoryElementPtrs & regulatoryElements()
return regulatoryElements that affect this area.
Id id
Id of this primitive (unique across one map)
A const (i.e. immutable) Area.
BoundingBox2d to2D(const BoundingBox3d &primitive)
std::vector< ConstLineStrings3d > ConstInnerBounds
std::enable_if_t< traits::isAreaT< T >(), RetT > IfAr
std::vector< CompoundPolygon3d > CompoundPolygons3d
ConstArea(const std::shared_ptr< const AreaData > &data)
Constructor to construct from the data of a different Area.
ConstArea(Id id=InvalId)
Constructs an empty or invalid area.
void addRegulatoryElement(RegulatoryElementPtr regElem)
adds a new regulatory element
std::vector< LineString3d > LineStrings3d
constexpr Id InvalId
indicates a primitive that is not part of a map
used internally by RegulatoryElements to avoid cyclic dependencies.