Create initial progress
This commit is contained in:
parent
35c53ed5e3
commit
50647d29f7
1 changed files with 13 additions and 8 deletions
|
@ -21,21 +21,26 @@ public class RouteCalculationProgress {
|
||||||
public boolean isCancelled;
|
public boolean isCancelled;
|
||||||
public boolean requestPrivateAccessRouting;
|
public boolean requestPrivateAccessRouting;
|
||||||
|
|
||||||
private static final float FIRST_ITERATION = 0.75f;
|
private static final float INITIAL_PROGRSS = 0.05f;
|
||||||
|
private static final float FIRST_ITERATION = 0.72f;
|
||||||
|
|
||||||
public float getLinearProgress() {
|
public float getLinearProgress() {
|
||||||
float p = Math.max(distanceFromBegin, distanceFromEnd);
|
float p = Math.max(distanceFromBegin, distanceFromEnd);
|
||||||
float all = totalEstimatedDistance * 1.25f;
|
float all = totalEstimatedDistance * 1.25f;
|
||||||
float pr = 0;
|
float pr = 0;
|
||||||
if (all > 0) {
|
if (all > 0) {
|
||||||
pr = Math.min(p * p / (all * all) * 100f, 99);
|
pr = p * p / (all * all);
|
||||||
}
|
}
|
||||||
if(totalIterations > 1) {
|
float progress = INITIAL_PROGRSS;
|
||||||
if(iteration <= 0) {
|
if (totalIterations > 1) {
|
||||||
return pr * FIRST_ITERATION;
|
if (iteration <= 0) {
|
||||||
|
progress = pr * FIRST_ITERATION + INITIAL_PROGRSS;
|
||||||
} else {
|
} else {
|
||||||
return Math.min(FIRST_ITERATION * 100 + pr * (1 - FIRST_ITERATION), 99);
|
progress = (INITIAL_PROGRSS + FIRST_ITERATION) + pr * (1 - FIRST_ITERATION - INITIAL_PROGRSS);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
progress = INITIAL_PROGRSS + pr * (1 - INITIAL_PROGRSS);
|
||||||
}
|
}
|
||||||
return pr;
|
return Math.min(progress * 100f, 99);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue