From 73dcd46565a0c62a263bf324fbc2143009a1dff4 Mon Sep 17 00:00:00 2001 From: Hardy Date: Wed, 9 Mar 2016 08:25:18 -0800 Subject: [PATCH] Try to complete miles rounded interval exceptions fix --- .../src/net/osmand/plus/OsmAndFormatter.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java index 9493fc78a2..ed572c5c27 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java @@ -66,15 +66,15 @@ public class OsmAndFormatter { pointer = 1; } } - //Miles exceptions - //FIXME (conversions missing) -// if (mc == MetricsConstants.MILES_AND_FOOTS && point == 1 / metersInSecondUnit && roundDist == 2000) { -// roundDist = 0.5f; -// } else if (mc == MetricsConstants.MILES_AND_YARDS && point == 1 / metersInSecondUnit && roundDist == 1000) { -// roundDist = 0.5f; -// } else if (mc == MetricsConstants.MILES_AND_YARDS && point == 1 / metersInSecondUnit && roundDist == 500) { -// roundDist = 0.25f; -// } + //Miles exceptions: 2000ft->0.5mi, 1000yd->0.5mi, 500yd->0.25mi + + if (mc == MetricsConstants.MILES_AND_FOOTS && point == 1 / metersInSecondUnit && roundDist == 2000 / FOOTS_IN_ONE_METER) { + roundDist = 0.5f * METERS_IN_ONE_MILE; + } else if (mc == MetricsConstants.MILES_AND_YARDS && point == 1 / metersInSecondUnit && roundDist == 1000 / YARDS_IN_ONE_METER) { + roundDist = 0.5f * METERS_IN_ONE_MILE; + } else if (mc == MetricsConstants.MILES_AND_YARDS && point == 1 / metersInSecondUnit && roundDist == 500 / YARDS_IN_ONE_METER) { + roundDist = 0.25f * METERS_IN_ONE_MILE; + } return roundDist; }