fix Graphhopper name
This commit is contained in:
parent
6cf15012ab
commit
5297bfa943
3 changed files with 6 additions and 6 deletions
|
@ -2,7 +2,7 @@ package net.osmand.plus.onlinerouting;
|
||||||
|
|
||||||
public enum EngineType {
|
public enum EngineType {
|
||||||
|
|
||||||
GRAPHHOPER("Graphhoper", "https://graphhopper.com/api/1/route"),
|
GRAPHHOPPER("Graphhopper", "https://graphhopper.com/api/1/route"),
|
||||||
OSRM("OSRM", "https://router.project-osrm.org/route/v1/"),
|
OSRM("OSRM", "https://router.project-osrm.org/route/v1/"),
|
||||||
ORS("Openroute Service", "https://api.openrouteservice.org/v2/directions/");
|
ORS("Openroute Service", "https://api.openrouteservice.org/v2/directions/");
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment {
|
||||||
} else if (typeCard.equals(card)) {
|
} else if (typeCard.equals(card)) {
|
||||||
typeCard.setHeaderSubtitle(engine.type.getTitle());
|
typeCard.setHeaderSubtitle(engine.type.getTitle());
|
||||||
typeCard.setEditedText(engine.getBaseUrl());
|
typeCard.setEditedText(engine.getBaseUrl());
|
||||||
if (engine.type == EngineType.GRAPHHOPER || engine.type == EngineType.ORS) {
|
if (engine.type == EngineType.GRAPHHOPPER || engine.type == EngineType.ORS) {
|
||||||
apiKeyCard.show();
|
apiKeyCard.show();
|
||||||
} else {
|
} else {
|
||||||
apiKeyCard.hide();
|
apiKeyCard.hide();
|
||||||
|
@ -414,7 +414,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
engineToSave.putParameter(EngineParameter.CUSTOM_NAME, engine.customName);
|
engineToSave.putParameter(EngineParameter.CUSTOM_NAME, engine.customName);
|
||||||
engineToSave.putParameter(EngineParameter.CUSTOM_URL, engine.customServerUrl);
|
engineToSave.putParameter(EngineParameter.CUSTOM_URL, engine.customServerUrl);
|
||||||
if (engine.type == EngineType.GRAPHHOPER || engine.type == EngineType.ORS) {
|
if (engine.type == EngineType.GRAPHHOPPER || engine.type == EngineType.ORS) {
|
||||||
engineToSave.putParameter(EngineParameter.API_KEY, engine.apiKey);
|
engineToSave.putParameter(EngineParameter.API_KEY, engine.apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment {
|
||||||
try {
|
try {
|
||||||
JSONObject obj = new JSONObject(response);
|
JSONObject obj = new JSONObject(response);
|
||||||
|
|
||||||
if (type == EngineType.GRAPHHOPER) {
|
if (type == EngineType.GRAPHHOPPER) {
|
||||||
resultOk = obj.has("paths");
|
resultOk = obj.has("paths");
|
||||||
} else if (type == EngineType.OSRM) {
|
} else if (type == EngineType.OSRM) {
|
||||||
resultOk = obj.has("routes");
|
resultOk = obj.has("routes");
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class OnlineRoutingHelper {
|
||||||
String apiKey = engine.getParameter(EngineParameter.API_KEY);
|
String apiKey = engine.getParameter(EngineParameter.API_KEY);
|
||||||
switch (engine.getType()) {
|
switch (engine.getType()) {
|
||||||
|
|
||||||
case GRAPHHOPER:
|
case GRAPHHOPPER:
|
||||||
sb.append("?");
|
sb.append("?");
|
||||||
for (LatLon point : path) {
|
for (LatLon point : path) {
|
||||||
sb.append("point=")
|
sb.append("point=")
|
||||||
|
@ -118,7 +118,7 @@ public class OnlineRoutingHelper {
|
||||||
|
|
||||||
switch (engine.getType()) {
|
switch (engine.getType()) {
|
||||||
|
|
||||||
case GRAPHHOPER:
|
case GRAPHHOPPER:
|
||||||
return GeoPolylineParserUtil.parse(
|
return GeoPolylineParserUtil.parse(
|
||||||
obj.getJSONArray("paths").getJSONObject(0).getString("points"),
|
obj.getJSONArray("paths").getJSONObject(0).getString("points"),
|
||||||
GeoPolylineParserUtil.PRECISION_5);
|
GeoPolylineParserUtil.PRECISION_5);
|
||||||
|
|
Loading…
Reference in a new issue