From 2a1df9b0411771b2e298634c2c08c7d1e9c70ffd Mon Sep 17 00:00:00 2001 From: "andreas.schildbach@gmail.com" Date: Sun, 30 Jan 2011 12:15:43 +0000 Subject: [PATCH] filter unassociated serving lines git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@472 0924bc21-9374-b0fa-ee44-9ff1593b38f0 --- .../schildbach/pte/AbstractEfaProvider.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/de/schildbach/pte/AbstractEfaProvider.java b/src/de/schildbach/pte/AbstractEfaProvider.java index 2b25a088..c90c5c73 100644 --- a/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/src/de/schildbach/pte/AbstractEfaProvider.java @@ -868,14 +868,23 @@ public abstract class AbstractEfaProvider implements NetworkProvider XmlPullUtil.enter(pp, "itdServingLines"); while (XmlPullUtil.test(pp, "itdServingLine")) { - final String destination = normalizeLocationName(pp.getAttributeValue(null, "direction")); - final String destinationIdStr = pp.getAttributeValue(null, "destID"); - final int destinationId = destinationIdStr.length() > 0 ? Integer.parseInt(destinationIdStr) : 0; + final String assignedStopId = pp.getAttributeValue(null, "assignedStopID"); + if (assignedStopId == null || Integer.parseInt(assignedStopId) == location.id) + { + final String destination = normalizeLocationName(pp.getAttributeValue(null, "direction")); + final String destinationIdStr = pp.getAttributeValue(null, "destID"); + final int destinationId = destinationIdStr.length() > 0 ? Integer.parseInt(destinationIdStr) : 0; - final String lineStr = processItdServingLine(pp); - final Line line = new Line(lineStr, lineColors(lineStr), destinationId, destination); - if (!lines.contains(line)) - lines.add(line); + final String lineStr = processItdServingLine(pp); + final Line line = new Line(lineStr, lineColors(lineStr), destinationId, destination); + if (!lines.contains(line)) + lines.add(line); + } + else + { + XmlPullUtil.enter(pp, "itdServingLine"); + XmlPullUtil.exit(pp, "itdServingLine"); + } } XmlPullUtil.exit(pp, "itdServingLines"); } @@ -892,7 +901,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider XmlPullUtil.enter(pp, "itdDepartureList"); while (XmlPullUtil.test(pp, "itdDeparture")) { - if (Integer.parseInt(pp.getAttributeValue(null, "stopID")) == location.id) + if (XmlPullUtil.intAttr(pp, "stopID") == location.id) { final String position = normalizePlatform(pp.getAttributeValue(null, "platform"), pp.getAttributeValue(null, "platformName"));