use JSON stopfinder for San Francisco

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@881 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2012-01-21 10:53:06 +00:00
parent f825c5f3f3
commit e6078baf79
2 changed files with 5 additions and 3 deletions

View file

@ -159,7 +159,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
String type = stop.getString("type"); String type = stop.getString("type");
if ("any".equals(type)) if ("any".equals(type))
type = stop.getString("anyType"); type = stop.getString("anyType");
final String name = stop.getString("object"); final String name = normalizeLocationName(stop.getString("object"));
final JSONObject ref = stop.getJSONObject("ref"); final JSONObject ref = stop.getJSONObject("ref");
String place = ref.getString("place"); String place = ref.getString("place");
if (place != null && place.length() == 0) if (place != null && place.length() == 0)
@ -183,8 +183,10 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
results.add(new Location(LocationType.STATION, stop.getInt("stateless"), lat, lon, place, name)); results.add(new Location(LocationType.STATION, stop.getInt("stateless"), lat, lon, place, name));
else if ("poi".equals(type)) else if ("poi".equals(type))
results.add(new Location(LocationType.POI, 0, lat, lon, place, name)); results.add(new Location(LocationType.POI, 0, lat, lon, place, name));
else if ("crossing".equals(type))
results.add(new Location(LocationType.ADDRESS, 0, lat, lon, place, name));
else if ("street".equals(type) || "address".equals(type) || "singlehouse".equals(type)) else if ("street".equals(type) || "address".equals(type) || "singlehouse".equals(type))
results.add(new Location(LocationType.ADDRESS, 0, lat, lon, place, stop.getString("name"))); results.add(new Location(LocationType.ADDRESS, 0, lat, lon, place, normalizeLocationName(stop.getString("name"))));
else else
throw new IllegalArgumentException("unknown type: " + type + " on " + uri); throw new IllegalArgumentException("unknown type: " + type + " on " + uri);
} }

View file

@ -73,7 +73,7 @@ public class SfProvider extends AbstractEfaProvider
@Override @Override
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
{ {
return xmlStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString())); return jsonStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
} }
@Override @Override