From 5520f7fb75f42da978d179ac298596a61ed06470 Mon Sep 17 00:00:00 2001 From: Kseniia Date: Sat, 6 Mar 2021 09:52:51 +0200 Subject: [PATCH] Add minor stop 10281 --- .../osmand/router/RouteResultPreparation.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java index 16c492422a..c6a5f1d393 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -186,32 +186,22 @@ public class RouteResultPreparation { public RouteSegmentResult filterMinorStops(RouteSegmentResult seg) { List stops = null; - int startPoint = seg.getStartPointIndex(); - int endPoint = seg.getEndPointIndex(); - int start; - int end; + boolean plus = seg.getStartPointIndex() < seg.getEndPointIndex(); + int next; - if (startPoint < endPoint) { - start = startPoint; - end = endPoint; - } else { - start = endPoint; - end = startPoint; - } - - while (start <= end) { - int[] pointTypes = seg.getObject().getPointTypes(start); + for (int i = seg.getStartPointIndex(); i != seg.getEndPointIndex(); i = next) { + next = plus ? i + 1 : i - 1; + int[] pointTypes = seg.getObject().getPointTypes(i); if (pointTypes != null) { for (int j = 0; j < pointTypes.length; j++) { if (pointTypes[j] == seg.getObject().region.stopMinor) { if (stops == null) { stops = new ArrayList<>(); } - stops.add(start); + stops.add(i); } } } - start++; } if (stops != null) {