mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 17:09:51 +00:00
SH: Handle querying for nearby stations by coordinate.
This commit is contained in:
parent
26199d7ec3
commit
f8e1674ab6
2 changed files with 16 additions and 10 deletions
|
@ -145,16 +145,6 @@ public class ShProvider extends AbstractHafasProvider
|
|||
return super.splitStationName(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NearbyLocationsResult queryNearbyLocations(final EnumSet<LocationType> types, final Location location, final int maxDistance,
|
||||
final int maxLocations) throws IOException
|
||||
{
|
||||
if (location.type == LocationType.STATION && location.hasId())
|
||||
return nearbyStationsById(location.id, maxDistance);
|
||||
else
|
||||
throw new IllegalArgumentException("cannot handle: " + location);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NearbyLocationsResult nearbyStationsById(final String id, final int maxDistance) throws IOException
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package de.schildbach.pte.live;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -51,6 +52,21 @@ public class ShProviderLiveTest extends AbstractProviderLiveTest
|
|||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsInvalidStation() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "999999"));
|
||||
assertEquals(NearbyLocationsResult.Status.INVALID_ID, result.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(Location.coord(54325845, 10122920));
|
||||
print(result);
|
||||
assertTrue(result.locations.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue