fixed coordinate parsing

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@731 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-07-14 13:51:09 +00:00
parent 0196c720cd
commit 78883e8f46

View file

@ -649,13 +649,13 @@ public final class BvgProvider extends AbstractHafasProvider
private static final Pattern P_CONNECTIONS_HEAD = Pattern.compile(".*?" // private static final Pattern P_CONNECTIONS_HEAD = Pattern.compile(".*?" //
+ "<td headers=\"ivuAnfFrom\"[^>]*>\n" // + "<td headers=\"ivuAnfFrom\"[^>]*>\n" //
+ "(?:([^\n]*)\n)?" // from name + "(?:([^\n]*)\n)?" // from name
+ "<a href=\"/Fahrinfo/[^\"]*?MapLocation\\.X=(\\d+)&MapLocation\\.Y=(\\d+)&[^\"]*?" // from lat, lon + "<a href=\"/Fahrinfo/[^\"]*?MapLocation\\.X=(\\d+)&MapLocation\\.Y=(\\d+)&[^\"]*?" // from lon, lat
+ "MapLocation\\.type=(\\w*)&(?:MapLocation.extId=(\\d+)&)?.*?" // from type, id + "MapLocation\\.type=(\\w*)&(?:MapLocation.extId=(\\d+)&)?.*?" // from type, id
+ "(?:<td headers=\"ivuAnfVia1\"[^>]*>\n" // + "(?:<td headers=\"ivuAnfVia1\"[^>]*>\n" //
+ "([^\n]*)<.*?)?" // via name + "([^\n]*)<.*?)?" // via name
+ "<td headers=\"ivuAnfTo\"[^>]*>\n" // + "<td headers=\"ivuAnfTo\"[^>]*>\n" //
+ "(?:([^\n]*)\n)?" // to name + "(?:([^\n]*)\n)?" // to name
+ "<a href=\"/Fahrinfo/[^\"]*?MapLocation\\.X=(\\d+)&MapLocation\\.Y=(\\d+)&[^\"]*?" // to lat, lon + "<a href=\"/Fahrinfo/[^\"]*?MapLocation\\.X=(\\d+)&MapLocation\\.Y=(\\d+)&[^\"]*?" // to lon, lat
+ "MapLocation\\.type=(\\w*)&(?:MapLocation.extId=(\\d+)&)?.*?" // to type, id + "MapLocation\\.type=(\\w*)&(?:MapLocation.extId=(\\d+)&)?.*?" // to type, id
+ "<td headers=\"ivuAnfTime\"[^>]*>.., (\\d{2}\\.\\d{2}\\.\\d{2}) \\d{1,2}:\\d{2}</td>.*?" // date + "<td headers=\"ivuAnfTime\"[^>]*>.., (\\d{2}\\.\\d{2}\\.\\d{2}) \\d{1,2}:\\d{2}</td>.*?" // date
+ "(?:<a href=\"([^\"]*)\" title=\"fr&uuml;here Verbindungen\"[^>]*?>.*?)?" // linkEarlier + "(?:<a href=\"([^\"]*)\" title=\"fr&uuml;here Verbindungen\"[^>]*?>.*?)?" // linkEarlier
@ -708,10 +708,10 @@ public final class BvgProvider extends AbstractHafasProvider
final Matcher mHead = P_CONNECTIONS_HEAD.matcher(page); final Matcher mHead = P_CONNECTIONS_HEAD.matcher(page);
if (mHead.matches()) if (mHead.matches())
{ {
final Location from = mHead.group(1) != null ? location(mHead.group(4), mHead.group(5), mHead.group(2), mHead.group(3), final Location from = mHead.group(1) != null ? location(mHead.group(4), mHead.group(5), mHead.group(3), mHead.group(2),
ParserUtils.resolveEntities(mHead.group(1))) : null; ParserUtils.resolveEntities(mHead.group(1))) : null;
final Location via = mHead.group(6) != null ? location(null, null, null, null, ParserUtils.resolveEntities(mHead.group(6))) : null; final Location via = mHead.group(6) != null ? location(null, null, null, null, ParserUtils.resolveEntities(mHead.group(6))) : null;
final Location to = mHead.group(7) != null ? location(mHead.group(10), mHead.group(11), mHead.group(8), mHead.group(9), final Location to = mHead.group(7) != null ? location(mHead.group(10), mHead.group(11), mHead.group(9), mHead.group(8),
ParserUtils.resolveEntities(mHead.group(7))) : null; ParserUtils.resolveEntities(mHead.group(7))) : null;
final Calendar currentDate = new GregorianCalendar(timeZone()); final Calendar currentDate = new GregorianCalendar(timeZone());
currentDate.clear(); currentDate.clear();