mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 09:00:36 +00:00
AbstractHafasClientInterfaceProvider: Fix parseLoc() could return STATION type for non-station locations.
This commit is contained in:
parent
f7a436c370
commit
6c78edea09
1 changed files with 5 additions and 3 deletions
|
@ -1023,6 +1023,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
||||||
throw new RuntimeException("Unknown type " + type + ": " + loc);
|
throw new RuntimeException("Unknown type " + type + ": " + loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Point coord;
|
||||||
final JSONObject crd = loc.optJSONObject("crd");
|
final JSONObject crd = loc.optJSONObject("crd");
|
||||||
if (crd != null) {
|
if (crd != null) {
|
||||||
final int crdSysX = loc.optInt("crdSysX", -1);
|
final int crdSysX = loc.optInt("crdSysX", -1);
|
||||||
|
@ -1031,11 +1032,12 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
||||||
if (!"WGS84".equals(crdSysType))
|
if (!"WGS84".equals(crdSysType))
|
||||||
throw new RuntimeException("unknown type: " + crdSysType);
|
throw new RuntimeException("unknown type: " + crdSysType);
|
||||||
}
|
}
|
||||||
return new Location(locationType, id, Point.from1E6(crd.getInt("y"), crd.getInt("x")), placeAndName[0],
|
coord = Point.from1E6(crd.getInt("y"), crd.getInt("x"));
|
||||||
placeAndName[1], products);
|
|
||||||
} else {
|
} else {
|
||||||
return new Location(LocationType.STATION, id, null, placeAndName[0], placeAndName[1], products);
|
coord = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Location(locationType, id, coord, placeAndName[0], placeAndName[1], products);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> parseOpList(final JSONArray opList) throws JSONException {
|
private List<String> parseOpList(final JSONArray opList) throws JSONException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue