Refactor `isThroughStreet`/Intersection options
Breaking out from https://github.com/Project-OSRM/osrm-backend/pull/3211
@daniel-j-h raised the following points in this context.
Also is this actually getting used at the moment? I thought about the function in the context of the isThroughStreet check. We have two of them (*)
bool isThroughStreet(const std::size_t index, const Intersection &intersection) const; // IntersectionHandler
bool isThroughStreet(const EdgeID from, const IntersectionView &intersection) const; // SliproadHandler
(disregard the Intersection vs IntersectionView difference for now)
Now in the SliproadHandler we only have the eid on the callsite, so I could use findEdge to get the road and then get the index with distance. But this would be expensive iterating all intersection roads i guess.
What's your take on our abstractions here, on what level of abstraction should (in this case) a through street be checked for?
(*)
- https://github.com/Project-OSRM/osrm-backend/blob/0a2f934c87b68fa09a5db7b7032f192a68cea5e9/include/extractor/guidance/intersection_handler.hpp#L92-L93
- https://github.com/Project-OSRM/osrm-backend/blob/0a2f934c87b68fa09a5db7b7032f192a68cea5e9/include/extractor/guidance/sliproad_handler.hpp#L54-L55
The general scope of what is attached to an intersection should be revisited.
Related: https://github.com/Project-OSRM/osrm-backend/issues/3102
This is an easy refactor that removes a duplicate implementation and potentially opens up to unit test this:
- [x] Remove
SliproadHandler::isThroughStreet - [x] Find index of
sliproad_edgeoverstd::findon intersection - [x] Move
Intersection::isThroughStreetto own file/free function and template the type ofIntersection.
@TheMarex is this good to close? Or is there more to do here?