mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-20 17:29:51 +00:00
Use common method for querying for nearby stations (Hafas).
This commit is contained in:
parent
fc91b8c7cb
commit
31b89f7ef8
26 changed files with 34 additions and 336 deletions
|
@ -17,11 +17,6 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
/**
|
||||
|
@ -137,28 +132,6 @@ public class LuProvider extends AbstractHafasProvider
|
|||
return super.splitPlaceAndName(name);
|
||||
}
|
||||
|
||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||
{
|
||||
if (location.hasLocation())
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(queryEndpoint);
|
||||
uri.append(jsonNearbyStationsParameters(location, maxDistance, maxStations));
|
||||
|
||||
return jsonNearbyStations(uri.toString());
|
||||
}
|
||||
else if (location.type == LocationType.STATION && location.hasId())
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlNearbyStationsParameters(location.id));
|
||||
|
||||
return xmlNearbyStations(uri.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("cannot handle: " + location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue