From 9a44cd70e66b8778d9edbb462decb5f2774bd3ac Mon Sep 17 00:00:00 2001 From: Kseniia Date: Thu, 4 Mar 2021 14:15:33 +0200 Subject: [PATCH] Add minor stop 10281 --- .../osmand/router/RouteResultPreparation.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 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 2faf6b1833..16c492422a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -185,6 +185,7 @@ public class RouteResultPreparation { } public RouteSegmentResult filterMinorStops(RouteSegmentResult seg) { + List stops = null; int startPoint = seg.getStartPointIndex(); int endPoint = seg.getEndPointIndex(); int start; @@ -198,27 +199,31 @@ public class RouteResultPreparation { end = startPoint; } - List stops = new ArrayList<>(); - - for (int i = start; i < end; i++) { - int[] pointTypes = seg.getObject().getPointTypes(i); + while (start <= end) { + int[] pointTypes = seg.getObject().getPointTypes(start); if (pointTypes != null) { for (int j = 0; j < pointTypes.length; j++) { if (pointTypes[j] == seg.getObject().region.stopMinor) { - stops.add(i); + if (stops == null) { + stops = new ArrayList<>(); + } + stops.add(start); } } } + start++; } - for (int stop : stops) { - List attachedRoutes = seg.getAttachedRoutes(stop); - for (RouteSegmentResult attached : attachedRoutes) { - int attStopPriority = highwaySpeakPriority(attached.getObject().getHighway()); - int segStopPriority = highwaySpeakPriority(seg.getObject().getHighway()); - if (segStopPriority < attStopPriority) { - seg.getObject().removePointType(stop, seg.getObject().region.stopSign); - break; + if (stops != null) { + for (int stop : stops) { + List attachedRoutes = seg.getAttachedRoutes(stop); + for (RouteSegmentResult attached : attachedRoutes) { + int attStopPriority = highwaySpeakPriority(attached.getObject().getHighway()); + int segStopPriority = highwaySpeakPriority(seg.getObject().getHighway()); + if (segStopPriority < attStopPriority) { + seg.getObject().removePointType(stop, seg.getObject().region.stopSign); + break; + } } } }