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

Function GetBestOsmWayOrRelation

libs/editor/feature_matcher.cpp:244–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244pugi::xml_node GetBestOsmWayOrRelation(pugi::xml_document const & osmResponse, std::vector<m2::PointD> const & geometry)
245{
246 double bestScore = geometry::kPenaltyScore;
247 pugi::xml_node bestMatchWay;
248
249 auto const xpath = "osm/way|osm/relation[tag[@k='type' and @v='multipolygon']]";
250 for (auto const & xWayOrRelation : osmResponse.select_nodes(xpath))
251 {
252 double const nodeScore = ScoreGeometry(osmResponse, xWayOrRelation.node(), geometry);
253
254 if (nodeScore < 0)
255 continue;
256
257 if (bestScore < nodeScore)
258 {
259 bestScore = nodeScore;
260 bestMatchWay = xWayOrRelation.node();
261 }
262 }
263
264 return bestMatchWay;
265}
266
267double ScoreTriangulatedGeometries(std::vector<m2::PointD> const & lhs, std::vector<m2::PointD> const & rhs)
268{

Callers 3

UNIT_TESTFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 1

ScoreGeometryFunction · 0.85

Tested by 2

UNIT_TESTFunction · 0.68
UNIT_TESTFunction · 0.68