Intermediate points
This commit is contained in:
parent
0ce4b23f2a
commit
c0b008df38
3 changed files with 13 additions and 7 deletions
|
@ -621,6 +621,10 @@ public class RouteCalculationResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void passIntermediatePoint(){
|
||||||
|
nextIntermediate ++ ;
|
||||||
|
}
|
||||||
|
|
||||||
public Location getLocationFromRouteDirection(RouteDirectionInfo i){
|
public Location getLocationFromRouteDirection(RouteDirectionInfo i){
|
||||||
if(i.routePointOffset < locations.size()){
|
if(i.routePointOffset < locations.size()){
|
||||||
return locations.get(i.routePointOffset);
|
return locations.get(i.routePointOffset);
|
||||||
|
|
|
@ -339,22 +339,23 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. check if intermediate found
|
// 2. check if intermediate found
|
||||||
if(getLeftDistanceNextIntermediate() < posTolerance * 1.5f){
|
if(route.getIntermediatePointsToPass() > 0 && route.getDistanceToNextIntermediate(lastFixedLocation) < posTolerance) {
|
||||||
showMessage(context.getString(R.string.arrived_at_intermediate_point));
|
showMessage(context.getString(R.string.arrived_at_intermediate_point));
|
||||||
voiceRouter.arrivedIntermediatePoint();
|
voiceRouter.arrivedIntermediatePoint();
|
||||||
}
|
route.passIntermediatePoint();
|
||||||
if(intermediatePoints != null && intermediatePoints.size() > 0) {
|
int toDel = settings.getIntermediatePoints().size() - route.getIntermediatePointsToPass();
|
||||||
while(route.getIntermediatePointsToPass() > settings.getIntermediatePoints().size()) {
|
while(toDel > 0) {
|
||||||
settings.deleteIntermediatePoint(0);
|
settings.deleteIntermediatePoint(0);
|
||||||
|
toDel--;
|
||||||
}
|
}
|
||||||
while(route.getIntermediatePointsToPass() > intermediatePoints.size()) {
|
while(intermediatePoints != null && route.getIntermediatePointsToPass() < intermediatePoints.size()) {
|
||||||
intermediatePoints.remove(0);
|
intermediatePoints.remove(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. check if destination found
|
// 3. check if destination found
|
||||||
Location lastPoint = routeNodes.get(routeNodes.size() - 1);
|
Location lastPoint = routeNodes.get(routeNodes.size() - 1);
|
||||||
if (currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < posTolerance * 1.5) {
|
if (currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < posTolerance * 1.2) {
|
||||||
showMessage(context.getString(R.string.arrived_at_destination));
|
showMessage(context.getString(R.string.arrived_at_destination));
|
||||||
voiceRouter.arrivedDestinationPoint();
|
voiceRouter.arrivedDestinationPoint();
|
||||||
clearCurrentRoute(null, null);
|
clearCurrentRoute(null, null);
|
||||||
|
|
|
@ -97,7 +97,8 @@ public class PointNavigationLayer extends OsmandMapLayer {
|
||||||
int locationY = view.getMapYForPoint(ip.getLatitude());
|
int locationY = view.getMapYForPoint(ip.getLatitude());
|
||||||
canvas.rotate(-view.getRotate(), locationX, locationY);
|
canvas.rotate(-view.getRotate(), locationX, locationY);
|
||||||
canvas.drawBitmap(intermediatePoint, locationX - marginX, locationY - marginY, bitmapPaint);
|
canvas.drawBitmap(intermediatePoint, locationX - marginX, locationY - marginY, bitmapPaint);
|
||||||
canvas.drawText(index + "", locationX + marginX, locationY, textPaint);
|
canvas.drawText(index + "", locationX + marginX, locationY - marginY / 2, textPaint);
|
||||||
|
canvas.rotate(view.getRotate(), locationX, locationY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isLocationVisible(pointToNavigate)) {
|
if (isLocationVisible(pointToNavigate)) {
|
||||||
|
|
Loading…
Reference in a new issue