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

Method IsFencedOff

libs/routing/index_router.cpp:1181–1213  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

1179
1180// static
1181bool IndexRouter::PointsOnEdgesSnapping::IsFencedOff(m2::PointD const & point, EdgeProjectionT const & edgeProjection,
1182 vector<RoadInfoT> const & fences)
1183{
1184 auto const & edge = edgeProjection.first;
1185 auto const & projPoint = edgeProjection.second.GetPoint();
1186
1187 for (auto const & fence : fences)
1188 {
1189 auto const & featureGeom = fence.m_roadInfo.m_junctions;
1190 for (size_t i = 1; i < featureGeom.size(); ++i)
1191 {
1192 auto const & fencePointFrom = featureGeom[i - 1];
1193 auto const & fencePointTo = featureGeom[i];
1194 if (IsTheSameSegments(fencePointFrom.GetPoint(), fencePointTo.GetPoint(), edge.GetStartPoint(),
1195 edge.GetEndPoint()))
1196 {
1197 continue;
1198 }
1199
1200 // If two segment are connected with its ends it's also considered as an
1201 // intersection according to m2::SegmentsIntersect(). On the other hand
1202 // it's possible that |projPoint| is an end point of |edge| and |edge|
1203 // is connected with other edges. To prevent fencing off such edges with their
1204 // neighboring edges the condition !m2::IsPointOnSegment() is added.
1205 if (m2::SegmentsIntersect(point, projPoint, fencePointFrom.GetPoint(), fencePointTo.GetPoint()) &&
1206 !m2::IsPointOnSegment(projPoint, fencePointFrom.GetPoint(), fencePointTo.GetPoint()))
1207 {
1208 return true;
1209 }
1210 }
1211 }
1212 return false;
1213}
1214
1215// static
1216void IndexRouter::PointsOnEdgesSnapping::RoadsToNearestEdges(m2::PointD const & point, vector<RoadInfoT> const & roads,

Callers

nothing calls this directly

Calls 7

IsTheSameSegmentsFunction · 0.85
SegmentsIntersectFunction · 0.85
IsPointOnSegmentFunction · 0.85
GetPointMethod · 0.45
sizeMethod · 0.45
GetStartPointMethod · 0.45
GetEndPointMethod · 0.45

Tested by

no test coverage detected