diff --git a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java index c2ea3691..d0dade04 100644 --- a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java @@ -1929,6 +1929,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider while (XmlPullUtil.test(pp, "itdPartialRoute")) { + final int distance = XmlPullUtil.optIntAttr(pp, "distance", 0); XmlPullUtil.enter(pp, "itdPartialRoute"); XmlPullUtil.test(pp, "itdPoint"); @@ -2013,12 +2014,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.transfer || transfer, lastFootway.departure, arrival, - path)); + parts.add(new Connection.Footway(lastFootway.min + min, distance, lastFootway.transfer || transfer, + lastFootway.departure, arrival, path)); } else { - parts.add(new Connection.Footway(min, transfer, departure, arrival, path)); + parts.add(new Connection.Footway(min, distance, transfer, departure, arrival, path)); } } else if ("gesicherter Anschluss".equals(productName) || "nicht umsteigen".equals(productName)) // type97 diff --git a/enabler/src/de/schildbach/pte/AbstractHafasProvider.java b/enabler/src/de/schildbach/pte/AbstractHafasProvider.java index 47707457..eb7b2fc0 100644 --- a/enabler/src/de/schildbach/pte/AbstractHafasProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractHafasProvider.java @@ -1292,11 +1292,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, false, lastFootway.departure, sectionArrival, null)); + parts.add(new Connection.Footway(lastFootway.min + min, 0, false, lastFootway.departure, sectionArrival, null)); } else { - parts.add(new Connection.Footway(min, false, sectionDeparture, sectionArrival, null)); + parts.add(new Connection.Footway(min, 0, false, sectionDeparture, sectionArrival, null)); } } } @@ -1844,12 +1844,12 @@ 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); - part = new Connection.Footway(lastFootway.min + min, lastFootway.transfer || transfer, lastFootway.departure, + part = new Connection.Footway(lastFootway.min + min, 0, lastFootway.transfer || transfer, lastFootway.departure, arrival, null); } else { - part = new Connection.Footway(min, transfer, departure, arrival, null); + part = new Connection.Footway(min, 0, transfer, departure, arrival, null); } } else if (type == 2) diff --git a/enabler/src/de/schildbach/pte/SadProvider.java b/enabler/src/de/schildbach/pte/SadProvider.java index 715122b3..1443149d 100644 --- a/enabler/src/de/schildbach/pte/SadProvider.java +++ b/enabler/src/de/schildbach/pte/SadProvider.java @@ -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]), false, + parts.add(new Footway(Integer.parseInt(tratto.getPropertyAsString("durata").split(":")[1]), 0, false, soapToLocation((SoapObject) tratto.getProperty("nodo_partenza")), soapToLocation((SoapObject) tratto .getProperty("nodo_arrivo")), null)); } diff --git a/enabler/src/de/schildbach/pte/dto/Connection.java b/enabler/src/de/schildbach/pte/dto/Connection.java index ed9a6bc9..ad1973a0 100644 --- a/enabler/src/de/schildbach/pte/dto/Connection.java +++ b/enabler/src/de/schildbach/pte/dto/Connection.java @@ -353,13 +353,16 @@ public final class Connection implements Serializable private static final long serialVersionUID = -6651381862837233925L; public final int min; + public final int distance; public final boolean transfer; - public Footway(final int min, final boolean transfer, final Location departure, final Location arrival, final List path) + public Footway(final int min, final int distance, final boolean transfer, final Location departure, final Location arrival, + final List path) { super(departure, arrival, path); this.min = min; + this.distance = distance; this.transfer = transfer; } @@ -369,6 +372,8 @@ public final class Connection implements Serializable final StringBuilder builder = new StringBuilder(getClass().getName() + "["); builder.append("min=").append(min); builder.append(","); + builder.append("distance=").append(distance); + builder.append(","); builder.append("transfer=").append(transfer); builder.append(","); builder.append("departure=").append(departure.toDebugString()); diff --git a/enabler/src/de/schildbach/pte/util/XmlPullUtil.java b/enabler/src/de/schildbach/pte/util/XmlPullUtil.java index 03a9591c..bfd0f765 100644 --- a/enabler/src/de/schildbach/pte/util/XmlPullUtil.java +++ b/enabler/src/de/schildbach/pte/util/XmlPullUtil.java @@ -107,6 +107,15 @@ public final class XmlPullUtil return Integer.parseInt(pp.getAttributeValue(null, attrName).trim()); } + public static int optIntAttr(final XmlPullParser pp, final String attrName, final int defaultValue) + { + final String attr = pp.getAttributeValue(null, attrName); + if (attr != null) + return Integer.parseInt(attr.trim()); + else + return defaultValue; + } + public static float floatAttr(final XmlPullParser pp, final String attrName) { return Float.parseFloat(pp.getAttributeValue(null, attrName).trim());