Download layer
This commit is contained in:
parent
2749b01454
commit
a449658b41
3 changed files with 25 additions and 8 deletions
|
@ -456,6 +456,12 @@ public class RotatedTileBox {
|
|||
double ty = getPixYFromLatLon(lat, lon);
|
||||
return tx >= 0 && tx <= pixWidth && ty >= 0 && ty <= pixHeight;
|
||||
}
|
||||
|
||||
public boolean containsLatLon(LatLon latLon) {
|
||||
double tx = getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||
double ty = getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||
return tx >= 0 && tx <= pixWidth && ty >= 0 && ty <= pixHeight;
|
||||
}
|
||||
|
||||
|
||||
public double getDistance(int pixX, int pixY, int pixX2, int pixY2) {
|
||||
|
|
|
@ -336,13 +336,23 @@ public class RouteResultPreparation {
|
|||
boolean tr = TurnType.TR.equals(t.getValue());
|
||||
if(tl || tr) {
|
||||
TurnType tnext = getTurnInfo(result, i + 1, leftside);
|
||||
if(tnext != null && result.get(i).getDistance() < 35) {
|
||||
if(tl && TurnType.TL.equals(tnext.getValue()) ) {
|
||||
next = i + 2;
|
||||
t = TurnType.valueOf(TurnType.TU, false);
|
||||
} else if(tr && TurnType.TR.equals(tnext.getValue()) ) {
|
||||
next = i + 2;
|
||||
t = TurnType.valueOf(TurnType.TU, true);
|
||||
if (tnext != null && result.get(i).getDistance() < 35) { //
|
||||
boolean ut = true;
|
||||
if (i > 0) {
|
||||
double uTurn = MapUtils.degreesDiff(result.get(i - 1).getBearingEnd(), result
|
||||
.get(i + 1).getBearingBegin());
|
||||
if (Math.abs(uTurn) < 120) {
|
||||
ut = false;
|
||||
}
|
||||
}
|
||||
if (ut) {
|
||||
if (tl && TurnType.TL.equals(tnext.getValue())) {
|
||||
next = i + 2;
|
||||
t = TurnType.valueOf(TurnType.TU, false);
|
||||
} else if (tr && TurnType.TR.equals(tnext.getValue())) {
|
||||
next = i + 2;
|
||||
t = TurnType.valueOf(TurnType.TU, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,8 @@ public class DownloadedRegionsLayer extends OsmandMapLayer {
|
|||
// wait for image to be rendered
|
||||
int count = 0;
|
||||
RotatedTileBox cb = rm.getRenderer().getCheckedBox();
|
||||
while (cb == null || cb.getZoom() != tileBox.getZoom()) {
|
||||
while (cb == null || cb.getZoom() != tileBox.getZoom() ||
|
||||
!cb.containsLatLon(tileBox.getCenterLatLon())) {
|
||||
if (count++ > 7) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue