mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +00:00
EFA: Silently ignore coordinates on other systems than WGS84.
This commit is contained in:
parent
40763ef6f6
commit
e48a68a240
1 changed files with 30 additions and 27 deletions
|
@ -554,7 +554,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider {
|
||||||
XmlPullUtil.enter(pp, "coordInfoItem");
|
XmlPullUtil.enter(pp, "coordInfoItem");
|
||||||
|
|
||||||
// FIXME this is always only one coordinate
|
// FIXME this is always only one coordinate
|
||||||
final Point coord = processItdPathCoordinates(pp).get(0);
|
final List<Point> path = processItdPathCoordinates(pp);
|
||||||
|
final Point coord = path != null ? path.get(0) : null;
|
||||||
|
|
||||||
XmlPullUtil.skipExit(pp, "coordInfoItem");
|
XmlPullUtil.skipExit(pp, "coordInfoItem");
|
||||||
|
|
||||||
|
@ -2828,20 +2829,23 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final String coord = intermediateParts[4];
|
final String coordPart = intermediateParts[4];
|
||||||
|
|
||||||
final Location location;
|
final Point coords;
|
||||||
if (!"::".equals(coord)) {
|
if (!"::".equals(coordPart)) {
|
||||||
final String[] coordParts = coord.split(":");
|
final String[] coordParts = coordPart.split(":");
|
||||||
if (!"WGS84".equals(coordParts[2]))
|
if ("WGS84".equals(coordParts[2])) {
|
||||||
throw new IllegalStateException("unknown map name: " + coordParts[2]);
|
final double lat = Double.parseDouble(coordParts[1]);
|
||||||
final double lat = Double.parseDouble(coordParts[1]);
|
final double lon = Double.parseDouble(coordParts[0]);
|
||||||
final double lon = Double.parseDouble(coordParts[0]);
|
coords = Point.fromDouble(lat, lon);
|
||||||
location = new Location(LocationType.STATION, id, Point.fromDouble(lat, lon),
|
} else {
|
||||||
null, name);
|
coords = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
location = new Location(LocationType.STATION, id, null, name);
|
coords = null;
|
||||||
}
|
}
|
||||||
|
final Location location = new Location(LocationType.STATION, id, coords, null,
|
||||||
|
name);
|
||||||
|
|
||||||
final Date plannedTime = plannedTimeCal.isSet(Calendar.HOUR_OF_DAY)
|
final Date plannedTime = plannedTimeCal.isSet(Calendar.HOUR_OF_DAY)
|
||||||
? plannedTimeCal.getTime() : null;
|
? plannedTimeCal.getTime() : null;
|
||||||
|
@ -2933,26 +2937,25 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider {
|
||||||
|
|
||||||
private List<Point> processItdPathCoordinates(final XmlPullParser pp) throws XmlPullParserException, IOException {
|
private List<Point> processItdPathCoordinates(final XmlPullParser pp) throws XmlPullParserException, IOException {
|
||||||
XmlPullUtil.enter(pp, "itdPathCoordinates");
|
XmlPullUtil.enter(pp, "itdPathCoordinates");
|
||||||
|
final List<Point> path;
|
||||||
|
|
||||||
final String ellipsoid = XmlPullUtil.valueTag(pp, "coordEllipsoid");
|
final String ellipsoid = XmlPullUtil.valueTag(pp, "coordEllipsoid");
|
||||||
if (!"WGS84".equals(ellipsoid))
|
if ("WGS84".equals(ellipsoid)) {
|
||||||
throw new IllegalStateException("unknown ellipsoid: " + ellipsoid);
|
final String type = XmlPullUtil.valueTag(pp, "coordType");
|
||||||
|
if (!"GEO_DECIMAL".equals(type))
|
||||||
final String type = XmlPullUtil.valueTag(pp, "coordType");
|
throw new IllegalStateException("unknown type: " + type);
|
||||||
if (!"GEO_DECIMAL".equals(type))
|
if (XmlPullUtil.test(pp, "itdCoordinateString")) {
|
||||||
throw new IllegalStateException("unknown type: " + type);
|
path = processCoordinateStrings(pp, "itdCoordinateString");
|
||||||
|
} else if (XmlPullUtil.test(pp, "itdCoordinateBaseElemList")) {
|
||||||
final List<Point> path;
|
path = processCoordinateBaseElems(pp);
|
||||||
if (XmlPullUtil.test(pp, "itdCoordinateString")) {
|
} else {
|
||||||
path = processCoordinateStrings(pp, "itdCoordinateString");
|
throw new IllegalStateException(pp.getPositionDescription());
|
||||||
} else if (XmlPullUtil.test(pp, "itdCoordinateBaseElemList")) {
|
}
|
||||||
path = processCoordinateBaseElems(pp);
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(pp.getPositionDescription());
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlPullUtil.skipExit(pp, "itdPathCoordinates");
|
XmlPullUtil.skipExit(pp, "itdPathCoordinates");
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3006,7 +3009,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!"WGS84".equals(mapName))
|
if (!"WGS84".equals(mapName))
|
||||||
throw new IllegalStateException("unknown mapName=" + mapName);
|
return null;
|
||||||
|
|
||||||
return new Point(y, x);
|
return new Point(y, x);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue