BasicRegulatoryElements.cpp
Go to the documentation of this file.
2 
3 #include <vector>
4 
10 
11 namespace std {
13  return !lhs.expired() && !rhs.expired() && lhs.lock() == rhs.lock();
14 }
15 } // namespace std
16 namespace lanelet {
17 namespace {
18 template <typename T>
19 bool findAndErase(const T& primitive, RuleParameterMap& parameters, RoleName role) {
20  auto parameterIt = parameters.find(role);
21  if (parameterIt == parameters.end()) {
22  return false;
23  }
24  auto& parameter = parameterIt->second;
25  auto it = std::find(parameter.begin(), parameter.end(), RuleParameter(primitive));
26  if (it == parameter.end()) {
27  return false;
28  }
29  parameter.erase(it);
30  if (parameter.empty()) {
31  parameters.erase(parameterIt);
32  }
33  return true;
34 }
35 
36 template <typename T>
37 Optional<T> tryGetFront(const std::vector<T>& vec) {
38  if (vec.empty()) {
39  return {};
40  }
41  return vec.front();
42 }
43 
44 template <typename T>
45 RuleParameters toRuleParameters(const std::vector<T>& primitives) {
46  return utils::transform(primitives, [](const auto& elem) { return static_cast<RuleParameter>(elem); });
47 }
48 
49 template <>
50 RuleParameters toRuleParameters(const std::vector<LineStringOrPolygon3d>& primitives) {
51  return utils::transform(primitives, [](const auto& elem) { return elem.asRuleParameter(); });
52 }
53 
54 LineStringsOrPolygons3d getLsOrPoly(const RuleParameterMap& paramsMap, RoleName role) {
55  auto params = paramsMap.find(role);
56  if (params == paramsMap.end()) {
57  return {};
58  }
59 
61  for (const auto& param : params->second) {
62  const auto* l = boost::get<LineString3d>(&param);
63  if (l != nullptr) {
64  result.push_back(*l);
65  }
66  const auto* p = boost::get<Polygon3d>(&param);
67  if (p != nullptr) {
68  result.push_back(*p);
69  }
70  }
71  return result;
72 }
73 
74 ConstLineStringsOrPolygons3d getConstLsOrPoly(const RuleParameterMap& params, RoleName role) {
75  return utils::transform(getLsOrPoly(params, role),
76  [](auto& lsOrPoly) { return static_cast<ConstLineStringOrPolygon3d>(lsOrPoly); });
77 }
78 
79 void updateTrafficSigns(TrafficSignsWithType trafficSigns) {
80  if (!trafficSigns.type.empty()) {
81  for (auto& sign : trafficSigns.trafficSigns) {
82  sign.applyVisitor([](auto prim) { prim.setAttribute(AttributeName::Type, AttributeValueString::TrafficSign); });
83  sign.applyVisitor([&](auto prim) { prim.setAttribute(AttributeName::Subtype, trafficSigns.type); });
84  }
85  }
86 }
87 
88 RegulatoryElementDataPtr constructTrafficLightData(Id id, const AttributeMap& attributes,
89  const LineStringsOrPolygons3d& trafficLights,
90  const Optional<LineString3d>& stopLine) {
91  RuleParameterMap rpm = {{RoleNameString::Refers, toRuleParameters(trafficLights)}};
92  if (!!stopLine) {
93  rpm.insert({RoleNameString::RefLine, {*stopLine}});
94  }
95  auto data = std::make_shared<RegulatoryElementData>(id, std::move(rpm), attributes);
96  data->attributes[AttributeName::Type] = AttributeValueString::RegulatoryElement;
97  data->attributes[AttributeName::Subtype] = AttributeValueString::TrafficLight;
98  return data;
99 }
100 RegulatoryElementDataPtr constructTrafficSignData(Id id, const AttributeMap& attributes,
101  const TrafficSignsWithType& trafficSigns,
102  const TrafficSignsWithType& cancellingTrafficSigns,
103  const LineStrings3d& refLines, const LineStrings3d& cancelLines) {
104  updateTrafficSigns(trafficSigns);
105  updateTrafficSigns(cancellingTrafficSigns);
106  RuleParameterMap rpm = {{RoleNameString::Refers, toRuleParameters(trafficSigns.trafficSigns)},
107  {RoleNameString::Cancels, toRuleParameters(cancellingTrafficSigns.trafficSigns)},
108  {RoleNameString::RefLine, toRuleParameters(refLines)},
109  {RoleNameString::CancelLine, toRuleParameters(cancelLines)}};
110  auto data = std::make_shared<RegulatoryElementData>(id, std::move(rpm), attributes);
111  data->attributes[AttributeName::Type] = AttributeValueString::RegulatoryElement;
112  data->attributes[AttributeName::Subtype] = AttributeValueString::TrafficSign;
113  return data;
114 }
115 RegulatoryElementDataPtr constructSpeedLimitData(Id id, const AttributeMap& attributes,
116  const TrafficSignsWithType& trafficSigns,
117  const TrafficSignsWithType& cancellingTrafficSigns,
118  const LineStrings3d& refLines, const LineStrings3d& cancelLines) {
119  auto data = constructTrafficSignData(id, attributes, trafficSigns, cancellingTrafficSigns, refLines, cancelLines);
120  data->attributes[AttributeName::Subtype] = AttributeValueString::SpeedLimit;
121  return data;
122 }
123 RegulatoryElementDataPtr constructRightOfWayData(Id id, const AttributeMap& attributes, const Lanelets& rightOfWay,
124  const Lanelets& yield, const Optional<LineString3d>& stopLine) {
125  RuleParameterMap rpm = {{RoleNameString::RightOfWay, toRuleParameters(rightOfWay)},
126  {RoleNameString::Yield, toRuleParameters(yield)}};
127  auto data = std::make_shared<RegulatoryElementData>(id, std::move(rpm), attributes);
128  data->attributes[AttributeName::Type] = AttributeValueString::RegulatoryElement;
129  data->attributes[AttributeName::Subtype] = AttributeValueString::RightOfWay;
130  if (stopLine) {
131  data->parameters[RoleName::RefLine] = {*stopLine};
132  }
133  return data;
134 }
135 RegulatoryElementDataPtr constructAllWayStopData(Id id, const AttributeMap& attributes,
136  const LaneletsWithStopLines& lltWithStop,
137  const LineStringsOrPolygons3d& signs) {
138  RuleParameters llts =
139  utils::transform(lltWithStop, [](auto& llt) { return static_cast<RuleParameter>(llt.lanelet); });
140  auto sl = utils::createReserved<RuleParameters>(lltWithStop.size());
141  utils::forEach(lltWithStop, [&](auto& stop) {
142  if (!!stop.stopLine) {
143  sl.push_back(static_cast<RuleParameter>(*stop.stopLine));
144  }
145  });
146  RuleParameterMap rpm = {
147  {RoleNameString::Yield, llts}, {RoleNameString::RefLine, sl}, {RoleNameString::Refers, toRuleParameters(signs)}};
148  auto data = std::make_shared<RegulatoryElementData>(id, std::move(rpm), attributes);
149  data->attributes[AttributeName::Type] = AttributeValueString::RegulatoryElement;
150  data->attributes[AttributeName::Subtype] = AttributeValueString::AllWayStop;
151  return data;
152 }
153 } // namespace
154 
160 #if __cplusplus < 201703L
161 constexpr char TrafficLight::RuleName[];
162 constexpr char RightOfWay::RuleName[];
163 constexpr char TrafficSign::RuleName[];
164 constexpr char SpeedLimit::RuleName[];
165 constexpr char AllWayStop::RuleName[];
166 #endif
167 
168 TrafficLight::TrafficLight(const RegulatoryElementDataPtr& data) : RegulatoryElement(data) {
169  if (getConstLsOrPoly(data->parameters, RoleName::Refers).empty()) {
170  throw InvalidInputError("No traffic light defined!");
171  }
172  if (getParameters<ConstLineString3d>(RoleName::RefLine).size() > 1) {
173  throw InvalidInputError("There can not exist more than one stop line!");
174  }
175 }
176 
179  : TrafficLight(constructTrafficLightData(id, attributes, trafficLights, stopLine)) {}
180 
182  return tryGetFront(getParameters<ConstLineString3d>(RoleName::RefLine));
183 }
184 
185 Optional<LineString3d> TrafficLight::stopLine() { return tryGetFront(getParameters<LineString3d>(RoleName::RefLine)); }
186 
188  return getConstLsOrPoly(parameters(), RoleName::Refers);
189 }
190 
192 
194  parameters()[RoleName::Refers].emplace_back(primitive.asRuleParameter());
195 }
196 
198  return findAndErase(primitive.asRuleParameter(), parameters(), RoleName::Refers);
199 }
200 
202 
204 
206  if (getParameters<WeakLanelet>(RoleName::RightOfWay).empty()) {
207  throw InvalidInputError("A maneuver must refer to at least one lanelet that has right of way!");
208  }
209  if (getParameters<WeakLanelet>(RoleName::Yield).empty()) {
210  throw InvalidInputError("A maneuver must refer to at least one lanelet that has to yield!");
211  }
212 }
213 
214 RightOfWay::RightOfWay(Id id, const AttributeMap& attributes, const Lanelets& rightOfWay, const Lanelets& yield,
216  : RightOfWay(constructRightOfWayData(id, attributes, rightOfWay, yield, stopLine)) {}
217 
219  if (utils::contains(rightOfWayLanelets(), lanelet)) {
221  }
222  if (utils::contains(yieldLanelets(), lanelet)) {
223  return ManeuverType::Yield;
224  }
225  return ManeuverType::Unknown;
226 }
227 
228 ConstLanelets RightOfWay::rightOfWayLanelets() const { return getParameters<ConstLanelet>(RoleName::RightOfWay); }
229 
231 
232 ConstLanelets RightOfWay::yieldLanelets() const { return getParameters<ConstLanelet>(RoleName::Yield); }
233 
234 Lanelets RightOfWay::yieldLanelets() { return utils::strong(getParameters<WeakLanelet>(RoleName::Yield)); }
235 
237  auto stopLine = getParameters<ConstLineString3d>(RoleName::RefLine);
238  if (!stopLine.empty()) {
239  return stopLine.front();
240  }
241  return {};
242 }
243 
245  auto stopLine = getParameters<LineString3d>(RoleName::RefLine);
246  if (!stopLine.empty()) {
247  return stopLine.front();
248  }
249  return {};
250 }
251 
253 
255  parameters()[RoleName::RightOfWay].emplace_back(lanelet);
256 }
257 
258 void RightOfWay::addYieldLanelet(const Lanelet& lanelet) { parameters()[RoleName::Yield].emplace_back(lanelet); }
259 
261  return findAndErase(lanelet, parameters(), RoleName::RightOfWay);
262 }
263 
265  return findAndErase(lanelet, parameters(), RoleName::Yield);
266 }
267 
269 
271  type(); // will throw if type is invalid
272 }
273 
276  const LineStrings3d& cancelLines)
277  : TrafficSign(
278  constructTrafficSignData(id, attributes, trafficSigns, cancellingTrafficSigns, refLines, cancelLines)) {}
279 
281  return getConstLsOrPoly(parameters(), RoleName::Refers);
282 }
283 
285 
286 std::string TrafficSign::type() const {
287  auto signs = trafficSigns();
288  if (!signs.empty() &&
289  signs.front().applyVisitor([](auto& prim) { return prim.hasAttribute(AttributeName::Subtype); })) {
290  const auto& attr = signs.front().applyVisitor([](auto& prim) { return prim.attribute(AttributeName::Subtype); });
291  return attr.value();
292  }
293  if (!signs.empty()) {
294  throw InvalidInputError("Regulatory element has a traffic sign without subtype attribute!");
295  }
298  }
299  throw InvalidInputError("Regulatory element can not determine the type of the traffic sign!");
300 } // namespace lanelet
301 
302 ConstLineStrings3d TrafficSign::refLines() const { return getParameters<ConstLineString3d>(RoleName::RefLine); }
303 
304 LineStrings3d TrafficSign::refLines() { return getParameters<LineString3d>(RoleName::RefLine); }
305 
307  parameters()[RoleName::Refers].emplace_back(sign.asRuleParameter());
308 }
309 
311  return findAndErase(sign.asRuleParameter(), parameters(), RoleName::Refers);
312 }
313 
314 void TrafficSign::addRefLine(const LineString3d& line) { parameters()[RoleName::RefLine].emplace_back(line); }
315 
317  return findAndErase(line, parameters(), RoleName::RefLine);
318 }
319 
321  parameters()[RoleName::CancelLine].emplace_back(line);
322 }
323 
325  return findAndErase(line, parameters(), RoleName::CancelLine);
326 }
327 
330  const LineStrings3d& cancelLines)
331  : TrafficSign(
332  constructSpeedLimitData(id, attributes, trafficSigns, cancellingTrafficSigns, refLines, cancelLines)) {}
333 
335 
337  updateTrafficSigns(signs);
338  for (const auto& sign : signs.trafficSigns) {
339  parameters()[RoleName::Cancels].emplace_back(sign.asRuleParameter());
340  }
341 }
342 
344  return findAndErase(sign.asRuleParameter(), parameters(), RoleName::Cancels);
345 }
346 
348  return getConstLsOrPoly(parameters(), RoleName::Cancels);
349 }
350 
352 
353 std::vector<std::string> TrafficSign::cancelTypes() const {
354  auto signs = cancellingTrafficSigns();
355  std::vector<std::string> types;
356  types.reserve(signs.size());
357  for (auto& sign : signs) {
358  types.push_back(sign.applyVisitor([](auto& prim) { return prim.attribute(AttributeName::Subtype); }).value());
359  }
360  std::sort(types.begin(), types.end());
361  types.erase(std::unique(types.begin(), types.end()), types.end());
362  return types;
363 }
364 
365 ConstLineStrings3d TrafficSign::cancelLines() const { return getParameters<ConstLineString3d>(RoleName::CancelLine); }
366 
367 LineStrings3d TrafficSign::cancelLines() { return getParameters<LineString3d>(RoleName::CancelLine); }
368 
369 ConstLanelets AllWayStop::lanelets() const { return getParameters<ConstLanelet>(RoleName::Yield); }
370 
371 Lanelets AllWayStop::lanelets() { return utils::strong(getParameters<WeakLanelet>(RoleName::Yield)); }
372 
373 ConstLineStrings3d AllWayStop::stopLines() const { return getParameters<ConstLineString3d>(RoleName::RefLine); }
374 
375 LineStrings3d AllWayStop::stopLines() { return getParameters<LineString3d>(RoleName::RefLine); }
376 
378  auto sl = stopLines();
379  if (sl.empty()) {
380  return {};
381  }
382  auto llts = lanelets();
383  auto it = std::find(llts.begin(), llts.end(), llt);
384  if (it == llts.end()) {
385  return {};
386  }
387  return sl.at(size_t(std::distance(llts.begin(), it)));
388 }
389 
391  auto sl = stopLines();
392  if (sl.empty()) {
393  return {};
394  }
395  auto llts = lanelets();
396  auto it = std::find(llts.begin(), llts.end(), llt);
397  if (it == llts.end()) {
398  return {};
399  }
400  return sl.at(size_t(std::distance(llts.begin(), it)));
401 }
402 
404  return getConstLsOrPoly(parameters(), RoleName::Refers);
405 }
406 
408 
410  parameters()[RoleName::Refers].push_back(sign.asRuleParameter());
411 }
412 
414  return findAndErase(sign.asRuleParameter(), parameters(), RoleName::Refers);
415 }
416 
417 void AllWayStop::addLanelet(const LaneletWithStopLine& lltWithStop) {
418  auto sl = stopLines();
419  if (sl.empty() && !lanelets().empty() && !!lltWithStop.stopLine) {
420  throw InvalidInputError("A lanelet with stop line was added, but existing lanelets don't have a stop line!");
421  }
422  if (!sl.empty() && !lltWithStop.stopLine) {
423  throw InvalidInputError("A lanelet without stopline was added, but existing lanelets have a stop line!");
424  }
425  parameters()[RoleName::Yield].emplace_back(lltWithStop.lanelet);
426  if (!!lltWithStop.stopLine) {
427  parameters()[RoleName::RefLine].emplace_back(*lltWithStop.stopLine);
428  }
429 }
430 
432  auto yieldIt = parameters().find(RoleName::Yield);
433  if (yieldIt == parameters().end()) {
434  return false;
435  }
436  auto& yieldLLts = yieldIt->second;
437  auto lltIt = std::find(yieldLLts.begin(), yieldLLts.end(), RuleParameter(llt));
438  if (lltIt == yieldLLts.end()) {
439  return false;
440  }
441  auto linesIt = parameters().find(RoleName::RefLine);
442  if (linesIt != parameters().end() && !linesIt->second.empty()) {
443  linesIt->second.erase(linesIt->second.begin() + std::distance(yieldLLts.begin(), lltIt));
444  }
445  yieldLLts.erase(lltIt);
446  return true;
447 }
448 
450  const LineStringsOrPolygons3d& signs)
451  : AllWayStop{constructAllWayStopData(id, attributes, lltsWithStop, signs)} {}
452 
454  auto yields = parameters().find(RoleName::Yield);
456  auto row = parameters().find(RoleName::RightOfWay);
457  if (row != parameters().end() && !row->second.empty()) {
458  throw InvalidInputError("An all way stop must not have a lanelet with right of way!");
459  }
460  if (lines == parameters().end() || lines->second.empty()) {
461  return;
462  }
463  if (yields == parameters().end() || lines->second.size() != yields->second.size()) {
464  throw InvalidInputError(
465  "Inconsistent number of lanelets and stop lines found! Either one stop line per lanelet or no stop lines!");
466  }
467 }
468 
469 } // namespace lanelet
template class for registering new RegulatoryElements.
BasicPoint p
iterator end()
Definition: HybridMap.h:126
A lanelet that has right of way in a relation.
SpeedLimit(Id id, const AttributeMap &attributes, const TrafficSignsWithType &trafficSigns, const TrafficSignsWithType &cancellingTrafficSigns={}, const LineStrings3d &refLines={}, const LineStrings3d &cancelLines={})
Lanelet has right of way
ConstLanelets lanelets() const
get the lanelets that potentially have to yield
bool hasAttribute(const std::string &name) const noexcept
check whether this primitive has a specific attribute
Definition: Primitive.h:99
std::vector< ConstLineString3d > ConstLineStrings3d
Definition: Forward.h:58
void addCancellingRefLine(const LineString3d &line)
Add a new line from where the sign becomes inactive.
ManeuverType
Enum to distinguish maneuver types.
std::vector< ConstLineStringOrPolygon3d > ConstLineStringsOrPolygons3d
auto find(ContainerT &&c, const ValueT &val)
Definition: Utilities.h:186
ConstLanelets yieldLanelets() const
get the lanelets that have to yield
Optional< ConstLineString3d > stopLine() const
get the stop line for the traffic light
void addRightOfWayLanelet(const Lanelet &lanelet)
Adds a lanelet for RightOfWay.
AllWayStop(Id id, const AttributeMap &attributes, const LaneletsWithStopLines &lltsWithStop, const LineStringsOrPolygons3d &signs)
static RegisterRegulatoryElement< TrafficSign > regTrafficSign
bool removeLanelet(const Lanelet &llt)
Removes a lanelet and the associated stop line, if there is one.
bool removeRefLine(const LineString3d &line)
Remove a reference line. Returns true on success.
The referring line where the rule becomes active.
int64_t Id
Definition: Forward.h:198
std::pair< iterator, bool > insert(const value_type &v)
Definition: HybridMap.h:130
void removeStopLine()
Removes the stop line.
ConstLanelets rightOfWayLanelets() const
get the lanelets have right of way
iterator find(const key_type &k)
Definition: HybridMap.h:114
const std::string & value() const
gets the value of this attribute
Definition: Attribute.h:96
void addLanelet(const LaneletWithStopLine &lltWithStop)
HybridMap< Attribute, decltype(AttributeNamesString::Map)&, AttributeNamesString::Map > AttributeMap
Definition: Attribute.h:371
void addYieldLanelet(const Lanelet &lanelet)
Add yielding lanelet.
const AttributeMap & attributes() const
get the attributes of this primitive
Definition: Primitive.h:89
This class holds either a LineString3d or a Polygon3d.
RoleName
Typical role names within lanelet (for faster lookup)
The famous (mutable) lanelet class.
bool removeYieldLanelet(const Lanelet &lanelet)
Removes a yielding lanelet and returns true no success.
std::vector< Lanelet > Lanelets
Definition: Forward.h:113
Optional< LineString3d > stopLine
bool removeTrafficSign(const LineStringOrPolygon3d &sign)
remove a traffic sign and returns true on success
std::shared_ptr< RegulatoryElementData > RegulatoryElementDataPtr
Definition: Forward.h:184
TrafficSign(Id id, const AttributeMap &attributes, const TrafficSignsWithType &trafficSigns, const TrafficSignsWithType &cancellingTrafficSigns={}, const LineStrings3d &refLines={}, const LineStrings3d &cancelLines={})
Defines right of way restrictions.
static RegisterRegulatoryElement< AllWayStop > regAllWayStop
const RuleParameterMap & parameters() const
static RegisterRegulatoryElement< SpeedLimit > regSpeedLimit
const Attribute & attribute(const std::string &name) const
retrieve an attribute
Definition: Primitive.h:113
RuleParameter asRuleParameter() const
auto strong(std::vector< WeakT > v)
transforms a vector of weak_ptrs to a vector of shared_ptrs
Definition: Utilities.h:347
std::string type() const
get the id/number of the sign(s)
bool operator==(const lanelet::LaneletDataConstWptr &lhs, const lanelet::LaneletDataConstWptr &rhs)
ConstLineStringsOrPolygons3d trafficSigns() const
returns the traffic signs
static RegisterRegulatoryElement< TrafficLight > regTraffic
Represents a traffic light restriction on the lanelet.
std::vector< RuleParameter > RuleParameters
Multiple parameters can have the same role in a rule (eg traffic_lights)
ConstLineStringsOrPolygons3d trafficLights() const
get the relevant traffic lights
primitive(s) that invalidate a rule (eg end of speed zone)
Used as input argument to create TrafficSign regElem.
bool removeCancellingTrafficSign(const LineStringOrPolygon3d &sign)
remove a cancelling traffic sign, returns true on success
void forEach(Container &&c, Func &&f)
Definition: Utilities.h:226
ConstLineStrings3d cancelLines() const
gets the line(s) from which a sign becomes invalid.
A normal 3d linestring with mutable data.
boost::optional< T > Optional
Definition: Optional.h:7
ConstLineStringsOrPolygons3d cancellingTrafficSigns() const
get list of cancellingTrafficSigns, if existing
std::weak_ptr< const LaneletData > LaneletDataConstWptr
Definition: Forward.h:103
bool empty() const
returns true if this object contains no parameters
std::vector< LaneletWithStopLine > LaneletsWithStopLines
bool removeRightOfWayLanelet(const Lanelet &lanelet)
Removes a right of way lanelet and returns true on success.
std::vector< LineStringOrPolygon3d > LineStringsOrPolygons3d
RightOfWay(Id id, const AttributeMap &attributes, const Lanelets &rightOfWay, const Lanelets &yield, const Optional< LineString3d > &stopLine={})
void setStopLine(const LineString3d &stopLine)
Overwrites the stop line.
bool removeCancellingRefLine(const LineString3d &line)
Remove a cancelling line. Returns true on success.
void addRefLine(const LineString3d &line)
Add a new reference line.
void addCancellingTrafficSign(const TrafficSignsWithType &signs)
Add new cancelling traffic sign.
Optional< double > distance
An immutable lanelet.
void removeStopLine()
Deletes the stop line.
auto transform(Container &&c, Func f)
Definition: Utilities.h:120
def lines
void addTrafficSign(const LineStringOrPolygon3d &sign)
Adds another traffic sign.
Optional< ConstLineString3d > getStopLine(const ConstLanelet &llt) const
gets the stop line for a lanelet, if there is one
Thrown when a function was called with invalid input arguments.
Definition: Exceptions.h:56
void setStopLine(const LineString3d &stopLine)
set a new stop line, overwrite the old one
ConstLineStrings3d refLines() const
gets the line(s) from which a sign becomes valid.
bool contains(const Container &c, const Value &v)
Definition: Utilities.h:221
Id id
Definition: LaneletMap.cpp:63
Lanelet ist not part of relation.
A general rule or limitation for a lanelet (abstract base class)
The line from which a rule is invalidated.
A lanelet that has to yield.
LineStringsOrPolygons3d trafficSigns
Lists relevant traffic signs.
bool removeTrafficLight(const LineStringOrPolygon3d &primitive)
remove a traffic light
void addTrafficSign(const LineStringOrPolygon3d &sign)
Adds another traffic sign.
TrafficLight(Id id, const AttributeMap &attributes, const LineStringsOrPolygons3d &trafficLights, const Optional< LineString3d > &stopLine)
Expresses a generic traffic sign rule.
static RegisterRegulatoryElement< RightOfWay > regRightOfWay
Optional< ConstLineString3d > stopLine() const
get the stop line for the yield lanelets, if present
std::vector< std::string > cancelTypes() const
Types of the cancelling traffic signs if they exist.
void addTrafficLight(const LineStringOrPolygon3d &primitive)
add a new traffic light
size_t size() const
get the number of roles in this regulatoryElement
ConstLineStringsOrPolygons3d trafficSigns() const
get list of traffic signs that constitute this AllWayStop if existing
static constexpr const char SignType[]
Definition: Attribute.h:235
Defines an all way stop. These are a special form of right of way, where all lanelets have to yield...
bool removeTrafficSign(const LineStringOrPolygon3d &sign)
removes a traffic sign and returns true on success
ConstLineStrings3d stopLines() const
get the stop lines
HybridMap< RuleParameters, decltype(RoleNameString::Map)&, RoleNameString::Map > RuleParameterMap
Rules are stored in a map internally.
std::vector< LineString3d > LineStrings3d
Definition: Forward.h:57
ManeuverType getManeuver(const ConstLanelet &lanelet) const
returns whether a lanelet has to yield or has right of way
boost::variant< Point3d, LineString3d, Polygon3d, WeakLanelet, WeakArea > RuleParameter
The primitive(s) that are the origin of this rule (ie signs)
std::vector< ConstLanelet > ConstLanelets
Definition: Forward.h:114


lanelet2_core
Author(s): Fabian Poggenhans
autogenerated on Tue Jun 6 2023 02:23:32