| 506 | // returned |
| 507 | template <typename FilterT> |
| 508 | std::vector<CandidateSegment> SearchInRange(const Coordinate input_coordinate, |
| 509 | double maxDistanceMeters, |
| 510 | const FilterT filter) const |
| 511 | { |
| 512 | auto projected_coordinate = web_mercator::fromWGS84(input_coordinate); |
| 513 | Coordinate fixed_projected_coordinate{projected_coordinate}; |
| 514 | |
| 515 | auto bbox = Rectangle::ExpandMeters(input_coordinate, maxDistanceMeters); |
| 516 | std::vector<CandidateSegment> results; |
| 517 | |
| 518 | SearchInBox( |
| 519 | bbox, |
| 520 | [&results, &filter, fixed_projected_coordinate, this](const EdgeDataT ¤t_edge) |
| 521 | { |
| 522 | const auto projected_u = web_mercator::fromWGS84(m_coordinate_list[current_edge.u]); |
| 523 | const auto projected_v = web_mercator::fromWGS84(m_coordinate_list[current_edge.v]); |
| 524 | |
| 525 | auto [_, projected_nearest] = coordinate_calculation::projectPointOnSegment( |
| 526 | projected_u, projected_v, fixed_projected_coordinate); |
| 527 | |
| 528 | CandidateSegment current_candidate{projected_nearest, current_edge}; |
| 529 | auto use_segment = filter(current_candidate); |
| 530 | if (!use_segment.first && !use_segment.second) |
| 531 | { |
| 532 | return; |
| 533 | } |
| 534 | current_candidate.data.forward_segment_id.enabled &= use_segment.first; |
| 535 | current_candidate.data.reverse_segment_id.enabled &= use_segment.second; |
| 536 | |
| 537 | results.push_back(current_candidate); |
| 538 | }); |
| 539 | |
| 540 | return results; |
| 541 | } |
| 542 | |
| 543 | // Return edges in distance order with the coordinate of the closest point on the edge. |
| 544 | template <typename FilterT, typename TerminationT> |
no test coverage detected