use elevation type for filter value

This commit is contained in:
afischerdev 2023-11-28 15:17:51 +01:00
parent 16d019c1d0
commit 068a5ff714

View file

@ -20,6 +20,7 @@ import btools.mapaccess.OsmLink;
import btools.mapaccess.OsmLinkHolder; import btools.mapaccess.OsmLinkHolder;
import btools.mapaccess.OsmNode; import btools.mapaccess.OsmNode;
import btools.mapaccess.OsmNodePairSet; import btools.mapaccess.OsmNodePairSet;
import btools.mapaccess.OsmPos;
import btools.util.CompactLongMap; import btools.util.CompactLongMap;
import btools.util.SortedHeap; import btools.util.SortedHeap;
import btools.util.StackSampler; import btools.util.StackSampler;
@ -855,11 +856,12 @@ public class RoutingEngine extends Thread {
if (ele_last != Short.MIN_VALUE) { if (ele_last != Short.MIN_VALUE) {
ehb = ehb + (ele_last - ele) * eleFactor; ehb = ehb + (ele_last - ele) * eleFactor;
} }
double filter = elevationFilter(n);
if (ehb > 0) { if (ehb > 0) {
ascend += ehb; ascend += ehb;
ehb = 0; ehb = 0;
} else if (ehb < -10) { } else if (ehb < filter) {
ehb = -10; ehb = filter;
} }
} }
@ -896,6 +898,21 @@ public class RoutingEngine extends Thread {
logInfo("filtered ascend = " + t.ascend); logInfo("filtered ascend = " + t.ascend);
} }
/**
* find the elevation type for position
* to determine the filter value
*
* @param n the point
* @return the filter value for 1sec / 3sec elevation source
*/
double elevationFilter(OsmPos n) {
if (nodesCache != null) {
int r = nodesCache.getElevationType(n.getILon(), n.getILat());
if (r == 1) return -5.;
}
return -10.;
}
// geometric position matching finding the nearest routable way-section // geometric position matching finding the nearest routable way-section
private void matchWaypointsToNodes(List<MatchedWaypoint> unmatchedWaypoints) { private void matchWaypointsToNodes(List<MatchedWaypoint> unmatchedWaypoints) {
resetCache(false); resetCache(false);