update the accumulator
| 36 | |
| 37 | // update the accumulator |
| 38 | void LengthLimitedCoordinateAccumulator::update(const NodeID from_node, |
| 39 | const EdgeID via_edge, |
| 40 | const NodeID /*to_node*/) |
| 41 | |
| 42 | { |
| 43 | auto current_coordinates = |
| 44 | coordinate_extractor.GetForwardCoordinatesAlongRoad(from_node, via_edge); |
| 45 | |
| 46 | const auto length = |
| 47 | util::coordinate_calculation::getLength(current_coordinates.begin(), |
| 48 | current_coordinates.end(), |
| 49 | util::coordinate_calculation::greatCircleDistance); |
| 50 | |
| 51 | // in case we get too many coordinates, we limit them to our desired length |
| 52 | if (length + accumulated_length > max_length) |
| 53 | current_coordinates = coordinate_extractor.TrimCoordinatesToLength( |
| 54 | std::move(current_coordinates), max_length - accumulated_length); |
| 55 | |
| 56 | coordinates.insert(coordinates.end(), current_coordinates.begin(), current_coordinates.end()); |
| 57 | |
| 58 | accumulated_length += length; |
| 59 | accumulated_length = std::min(accumulated_length, max_length); |
| 60 | } |
| 61 | |
| 62 | // --------------------------------------------------------------------------------- |
| 63 | SelectRoadByNameOnlyChoiceAndStraightness::SelectRoadByNameOnlyChoiceAndStraightness( |
no test coverage detected