BearingPointCalculator { public GeoCoordinates calculateBearingDestinationInDirection(Line lrpLine, int bearingDistance, int projectionAlongLine) { return getBearingDestination(lrpLine, lrpLine.getLineLength() - projectionAlongLine, true, bearingDistance); }  GeoCoordinates calculateBearingDestinationInDirection(Line lrpLine, int bearingDistance, int projectionAlongLine); GeoCoordinates calculateBearingDestinationAgainstDirection(Line lrpLine, int bearingDistance, int projectionAlongLine);  }
@Test public void testBearingDestinationAlongLocationDirection() { Line lrpLine = mapDatabase.getLine(3L); int projectionAlongLine = 70; GeoCoordinates bearingDestinationInDirection = bearingPointCalculator.calculateBearingDestinationInDirection(lrpLine, bearingDistance, projectionAlongLine); int distanceAlongSuccessorLine = bearingDistance - (lrpLine.getLineLength() - projectionAlongLine); assertEquals(bearingDestinationInDirection, mapDatabase.getLine(4L).getGeoCoordinateAlongLine(distanceAlongSuccessorLine)); }
@Test public void testBearingDestinationAtIntersectionInDirection() { Line lrpLine = mapDatabase.getLine(1L); int projectionAlongLine = 70; assertEquals(bearingPointCalculator.calculateBearingDestinationInDirection(lrpLine, bearingDistance, projectionAlongLine), lrpLine.getEndNode().getGeoCoordinates()); }
@Test public void testBearingDestinationAtLrpLineInDirection() { Line lrpLine = mapDatabase.getLine(6L); assertEquals(bearingPointCalculator.calculateBearingDestinationInDirection(lrpLine, bearingDistance, 0), lrpLine.getGeoCoordinateAlongLine(bearingDistance)); }
@Test public void testBearingRouteAlongMultipleRoadSegments() { Line lrpLine = multiWalkMapDatabase.getLine(1L); Line bearingDestination = multiWalkMapDatabase.getLine(6L); assertEquals(bearingPointCalculator.calculateBearingDestinationInDirection(lrpLine, 500, 0), bearingDestination.getEndNode().getGeoCoordinates()); }