Fix #3244
This commit is contained in:
parent
adc2a2f1c1
commit
2fd9d32b78
1 changed files with 5 additions and 4 deletions
|
@ -31,7 +31,7 @@ import android.graphics.PorterDuffColorFilter;
|
||||||
|
|
||||||
public class RouteLayer extends OsmandMapLayer {
|
public class RouteLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private static final float EPSILON_IN_DPI = 4;
|
private static final float EPSILON_IN_DPI = 2;
|
||||||
|
|
||||||
private OsmandMapTileView view;
|
private OsmandMapTileView view;
|
||||||
|
|
||||||
|
@ -273,9 +273,13 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
distances = new ArrayList<Double>(locations.size());
|
distances = new ArrayList<Double>(locations.size());
|
||||||
angles = new ArrayList<Double>(locations.size());
|
angles = new ArrayList<Double>(locations.size());
|
||||||
simplifyPoints.fill(0, locations.size(), (byte)0);
|
simplifyPoints.fill(0, locations.size(), (byte)0);
|
||||||
|
if(locations.size() > 0) {
|
||||||
|
simplifyPoints.set(0, (byte) 1);
|
||||||
|
}
|
||||||
double distInPix = (tb.getDistance(0, 0, tb.getPixWidth(), 0) / tb.getPixWidth());
|
double distInPix = (tb.getDistance(0, 0, tb.getPixWidth(), 0) / tb.getPixWidth());
|
||||||
double cullDistance = (distInPix * (EPSILON_IN_DPI * Math.max(1, tb.getDensity())));
|
double cullDistance = (distInPix * (EPSILON_IN_DPI * Math.max(1, tb.getDensity())));
|
||||||
cullRamerDouglasPeucker(simplifyPoints, locations, 0, locations.size() - 1, cullDistance);
|
cullRamerDouglasPeucker(simplifyPoints, locations, 0, locations.size() - 1, cullDistance);
|
||||||
|
|
||||||
int previousIndex = -1;
|
int previousIndex = -1;
|
||||||
for(int i = 0; i < locations.size(); i++) {
|
for(int i = 0; i < locations.size(); i++) {
|
||||||
double d = 0;
|
double d = 0;
|
||||||
|
@ -301,9 +305,6 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Double> getAngles() {
|
|
||||||
return angles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Double> getDistances() {
|
public List<Double> getDistances() {
|
||||||
return distances;
|
return distances;
|
||||||
|
|
Loading…
Reference in a new issue