distinguish between footway and transfer

This commit is contained in:
Andreas Schildbach 2012-08-10 14:04:11 +02:00
parent 86717d4c86
commit ad6d8b19cd
4 changed files with 19 additions and 9 deletions

View file

@ -1969,6 +1969,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
if ("Fussweg".equals(productName) || "Taxi".equals(productName))
{
final int min = (int) (arrivalTime.getTime() - departureTime.getTime()) / 1000 / 60;
final boolean transfer = "Taxi".equals(productName);
XmlPullUtil.enter(pp, "itdMeansOfTransport");
XmlPullUtil.exit(pp, "itdMeansOfTransport");
@ -1988,11 +1989,12 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
if (path != null && lastFootway.path != null)
path.addAll(0, lastFootway.path);
parts.add(new Connection.Footway(lastFootway.min + min, lastFootway.departure, arrival, path));
parts.add(new Connection.Footway(lastFootway.min + min, lastFootway.transfer || transfer, lastFootway.departure, arrival,
path));
}
else
{
parts.add(new Connection.Footway(min, departure, arrival, path));
parts.add(new Connection.Footway(min, transfer, departure, arrival, path));
}
}
else if ("gesicherter Anschluss".equals(productName) || "nicht umsteigen".equals(productName)) // type97

View file

@ -1273,11 +1273,11 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
{
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
parts.add(new Connection.Footway(lastFootway.min + min, lastFootway.departure, sectionArrival, null));
parts.add(new Connection.Footway(lastFootway.min + min, false, lastFootway.departure, sectionArrival, null));
}
else
{
parts.add(new Connection.Footway(min, sectionDeparture, sectionArrival, null));
parts.add(new Connection.Footway(min, false, sectionDeparture, sectionArrival, null));
}
}
}
@ -1812,15 +1812,17 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
if (type == 1 /* Fussweg */|| type == 3 /* Uebergang */|| type == 4 /* Uebergang */)
{
final int min = (int) ((plannedArrivalTime - plannedDepartureTime) / 1000 / 60);
final boolean transfer = type != 1;
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
{
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
part = new Connection.Footway(lastFootway.min + min, lastFootway.departure, arrival, null);
part = new Connection.Footway(lastFootway.min + min, lastFootway.transfer || transfer, lastFootway.departure, arrival,
null);
}
else
{
part = new Connection.Footway(min, departure, arrival, null);
part = new Connection.Footway(min, transfer, departure, arrival, null);
}
}

View file

@ -416,7 +416,7 @@ public class SadProvider extends AbstractNetworkProvider {
// Add footway to parts list
if (isFootway) {
// NOTE: path is set to null
parts.add(new Footway(Integer.parseInt(tratto.getPropertyAsString("durata").split(":")[1]),
parts.add(new Footway(Integer.parseInt(tratto.getPropertyAsString("durata").split(":")[1]), false,
soapToLocation((SoapObject) tratto.getProperty("nodo_partenza")), soapToLocation((SoapObject) tratto
.getProperty("nodo_arrivo")), null));
}

View file

@ -350,13 +350,17 @@ public final class Connection implements Serializable
public final static class Footway extends Part
{
public final int min;
private static final long serialVersionUID = -6651381862837233925L;
public Footway(final int min, final Location departure, final Location arrival, final List<Point> path)
public final int min;
public final boolean transfer;
public Footway(final int min, final boolean transfer, final Location departure, final Location arrival, final List<Point> path)
{
super(departure, arrival, path);
this.min = min;
this.transfer = transfer;
}
@Override
@ -365,6 +369,8 @@ public final class Connection implements Serializable
final StringBuilder builder = new StringBuilder(getClass().getName() + "[");
builder.append("min=").append(min);
builder.append(",");
builder.append("transfer=").append(transfer);
builder.append(",");
builder.append("departure=").append(departure.toDebugString());
builder.append(",");
builder.append("arrival=").append(arrival.toDebugString());