| 17 | namespace |
| 18 | { |
| 19 | bool ValidatePath(Graph::EdgeVector const & path, double const distanceToNextPoint, double const pathLengthTolerance) |
| 20 | { |
| 21 | double pathLen = 0.0; |
| 22 | for (auto const & e : path) |
| 23 | pathLen += EdgeLength(e); |
| 24 | |
| 25 | double pathDiffPercent = |
| 26 | AbsDifference(static_cast<double>(distanceToNextPoint), pathLen) / static_cast<double>(distanceToNextPoint); |
| 27 | |
| 28 | LOG(LDEBUG, ("Validating path:", LogAs2GisPath(path))); |
| 29 | |
| 30 | if (pathDiffPercent > pathLengthTolerance) |
| 31 | { |
| 32 | LOG(LDEBUG, ("Shortest path doest not meet required length constraints, error:", pathDiffPercent)); |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | return true; |
| 37 | } |
| 38 | } // namespace |
| 39 | |
| 40 | PathsConnector::PathsConnector(double pathLengthTolerance, Graph & graph, RoadInfoGetter & infoGetter, v2::Stats & stat) |
no test coverage detected