Refactor RouteService

This commit is contained in:
Alex Sytnyk 2018-09-17 17:07:29 +03:00
parent 1a082c5c98
commit 624b897a6c

View file

@ -79,14 +79,16 @@ public class RouteProvider {
private static final int MIN_DISTANCE_FOR_INSERTING_ROUTE_SEGMENT = 60; private static final int MIN_DISTANCE_FOR_INSERTING_ROUTE_SEGMENT = 60;
public enum RouteService { public enum RouteService {
OSMAND("OsmAnd (offline)"), YOURS("YOURS"), OSMAND("OsmAnd (offline)"),
// ORS("OpenRouteService"), // disable ors due to no public rest service (testing2015 doesn't seem stable) YOURS("YOURS"),
//ORS("OpenRouteService"), // disable ors due to no public rest service (testing2015 doesn't seem stable)
OSRM("OSRM (only car)"), OSRM("OSRM (only car)"),
BROUTER("BRouter (offline)"), STRAIGHT("Straight line"); BROUTER("BRouter (offline)"),
STRAIGHT("Straight line");
private final String name; private final String name;
private RouteService(String name) { RouteService(String name) {
this.name = name; this.name = name;
} }
@ -106,8 +108,8 @@ public class RouteProvider {
} }
public static RouteService[] getAvailableRouters(OsmandApplication ctx) { public static RouteService[] getAvailableRouters(OsmandApplication ctx) {
List<RouteService> list = new ArrayList<RouteProvider.RouteService>(); List<RouteService> list = new ArrayList<>();
for(RouteService r : values()) { for (RouteService r : values()) {
if (r.isAvailable(ctx)) { if (r.isAvailable(ctx)) {
list.add(r); list.add(r);
} }