Class DirectionResolver

java.lang.Object
com.graphhopper.routing.DirectionResolver

public class DirectionResolver extends Object
This class is used to determine the pairs of edges that go into/out of a node of the routing graph. Two such pairs are determined: One pair for the case a given coordinate should be right of a vehicle driving into/out of the node and one pair for the case where the coordinate is on the left.

Example:

.a x b --- o ---

If the location 'x' should be on the left side the incoming edge would be 'a' and the outgoing edge would be 'b'. If the location 'x' should be on the right side the incoming edge would be 'b' and the outgoing edge would be 'a'.

The returned edge IDs can have some special values: we use EdgeIterator.NO_EDGE to indicate it is not possible to arrive or leave a location in a certain direction and EdgeIterator.ANY_EDGE if there was no clear way to determine an edge id.

There are a few special cases: - if it is not possible to determine a clear result, such as for junctions with multiple adjacent edges we return DirectionResolverResult.unrestricted()} - if there is no way to reach or leave a location at all we return DirectionResolverResult.impossible() - for locations where the location can only possibly be on the left or right side (such as one-ways we return DirectionResolverResult.onlyLeft(int, int) or DirectionResolverResult.onlyRight(int, int)

  • Constructor Details

  • Method Details

    • resolveDirections

      public DirectionResolverResult resolveDirections(int node, GHPoint location)
      Parameters:
      node - the node for which the incoming/outgoing edges should be determined
      location - the location next to the road relative to which the 'left' and 'right' side edges should be determined
      See Also: