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

Method IsJunction

tools/openlr/score_candidate_points_getter.cpp:94–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94bool ScoreCandidatePointsGetter::IsJunction(m2::PointD const & p)
95{
96 Graph::EdgeListT outgoing;
97 m_graph.GetRegularOutgoingEdges(geometry::PointWithAltitude(p, 0 /* altitude */), outgoing);
98
99 Graph::EdgeListT ingoing;
100 m_graph.GetRegularIngoingEdges(geometry::PointWithAltitude(p, 0 /* altitude */), ingoing);
101
102 // Note. At mwm borders the size of |ids| may be bigger than two in case of straight
103 // road because of road feature duplication at borders.
104 std::set<std::pair<uint32_t, uint32_t>> ids;
105 for (auto const & e : outgoing)
106 ids.insert(std::make_pair(e.GetFeatureId().m_index, e.GetSegId()));
107
108 for (auto const & e : ingoing)
109 ids.insert(std::make_pair(e.GetFeatureId().m_index, e.GetSegId()));
110
111 // Size of |ids| is number of different pairs of (feature id, segment id) starting from
112 // |p| plus going to |p|. The size 0, 1 or 2 is considered |p| is not a junction of roads.
113 // If the size is 3 or more it means |p| is an intersection of 3 or more roads.
114 return ids.size() >= 3;
115}
116
117Score ScoreCandidatePointsGetter::GetScoreByDistance(m2::PointD const & point, m2::PointD const & candidate)
118{

Callers

nothing calls this directly

Calls 7

GetSegIdMethod · 0.80
PointWithAltitudeClass · 0.50
insertMethod · 0.45
GetFeatureIdMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected