From 7ade1a9ad96929ffa1792cf517a19ddd40ddc141 Mon Sep 17 00:00:00 2001 From: sonora Date: Mon, 28 Nov 2016 15:52:20 +0100 Subject: [PATCH] Elevation Profile: Fix for files with sub-zero values --- OsmAnd/src/net/osmand/plus/myplaces/ElevationView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/myplaces/ElevationView.java b/OsmAnd/src/net/osmand/plus/myplaces/ElevationView.java index 94d063dd25..dbbf93aba2 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/ElevationView.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/ElevationView.java @@ -43,8 +43,8 @@ public class ElevationView extends ImageView { final int stepBase = useFeet ? 200 : 100; final float convEle = useFeet ? 3.28084f : 1.0f; - final int maxBase = ((int)(maxElevation * convEle / stepBase) + 1) * stepBase; - final int minBase = (int)(minElevation * convEle / stepBase) * stepBase; + final int maxBase = ((int)Math.floor((maxElevation * convEle / stepBase) + 1)) * stepBase; + final int minBase = (int)Math.floor((minElevation * convEle / stepBase)) * stepBase; final float yDistance = maxBase - minBase; final float xPer = (float)canvas.getWidth() / xDistance; final float yPer = (float)canvas.getHeight() / yDistance;