mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 09:00:36 +00:00
fixed bad parsing of stops in odvNameElems
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@260 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
f915eae84d
commit
f33f266a61
1 changed files with 33 additions and 23 deletions
|
@ -105,22 +105,49 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
{
|
{
|
||||||
final String anyType = pp.getAttributeValue(null, "anyType");
|
final String anyType = pp.getAttributeValue(null, "anyType");
|
||||||
final String idStr = pp.getAttributeValue(null, "id");
|
final String idStr = pp.getAttributeValue(null, "id");
|
||||||
int id = 0;
|
final String stopIdStr = pp.getAttributeValue(null, "stopID");
|
||||||
if (idStr != null)
|
|
||||||
|
LocationType type;
|
||||||
|
int id;
|
||||||
|
if ("stop".equals(anyType))
|
||||||
|
{
|
||||||
|
type = LocationType.STATION;
|
||||||
id = Integer.parseInt(idStr);
|
id = Integer.parseInt(idStr);
|
||||||
if (id < 0)
|
}
|
||||||
|
else if ("poi".equals(anyType))
|
||||||
|
{
|
||||||
|
type = LocationType.POI;
|
||||||
|
id = Integer.parseInt(idStr);
|
||||||
|
}
|
||||||
|
else if ("loc".equals(anyType))
|
||||||
|
{
|
||||||
|
type = LocationType.ANY;
|
||||||
id = 0;
|
id = 0;
|
||||||
|
}
|
||||||
|
else if ("street".equals(anyType) || "address".equals(anyType) || "singlehouse".equals(anyType))
|
||||||
|
{
|
||||||
|
type = LocationType.ADDRESS;
|
||||||
|
id = 0;
|
||||||
|
}
|
||||||
|
else if (stopIdStr != null)
|
||||||
|
{
|
||||||
|
type = LocationType.STATION;
|
||||||
|
id = Integer.parseInt(stopIdStr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("unknown type: " + anyType + " " + idStr + " " + stopIdStr);
|
||||||
|
}
|
||||||
|
|
||||||
int lat = 0, lon = 0;
|
int lat = 0, lon = 0;
|
||||||
if ("WGS84".equals(pp.getAttributeValue(null, "mapName")))
|
if ("WGS84".equals(pp.getAttributeValue(null, "mapName")))
|
||||||
{
|
{
|
||||||
lat = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
lat = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||||
lon = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
lon = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final String name = normalizeLocationName(pp.nextText());
|
final String name = normalizeLocationName(pp.nextText());
|
||||||
|
|
||||||
LocationType type = LocationType.ADDRESS;
|
|
||||||
if (anyType != null)
|
|
||||||
type = type(anyType);
|
|
||||||
return new Location(type, id, lat, lon, name);
|
return new Location(type, id, lat, lon, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,23 +164,6 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
return new Location(LocationType.STATION, id, lat, lon, name);
|
return new Location(LocationType.STATION, id, lat, lon, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LocationType type(final String type)
|
|
||||||
{
|
|
||||||
if (type.equals("stop"))
|
|
||||||
return LocationType.STATION;
|
|
||||||
if (type.equals("poi"))
|
|
||||||
return LocationType.POI;
|
|
||||||
if (type.equals("loc"))
|
|
||||||
return LocationType.ANY;
|
|
||||||
if (type.equals("street"))
|
|
||||||
return LocationType.ADDRESS;
|
|
||||||
if (type.equals("singlehouse"))
|
|
||||||
return LocationType.ADDRESS;
|
|
||||||
if (type.equals("address"))
|
|
||||||
return LocationType.ADDRESS;
|
|
||||||
throw new IllegalArgumentException("unknown type: " + type);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Pattern P_NEARBY_MESSAGES = Pattern.compile("(unsere Server zur Zeit ausgelastet)");
|
private static final Pattern P_NEARBY_MESSAGES = Pattern.compile("(unsere Server zur Zeit ausgelastet)");
|
||||||
|
|
||||||
protected abstract String nearbyLatLonUri(int lat, int lon);
|
protected abstract String nearbyLatLonUri(int lat, int lon);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue