From 4503feeb2249230668787a03ada26d4c81293eea Mon Sep 17 00:00:00 2001 From: sonora Date: Sat, 28 Oct 2017 19:37:43 +0200 Subject: [PATCH] optimze code --- OsmAnd-java/src/net/osmand/binary/RouteDataObject.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java index 07890f76d9..0aa381765f 100644 --- a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java @@ -705,8 +705,10 @@ public class RouteDataObject { //} } // Experimental: Distance analysis for STOP with no recognized directional tagging - if (((direction == true) && (distance(0, intId) < distance(intId, getPointsLength() - 1))) - || ((direction == false) && (distance(0, intId) > distance(intId, getPointsLength() - 1)))) { + double d1 = distance(0, intId); + double d2 = distance(intId, getPointsLength() - 1); + if (((direction == true) && (d1 < d2)) + || ((direction == false) && (d1 > d2)) && (d1 != 0) && (d2 != 0)) { return false; } // No directional info detected