parse float coordinate values

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@753 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-08-24 08:33:37 +00:00
parent 4242eded41
commit bfdfeb828f

View file

@ -354,8 +354,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
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 = Math.round(XmlPullUtil.floatAttr(pp, "y"));
lon = Integer.parseInt(pp.getAttributeValue(null, "x")); lon = Math.round(XmlPullUtil.floatAttr(pp, "x"));
} }
LocationType type; LocationType type;
@ -419,8 +419,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
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 = Math.round(XmlPullUtil.floatAttr(pp, "y"));
lon = Integer.parseInt(pp.getAttributeValue(null, "x")); lon = Math.round(XmlPullUtil.floatAttr(pp, "x"));
} }
final String place = normalizeLocationName(XmlPullUtil.attr(pp, "place")); final String place = normalizeLocationName(XmlPullUtil.attr(pp, "place"));
@ -483,8 +483,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
// final String parsedLongName = normalizeLocationName(XmlPullUtil.attr(pp, // final String parsedLongName = normalizeLocationName(XmlPullUtil.attr(pp,
// "nameWithPlace")); // "nameWithPlace"));
final String parsedPlace = normalizeLocationName(XmlPullUtil.attr(pp, "place")); final String parsedPlace = normalizeLocationName(XmlPullUtil.attr(pp, "place"));
final int parsedLon = XmlPullUtil.intAttr(pp, "x"); final int parsedLon = Math.round(XmlPullUtil.floatAttr(pp, "x"));
final int parsedLat = XmlPullUtil.intAttr(pp, "y"); final int parsedLat = Math.round(XmlPullUtil.floatAttr(pp, "y"));
XmlPullUtil.enter(pp, "itdOdvAssignedStop"); XmlPullUtil.enter(pp, "itdOdvAssignedStop");
final String parsedName = normalizeLocationName(pp.getText()); final String parsedName = normalizeLocationName(pp.getText());
XmlPullUtil.exit(pp, "itdOdvAssignedStop"); XmlPullUtil.exit(pp, "itdOdvAssignedStop");
@ -1157,8 +1157,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
final String mapName = pp.getAttributeValue(null, "mapName"); final String mapName = pp.getAttributeValue(null, "mapName");
if (mapName == null || !"WGS84".equals(mapName)) if (mapName == null || !"WGS84".equals(mapName))
throw new IllegalStateException("unknown mapName: " + mapName); throw new IllegalStateException("unknown mapName: " + mapName);
final int lon = XmlPullUtil.intAttr(pp, "x"); final int lon = Math.round(XmlPullUtil.floatAttr(pp, "x"));
final int lat = XmlPullUtil.intAttr(pp, "y"); final int lat = Math.round(XmlPullUtil.floatAttr(pp, "y"));
// final String name = normalizeLocationName(XmlPullUtil.attr(pp, "nameWO")); // final String name = normalizeLocationName(XmlPullUtil.attr(pp, "nameWO"));
assignedStationDepartures = new StationDepartures(new Location(LocationType.STATION, assignedStopId, lat, lon), assignedStationDepartures = new StationDepartures(new Location(LocationType.STATION, assignedStopId, lat, lon),
@ -1244,8 +1244,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
final int lat, lon; final int lat, lon;
if ("WGS84".equals(pp.getAttributeValue(null, "mapName"))) if ("WGS84".equals(pp.getAttributeValue(null, "mapName")))
{ {
lat = Integer.parseInt(pp.getAttributeValue(null, "y")); lat = Math.round(XmlPullUtil.floatAttr(pp, "y"));
lon = Integer.parseInt(pp.getAttributeValue(null, "x")); lon = Math.round(XmlPullUtil.floatAttr(pp, "x"));
} }
else else
{ {