MCPcopy Create free account
hub / github.com/comaps/comaps / IsRestrictionValid

Method IsRestrictionValid

generator/restriction_collector.cpp:258–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258bool RestrictionCollector::IsRestrictionValid(Restriction::Type & restrictionType, m2::PointD const & coords,
259 std::vector<uint32_t> & featureIds) const
260{
261 if (featureIds.empty() || !m_indexGraph.IsRoad(featureIds[0]))
262 return false;
263
264 for (size_t i = 1; i < featureIds.size(); ++i)
265 {
266 auto prev = featureIds[i - 1];
267 auto cur = featureIds[i];
268 if (!m_indexGraph.IsRoad(cur))
269 return false;
270
271 if (!FeaturesAreCross(coords, prev, cur))
272 return false;
273 }
274
275 ConvertToUTurnIfPossible(restrictionType, coords, featureIds);
276
277 if (!IsUTurnType(restrictionType))
278 return true;
279
280 return CheckAndProcessUTurn(restrictionType, coords, featureIds);
281}
282
283bool RestrictionCollector::AddRestriction(m2::PointD const & coords, Restriction::Type restrictionType,
284 std::vector<base::GeoObjectId> const & osmIds)

Callers

nothing calls this directly

Calls 5

ConvertToUTurnIfPossibleFunction · 0.85
IsUTurnTypeFunction · 0.85
emptyMethod · 0.45
IsRoadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected