From 5128d2f1e53098004090b48d4fb7d4616343cb90 Mon Sep 17 00:00:00 2001 From: "andreas.schildbach" Date: Sat, 9 Oct 2010 13:57:35 +0000 Subject: [PATCH] parse special address case git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@261 0924bc21-9374-b0fa-ee44-9ff1593b38f0 --- src/de/schildbach/pte/AbstractEfaProvider.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/de/schildbach/pte/AbstractEfaProvider.java b/src/de/schildbach/pte/AbstractEfaProvider.java index 7bd9f33b..0d70dc33 100644 --- a/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/src/de/schildbach/pte/AbstractEfaProvider.java @@ -106,6 +106,12 @@ public abstract class AbstractEfaProvider implements NetworkProvider final String anyType = pp.getAttributeValue(null, "anyType"); final String idStr = pp.getAttributeValue(null, "id"); final String stopIdStr = pp.getAttributeValue(null, "stopID"); + int lat = 0, lon = 0; + if ("WGS84".equals(pp.getAttributeValue(null, "mapName"))) + { + lat = Integer.parseInt(pp.getAttributeValue(null, "y")); + lon = Integer.parseInt(pp.getAttributeValue(null, "x")); + } LocationType type; int id; @@ -134,18 +140,16 @@ public abstract class AbstractEfaProvider implements NetworkProvider type = LocationType.STATION; id = Integer.parseInt(stopIdStr); } + else if (stopIdStr == null && idStr == null && (lat != 0 || lon != 0)) + { + type = LocationType.ADDRESS; + id = 0; + } else { throw new IllegalArgumentException("unknown type: " + anyType + " " + idStr + " " + stopIdStr); } - int lat = 0, lon = 0; - if ("WGS84".equals(pp.getAttributeValue(null, "mapName"))) - { - lat = Integer.parseInt(pp.getAttributeValue(null, "y")); - lon = Integer.parseInt(pp.getAttributeValue(null, "x")); - } - final String name = normalizeLocationName(pp.nextText()); return new Location(type, id, lat, lon, name);