mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
Navitia: Find products for nearby stations
This commit is contained in:
parent
d6d3371de2
commit
4566bf3cfb
2 changed files with 18 additions and 2 deletions
|
@ -257,7 +257,18 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
|||
if (admin.length() > 0)
|
||||
place = Strings.emptyToNull(admin.getJSONObject(0).optString("name"));
|
||||
}
|
||||
return new Location(type, id, point, place, name);
|
||||
Set<Product> products = null;
|
||||
if (location.has("stop_area") && location.getJSONObject("stop_area").has("physical_modes"))
|
||||
{
|
||||
products = EnumSet.noneOf(Product.class);
|
||||
JSONArray physicalModes = location.getJSONObject("stop_area").getJSONArray("physical_modes");
|
||||
for (int i = 0; i < physicalModes.length(); i++) {
|
||||
JSONObject mode = physicalModes.getJSONObject(i);
|
||||
Product product = parseLineProductFromMode(mode.getString("id"));
|
||||
if (product != null) products.add(product);
|
||||
}
|
||||
}
|
||||
return new Location(type, id, point, place, name, products);
|
||||
}
|
||||
catch (final JSONException jsonExc)
|
||||
{
|
||||
|
@ -853,7 +864,7 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
|||
queryUri.append("&distance=").append(maxDistance);
|
||||
if (maxLocations > 0)
|
||||
queryUri.append("&count=").append(maxLocations);
|
||||
queryUri.append("&depth=0");
|
||||
queryUri.append("&depth=3");
|
||||
final CharSequence page = httpClient.get(queryUri.toString());
|
||||
|
||||
try
|
||||
|
|
|
@ -70,6 +70,11 @@ public final class Location implements Serializable
|
|||
this(type, id, lat, lon, place, name, null);
|
||||
}
|
||||
|
||||
public Location(final LocationType type, final String id, final Point coord, final String place, final String name, final Set<Product> products)
|
||||
{
|
||||
this(type, id, coord != null ? coord.lat : 0, coord != null ? coord.lon : 0, place, name, products);
|
||||
}
|
||||
|
||||
public Location(final LocationType type, final String id, final Point coord, final String place, final String name)
|
||||
{
|
||||
this(type, id, coord != null ? coord.lat : 0, coord != null ? coord.lon : 0, place, name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue