Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a5ea76933a
3 changed files with 22 additions and 26 deletions
|
@ -335,15 +335,15 @@ public class WaypointHelper {
|
||||||
point.getLatitude(), point.getLongitude()) - lwp.getDeviationDistance());
|
point.getLatitude(), point.getLongitude()) - lwp.getDeviationDistance());
|
||||||
Integer state = locationPointsStates.get(point);
|
Integer state = locationPointsStates.get(point);
|
||||||
if (state != null && state.intValue() == ANNOUNCED_ONCE
|
if (state != null && state.intValue() == ANNOUNCED_ONCE
|
||||||
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, SHORT_ANNOUNCE_RADIUS)) {
|
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, SHORT_ANNOUNCE_RADIUS, 0f)) {
|
||||||
locationPointsStates.put(point, ANNOUNCED_DONE);
|
locationPointsStates.put(point, ANNOUNCED_DONE);
|
||||||
announcePoints.add(lwp);
|
announcePoints.add(lwp);
|
||||||
} else if (type != ALARMS && (state == null || state == NOT_ANNOUNCED)
|
} else if (type != ALARMS && (state == null || state == NOT_ANNOUNCED)
|
||||||
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, LONG_ANNOUNCE_RADIUS)) {
|
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, LONG_ANNOUNCE_RADIUS, 0f)) {
|
||||||
locationPointsStates.put(point, ANNOUNCED_ONCE);
|
locationPointsStates.put(point, ANNOUNCED_ONCE);
|
||||||
approachPoints.add(lwp);
|
approachPoints.add(lwp);
|
||||||
} else if (type == ALARMS && (state == null || state == NOT_ANNOUNCED)
|
} else if (type == ALARMS && (state == null || state == NOT_ANNOUNCED)
|
||||||
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, ALARMS_ANNOUNCE_RADIUS)) {
|
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, ALARMS_ANNOUNCE_RADIUS, 0f)) {
|
||||||
locationPointsStates.put(point, ANNOUNCED_ONCE);
|
locationPointsStates.put(point, ANNOUNCED_ONCE);
|
||||||
approachPoints.add(lwp);
|
approachPoints.add(lwp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -695,12 +695,12 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isDistanceLess(float currentSpeed, double dist, double etalon, double defSpeed){
|
// protected boolean isDistanceLess(float currentSpeed, double dist, double etalon, float defSpeed){
|
||||||
if(dist < etalon || ((dist / currentSpeed) < (etalon / defSpeed))){
|
// if(dist < etalon || ((dist / currentSpeed) < (etalon / defSpeed))){
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public synchronized String getCurrentName(TurnType[] next){
|
public synchronized String getCurrentName(TurnType[] next){
|
||||||
NextDirectionInfo n = getNextRouteDirectionInfo(new NextDirectionInfo(), false);
|
NextDirectionInfo n = getNextRouteDirectionInfo(new NextDirectionInfo(), false);
|
||||||
|
@ -710,7 +710,7 @@ public class RoutingHelper {
|
||||||
speed = l.getSpeed();
|
speed = l.getSpeed();
|
||||||
}
|
}
|
||||||
if(n.distanceTo > 0 && n.directionInfo != null && !n.directionInfo.getTurnType().isSkipToSpeak() &&
|
if(n.distanceTo > 0 && n.directionInfo != null && !n.directionInfo.getTurnType().isSkipToSpeak() &&
|
||||||
voiceRouter.isDistanceLess(speed, n.distanceTo, voiceRouter.PREPARE_DISTANCE * 0.75f)) {
|
voiceRouter.isDistanceLess(speed, n.distanceTo, voiceRouter.PREPARE_DISTANCE * 0.75f, 0f)) {
|
||||||
String nm = n.directionInfo.getStreetName();
|
String nm = n.directionInfo.getStreetName();
|
||||||
String rf = n.directionInfo.getRef();
|
String rf = n.directionInfo.getRef();
|
||||||
String dn = n.directionInfo.getDestinationName();
|
String dn = n.directionInfo.getDestinationName();
|
||||||
|
|
|
@ -166,17 +166,13 @@ public class VoiceRouter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDistanceLess(float currentSpeed, double dist, double etalon){
|
public boolean isDistanceLess(float currentSpeed, double dist, double etalon, float defSpeed){
|
||||||
|
if(defSpeed <= 0) {
|
||||||
|
defSpeed = DEFAULT_SPEED;
|
||||||
|
}
|
||||||
if(currentSpeed <= 0) {
|
if(currentSpeed <= 0) {
|
||||||
currentSpeed = DEFAULT_SPEED;
|
currentSpeed = DEFAULT_SPEED;
|
||||||
}
|
}
|
||||||
if(dist < etalon || ((dist / currentSpeed) < (etalon / DEFAULT_SPEED))){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isDistanceLess(float currentSpeed, double dist, double etalon, double defSpeed){
|
|
||||||
if(dist < etalon || ((dist / currentSpeed) < (etalon / defSpeed))){
|
if(dist < etalon || ((dist / currentSpeed) < (etalon / defSpeed))){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +184,7 @@ public class VoiceRouter {
|
||||||
if(loc != null && loc.hasSpeed()) {
|
if(loc != null && loc.hasSpeed()) {
|
||||||
speed = loc.getSpeed();
|
speed = loc.getSpeed();
|
||||||
}
|
}
|
||||||
if (isDistanceLess(speed, dist, TURN_IN_DISTANCE_END)) {
|
if (isDistanceLess(speed, dist, TURN_IN_DISTANCE_END, 0f)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if ( dist <= PREPARE_DISTANCE) {
|
} else if ( dist <= PREPARE_DISTANCE) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -439,11 +435,11 @@ public class VoiceRouter {
|
||||||
|
|
||||||
// say how much to go if there is next turn is a bit far
|
// say how much to go if there is next turn is a bit far
|
||||||
if (currentStatus == STATUS_UNKNOWN) {
|
if (currentStatus == STATUS_UNKNOWN) {
|
||||||
if (!isDistanceLess(speed, dist, TURN_IN_DISTANCE * 1.3)) {
|
if (!isDistanceLess(speed, dist, TURN_IN_DISTANCE * 1.3, 0f)) {
|
||||||
playGoAheadDist = dist - 80;
|
playGoAheadDist = dist - 80;
|
||||||
}
|
}
|
||||||
// say long distance message only for long distances > 10 km
|
// say long distance message only for long distances > 10 km
|
||||||
// if (dist >= PREPARE_LONG_DISTANCE && !isDistanceLess(speed, dist, PREPARE_LONG_DISTANCE)) {
|
// if (dist >= PREPARE_LONG_DISTANCE && !isDistanceLess(speed, dist, PREPARE_LONG_DISTANCE, 0f)) {
|
||||||
if (dist > PREPARE_LONG_DISTANCE + 300) {
|
if (dist > PREPARE_LONG_DISTANCE + 300) {
|
||||||
nextStatusAfter(STATUS_UNKNOWN);
|
nextStatusAfter(STATUS_UNKNOWN);
|
||||||
} else if (dist > PREPARE_DISTANCE + 300) {
|
} else if (dist > PREPARE_DISTANCE + 300) {
|
||||||
|
@ -466,9 +462,9 @@ public class VoiceRouter {
|
||||||
andSpeakArriveAtPoint(nextNextInfo);
|
andSpeakArriveAtPoint(nextNextInfo);
|
||||||
}
|
}
|
||||||
nextStatusAfter(STATUS_TURN);
|
nextStatusAfter(STATUS_TURN);
|
||||||
} else if ((repeat || statusNotPassed(STATUS_TURN_IN)) && isDistanceLess(speed, dist, TURN_IN_DISTANCE)) {
|
} else if ((repeat || statusNotPassed(STATUS_TURN_IN)) && isDistanceLess(speed, dist, TURN_IN_DISTANCE, 0f)) {
|
||||||
if (repeat || dist >= TURN_IN_DISTANCE_END) {
|
if (repeat || dist >= TURN_IN_DISTANCE_END) {
|
||||||
if ((isDistanceLess(speed, next.distance, TURN_DISTANCE) || next.distance < TURN_IN_DISTANCE_END) &&
|
if ((isDistanceLess(speed, next.distance, TURN_DISTANCE, 0f) || next.distance < TURN_IN_DISTANCE_END) &&
|
||||||
nextNextInfo != null) {
|
nextNextInfo != null) {
|
||||||
playMakeTurnIn(currentSegment, next, dist, nextNextInfo.directionInfo);
|
playMakeTurnIn(currentSegment, next, dist, nextNextInfo.directionInfo);
|
||||||
} else {
|
} else {
|
||||||
|
@ -477,7 +473,7 @@ public class VoiceRouter {
|
||||||
playAndArriveAtDestination(repeat, nextInfo, currentSegment);
|
playAndArriveAtDestination(repeat, nextInfo, currentSegment);
|
||||||
}
|
}
|
||||||
nextStatusAfter(STATUS_TURN_IN);
|
nextStatusAfter(STATUS_TURN_IN);
|
||||||
// } else if (statusNotPassed(STATUS_PREPARE) && isDistanceLess(speed, dist, PREPARE_DISTANCE)) {
|
// } else if (statusNotPassed(STATUS_PREPARE) && isDistanceLess(speed, dist, PREPARE_DISTANCE, 0f)) {
|
||||||
} else if ((repeat || statusNotPassed(STATUS_PREPARE)) && (dist <= PREPARE_DISTANCE)) {
|
} else if ((repeat || statusNotPassed(STATUS_PREPARE)) && (dist <= PREPARE_DISTANCE)) {
|
||||||
if (repeat || dist >= PREPARE_DISTANCE_END) {
|
if (repeat || dist >= PREPARE_DISTANCE_END) {
|
||||||
if (!repeat && (next.getTurnType().keepLeft() || next.getTurnType().keepRight())){
|
if (!repeat && (next.getTurnType().keepLeft() || next.getTurnType().keepRight())){
|
||||||
|
@ -488,7 +484,7 @@ public class VoiceRouter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nextStatusAfter(STATUS_PREPARE);
|
nextStatusAfter(STATUS_PREPARE);
|
||||||
// } else if (statusNotPassed(STATUS_LONG_PREPARE) && isDistanceLess(speed, dist, PREPARE_LONG_DISTANCE)){
|
// } else if (statusNotPassed(STATUS_LONG_PREPARE) && isDistanceLess(speed, dist, PREPARE_LONG_DISTANCE, 0f)){
|
||||||
} else if ((repeat || statusNotPassed(STATUS_LONG_PREPARE)) && (dist <= PREPARE_LONG_DISTANCE)) {
|
} else if ((repeat || statusNotPassed(STATUS_LONG_PREPARE)) && (dist <= PREPARE_LONG_DISTANCE)) {
|
||||||
if (repeat || dist >= PREPARE_LONG_DISTANCE_END) {
|
if (repeat || dist >= PREPARE_LONG_DISTANCE_END) {
|
||||||
playPrepareTurn(currentSegment, next, dist);
|
playPrepareTurn(currentSegment, next, dist);
|
||||||
|
|
Loading…
Reference in a new issue