* Checks to see if the edge weights are valid. We might have an edge, * but a traffic update might set the speed to 0 (weight == INVALID_SEGMENT_WEIGHT). * which means that this edge is not currently traversable. If this is the case, * then we shouldn't snap to this edge. */
| 554 | * then we shouldn't snap to this edge. |
| 555 | */ |
| 556 | std::pair<bool, bool> HasValidEdge(const CandidateSegment &segment, |
| 557 | const bool use_all_edges = false) const |
| 558 | { |
| 559 | |
| 560 | bool forward_edge_valid = false; |
| 561 | bool reverse_edge_valid = false; |
| 562 | |
| 563 | const auto &data = segment.data; |
| 564 | BOOST_ASSERT(data.forward_segment_id.enabled); |
| 565 | BOOST_ASSERT(data.forward_segment_id.id != SPECIAL_NODEID); |
| 566 | const auto geometry_id = datafacade.GetGeometryIndex(data.forward_segment_id.id).id; |
| 567 | |
| 568 | const auto forward_weights = datafacade.GetUncompressedForwardWeights(geometry_id); |
| 569 | if (forward_weights[data.fwd_segment_position] != INVALID_SEGMENT_WEIGHT) |
| 570 | { |
| 571 | forward_edge_valid = data.forward_segment_id.enabled; |
| 572 | } |
| 573 | |
| 574 | const auto reverse_weights = datafacade.GetUncompressedReverseWeights(geometry_id); |
| 575 | if (reverse_weights[reverse_weights.size() - data.fwd_segment_position - 1] != |
| 576 | INVALID_SEGMENT_WEIGHT) |
| 577 | { |
| 578 | reverse_edge_valid = data.reverse_segment_id.enabled; |
| 579 | } |
| 580 | |
| 581 | forward_edge_valid = forward_edge_valid && (data.is_startpoint || use_all_edges); |
| 582 | reverse_edge_valid = reverse_edge_valid && (data.is_startpoint || use_all_edges); |
| 583 | |
| 584 | return std::make_pair(forward_edge_valid, reverse_edge_valid); |
| 585 | } |
| 586 | |
| 587 | bool IsTinyComponent(const CandidateSegment &segment) const |
| 588 | { |
nothing calls this directly
no test coverage detected