Add minor stop 10281

This commit is contained in:
Kseniia 2021-03-06 09:52:51 +02:00
parent d230a323ce
commit 5520f7fb75

View file

@ -186,32 +186,22 @@ public class RouteResultPreparation {
public RouteSegmentResult filterMinorStops(RouteSegmentResult seg) { public RouteSegmentResult filterMinorStops(RouteSegmentResult seg) {
List<Integer> stops = null; List<Integer> stops = null;
int startPoint = seg.getStartPointIndex(); boolean plus = seg.getStartPointIndex() < seg.getEndPointIndex();
int endPoint = seg.getEndPointIndex(); int next;
int start;
int end;
if (startPoint < endPoint) { for (int i = seg.getStartPointIndex(); i != seg.getEndPointIndex(); i = next) {
start = startPoint; next = plus ? i + 1 : i - 1;
end = endPoint; int[] pointTypes = seg.getObject().getPointTypes(i);
} else {
start = endPoint;
end = startPoint;
}
while (start <= end) {
int[] pointTypes = seg.getObject().getPointTypes(start);
if (pointTypes != null) { if (pointTypes != null) {
for (int j = 0; j < pointTypes.length; j++) { for (int j = 0; j < pointTypes.length; j++) {
if (pointTypes[j] == seg.getObject().region.stopMinor) { if (pointTypes[j] == seg.getObject().region.stopMinor) {
if (stops == null) { if (stops == null) {
stops = new ArrayList<>(); stops = new ArrayList<>();
} }
stops.add(start); stops.add(i);
} }
} }
} }
start++;
} }
if (stops != null) { if (stops != null) {