Class BRouterRouteLengthComputer

java.lang.Object
slash.navigation.converter.cmdline.BRouterRouteLengthComputer
All Implemented Interfaces:
RouteLengthComputer

public class BRouterRouteLengthComputer extends Object implements RouteLengthComputer
BRouter-backed RouteLengthComputer for the analyze command (specs/00055 P2b). Route-characteristic position lists (planned routes) are routed on-road with BRouter and reported as routed; every other list (recorded tracks, loose waypoints) is delegated to the point-to-point PointToPointLengthComputer.

A Route list is routed in a single call over all of its coordinates, and the total on-road distance is reported. If the route cannot be routed (no segment coverage, routing error, timeout, missing profile) the whole list falls back to the straight-line length, so the label never over-promises and a partially-covered route is never reported as a mix. Routing failures never propagate: computeLength(slash.navigation.base.BaseRoute<?, ?>) never throws for a routing problem, so the analyzer always emits its JSON.

The actual routing is behind the BRouterRouteLengthComputer.RouteRouter seam. The production seam is BRouterRouteRouter, which drives BRouter's RoutingContext/RoutingEngine over the whole waypoint list like slash.navigation.brouter.BRouter#getRouteBetween. Tests inject a fake BRouterRouteLengthComputer.RouteRouter to exercise the routed/fallback logic without real .rd5 segments.

Author:
Christian Pesch
  • Constructor Details

    • BRouterRouteLengthComputer

      public BRouterRouteLengthComputer(File segmentsDirectory)
      Production constructor: routes with BRouter against the given .rd5 segments directory using the bundled default profile.
  • Method Details