mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 00:30:31 +00:00
distance in footways
This commit is contained in:
parent
fb34a5920d
commit
ae4d78cbbc
5 changed files with 24 additions and 9 deletions
|
@ -1929,6 +1929,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
||||||
|
|
||||||
while (XmlPullUtil.test(pp, "itdPartialRoute"))
|
while (XmlPullUtil.test(pp, "itdPartialRoute"))
|
||||||
{
|
{
|
||||||
|
final int distance = XmlPullUtil.optIntAttr(pp, "distance", 0);
|
||||||
XmlPullUtil.enter(pp, "itdPartialRoute");
|
XmlPullUtil.enter(pp, "itdPartialRoute");
|
||||||
|
|
||||||
XmlPullUtil.test(pp, "itdPoint");
|
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);
|
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
|
||||||
if (path != null && lastFootway.path != null)
|
if (path != null && lastFootway.path != null)
|
||||||
path.addAll(0, lastFootway.path);
|
path.addAll(0, lastFootway.path);
|
||||||
parts.add(new Connection.Footway(lastFootway.min + min, lastFootway.transfer || transfer, lastFootway.departure, arrival,
|
parts.add(new Connection.Footway(lastFootway.min + min, distance, lastFootway.transfer || transfer,
|
||||||
path));
|
lastFootway.departure, arrival, path));
|
||||||
}
|
}
|
||||||
else
|
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
|
else if ("gesicherter Anschluss".equals(productName) || "nicht umsteigen".equals(productName)) // type97
|
||||||
|
|
|
@ -1292,11 +1292,11 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
||||||
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
|
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
|
||||||
{
|
{
|
||||||
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
|
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
|
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)
|
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
|
||||||
{
|
{
|
||||||
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
|
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);
|
arrival, null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
part = new Connection.Footway(min, transfer, departure, arrival, null);
|
part = new Connection.Footway(min, 0, transfer, departure, arrival, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
|
|
|
@ -416,7 +416,7 @@ public class SadProvider extends AbstractNetworkProvider {
|
||||||
// Add footway to parts list
|
// Add footway to parts list
|
||||||
if (isFootway) {
|
if (isFootway) {
|
||||||
// NOTE: path is set to null
|
// 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
|
soapToLocation((SoapObject) tratto.getProperty("nodo_partenza")), soapToLocation((SoapObject) tratto
|
||||||
.getProperty("nodo_arrivo")), null));
|
.getProperty("nodo_arrivo")), null));
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,13 +353,16 @@ public final class Connection implements Serializable
|
||||||
private static final long serialVersionUID = -6651381862837233925L;
|
private static final long serialVersionUID = -6651381862837233925L;
|
||||||
|
|
||||||
public final int min;
|
public final int min;
|
||||||
|
public final int distance;
|
||||||
public final boolean transfer;
|
public final boolean transfer;
|
||||||
|
|
||||||
public Footway(final int min, final boolean transfer, final Location departure, final Location arrival, final List<Point> path)
|
public Footway(final int min, final int distance, final boolean transfer, final Location departure, final Location arrival,
|
||||||
|
final List<Point> path)
|
||||||
{
|
{
|
||||||
super(departure, arrival, path);
|
super(departure, arrival, path);
|
||||||
|
|
||||||
this.min = min;
|
this.min = min;
|
||||||
|
this.distance = distance;
|
||||||
this.transfer = transfer;
|
this.transfer = transfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,6 +372,8 @@ public final class Connection implements Serializable
|
||||||
final StringBuilder builder = new StringBuilder(getClass().getName() + "[");
|
final StringBuilder builder = new StringBuilder(getClass().getName() + "[");
|
||||||
builder.append("min=").append(min);
|
builder.append("min=").append(min);
|
||||||
builder.append(",");
|
builder.append(",");
|
||||||
|
builder.append("distance=").append(distance);
|
||||||
|
builder.append(",");
|
||||||
builder.append("transfer=").append(transfer);
|
builder.append("transfer=").append(transfer);
|
||||||
builder.append(",");
|
builder.append(",");
|
||||||
builder.append("departure=").append(departure.toDebugString());
|
builder.append("departure=").append(departure.toDebugString());
|
||||||
|
|
|
@ -107,6 +107,15 @@ public final class XmlPullUtil
|
||||||
return Integer.parseInt(pp.getAttributeValue(null, attrName).trim());
|
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)
|
public static float floatAttr(final XmlPullParser pp, final String attrName)
|
||||||
{
|
{
|
||||||
return Float.parseFloat(pp.getAttributeValue(null, attrName).trim());
|
return Float.parseFloat(pp.getAttributeValue(null, attrName).trim());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue