Download layer
This commit is contained in:
parent
2749b01454
commit
a449658b41
3 changed files with 25 additions and 8 deletions
|
@ -457,6 +457,12 @@ public class RotatedTileBox {
|
|||
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) {
|
||||
final double lat1 = getLatFromPixel(pixX, pixY);
|
||||
|
|
|
@ -336,7 +336,16 @@ 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 (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);
|
||||
|
@ -347,6 +356,7 @@ public class RouteResultPreparation {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result.get(i).setTurnType(t);
|
||||
}
|
||||
if (t != null || i == result.size()) {
|
||||
|
|
|
@ -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