parse special address case

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@261 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-10-09 13:57:35 +00:00
parent f33f266a61
commit 5128d2f1e5

View file

@ -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);