mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 06:08:52 +00:00
Navitia: Add support for walking speed in queryTrips.
This commit is contained in:
parent
22804d9e4d
commit
54ea75fefc
2 changed files with 41 additions and 1 deletions
|
@ -991,9 +991,27 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
|||
final String dateString = printDate(date);
|
||||
final String dateTimeRep = dep ? "departure" : "arrival";
|
||||
|
||||
// Set walking speed.
|
||||
final double walkingSpeed;
|
||||
switch (walkSpeed)
|
||||
{
|
||||
case SLOW:
|
||||
walkingSpeed = 1.12 * 0.8;
|
||||
break;
|
||||
case NORMAL:
|
||||
walkingSpeed = 1.12;
|
||||
break;
|
||||
case FAST:
|
||||
walkingSpeed = 1.12 * 1.2;
|
||||
break;
|
||||
default:
|
||||
walkingSpeed = 1.12;
|
||||
break;
|
||||
}
|
||||
|
||||
final StringBuilder queryUri = new StringBuilder(tripUri() + "journeys?" + "from=" + ParserUtils.urlEncode(fromString) + "&to="
|
||||
+ ParserUtils.urlEncode(toString) + "&datetime=" + dateString + "&datetime_represents=" + dateTimeRep + "&count=1"
|
||||
+ "&depth=0");
|
||||
+ "&walking_speed=" + walkingSpeed + "&depth=0");
|
||||
|
||||
if (options != null && options.contains(Option.BIKE))
|
||||
{
|
||||
|
|
|
@ -258,6 +258,28 @@ public class ParisProviderLiveTest extends AbstractProviderLiveTest
|
|||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryTripSlowWalk() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, 48877095, 2378431), null, new Location(LocationType.ADDRESS,
|
||||
48847168, 2261272), new Date(), true, Product.ALL, WalkSpeed.SLOW, Accessibility.NEUTRAL);
|
||||
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryTripFastWalk() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, 48877095, 2378431), null, new Location(LocationType.ADDRESS,
|
||||
48847168, 2261272), new Date(), true, Product.ALL, WalkSpeed.FAST, Accessibility.NEUTRAL);
|
||||
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryMoreTrips() throws Exception
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue