Elevation Profile: Fix for files with sub-zero values
This commit is contained in:
parent
cc07ef46e5
commit
7ade1a9ad9
1 changed files with 2 additions and 2 deletions
|
@ -43,8 +43,8 @@ public class ElevationView extends ImageView {
|
||||||
final int stepBase = useFeet ? 200 : 100;
|
final int stepBase = useFeet ? 200 : 100;
|
||||||
final float convEle = useFeet ? 3.28084f : 1.0f;
|
final float convEle = useFeet ? 3.28084f : 1.0f;
|
||||||
|
|
||||||
final int maxBase = ((int)(maxElevation * convEle / stepBase) + 1) * stepBase;
|
final int maxBase = ((int)Math.floor((maxElevation * convEle / stepBase) + 1)) * stepBase;
|
||||||
final int minBase = (int)(minElevation * convEle / stepBase) * stepBase;
|
final int minBase = (int)Math.floor((minElevation * convEle / stepBase)) * stepBase;
|
||||||
final float yDistance = maxBase - minBase;
|
final float yDistance = maxBase - minBase;
|
||||||
final float xPer = (float)canvas.getWidth() / xDistance;
|
final float xPer = (float)canvas.getWidth() / xDistance;
|
||||||
final float yPer = (float)canvas.getHeight() / yDistance;
|
final float yPer = (float)canvas.getHeight() / yDistance;
|
||||||
|
|
Loading…
Reference in a new issue