mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 18:39:50 +00:00
refactor pte to use int,int for coordinates
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@219 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
135b07f59e
commit
9af8c00ede
17 changed files with 69 additions and 106 deletions
|
@ -79,11 +79,11 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
+ "|distance=\"(\\d+)\" [^>]*? nameWithPlace=\"([^\"]*)\" [^>]*? stopID=\"(\\d+)\" [^>]*? x=\"(\\d+)\" y=\"(\\d+)\"" //
|
||||
+ ")");
|
||||
|
||||
protected abstract String nearbyLatLonUri(double lat, double lon);
|
||||
protected abstract String nearbyLatLonUri(int lat, int lon);
|
||||
|
||||
protected abstract String nearbyStationUri(String stationId);
|
||||
|
||||
public List<Station> nearbyStations(final String stationId, final double lat, final double lon, final int maxDistance, final int maxStations)
|
||||
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
|
||||
throws IOException
|
||||
{
|
||||
String uri = null;
|
||||
|
@ -103,8 +103,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
{
|
||||
final boolean firstSyntax = mNearby.group(1) != null;
|
||||
final int sId = Integer.parseInt(mNearby.group(firstSyntax ? 1 : 8));
|
||||
final double sLon = latLonToDouble(Integer.parseInt(mNearby.group(firstSyntax ? 2 : 9)));
|
||||
final double sLat = latLonToDouble(Integer.parseInt(mNearby.group(firstSyntax ? 3 : 10)));
|
||||
final int sLon = Integer.parseInt(mNearby.group(firstSyntax ? 2 : 9));
|
||||
final int sLat = Integer.parseInt(mNearby.group(firstSyntax ? 3 : 10));
|
||||
final String sName = mNearby.group(firstSyntax ? 4 : 7).trim();
|
||||
final int sDist = Integer.parseInt(mNearby.group(firstSyntax ? 5 : 6));
|
||||
|
||||
|
@ -118,11 +118,6 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
return stations.subList(0, maxStations);
|
||||
}
|
||||
|
||||
private static double latLonToDouble(final int value)
|
||||
{
|
||||
return (double) value / 1000000;
|
||||
}
|
||||
|
||||
private static final Pattern P_LINE_RE = Pattern.compile("RE\\d+");
|
||||
private static final Pattern P_LINE_RB = Pattern.compile("RB\\d+");
|
||||
private static final Pattern P_LINE_U = Pattern.compile("U\\d+");
|
||||
|
@ -423,4 +418,9 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
{
|
||||
return P_STATION_NAME_WHITESPACE.matcher(name).replaceAll(" ");
|
||||
}
|
||||
|
||||
protected static double latLonToDouble(final int value)
|
||||
{
|
||||
return (double) value / 1000000;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue