osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

Refactor `isThroughStreet`/Intersection options

Open MoKob opened this issue 9 years ago • 3 comments

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.

MoKob avatar Dec 23 '16 07:12 MoKob

Related: https://github.com/Project-OSRM/osrm-backend/issues/3102

daniel-j-h avatar Jan 06 '17 15:01 daniel-j-h

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_edge over std::find on intersection
  • [x] Move Intersection::isThroughStreet to own file/free function and template the type of Intersection.

TheMarex avatar Dec 05 '17 13:12 TheMarex

@TheMarex is this good to close? Or is there more to do here?

ghoshkaj avatar Jan 19 '18 18:01 ghoshkaj