switch to numeric transport mode

This commit is contained in:
afischerdev 2023-12-22 17:51:04 +01:00
parent 4c310bf4b4
commit f405b0e16e
2 changed files with 26 additions and 5 deletions

View file

@ -44,7 +44,7 @@ public class VoiceHint {
float angle = Float.MAX_VALUE;
boolean turnAngleConsumed;
boolean needsRealTurn;
int maxBadPrio;
int maxBadPrio = -1;
int roundaboutExit;

View file

@ -10,23 +10,44 @@ import java.util.ArrayList;
import java.util.List;
public class VoiceHintList {
private String transportMode;
static final int TRANS_MODE_NONE = 0;
static final int TRANS_MODE_FOOT = 1;
static final int TRANS_MODE_BIKE = 2;
static final int TRANS_MODE_CAR = 3;
private int transportMode = TRANS_MODE_BIKE;
int turnInstructionMode;
List<VoiceHint> list = new ArrayList<>();
public void setTransportMode(boolean isCar, boolean isBike) {
transportMode = isCar ? "car" : (isBike ? "bike" : "foot");
transportMode = isCar ? TRANS_MODE_CAR : (isBike ? TRANS_MODE_BIKE : TRANS_MODE_FOOT);
}
public void setTransportMode(int mode) {
transportMode = mode;
}
public String getTransportMode() {
String ret;
switch(transportMode) {
case TRANS_MODE_FOOT: ret = "foot"; break;
case TRANS_MODE_CAR : ret = "car"; break;
case TRANS_MODE_BIKE:
default: ret = "bike";
}
return ret;
}
public int transportMode() {
return transportMode;
}
public int getLocusRouteType() {
if ("car".equals(transportMode)) {
if (transportMode == TRANS_MODE_CAR) {
return 0;
}
if ("bike".equals(transportMode)) {
if (transportMode == TRANS_MODE_BIKE) {
return 5;
}
return 3; // foot