primitives/RegulatoryElement.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/variant.hpp>
4 #include <utility>
5 
14 
15 namespace lanelet {
53 
55 enum class RoleName {
56  Refers,
57  RefLine,
58  RightOfWay,
59  Yield,
60  Cancels,
61  CancelLine,
62 };
63 
66  static constexpr const char Refers[] = "refers";
67  static constexpr const char RefLine[] = "ref_line";
68  static constexpr const char Yield[] = "yield";
69  static constexpr const char RightOfWay[] = "right_of_way";
70  static constexpr const char Cancels[] = "cancels";
71  static constexpr const char CancelLine[] = "cancel_line";
72 
73  // roles not included in fast lookup
74  static constexpr const char Left[] = "left";
75  static constexpr const char Right[] = "right";
76  static constexpr const char Centerline[] = "centerline";
77  static constexpr const char Inner[] = "inner";
78  static constexpr const char Outer[] = "outer";
79  static constexpr const char Lanelet[] = "lanelet";
80  static constexpr const char RegulatoryElement[] = "regulatory_element";
81 
82  using RoleNamesItem = std::pair<const char*, const RoleName>;
86 };
87 
90 using RuleParameter = boost::variant<Point3d, LineString3d, Polygon3d, WeakLanelet, WeakArea>;
91 
93 using ConstRuleParameter =
94  boost::variant<ConstPoint3d, ConstLineString3d, ConstPolygon3d, ConstWeakLanelet, ConstWeakArea>;
95 
96 namespace traits {
97 template <>
99  using DataType = void;
102  using TwoDType = void;
103  using ThreeDType = void;
104  using Category = void;
105 };
106 template <>
108  using DataType = void;
111  using TwoDType = void;
112  using ThreeDType = void;
113  using Category = void;
114 };
115 
116 template <>
118 } // namespace traits
119 
121 using RuleParameters = std::vector<RuleParameter>;
122 
124 using ConstRuleParameters = std::vector<ConstRuleParameter>;
125 
128 
131 
135  public:
138  : PrimitiveData(id, attributes), parameters{std::move(parameters)} {}
140 };
141 
147 class RuleParameterVisitor : public boost::static_visitor<void> { // NOLINT
148  public:
149  virtual void operator()(const ConstPoint3d& /*unused*/) {}
150  virtual void operator()(const ConstLineString3d& /*unused*/) {}
151  virtual void operator()(const ConstPolygon3d& /*unused*/) {}
152  virtual void operator()(const ConstWeakLanelet& /*unused*/) {}
153  virtual void operator()(const ConstWeakArea& /*unused*/) {}
154  virtual ~RuleParameterVisitor() = default;
155  std::string role;
156 };
157 
158 namespace internal {
159 class MutableParameterVisitor : public boost::static_visitor<void> { // NOLINT
160  public:
161  virtual void operator()(const Point3d /*unused*/&) = 0;
162  virtual void operator()(const LineString3d& /*unused*/) = 0;
163  virtual void operator()(const Polygon3d& /*unused*/) = 0;
164  virtual void operator()(const WeakLanelet& /*unused*/) = 0;
165  virtual void operator()(const WeakArea& /*unused*/) = 0;
166  virtual ~MutableParameterVisitor() = default;
167  std::string role;
168 };
169 } // namespace internal
170 
174 class RegulatoryElement // NOLINT
175  : public ConstPrimitive<RegulatoryElementData>,
176  private boost::noncopyable {
177  public:
185  static constexpr char RuleName[] = "basic_regulatory_element";
186 
187  virtual ~RegulatoryElement();
188 
189  /*
190  * @brief set a new id for this primitive
191  *
192  * This is the best way to corrupt a map, because all primitives are
193  * identified by their id. Make sure you know what you are doing!
194  */
195  void setId(Id id) noexcept { data()->id = id; }
196 
199 
201  template <typename T>
202  std::vector<T> getParameters(const std::string& role) const {
203  static_assert(traits::isConst<T>(), "You must pass a const primitive type");
204  auto it = constData()->parameters.find(role);
205  if (it == constData()->parameters.end()) {
206  return {};
207  }
208  return utils::getVariant<T>(it->second);
209  }
210 
213  template <typename T>
214  std::vector<T> getParameters(RoleName role) const {
215  static_assert(traits::isConst<T>(), "You must pass a const primitive type");
216  auto it = constData()->parameters.find(role);
217  if (it == constData()->parameters.end()) {
218  return {};
219  }
220  return utils::getVariant<T>(it->second);
221  }
222 
224  std::vector<std::string> roles() const {
225  return utils::transform(parameters(), [](const auto& elem) { return elem.first; });
226  }
227 
229  template <typename T>
230  Optional<T> find(Id id) const;
231 
233  bool empty() const { return constData()->parameters.empty(); }
234 
236  size_t size() const { return constData()->parameters.size(); }
237 
239  void applyVisitor(RuleParameterVisitor& visitor) const;
240 
241  protected:
242  const_iterator begin() const { return constData()->parameters.begin(); }
243  const_iterator end() const { return constData()->parameters.end(); }
244  void applyVisitor(internal::MutableParameterVisitor& visitor) const;
245  const RuleParameterMap& parameters() const { return constData()->parameters; }
246  RuleParameterMap& parameters() { return std::const_pointer_cast<RegulatoryElementData>(constData())->parameters; }
247  RegulatoryElementDataPtr data() { return std::const_pointer_cast<RegulatoryElementData>(constData()); }
248  template <typename T>
249  std::vector<T> getParameters(RoleName role) {
250  auto it = data()->parameters.find(role);
251  if (it == data()->parameters.end()) {
252  return {};
253  }
254  return utils::getVariant<T>(it->second);
255  }
256 
258  friend class LaneletMap; // Needs access to add all parameters of a regElem
259  explicit RegulatoryElement(Id id = InvalId, const RuleParameterMap& members = RuleParameterMap(),
261  : ConstPrimitive(std::make_shared<RegulatoryElementData>(id, members, attributes)) {}
263 };
264 
270 class GenericRegulatoryElement final : public Primitive<RegulatoryElement> {
271  public:
272  static constexpr char RuleName[] = "regulatory_element";
275 
280 
282  template <typename PrimitiveT>
283  void addParameter(const std::string& role, const PrimitiveT& primitive);
284 
286  template <typename PrimitiveT>
287  void addParameter(RoleName role, const PrimitiveT& primitive);
288 
290 
292  RuleParameterMap& parameters() noexcept { return data()->parameters; }
293 };
294 
295 namespace traits {
296 template <>
298  return prim->id();
299 }
300 
301 template <>
303  return prim->id();
304 }
305 
307 template <>
309 
310 template <>
312 } // namespace traits
313 
314 namespace utils {
325 bool has(const RegulatoryElement& regElem, Id id);
326 inline bool has(const RegulatoryElementConstPtr& ls, Id id) { return has(*ls, id); }
327 } // namespace utils
328 
333  public:
335  void registerStrategy(const std::string& strategy, const FactoryFcn& factoryFunction) {
336  registry_[strategy] = factoryFunction;
337  }
338 
351  static RegulatoryElementPtr create(std::string ruleName, const RegulatoryElementDataPtr& data);
352 
353  static RegulatoryElementPtr create(const std::string& ruleName, Id id, const RuleParameterMap& map,
354  const AttributeMap& attributes = AttributeMap()) {
355  return create(ruleName, std::make_shared<RegulatoryElementData>(id, map, attributes));
356  }
357 
359  static std::vector<std::string> availableRules();
360 
362 
363  private:
364  RegulatoryElementFactory() = default;
365  std::map<std::string, FactoryFcn> registry_;
366 };
367 
383 template <class T>
385  public:
387  static_assert(!utils::strequal(T::RuleName, "basic_regulatory_element"),
388  "You did not provide a RuleName for your regulatoryElement!");
390  T::RuleName, [](const RegulatoryElementDataPtr& data) -> RegulatoryElementPtr {
391  return std::shared_ptr<T>(new T(data)); // have to use new because of friendship
392  });
393  }
394 };
395 
396 template <typename PrimitiveT>
397 void GenericRegulatoryElement::addParameter(const std::string& role, const PrimitiveT& primitive) {
398  parameters()[role].push_back(primitive);
399 }
400 
401 template <typename PrimitiveT>
402 void GenericRegulatoryElement::addParameter(RoleName role, const PrimitiveT& primitive) {
403  parameters()[role].push_back(primitive);
404 }
405 
406 template <typename T>
408  static_assert(traits::isConst<T>(), "You must pass a const primitive type!");
409  using MutableT = traits::MutablePrimitiveType<T>;
410  for (const auto& params : parameters()) {
411  for (const auto& elem : params.second) {
412  auto telem = boost::get<MutableT>(&elem);
413  if (telem && telem->id() == id) {
414  return *telem;
415  }
416  }
417  }
418  return {};
419 }
420 
421 template <>
423  for (const auto& params : parameters()) {
424  for (const auto& elem : params.second) {
425  if (utils::getId(elem) == id) {
426  return traits::toConst(elem);
427  }
428  }
429  }
430  return {};
431 }
432 
433 template <>
434 inline boost::optional<ConstLanelet> RegulatoryElement::find<ConstLanelet>(Id id) const {
435  for (const auto& params : parameters()) {
436  for (const auto& elem : params.second) {
437  const auto* telem = boost::get<WeakLanelet>(&elem);
438  if (telem != nullptr && !telem->expired() && telem->lock().id() == id) {
439  return telem->lock();
440  }
441  }
442  }
443  return {};
444 }
445 
446 template <>
447 inline boost::optional<ConstArea> RegulatoryElement::find<ConstArea>(Id id) const {
448  for (const auto& params : parameters()) {
449  for (const auto& elem : params.second) {
450  const auto* telem = boost::get<WeakArea>(&elem);
451  if (telem != nullptr && !telem->expired() && telem->lock().id() == id) {
452  return telem->lock();
453  }
454  }
455  }
456  return {};
457 }
458 
459 std::ostream& operator<<(std::ostream& stream, const RegulatoryElement& obj);
460 
461 template <>
462 inline std::vector<ConstLanelet> RegulatoryElement::getParameters(const std::string& role) const {
463  auto it = parameters().find(role);
464  if (it == parameters().end()) {
465  return {};
466  }
467  return utils::strong(utils::getVariant<ConstWeakLanelet>(it->second));
468 }
469 template <>
470 inline std::vector<ConstLanelet> RegulatoryElement::getParameters(RoleName role) const {
471  auto it = parameters().find(role);
472  if (it == parameters().end()) {
473  return {};
474  }
475  return utils::strong(utils::getVariant<ConstWeakLanelet>(it->second));
476 }
477 
478 template <>
479 inline std::vector<ConstArea> RegulatoryElement::getParameters(const std::string& role) const {
480  auto it = parameters().find(role);
481  if (it == parameters().end()) {
482  return {};
483  }
484  return utils::strong(utils::getVariant<ConstWeakArea>(it->second));
485 }
486 template <>
487 inline std::vector<ConstArea> RegulatoryElement::getParameters(RoleName role) const {
488  auto it = parameters().find(role);
489  if (it == parameters().end()) {
490  return {};
491  }
492  return utils::strong(utils::getVariant<ConstWeakArea>(it->second));
493 }
494 
495 namespace traits {
496 template <typename T>
497 constexpr bool isRegulatoryElementT() {
498  using DataT = typename PrimitiveTraits<T>::DataType;
499  return std::is_same<DataT, RegulatoryElementData>::value;
500 }
501 template <>
504 };
505 } // namespace traits
506 
507 template <typename T, typename RetT>
508 using IfRE = std::enable_if_t<traits::isRegulatoryElementT<T>(), RetT>;
509 
510 } // namespace lanelet
511 
512 // Hash function for usage in containers
513 namespace std {
514 template <>
515 struct hash<lanelet::RegulatoryElement> : public lanelet::HashBase<lanelet::RegulatoryElement> {};
516 } // namespace std
lanelet::InvalId
constexpr Id InvalId
indicates a primitive that is not part of a map
Definition: Forward.h:199
lanelet::HashBase
Definition: Primitive.h:328
lanelet::RegulatoryElementFactory::registry_
std::map< std::string, FactoryFcn > registry_
Definition: primitives/RegulatoryElement.h:365
lanelet::Primitive
Base class for all mutable Primitives of lanelet2.
Definition: Primitive.h:243
lanelet::HybridMap::end
iterator end()
Definition: HybridMap.h:126
lanelet::RoleName::Cancels
@ Cancels
primitive(s) that invalidate a rule (eg end of speed zone)
lanelet::traits::PrimitiveTraits< RuleParameter >::TwoDType
void TwoDType
Definition: primitives/RegulatoryElement.h:102
lanelet::RoleName::RefLine
@ RefLine
The referring line where the rule becomes active.
lanelet::RegulatoryElement::getParameters
std::vector< T > getParameters(RoleName role)
Definition: primitives/RegulatoryElement.h:249
lanelet::RuleParameterVisitor::~RuleParameterVisitor
virtual ~RuleParameterVisitor()=default
lanelet::RegulatoryElement::roles
std::vector< std::string > roles() const
returns all the roles this regulatory element has
Definition: primitives/RegulatoryElement.h:224
lanelet::GenericRegulatoryElement
A GenericRegulatoryElement can hold any parameters.
Definition: primitives/RegulatoryElement.h:270
lanelet::RegulatoryElement::setId
void setId(Id id) noexcept
Definition: primitives/RegulatoryElement.h:195
lanelet::PrimitiveData
Common data class for all lanelet primitives.
Definition: Primitive.h:31
lanelet::RegulatoryElementData
Data container for all RegulatoryElement types.
Definition: primitives/RegulatoryElement.h:134
lanelet::RuleParameterVisitor::operator()
virtual void operator()(const ConstLineString3d &)
Definition: primitives/RegulatoryElement.h:150
lanelet
Definition: Attribute.h:13
Point.h
lanelet::traits::PrimitiveTraits< ConstRuleParameter >::Category
void Category
Definition: primitives/RegulatoryElement.h:113
lanelet::RegulatoryElement::empty
bool empty() const
returns true if this object contains no parameters
Definition: primitives/RegulatoryElement.h:233
lanelet::RegulatoryElementPtr
std::shared_ptr< RegulatoryElement > RegulatoryElementPtr
Definition: Forward.h:192
lanelet::traits::Owned< RegulatoryElementPtr >::Type
RuleParameter Type
Definition: primitives/RegulatoryElement.h:503
lanelet::RoleNameString::RoleNamesItem
std::pair< const char *, const RoleName > RoleNamesItem
Definition: primitives/RegulatoryElement.h:82
lanelet::RegulatoryElement::parameters
RuleParameterMap & parameters()
Definition: primitives/RegulatoryElement.h:246
lanelet::ConstPrimitive< RegulatoryElementData >::attributes
const AttributeMap & attributes() const
get the attributes of this primitive
Definition: Primitive.h:89
lanelet::traits::PrimitiveTraits< RuleParameter >::ConstType
ConstRuleParameter ConstType
Definition: primitives/RegulatoryElement.h:100
lanelet::RoleNameString::Inner
static constexpr const char Inner[]
Definition: primitives/RegulatoryElement.h:77
lanelet::RoleName::Yield
@ Yield
A lanelet that has to yield.
lanelet::AttributeMap
HybridMap< Attribute, decltype(AttributeNamesString::Map)&, AttributeNamesString::Map > AttributeMap
Definition: Attribute.h:371
lanelet::traits::PrimitiveTraits< RuleParameter >::Category
void Category
Definition: primitives/RegulatoryElement.h:104
lanelet::RoleName
RoleName
Typical role names within lanelet (for faster lookup)
Definition: primitives/RegulatoryElement.h:55
lanelet::utils::getId
Id getId()
returns a unique id by incrementing a counter each time this is called.
Definition: LaneletMap.cpp:883
lanelet::RoleNameString
Lists which role strings are mapped to which enum value.
Definition: primitives/RegulatoryElement.h:65
lanelet::RegulatoryElement::find
Optional< T > find(Id id) const
Finds a parameter by its id, independent of the role.
Definition: primitives/RegulatoryElement.h:407
lanelet::RegulatoryElementDataPtr
std::shared_ptr< RegulatoryElementData > RegulatoryElementDataPtr
Definition: Forward.h:184
Area.h
lanelet::Id
int64_t Id
Definition: Forward.h:198
lanelet::operator<<
std::ostream & operator<<(std::ostream &stream, const Attribute &obj)
Definition: Attribute.h:369
lanelet::ConstPolygon3d
An immutable clockwise oriented, open (ie start point != end point) polygon in 3d.
Definition: primitives/Polygon.h:122
lanelet::utils::transform
auto transform(Iterator begin, Iterator end, const Func f)
Definition: Utilities.h:176
lanelet::traits::getId< RegulatoryElementConstPtr >
Id getId< RegulatoryElementConstPtr >(const RegulatoryElementConstPtr &prim)
Definition: primitives/RegulatoryElement.h:302
lanelet::internal::MutableParameterVisitor::~MutableParameterVisitor
virtual ~MutableParameterVisitor()=default
lanelet::RegulatoryElement::size
size_t size() const
get the number of roles in this regulatoryElement
Definition: primitives/RegulatoryElement.h:236
lanelet::RegulatoryElement::applyVisitor
void applyVisitor(RuleParameterVisitor &visitor) const
applies a visitor to every parameter in the regulatory element
Definition: RegulatoryElement.cpp:146
lanelet::RegulatoryElement
A general rule or limitation for a lanelet (abstract base class)
Definition: primitives/RegulatoryElement.h:174
lanelet::Primitive< RegulatoryElement >::attributes
AttributeMap & attributes() noexcept
get the attributes in a mutable way
Definition: Primitive.h:284
lanelet::RegulatoryElement::getParameters
std::vector< T > getParameters(const std::string &role) const
Returns a vector of all RuleParameters that could be converted to T.
Definition: primitives/RegulatoryElement.h:202
lanelet::RegulatoryElementFactory
Creates regulatory elements based on their type.
Definition: primitives/RegulatoryElement.h:332
lanelet::RuleParameterVisitor::role
std::string role
applyVisitor will set the current role here
Definition: primitives/RegulatoryElement.h:155
lanelet::RuleParameters
std::vector< RuleParameter > RuleParameters
Multiple parameters can have the same role in a rule (eg traffic_lights)
Definition: primitives/RegulatoryElement.h:121
lanelet::RegulatoryElementFactory::RegulatoryElementFactory
RegulatoryElementFactory()=default
lanelet::HybridMap::find
iterator find(const key_type &k)
Definition: HybridMap.h:114
lanelet::RoleNameString::Refers
static constexpr const char Refers[]
Definition: primitives/RegulatoryElement.h:66
lanelet::RoleNameString::Centerline
static constexpr const char Centerline[]
Definition: primitives/RegulatoryElement.h:76
lanelet::RegulatoryElement::getParameters
ConstRuleParameterMap getParameters() const
Returns all parameters as const object (coversion overhead for const)
Definition: RegulatoryElement.cpp:137
lanelet::ConstPrimitive< RegulatoryElementData >::constData
const std::shared_ptr< const RegulatoryElementData > & constData() const
get the internal data of this primitive
Definition: Primitive.h:178
lanelet::RuleParameterVisitor::operator()
virtual void operator()(const ConstPolygon3d &)
Definition: primitives/RegulatoryElement.h:151
lanelet::utils::strong
auto strong(std::vector< WeakT > v)
transforms a vector of weak_ptrs to a vector of shared_ptrs
Definition: Utilities.h:347
HybridMap.h
lanelet::ConstPoint3d
An immutable 3d point.
Definition: primitives/Point.h:202
Primitive.h
lanelet::LaneletMap
Basic element for accessing and managing the elements of a map.
Definition: LaneletMap.h:375
lanelet::HybridMap< RuleParameters, decltype(RoleNameString::Map)&, RoleNameString::Map >::iterator
typename Map::iterator iterator
Definition: HybridMap.h:77
lanelet::RightOfWay
Defines right of way restrictions.
Definition: BasicRegulatoryElements.h:87
lanelet::Optional
boost::optional< T > Optional
Definition: Optional.h:7
lanelet::Lanelet
The famous (mutable) lanelet class.
Definition: primitives/Lanelet.h:221
lanelet::WeakLanelet
Definition: primitives/Lanelet.h:342
lanelet::ConstRuleParameter
boost::variant< ConstPoint3d, ConstLineString3d, ConstPolygon3d, ConstWeakLanelet, ConstWeakArea > ConstRuleParameter
Const-version of the parameters.
Definition: primitives/RegulatoryElement.h:94
lanelet::RoleNameString::Left
static constexpr const char Left[]
Definition: primitives/RegulatoryElement.h:74
lanelet::PrimitiveData::attributes
AttributeMap attributes
attributes of this primitive
Definition: Primitive.h:45
lanelet::RoleNameString::Cancels
static constexpr const char Cancels[]
Definition: primitives/RegulatoryElement.h:70
lanelet::RuleParameterVisitor::operator()
virtual void operator()(const ConstWeakArea &)
Definition: primitives/RegulatoryElement.h:153
lanelet::WeakArea
used internally by RegulatoryElements to avoid cyclic dependencies.
Definition: primitives/Area.h:300
lanelet::traits::PrimitiveTraits< ConstRuleParameter >::ThreeDType
void ThreeDType
Definition: primitives/RegulatoryElement.h:112
lanelet::GenericRegulatoryElement::GenericRegulatoryElement
GenericRegulatoryElement(Id id=InvalId, const RuleParameterMap &parameters=RuleParameterMap(), const AttributeMap &attributes=AttributeMap())
Construct generically from id, parameters and attributes.
Definition: primitives/RegulatoryElement.h:277
lanelet::RegulatoryElement::RegulatoryElement
RegulatoryElement(Id id=InvalId, const RuleParameterMap &members=RuleParameterMap(), const AttributeMap &attributes=AttributeMap())
Definition: primitives/RegulatoryElement.h:259
lanelet::RegulatoryElement::RegulatoryElement
RegulatoryElement(const RegulatoryElementDataPtr &data)
Definition: primitives/RegulatoryElement.h:262
lanelet::traits::Owned
Can be used to determine which primitive type is managed by a primitive.
Definition: Traits.h:51
lanelet::GenericRegulatoryElement::addParameter
void addParameter(const std::string &role, const PrimitiveT &primitive)
Add a (mutable) primitive to the regulatory element.
Definition: primitives/RegulatoryElement.h:397
lanelet::RoleNameString::CancelLine
static constexpr const char CancelLine[]
Definition: primitives/RegulatoryElement.h:71
lanelet::traits::MutablePrimitiveType
typename PrimitiveTraits< PrimitiveT >::MutableType MutablePrimitiveType
Utility for determinig the matching mutable type for a primitive.
Definition: Traits.h:84
lanelet::RegulatoryElement::end
const_iterator end() const
Definition: primitives/RegulatoryElement.h:243
lanelet::RuleParameterVisitor::operator()
virtual void operator()(const ConstPoint3d &)
Definition: primitives/RegulatoryElement.h:149
lanelet::internal::MutableParameterVisitor::role
std::string role
applyVisitor will set the current role here
Definition: primitives/RegulatoryElement.h:167
lanelet::RegulatoryElement::iterator
RuleParameterMap::iterator iterator
Definition: primitives/RegulatoryElement.h:184
lanelet::RegulatoryElementFactory::availableRules
static std::vector< std::string > availableRules()
returns regulatory element names that this factory can handle
Definition: RegulatoryElement.cpp:127
lanelet::RegulatoryElement::~RegulatoryElement
virtual ~RegulatoryElement()
lanelet::GenericRegulatoryElement::parameters
RuleParameterMap & parameters() noexcept
getter for all parameters of a regulatory element.
Definition: primitives/RegulatoryElement.h:292
lanelet::traits::PrimitiveTraits< ConstRuleParameter >::MutableType
RuleParameter MutableType
Definition: primitives/RegulatoryElement.h:110
lanelet::traits::toConst
ConstPrimitiveType< PrimitiveT > toConst(const PrimitiveT &primitive)
Converts a primitive to its matching const type.
Definition: Traits.h:108
lanelet::traits::PrimitiveTraits< ConstRuleParameter >::DataType
void DataType
Definition: primitives/RegulatoryElement.h:108
lanelet::traits::PrimitiveTraits< RuleParameter >::DataType
void DataType
Definition: primitives/RegulatoryElement.h:99
lanelet::utils::strequal
constexpr bool strequal(char const *lhs, char const *rhs)
compares two c-strings at compile time. Do not use this for run time.
Definition: Utilities.h:332
lanelet::RegulatoryElementConstPtr
std::shared_ptr< const RegulatoryElement > RegulatoryElementConstPtr
Definition: Forward.h:194
lanelet::Point3d
A mutable 3d point.
Definition: primitives/Point.h:271
lanelet::traits::getId< RegulatoryElementPtr >
Id getId< RegulatoryElementPtr >(const RegulatoryElementPtr &prim)
Definition: primitives/RegulatoryElement.h:297
lanelet::RegulatoryElementData::RegulatoryElementData
RegulatoryElementData(Id id, RuleParameterMap parameters=RuleParameterMap(), const AttributeMap &attributes=AttributeMap())
Definition: primitives/RegulatoryElement.h:136
lanelet::traits::PrimitiveTraits< RuleParameter >::ThreeDType
void ThreeDType
Definition: primitives/RegulatoryElement.h:103
lanelet::RegulatoryElement::parameters
const RuleParameterMap & parameters() const
Definition: primitives/RegulatoryElement.h:245
lanelet::RegulatoryElement::getParameters
std::vector< T > getParameters(RoleName role) const
Definition: primitives/RegulatoryElement.h:214
lanelet::traits::PrimitiveTraits::DataType
typename T::DataType DataType
Definition: Traits.h:21
lanelet::RoleNameString::Outer
static constexpr const char Outer[]
Definition: primitives/RegulatoryElement.h:78
lanelet::RegulatoryElementFactory::registerStrategy
void registerStrategy(const std::string &strategy, const FactoryFcn &factoryFunction)
Definition: primitives/RegulatoryElement.h:335
lanelet::HybridMap< RuleParameters, decltype(RoleNameString::Map)&, RoleNameString::Map >
lanelet::RegisterRegulatoryElement
template class for registering new RegulatoryElements.
Definition: primitives/RegulatoryElement.h:384
lanelet::utils::has
bool has(const ConstArea &ll, Id id)
returns true if element of a regulatory element has a matching Id
Definition: primitives/Area.h:324
lanelet::RoleNameString::Map
static constexpr RoleNamesItem Map[]
Definition: primitives/RegulatoryElement.h:83
lanelet::IfRE
std::enable_if_t< traits::isRegulatoryElementT< T >(), RetT > IfRE
Definition: primitives/RegulatoryElement.h:508
lanelet::ConstPrimitive
Basic Primitive class for all primitives of lanelet2.
Definition: Primitive.h:70
std
Definition: primitives/Area.h:369
lanelet::RegulatoryElementFactory::create
static RegulatoryElementPtr create(std::string ruleName, const RegulatoryElementDataPtr &data)
create a regulatory element based on the name of the rule
Definition: RegulatoryElement.cpp:114
lanelet::RoleName::RightOfWay
@ RightOfWay
A lanelet that has right of way in a relation.
lanelet::GenericRegulatoryElement::GenericRegulatoryElement
GenericRegulatoryElement(const RegulatoryElementDataPtr &data)
Definition: primitives/RegulatoryElement.h:273
lanelet::RoleName::CancelLine
@ CancelLine
The line from which a rule is invalidated.
lanelet::traits::getId< RuleParameter >
Id getId< RuleParameter >(const RuleParameter &prim)
Extracts the id of a rule parameter.
Definition: RegulatoryElement.cpp:191
lanelet::RoleNameString::Right
static constexpr const char Right[]
Definition: primitives/RegulatoryElement.h:75
lanelet::ConstLineString3d
A normal 3d linestring with immutable data.
Definition: primitives/LineString.h:521
Lanelet.h
lanelet::RuleParameterVisitor::operator()
virtual void operator()(const ConstWeakLanelet &)
Definition: primitives/RegulatoryElement.h:152
lanelet::Polygon3d
A mutable clockwise oriented, open (ie start point != end point) polygon in 3d.
Definition: primitives/Polygon.h:157
lanelet::GenericRegulatoryElement::RuleName
static constexpr char RuleName[]
Definition: primitives/RegulatoryElement.h:272
lanelet::traits::isRegulatoryElementT
constexpr bool isRegulatoryElementT()
Definition: primitives/RegulatoryElement.h:497
lanelet::RegulatoryElementData::parameters
RuleParameterMap parameters
Definition: primitives/RegulatoryElement.h:139
lanelet::traits::getId< ConstRuleParameter >
Id getId< ConstRuleParameter >(const ConstRuleParameter &prim)
Definition: RegulatoryElement.cpp:196
lanelet::RuleParameterVisitor
You can inherit from this visitor to perform an operation on each parameter of a regulatory element.
Definition: primitives/RegulatoryElement.h:147
lanelet::traits::toConst< RuleParameter >
ConstRuleParameter toConst< RuleParameter >(const RuleParameter &primitive)
Definition: RegulatoryElement.cpp:171
lanelet::RegulatoryElement::const_iterator
RuleParameterMap::const_iterator const_iterator
Definition: primitives/RegulatoryElement.h:183
lanelet::RoleNameString::Yield
static constexpr const char Yield[]
Definition: primitives/RegulatoryElement.h:68
lanelet::RoleNameString::RefLine
static constexpr const char RefLine[]
Definition: primitives/RegulatoryElement.h:67
LineString.h
lanelet::ConstRuleParameters
std::vector< ConstRuleParameter > ConstRuleParameters
Const version for a range of rule parameters.
Definition: primitives/RegulatoryElement.h:124
lanelet::traits::PrimitiveTraits< ConstRuleParameter >::TwoDType
void TwoDType
Definition: primitives/RegulatoryElement.h:111
lanelet::RegisterRegulatoryElement::RegisterRegulatoryElement
RegisterRegulatoryElement()
Definition: primitives/RegulatoryElement.h:386
lanelet::ConstWeakLanelet
Definition: primitives/Lanelet.h:316
lanelet::ConstWeakArea
used internally by RegulatoryElements to avoid cyclic dependencies.
Definition: primitives/Area.h:271
Polygon.h
lanelet::PrimitiveData::id
Id id
Id of this primitive (unique across one map)
Definition: Primitive.h:44
lanelet::RegulatoryElement::data
RegulatoryElementDataPtr data()
Definition: primitives/RegulatoryElement.h:247
lanelet::RegulatoryElementFactory::create
static RegulatoryElementPtr create(const std::string &ruleName, Id id, const RuleParameterMap &map, const AttributeMap &attributes=AttributeMap())
Definition: primitives/RegulatoryElement.h:353
lanelet::RegulatoryElementFactory::instance
static RegulatoryElementFactory & instance()
Definition: RegulatoryElement.cpp:132
lanelet::traits::PrimitiveTraits
Identifies RegulatoryElementPrimitives.
Definition: Traits.h:20
lanelet::traits::PrimitiveTraits< ConstRuleParameter >::ConstType
ConstRuleParameter ConstType
Definition: primitives/RegulatoryElement.h:109
Forward.h
lanelet::traits::PrimitiveTraits< RuleParameter >::MutableType
RuleParameter MutableType
Definition: primitives/RegulatoryElement.h:101
lanelet::HybridMap< RuleParameters, decltype(RoleNameString::Map)&, RoleNameString::Map >::const_iterator
typename Map::const_iterator const_iterator
Definition: HybridMap.h:78
lanelet::RoleName::Refers
@ Refers
The primitive(s) that are the origin of this rule (ie signs)
lanelet::Primitive< RegulatoryElement >::data
std::shared_ptr< DataType > data() const
Definition: Primitive.h:287
lanelet::LineString3d
A normal 3d linestring with mutable data.
Definition: primitives/LineString.h:538
lanelet::RuleParameter
boost::variant< Point3d, LineString3d, Polygon3d, WeakLanelet, WeakArea > RuleParameter
Definition: primitives/RegulatoryElement.h:90
lanelet::ConstPrimitive< RegulatoryElementData >::id
Id id() const noexcept
get the unique id of this primitive
Definition: Primitive.h:96
lanelet::internal::MutableParameterVisitor
Definition: primitives/RegulatoryElement.h:159
lanelet::RegulatoryElement::begin
const_iterator begin() const
Definition: primitives/RegulatoryElement.h:242
lanelet::RegulatoryElement::RuleName
static constexpr char RuleName[]
Definition: primitives/RegulatoryElement.h:185
lanelet::internal::MutableParameterVisitor::operator()
virtual void operator()(const Point3d &)=0
lanelet::RuleParameterMap
HybridMap< RuleParameters, decltype(RoleNameString::Map)&, RoleNameString::Map > RuleParameterMap
Rules are stored in a map internally.
Definition: primitives/RegulatoryElement.h:127
lanelet::RegulatoryElementFactory::FactoryFcn
std::function< RegulatoryElementPtr(const RegulatoryElementDataPtr &)> FactoryFcn
Definition: primitives/RegulatoryElement.h:334
lanelet::traits::RegulatoryElementTag
Identifies AreaPrimitives.
Definition: Traits.h:12
lanelet::RoleNameString::RightOfWay
static constexpr const char RightOfWay[]
Definition: primitives/RegulatoryElement.h:69


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