mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 00:50:31 +00:00
resolve addresses without geolocation
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@537 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
acdec06e61
commit
5ce40b8a07
2 changed files with 23 additions and 3 deletions
|
@ -198,7 +198,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
public QueryConnectionsResult queryConnections(Location from, Location via, Location to, final Date date, final boolean dep,
|
||||
final String products, final WalkSpeed walkSpeed) throws IOException
|
||||
{
|
||||
if (from.type == LocationType.ANY)
|
||||
if (from.type == LocationType.ANY || (from.type == LocationType.ADDRESS && !from.hasLocation()))
|
||||
{
|
||||
final List<Location> autocompletes = autocompleteStations(from.name);
|
||||
if (autocompletes.isEmpty())
|
||||
|
@ -208,7 +208,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
from = autocompletes.get(0);
|
||||
}
|
||||
|
||||
if (via != null && via.type == LocationType.ANY)
|
||||
if (via != null && (via.type == LocationType.ANY || (via.type == LocationType.ADDRESS && !via.hasLocation())))
|
||||
{
|
||||
final List<Location> autocompletes = autocompleteStations(via.name);
|
||||
if (autocompletes.isEmpty())
|
||||
|
@ -218,7 +218,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
via = autocompletes.get(0);
|
||||
}
|
||||
|
||||
if (to.type == LocationType.ANY)
|
||||
if (to.type == LocationType.ANY || (to.type == LocationType.ADDRESS && !to.hasLocation()))
|
||||
{
|
||||
final List<Location> autocompletes = autocompleteStations(to.name);
|
||||
if (autocompletes.isEmpty())
|
||||
|
|
|
@ -46,6 +46,14 @@ public class SbbProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoCompleteAddress() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("Dorfstrasse 10, Dällikon, Schweiz");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
@ -99,4 +107,16 @@ public class SbbProviderLiveTest
|
|||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void connectionFromAddress() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ADDRESS, 0, null,
|
||||
"Dorfstrasse 10, Dällikon, Schweiz"), null, new Location(LocationType.STATION, 8500010, null, "Basel"), new Date(), true,
|
||||
ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue