diff --git a/OsmAnd-java/build.gradle b/OsmAnd-java/build.gradle index d4e77b9d85..d461ea8aff 100644 --- a/OsmAnd-java/build.gradle +++ b/OsmAnd-java/build.gradle @@ -112,7 +112,6 @@ dependencies { implementation group: 'org.json', name: 'json', version: '20171018' implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1' implementation 'org.apache.commons:commons-compress:1.17' - implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0' implementation 'com.moparisthebest:junidecode:0.1.1' implementation 'com.vividsolutions:jts-core:1.14.0' implementation 'com.google.openlocationcode:openlocationcode:1.0.4' diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java index 61d282e5e4..d4c4024b27 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java @@ -8,7 +8,6 @@ import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; import net.osmand.util.TransliterationHelper; -import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.logging.Log; import java.text.MessageFormat; @@ -504,9 +503,16 @@ public class RouteDataObject { public void removePointType(int ind, int type) { if (pointTypes != null || ind < pointTypes.length) { int[] typesArr = pointTypes[ind]; - for (int t : typesArr) { - if (t == type) { - pointTypes[ind] = ArrayUtils.removeElement(typesArr, t); + + for (int i = 0; i < typesArr.length; i++) { + if (typesArr[i] == type) { + int[] result = new int[typesArr.length - 1]; + System.arraycopy(typesArr, 0, result, 0, i); + if (typesArr.length != i) { + System.arraycopy(typesArr, i + 1, result, i, typesArr.length - 1 - i); + pointTypes[ind] = result; + break; + } } } } 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 d79bbc53da..2faf6b1833 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -177,19 +177,30 @@ public class RouteResultPreparation { validateAllPointsConnected(result); splitRoadsAndAttachRoadSegments(ctx, result, recalculation); for (int i = 0; i < result.size(); i++) { - prepareStopSign(result.get(i)); + filterMinorStops(result.get(i)); } calculateTimeSpeed(ctx, result); prepareTurnResults(ctx, result); return result; } - public RouteSegmentResult prepareStopSign(RouteSegmentResult seg) { - int start = seg.getStartPointIndex(); - int end = seg.getEndPointIndex(); + public RouteSegmentResult filterMinorStops(RouteSegmentResult seg) { + int startPoint = seg.getStartPointIndex(); + int endPoint = seg.getEndPointIndex(); + int start; + int end; + + if (startPoint < endPoint) { + start = startPoint; + end = endPoint; + } else { + start = endPoint; + end = startPoint; + } + List stops = new ArrayList<>(); - for (int i = start; i > end; i--) { + for (int i = start; i < end; i++) { int[] pointTypes = seg.getObject().getPointTypes(i); if (pointTypes != null) { for (int j = 0; j < pointTypes.length; j++) {