| 242 | } |
| 243 | |
| 244 | pugi::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 | |
| 267 | double ScoreTriangulatedGeometries(std::vector<m2::PointD> const & lhs, std::vector<m2::PointD> const & rhs) |
| 268 | { |