Introduce location type for plain coordinates.

This commit is contained in:
Andreas Schildbach 2015-01-27 13:41:24 +01:00
parent 71d88fcd18
commit 4b65f0145c
70 changed files with 186 additions and 174 deletions

View file

@ -470,7 +470,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
else if ("poi".equals(ty)) else if ("poi".equals(ty))
type = LocationType.POI; type = LocationType.POI;
else if ("loc".equals(ty)) else if ("loc".equals(ty))
type = LocationType.ADDRESS; type = LocationType.COORD;
else if ("street".equals(ty)) else if ("street".equals(ty))
type = LocationType.ADDRESS; type = LocationType.ADDRESS;
else if ("singlehouse".equals(ty)) else if ("singlehouse".equals(ty))
@ -833,6 +833,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
final String buildingName = XmlPullUtil.optAttr(pp, "buildingName", null); final String buildingName = XmlPullUtil.optAttr(pp, "buildingName", null);
final String buildingNumber = XmlPullUtil.optAttr(pp, "buildingNumber", null); final String buildingNumber = XmlPullUtil.optAttr(pp, "buildingNumber", null);
final String postCode = XmlPullUtil.optAttr(pp, "postCode", null); final String postCode = XmlPullUtil.optAttr(pp, "postCode", null);
final String streetName = XmlPullUtil.optAttr(pp, "streetName", null);
final Point coord = processCoordAttr(pp); final Point coord = processCoordAttr(pp);
final String nameElem = normalizeLocationName(XmlPullUtil.valueTag(pp, "odvNameElem")); final String nameElem = normalizeLocationName(XmlPullUtil.valueTag(pp, "odvNameElem"));
@ -844,42 +845,53 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
if ("stop".equals(type)) if ("stop".equals(type))
{ {
locationType = LocationType.STATION; locationType = LocationType.STATION;
place = locality; place = locality != null ? locality : defaultPlace;
name = objectName; name = objectName != null ? objectName : nameElem;
} }
else if ("poi".equals(type)) else if ("poi".equals(type))
{ {
locationType = LocationType.POI; locationType = LocationType.POI;
place = locality; place = locality != null ? locality : defaultPlace;
name = objectName; name = objectName != null ? objectName : nameElem;
} }
else if ("loc".equals(type)) else if ("loc".equals(type))
{ {
return null; if (coord != null)
{
locationType = LocationType.COORD;
place = null;
name = null;
}
else
{
locationType = LocationType.ADDRESS;
place = null;
name = locality;
}
} }
else if ("address".equals(type) || "singlehouse".equals(type)) else if ("address".equals(type) || "singlehouse".equals(type))
{ {
locationType = LocationType.ADDRESS; locationType = LocationType.ADDRESS;
place = locality; place = locality != null ? locality : defaultPlace;
name = objectName + (buildingNumber != null ? " " + buildingNumber : ""); name = objectName + (buildingNumber != null ? " " + buildingNumber : "");
} }
else if ("street".equals(type) || "crossing".equals(type)) else if ("street".equals(type) || "crossing".equals(type))
{ {
locationType = LocationType.ADDRESS; locationType = LocationType.ADDRESS;
place = locality; place = locality != null ? locality : defaultPlace;
name = objectName; name = objectName != null ? objectName : nameElem;
} }
else if ("postcode".equals(type)) else if ("postcode".equals(type))
{ {
locationType = LocationType.ADDRESS; locationType = LocationType.ADDRESS;
place = locality; place = locality != null ? locality : defaultPlace;
name = postCode; name = postCode;
} }
else if ("buildingname".equals(type)) else if ("buildingname".equals(type))
{ {
locationType = LocationType.ADDRESS; locationType = LocationType.ADDRESS;
place = locality; place = locality != null ? locality : defaultPlace;
name = buildingName; name = buildingName != null ? buildingName : streetName;
} }
else if ("coord".equals(type)) else if ("coord".equals(type))
{ {
@ -892,7 +904,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
throw new IllegalArgumentException("unknown type/anyType: " + type); throw new IllegalArgumentException("unknown type/anyType: " + type);
} }
return new Location(locationType, id, coord, place != null ? place : defaultPlace, name != null ? name : nameElem); return new Location(locationType, id, coord, place, name);
} }
private Location processItdOdvAssignedStop(final XmlPullParser pp) throws XmlPullParserException, IOException private Location processItdOdvAssignedStop(final XmlPullParser pp) throws XmlPullParserException, IOException
@ -3271,7 +3283,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
private void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix) private void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
{ {
if (location.type == LocationType.ADDRESS && location.hasLocation()) if ((location.type == LocationType.ADDRESS || location.type == LocationType.COORD) && location.hasLocation())
{ {
uri.append("&type_").append(paramSuffix).append("=coord"); uri.append("&type_").append(paramSuffix).append("=coord");
uri.append("&name_").append(paramSuffix).append("=") uri.append("&name_").append(paramSuffix).append("=")
@ -3291,6 +3303,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
return "stop"; return "stop";
if (type == LocationType.ADDRESS) if (type == LocationType.ADDRESS)
return "any"; // strange, matches with anyObjFilter return "any"; // strange, matches with anyObjFilter
if (type == LocationType.COORD)
return "coord";
if (type == LocationType.POI) if (type == LocationType.POI)
return "poi"; return "poi";
if (type == LocationType.ANY) if (type == LocationType.ANY)

View file

@ -1316,6 +1316,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
else if (location.type == LocationType.ADDRESS && location.hasLocation()) else if (location.type == LocationType.ADDRESS && location.hasLocation())
return "<Address type=\"WGS84\" x=\"" + location.lon + "\" y=\"" + location.lat + "\" name=\"" return "<Address type=\"WGS84\" x=\"" + location.lon + "\" y=\"" + location.lat + "\" name=\""
+ (location.place != null ? location.place + ", " : "") + location.name + "\" />"; + (location.place != null ? location.place + ", " : "") + location.name + "\" />";
else if (location.type == LocationType.COORD && location.hasLocation())
return "<Coord type=\"WGS84\" x=\"" + location.lon + "\" y=\"" + location.lat + "\" />";
else else
throw new IllegalArgumentException("cannot handle: " + location); throw new IllegalArgumentException("cannot handle: " + location);
} }
@ -1354,7 +1356,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
return 1; return 1;
if (type == LocationType.POI) if (type == LocationType.POI)
return 4; return 4;
if (type == LocationType.ADDRESS && location.hasLocation()) if (type == LocationType.COORD || (type == LocationType.ADDRESS && location.hasLocation()))
return 16; return 16;
if (type == LocationType.ADDRESS && location.name != null) if (type == LocationType.ADDRESS && location.name != null)
return 2; return 2;

View file

@ -791,7 +791,7 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
// Build query uri depending of location type. // Build query uri depending of location type.
final String queryUriType; final String queryUriType;
if (location.type == LocationType.ADDRESS || location.type == LocationType.ANY) if (location.type == LocationType.COORD || location.type == LocationType.ADDRESS || location.type == LocationType.ANY)
{ {
if (!location.hasLocation()) if (!location.hasLocation())
{ {

View file

@ -53,6 +53,11 @@ public final class Location implements Serializable
checkArgument(id == null || id.length() > 0, "ID cannot be the empty string"); checkArgument(id == null || id.length() > 0, "ID cannot be the empty string");
checkArgument(place == null || name != null, "place '%s' without name cannot exist", place); checkArgument(place == null || name != null, "place '%s' without name cannot exist", place);
if (type == LocationType.COORD)
{
checkArgument(hasLocation(), "coordinates missing");
checkArgument(place == null && name == null, "coordinates cannot have place or name");
}
} }
public Location(final LocationType type, final String id, final Point coord, final String place, final String name) public Location(final LocationType type, final String id, final Point coord, final String place, final String name)
@ -62,24 +67,12 @@ public final class Location implements Serializable
public Location(final LocationType type, final String id, final String place, final String name) public Location(final LocationType type, final String id, final String place, final String name)
{ {
this.type = checkNotNull(type); this(type, id, 0, 0, place, name);
this.id = id;
this.lat = 0;
this.lon = 0;
this.place = place;
this.name = name;
checkArgument(place == null || name != null, "place '%s' without name cannot exist", place);
} }
public Location(final LocationType type, final String id, final int lat, final int lon) public Location(final LocationType type, final String id, final int lat, final int lon)
{ {
this.type = checkNotNull(type); this(type, id, lat, lon, null, null);
this.id = id;
this.lat = lat;
this.lon = lon;
this.place = null;
this.name = null;
} }
public Location(final LocationType type, final String id, final Point coord) public Location(final LocationType type, final String id, final Point coord)
@ -89,27 +82,17 @@ public final class Location implements Serializable
public Location(final LocationType type, final String id) public Location(final LocationType type, final String id)
{ {
this.type = checkNotNull(type); this(type, id, null, null);
this.id = id;
this.lat = 0;
this.lon = 0;
this.place = null;
this.name = null;
} }
public Location(final LocationType type, final int lat, final int lon) public static Location coord(final int lat, final int lon)
{ {
this.type = checkNotNull(type); return new Location(LocationType.COORD, null, lat, lon);
this.id = null;
this.lat = lat;
this.lon = lon;
this.place = null;
this.name = null;
} }
public Location(final LocationType type, final Point coord) public static Location coord(final Point coord)
{ {
this(type, coord != null ? coord.lat : 0, coord != null ? coord.lon : 0); return new Location(LocationType.COORD, null, coord.lat, coord.lon);
} }
public final boolean hasId() public final boolean hasId()
@ -135,7 +118,7 @@ public final class Location implements Serializable
if (type == LocationType.POI) if (type == LocationType.POI)
return true; return true;
if (type == LocationType.ADDRESS) if (type == LocationType.ADDRESS || type == LocationType.COORD)
return hasLocation(); return hasLocation();
return false; return false;
@ -196,7 +179,7 @@ public final class Location implements Serializable
public String toString() public String toString()
{ {
final ToStringHelper helper = MoreObjects.toStringHelper(this).addValue(type).addValue(id); final ToStringHelper helper = MoreObjects.toStringHelper(this).addValue(type).addValue(id);
if (lat != 0 || lon != 0) if (hasLocation())
helper.addValue(lat + "/" + lon); helper.addValue(lat + "/" + lon);
return helper.add("place", place).add("name", name).omitNullValues().toString(); return helper.add("place", place).add("name", name).omitNullValues().toString();
} }

View file

@ -22,5 +22,14 @@ package de.schildbach.pte.dto;
*/ */
public enum LocationType public enum LocationType
{ {
ANY, STATION, POI, ADDRESS /** Location can represent any of the below. Mainly meant for user input. */
ANY,
/** Location represents a station or stop. */
STATION,
/** Location represents a point of interest. */
POI,
/** Location represents a postal address. */
ADDRESS,
/** Location represents a just a plain coordinate, e.g. acquired by GPS. */
COORD
} }

View file

@ -52,8 +52,7 @@ public abstract class AbstractNavitiaProviderLiveTest extends AbstractProviderLi
protected final void nearbyStationsAddress(final int lat, final int lon) throws IOException protected final void nearbyStationsAddress(final int lat, final int lon) throws IOException
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), new Location(LocationType.ADDRESS, lat, lon), final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(lat, lon), 700, 10);
700, 10);
assertEquals(NearbyLocationsResult.Status.OK, result.status); assertEquals(NearbyLocationsResult.Status.OK, result.status);
print(result); print(result);
} }
@ -75,7 +74,7 @@ public abstract class AbstractNavitiaProviderLiveTest extends AbstractProviderLi
protected final void nearbyStationsAny(final int lat, final int lon) throws IOException protected final void nearbyStationsAny(final int lat, final int lon) throws IOException
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), new Location(LocationType.ANY, lat, lon), 700, 10); final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(lat, lon), 700, 10);
assertEquals(NearbyLocationsResult.Status.OK, result.status); assertEquals(NearbyLocationsResult.Status.OK, result.status);
print(result); print(result);
} }

View file

@ -53,7 +53,7 @@ public class AtcProviderLiveTest extends AbstractProviderLiveTest
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
// TODO bad coordinate! // TODO bad coordinate!
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 8168907, 10609969)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(8168907, 10609969));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class AvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48367233, 10894976)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48367233, 10894976));
print(result); print(result);
} }

View file

@ -57,15 +57,14 @@ public class BahnProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52525589, 13369548)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52525589, 13369548));
print(result); print(result);
} }
@Test @Test
public void nearbyPOIsByCoordinate() throws Exception public void nearbyPOIsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.POI), final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.POI), Location.coord(52525589, 13369548));
new Location(LocationType.ADDRESS, 52525589, 13369548));
print(result); print(result);
assertThat(result.locations, hasItem(new Location(LocationType.POI, "990416076", "Berlin", "Museum für Naturkunde"))); assertThat(result.locations, hasItem(new Location(LocationType.POI, "990416076", "Berlin", "Museum für Naturkunde")));
} }
@ -112,7 +111,6 @@ public class BahnProviderLiveTest extends AbstractProviderLiveTest
{ {
final SuggestLocationsResult result = suggestLocations("München, Friedenstraße 2"); final SuggestLocationsResult result = suggestLocations("München, Friedenstraße 2");
print(result); print(result);
assertEquals(LocationType.ADDRESS, result.getLocations().get(0).type); assertEquals(LocationType.ADDRESS, result.getLocations().get(0).type);
assertEquals("Friedenstraße 2", result.getLocations().get(0).name); assertEquals("Friedenstraße 2", result.getLocations().get(0).name);
} }
@ -179,7 +177,6 @@ public class BahnProviderLiveTest extends AbstractProviderLiveTest
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8010205", null, "Leipzig Hbf"), null, new Location( final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8010205", null, "Leipzig Hbf"), null, new Location(
LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
assertEquals(QueryTripsResult.Status.TOO_CLOSE, result.status); assertEquals(QueryTripsResult.Status.TOO_CLOSE, result.status);
} }
@ -189,7 +186,6 @@ public class BahnProviderLiveTest extends AbstractProviderLiveTest
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8011160", null, "Berlin Hbf"), null, new Location( final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8011160", null, "Berlin Hbf"), null, new Location(
LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(0), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); LocationType.STATION, "8010205", null, "Leipzig Hbf"), new Date(0), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
assertEquals(QueryTripsResult.Status.INVALID_DATE, result.status); assertEquals(QueryTripsResult.Status.INVALID_DATE, result.status);
} }
} }

View file

@ -56,7 +56,7 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48135232, 11560650)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48135232, 11560650));
print(result); print(result);
assertTrue(result.locations.size() > 0); assertTrue(result.locations.size() > 0);
} }
@ -64,8 +64,8 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyLocationsByCoordinate() throws Exception public void nearbyLocationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI), new Location( final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI),
LocationType.ADDRESS, 48135232, 11560650)); Location.coord(48135232, 11560650));
print(result); print(result);
assertTrue(result.locations.size() > 0); assertTrue(result.locations.size() > 0);
} }
@ -140,8 +140,8 @@ public class BayernProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void tripBetweenCoordinates() throws Exception public void tripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 48165238, 11577473), null, new Location( final QueryTripsResult result = queryTrips(Location.coord(48165238, 11577473), null, Location.coord(47987199, 11326532), new Date(), true,
LocationType.ADDRESS, null, 47987199, 11326532), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true); final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult); print(laterResult);

View file

@ -57,7 +57,7 @@ public class BsvagProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52272065, 10524788)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52272065, 10524788));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class BvbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47551466, 7585187)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47551466, 7585187));
print(result); print(result);
} }

View file

@ -57,7 +57,7 @@ public class BvgProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52486400, 13350744)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52486400, 13350744));
print(result); print(result);
} }
@ -172,8 +172,8 @@ public class BvgProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void tripBetweenCoordinates() throws Exception public void tripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 52501507, 13357026, null, null), null, new Location( final QueryTripsResult result = queryTrips(Location.coord(52501507, 13357026), null, Location.coord(52513639, 13568648), new Date(), true,
LocationType.ADDRESS, null, 52513639, 13568648, null, null), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true); final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult); print(laterResult);
@ -193,10 +193,8 @@ public class BvgProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void viaTripBetweenCoordinates() throws Exception public void viaTripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 52501507, 13357026, null, null), new Location( final QueryTripsResult result = queryTrips(Location.coord(52501507, 13357026), Location.coord(52479868, 13324247),
LocationType.ADDRESS, null, 52479868, 13324247, null, null), Location.coord(52513639, 13568648), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
new Location(LocationType.ADDRESS, null, 52513639, 13568648, null, null), new Date(), true, Product.ALL, WalkSpeed.NORMAL,
Accessibility.NEUTRAL);
print(result); print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true); final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult); print(laterResult);

View file

@ -55,7 +55,7 @@ public class DingProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48401092, 9992037)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48401092, 9992037));
print(result); print(result);
} }
@ -114,4 +114,12 @@ public class DingProviderLiveTest extends AbstractProviderLiveTest
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false); final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult); print(earlierResult);
} }
@Test
public void tripAnyToAny() throws Exception
{
final QueryTripsResult result = queryTrips(new Location(LocationType.ANY, null, null, "Hermaringen"), null, new Location(LocationType.ANY,
null, null, "Heidenheim"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result);
}
} }

View file

@ -54,7 +54,7 @@ public class DsbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 55670305, 12554169)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(55670305, 12554169));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class DubProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 25269008, 55312672)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(25269008, 55312672));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class EireannProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 53343993, -6267371)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(53343993, -6267371));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class GvhProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52379497, 9735832)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52379497, 9735832));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class InvgProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48744678, 11437941)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48744678, 11437941));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class IvbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47271228, 11402063)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47271228, 11402063));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class JetProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 31769757, 35213506)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(31769757, 35213506));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class KvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 49008184, 8400736)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(49008184, 8400736));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class LinzProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48305726, 14287863)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48305726, 14287863));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class LuProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 49610187, 6132746)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(49610187, 6132746));
print(result); print(result);
} }

View file

@ -56,15 +56,15 @@ public class MerseyProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 53401112, -2958903)); final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(53401112, -2958903));
print(result); print(result);
} }
@Test @Test
public void nearbyLocationsByCoordinate() throws Exception public void nearbyLocationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI), new Location( final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI),
LocationType.ADDRESS, 53401112, -2958903)); Location.coord(53401112, -2958903));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class MetProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, -37800941, 144966545)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(-37800941, 144966545));
print(result); print(result);
} }

View file

@ -57,7 +57,7 @@ public class MvgProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51219852, 7639217)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51219852, 7639217));
print(result); print(result);
} }

View file

@ -58,7 +58,7 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48135232, 11560650)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48135232, 11560650));
print(result); print(result);
assertTrue(result.locations.size() > 0); assertTrue(result.locations.size() > 0);
} }
@ -66,8 +66,8 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyLocationsByCoordinate() throws Exception public void nearbyLocationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI), new Location( final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI),
LocationType.ADDRESS, 48135232, 11560650)); Location.coord(48135232, 11560650));
print(result); print(result);
assertTrue(result.locations.size() > 0); assertTrue(result.locations.size() > 0);
} }
@ -148,8 +148,8 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void tripBetweenCoordinates() throws Exception public void tripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 48165238, 11577473), null, new Location( final QueryTripsResult result = queryTrips(Location.coord(48165238, 11577473), null, Location.coord(47987199, 11326532), new Date(), true,
LocationType.ADDRESS, null, 47987199, 11326532), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true); final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult); print(laterResult);

View file

@ -55,7 +55,7 @@ public class NasaProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51346546, 12383333)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51346546, 12383333));
print(result); print(result);
assertEquals(NearbyLocationsResult.Status.OK, result.status); assertEquals(NearbyLocationsResult.Status.OK, result.status);

View file

@ -54,7 +54,7 @@ public class NriProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 59911871, 10764999)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(59911871, 10764999));
print(result); print(result);
} }

View file

@ -53,7 +53,7 @@ public class NsProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52377548, 4901218)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52377548, 4901218));
print(result); print(result);
} }

View file

@ -60,10 +60,10 @@ public class NvbwProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result1 = queryNearbyStations(new Location(LocationType.ADDRESS, 48778953, 9178963)); final NearbyLocationsResult result1 = queryNearbyStations(Location.coord(48778953, 9178963));
print(result1); print(result1);
final NearbyLocationsResult result2 = queryNearbyStations(new Location(LocationType.ADDRESS, 48493550, 9205656)); final NearbyLocationsResult result2 = queryNearbyStations(Location.coord(48493550, 9205656));
print(result2); print(result2);
} }

View file

@ -56,14 +56,14 @@ public class NvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 50108625, 8669604)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(50108625, 8669604));
print(result); print(result);
} }
@Test @Test
public void nearbyStationsByCoordinateKassel() throws Exception public void nearbyStationsByCoordinateKassel() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51318447, 9496250)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51318447, 9496250));
print(result); print(result);
} }

View file

@ -56,7 +56,7 @@ public class OebbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48200239, 16370773)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48200239, 16370773));
print(result); print(result);
assertEquals(NearbyLocationsResult.Status.OK, result.status); assertEquals(NearbyLocationsResult.Status.OK, result.status);

View file

@ -54,7 +54,7 @@ public class PlProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52227027, 20989795)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52227027, 20989795));
print(result); print(result);
} }

View file

@ -56,7 +56,7 @@ public class RsagProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 54078314, 12131715)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(54078314, 12131715));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class RtProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52525589, 13369548)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52525589, 13369548));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class SbbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52525589, 13369548)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52525589, 13369548));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class SeProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 57709311, 11988459)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(57709311, 11988459));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class SeptaProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 39954122, -75161705)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(39954122, -75161705));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class SfProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 37777811, -122419481)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(37777811, -122419481));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class SncbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 50748017, 3407118)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(50748017, 3407118));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class StockholmProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 59329897, 18072281)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(59329897, 18072281));
print(result); print(result);
} }

View file

@ -57,7 +57,7 @@ public class StvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47072612, 15431814)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47072612, 15431814));
print(result); print(result);
} }

View file

@ -57,7 +57,7 @@ public class SvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47809195, 13054919)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47809195, 13054919));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class SydneyProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, -32823911, 151462824)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(-32823911, 151462824));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class TfiProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 53348656, -6262221)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(53348656, -6262221));
print(result); print(result);
} }

View file

@ -58,7 +58,7 @@ public class TlemProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51507161, -0127144)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51507161, -0127144));
print(result); print(result);
} }
@ -196,6 +196,16 @@ public class TlemProviderLiveTest extends AbstractProviderLiveTest
print(result); print(result);
} }
@Test
public void tripFromAddress() throws Exception
{
final QueryTripsResult result = queryTrips(
new Location(LocationType.ADDRESS, "streetID:203417::31117006:-1", "London", "Kings Cross, London"), null, new Location(
LocationType.STATION, "1002070", 51508530, 46706, "Royal Albert", "Royal Albert"), new Date(), true, Product.ALL,
WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result);
}
@Test @Test
public void tripPostcode() throws Exception public void tripPostcode() throws Exception
{ {

View file

@ -57,7 +57,7 @@ public class VagfrProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48000295, 7854338)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48000295, 7854338));
print(result); print(result);
} }

View file

@ -64,7 +64,7 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 52548505, 13388640)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(52548505, 13388640));
print(result); print(result);
assertTrue(result.locations.size() > 0); assertTrue(result.locations.size() > 0);
} }
@ -172,8 +172,8 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void tripBetweenCoordinates() throws Exception public void tripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 52501507, 13357026, null, null), null, new Location( final QueryTripsResult result = queryTrips(Location.coord(52501507, 13357026), null, Location.coord(52513639, 13568648), new Date(), true,
LocationType.ADDRESS, null, 52513639, 13568648, null, null), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
if (!result.context.canQueryLater()) if (!result.context.canQueryLater())
@ -186,10 +186,8 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void viaTripBetweenCoordinates() throws Exception public void viaTripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 52501507, 13357026, null, null), new Location( final QueryTripsResult result = queryTrips(Location.coord(52501507, 13357026), Location.coord(52479868, 13324247),
LocationType.ADDRESS, null, 52479868, 13324247, null, null), Location.coord(52513639, 13568648), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
new Location(LocationType.ADDRESS, null, 52513639, 13568648, null, null), new Date(), true, Product.ALL, WalkSpeed.NORMAL,
Accessibility.NEUTRAL);
print(result); print(result);
if (!result.context.canQueryLater()) if (!result.context.canQueryLater())

View file

@ -55,7 +55,7 @@ public class VblProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47049107, 8312502)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47049107, 8312502));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class VbnProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51318447, 9496250)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51318447, 9496250));
print(result); print(result);
} }

View file

@ -52,7 +52,7 @@ public class VgnProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 49455472, 11079655)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(49455472, 11079655));
print(result); print(result);
} }

View file

@ -54,7 +54,7 @@ public class VgsProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 49234783, 6995687)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(49234783, 6995687));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class VmobilProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47271228, 11402063)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47271228, 11402063));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class VmsProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 50832754, 12918348)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(50832754, 12918348));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class VmvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 53637555, 11392593)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(53637555, 11392593));
print(result); print(result);
} }

View file

@ -57,7 +57,7 @@ public class VorProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48207355, 16370602)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48207355, 16370602));
print(result); print(result);
} }
@ -137,8 +137,8 @@ public class VorProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void tripBetweenCoordinates() throws Exception public void tripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 48180281, 16333551), null, new Location( final QueryTripsResult result = queryTrips(Location.coord(48180281, 16333551), null, Location.coord(48240452, 16444788), new Date(), true,
LocationType.ADDRESS, null, 48240452, 16444788), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true); final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult); print(laterResult);

View file

@ -60,10 +60,10 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result1 = queryNearbyStations(new Location(LocationType.ADDRESS, 49486561, 8477297)); final NearbyLocationsResult result1 = queryNearbyStations(Location.coord(49486561, 8477297));
print(result1); print(result1);
final NearbyLocationsResult result2 = queryNearbyStations(new Location(LocationType.ADDRESS, 49757571, 6639147)); final NearbyLocationsResult result2 = queryNearbyStations(Location.coord(49757571, 6639147));
print(result2); print(result2);
} }

View file

@ -57,10 +57,10 @@ public class VrrProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51218693, 6777785)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51218693, 6777785));
print(result); print(result);
final NearbyLocationsResult result2 = queryNearbyStations(new Location(LocationType.ADDRESS, 51719648, 8754330)); final NearbyLocationsResult result2 = queryNearbyStations(Location.coord(51719648, 8754330));
print(result2); print(result2);
} }

View file

@ -73,29 +73,27 @@ public class VrsProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ANY, 51218693, 6777785)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51218693, 6777785));
print(result); print(result);
final NearbyLocationsResult result2 = queryNearbyStations(new Location(LocationType.ANY, 51719648, 8754330)); final NearbyLocationsResult result2 = queryNearbyStations(Location.coord(51719648, 8754330));
print(result2); print(result2);
} }
@Test @Test
public void nearbyLocationsByCoordinate() throws Exception public void nearbyLocationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(50732100, 7096820), 100, 1);
new Location(LocationType.ANY, 50732100, 7096820), 100, 1);
print(result); print(result);
final NearbyLocationsResult result2 = queryNearbyLocations(EnumSet.of(LocationType.ADDRESS), final NearbyLocationsResult result2 = queryNearbyLocations(EnumSet.of(LocationType.ADDRESS), Location.coord(50732100, 7096820));
new Location(LocationType.ANY, 50732100, 7096820));
print(result2); print(result2);
final NearbyLocationsResult result3 = queryNearbyLocations(EnumSet.of(LocationType.POI), new Location(LocationType.ANY, 50732100, 7096820)); final NearbyLocationsResult result3 = queryNearbyLocations(EnumSet.of(LocationType.POI), Location.coord(50732100, 7096820));
print(result3); print(result3);
final NearbyLocationsResult result4 = queryNearbyLocations(EnumSet.of(LocationType.ADDRESS, LocationType.STATION), new Location( final NearbyLocationsResult result4 = queryNearbyLocations(EnumSet.of(LocationType.ADDRESS, LocationType.STATION),
LocationType.ANY, 50732100, 7096820)); Location.coord(50732100, 7096820));
print(result4); print(result4);
} }
@ -111,7 +109,7 @@ public class VrsProviderLiveTest extends AbstractProviderLiveTest
{ {
int lat = LAT_FROM + rand.nextInt(LAT_TO - LAT_FROM); int lat = LAT_FROM + rand.nextInt(LAT_TO - LAT_FROM);
int lon = LON_FROM + rand.nextInt(LON_TO - LON_FROM); int lon = LON_FROM + rand.nextInt(LON_TO - LON_FROM);
NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.ANY), new Location(LocationType.ANY, lat, lon)); NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.ANY), Location.coord(lat, lon));
System.out.println(result); System.out.println(result);
assertNotNull(result.locations); assertNotNull(result.locations);
assertNotNull(result.locations.get(0)); assertNotNull(result.locations.get(0));
@ -121,23 +119,20 @@ public class VrsProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsWithLimits() throws Exception public void nearbyStationsWithLimits() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(50732100, 7096820), 0, 0);
new Location(LocationType.ANY, 50732100, 7096820), 0, 0);
print(result); print(result);
final NearbyLocationsResult result2 = queryNearbyLocations(EnumSet.of(LocationType.STATION), final NearbyLocationsResult result2 = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(50732100, 7096820), 0, 50);
new Location(LocationType.ANY, 50732100, 7096820), 0, 50);
print(result2); print(result2);
final NearbyLocationsResult result3 = queryNearbyLocations(EnumSet.of(LocationType.STATION), final NearbyLocationsResult result3 = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(50732100, 7096820), 1000, 50);
new Location(LocationType.ANY, 50732100, 7096820), 1000, 50);
print(result3); print(result3);
} }
@Test @Test
public void nearbyLocationsEmpty() throws Exception public void nearbyLocationsEmpty() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.allOf(LocationType.class), new Location(LocationType.ANY, 1, 0), 0, 0); final NearbyLocationsResult result = queryNearbyLocations(EnumSet.allOf(LocationType.class), Location.coord(1, 0), 0, 0);
print(result); print(result);
assertEquals(0, result.locations.size()); assertEquals(0, result.locations.size());
} }
@ -416,8 +411,8 @@ public class VrsProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void testTripByCoord() throws Exception public void testTripByCoord() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ANY, 50740530, 7129200), null, new Location(LocationType.ANY, 50933930, final QueryTripsResult result = queryTrips(Location.coord(50740530, 7129200), null, Location.coord(50933930, 6932440), new Date(), true,
6932440), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
assertEquals(QueryTripsResult.Status.OK, result.status); assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0); assertTrue(result.trips.size() > 0);
@ -457,8 +452,8 @@ public class VrsProviderLiveTest extends AbstractProviderLiveTest
int fromLon = lonFrom + rand.nextInt(lonTo - lonFrom); int fromLon = lonFrom + rand.nextInt(lonTo - lonFrom);
int toLat = latFrom + rand.nextInt(latTo - latFrom); int toLat = latFrom + rand.nextInt(latTo - latFrom);
int toLon = lonFrom + rand.nextInt(lonTo - lonFrom); int toLon = lonFrom + rand.nextInt(lonTo - lonFrom);
final QueryTripsResult result = queryTrips(new Location(LocationType.ANY, fromLat, fromLon), null, new Location(LocationType.ANY, final QueryTripsResult result = queryTrips(Location.coord(fromLat, fromLon), null, Location.coord(toLat, toLon), new Date(), true,
toLat, toLon), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
System.out.println("# " + (i + 1)); System.out.println("# " + (i + 1));
if (result.status.equals(QueryTripsResult.Status.OK)) if (result.status.equals(QueryTripsResult.Status.OK))
{ {
@ -527,7 +522,7 @@ public class VrsProviderLiveTest extends AbstractProviderLiveTest
int lat = latFrom + rand.nextInt(latTo - latFrom); int lat = latFrom + rand.nextInt(latTo - latFrom);
int lon = lonFrom + rand.nextInt(lonTo - lonFrom); int lon = lonFrom + rand.nextInt(lonTo - lonFrom);
System.out.println(i + " " + lat + " " + lon); System.out.println(i + " " + lat + " " + lon);
NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), new Location(LocationType.STATION, lat, lon), 0, 3); NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), Location.coord(lat, lon), 0, 3);
if (result.status == NearbyLocationsResult.Status.OK) if (result.status == NearbyLocationsResult.Status.OK)
{ {
stations.addAll(result.locations); stations.addAll(result.locations);

View file

@ -54,7 +54,7 @@ public class VsnProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51536614, 9925673)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51536614, 9925673));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class VvmProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 49455472, 11079655)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(49455472, 11079655));
print(result); print(result);
} }

View file

@ -57,7 +57,7 @@ public class VvoProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 51052467, 13733196)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(51052467, 13733196));
print(result); print(result);
} }

View file

@ -57,7 +57,7 @@ public class VvsProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48775005, 9166517)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48775005, 9166517));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class VvtProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47271228, 11402063)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47271228, 11402063));
print(result); print(result);
} }

View file

@ -55,7 +55,7 @@ public class VvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 50776518, 12056032)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(50776518, 12056032));
print(result); print(result);
} }

View file

@ -58,15 +58,15 @@ public class WienProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 48207355, 16370602)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(48207355, 16370602));
print(result); print(result);
} }
@Test @Test
public void nearbyLocationsByCoordinate() throws Exception public void nearbyLocationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI), new Location( final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI),
LocationType.ADDRESS, 48207355, 16370602)); Location.coord(48207355, 16370602));
print(result); print(result);
assertTrue(result.locations.size() > 0); assertTrue(result.locations.size() > 0);
} }
@ -136,8 +136,8 @@ public class WienProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void tripBetweenCoordinates() throws Exception public void tripBetweenCoordinates() throws Exception
{ {
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 48180281, 16333551), null, new Location( final QueryTripsResult result = queryTrips(Location.coord(48180281, 16333551), null, Location.coord(48240452, 16444788), new Date(), true,
LocationType.ADDRESS, null, 48240452, 16444788), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
print(result); print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true); final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult); print(laterResult);

View file

@ -54,7 +54,7 @@ public class ZvvProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void nearbyStationsByCoordinate() throws Exception public void nearbyStationsByCoordinate() throws Exception
{ {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.ADDRESS, 47378968, 8540534)); final NearbyLocationsResult result = queryNearbyStations(Location.coord(47378968, 8540534));
print(result); print(result);
} }

View file

@ -51,7 +51,7 @@ public class LocationController
@ResponseBody @ResponseBody
public NearbyLocationsResult nearby(@RequestParam("lat") final int lat, @RequestParam("lon") final int lon) throws IOException public NearbyLocationsResult nearby(@RequestParam("lat") final int lat, @RequestParam("lon") final int lon) throws IOException
{ {
final Location location = new Location(LocationType.ANY, lat, lon); final Location coord = Location.coord(lat, lon);
return provider.queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI), location, 5000, 100); return provider.queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI), coord, 5000, 100);
} }
} }