From 148e602c6b4ea003ba03e5661d4305b0ba5fd557 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 23 Sep 2015 13:14:46 +0300 Subject: [PATCH 1/3] Context menu - fix borders in landscape on hide --- OsmAnd/res/layout/main.xml | 8 ++++++++ OsmAnd/res/layout/map_hud_bottom.xml | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/layout/main.xml b/OsmAnd/res/layout/main.xml index 8055744234..19924688a6 100644 --- a/OsmAnd/res/layout/main.xml +++ b/OsmAnd/res/layout/main.xml @@ -48,6 +48,14 @@ + + + - - - From a0d0db1fae9cfab9350c07ba7ff4d0663b86bc39 Mon Sep 17 00:00:00 2001 From: sonora Date: Wed, 23 Sep 2015 12:39:36 +0200 Subject: [PATCH 2/3] first prototype elevation gain/losss accumulation via trend channel --- OsmAnd/src/net/osmand/plus/GPXUtilities.java | 66 +++++++++++++++++--- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/GPXUtilities.java b/OsmAnd/src/net/osmand/plus/GPXUtilities.java index 6277b66929..17e7b6678f 100644 --- a/OsmAnd/src/net/osmand/plus/GPXUtilities.java +++ b/OsmAnd/src/net/osmand/plus/GPXUtilities.java @@ -226,8 +226,17 @@ public class GPXUtilities { double totalSpeedSum = 0; points = 0; + double channelThres = 5; + double channelBase; + double channelTop; + double channelBottom; + boolean climb = false; + for (SplitSegment s : splitSegments) { final int numberOfPoints = s.getNumberOfPoints(); + + channelBase = 99999; + metricEnd += s.metricEnd; points += numberOfPoints; for (int j = 0; j < numberOfPoints; j++) { @@ -259,17 +268,58 @@ public class GPXUtilities { speedCount++; } + // Trend channel approach for elevation gain/loss, Hardy 2015-09-22 + if (!Double.isNaN(point.ele)) { + // Init channel + if (channelBase == 99999) { + channelBase = point.ele; + channelTop = channelBase; + channelBottom = channelBase; + } + // Channel maintenance + if (point.ele > channelTop) { + channelTop = point.ele; + } else if (point.ele < channelBottom) { + channelBottom = point.ele; + } + // Turnaround (breakout) detection + if ((point.ele <= (channelTop - channelThres)) && (climb == true)) { + if ((channelTop - channelBase) >= channelThres) { + diffElevationUp += channelTop - channelBase; + } + channelBase = channelTop; + channelBottom = point.ele; + climb = false; + } else if ((point.ele >= (channelBottom + channelThres)) && (climb == false)) { + if ((channelBase - channelBottom) >= channelThres) { + diffElevationDown += channelBase - channelBottom; + } + channelBase = channelBottom; + channelTop = point.ele; + climb = true; + // End detection without breakout + } else if (j == numberOfPoints -1) { + if ((channelTop - channelBase) >= channelThres) { + diffElevationUp += channelTop - channelBase; + } + if ((channelBase - channelBottom) >= channelThres) { + diffElevationDown += channelBase - channelBottom; + } + } + } + if (j > 0) { WptPt prev = s.get(j - 1); - if (!Double.isNaN(point.ele) && !Double.isNaN(prev.ele)) { - double diff = point.ele - prev.ele; - if (diff > 0) { - diffElevationUp += diff; - } else { - diffElevationDown -= diff; - } - } + // Old complete summation approach for elevation gain/loss + //if (!Double.isNaN(point.ele) && !Double.isNaN(prev.ele)) { + // double diff = point.ele - prev.ele; + // if (diff > 0) { + // diffElevationUp += diff; + // } else { + // diffElevationDown -= diff; + // } + //} // totalDistance += MapUtils.getDistance(prev.lat, prev.lon, point.lat, point.lon); // using ellipsoidal 'distanceBetween' instead of spherical haversine (MapUtils.getDistance) is From 6cca11850b59762d1dbc971229794300c4ab20a4 Mon Sep 17 00:00:00 2001 From: sonora Date: Wed, 23 Sep 2015 12:52:17 +0200 Subject: [PATCH 3/3] fix build --- OsmAnd/src/net/osmand/plus/GPXUtilities.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/GPXUtilities.java b/OsmAnd/src/net/osmand/plus/GPXUtilities.java index 17e7b6678f..be18c80acb 100644 --- a/OsmAnd/src/net/osmand/plus/GPXUtilities.java +++ b/OsmAnd/src/net/osmand/plus/GPXUtilities.java @@ -236,6 +236,8 @@ public class GPXUtilities { final int numberOfPoints = s.getNumberOfPoints(); channelBase = 99999; + channelTop = channelBase; + channelBottom = channelBase; metricEnd += s.metricEnd; points += numberOfPoints;