Add minor stop 10281

This commit is contained in:
Kseniia 2021-03-04 14:15:33 +02:00
parent 368b2ff8f9
commit 9a44cd70e6

View file

@ -185,6 +185,7 @@ public class RouteResultPreparation {
} }
public RouteSegmentResult filterMinorStops(RouteSegmentResult seg) { public RouteSegmentResult filterMinorStops(RouteSegmentResult seg) {
List<Integer> stops = null;
int startPoint = seg.getStartPointIndex(); int startPoint = seg.getStartPointIndex();
int endPoint = seg.getEndPointIndex(); int endPoint = seg.getEndPointIndex();
int start; int start;
@ -198,27 +199,31 @@ public class RouteResultPreparation {
end = startPoint; end = startPoint;
} }
List<Integer> stops = new ArrayList<>(); while (start <= end) {
int[] pointTypes = seg.getObject().getPointTypes(start);
for (int i = start; i < end; i++) {
int[] pointTypes = seg.getObject().getPointTypes(i);
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) {
stops.add(i); if (stops == null) {
stops = new ArrayList<>();
}
stops.add(start);
} }
} }
} }
start++;
} }
for (int stop : stops) { if (stops != null) {
List<RouteSegmentResult> attachedRoutes = seg.getAttachedRoutes(stop); for (int stop : stops) {
for (RouteSegmentResult attached : attachedRoutes) { List<RouteSegmentResult> attachedRoutes = seg.getAttachedRoutes(stop);
int attStopPriority = highwaySpeakPriority(attached.getObject().getHighway()); for (RouteSegmentResult attached : attachedRoutes) {
int segStopPriority = highwaySpeakPriority(seg.getObject().getHighway()); int attStopPriority = highwaySpeakPriority(attached.getObject().getHighway());
if (segStopPriority < attStopPriority) { int segStopPriority = highwaySpeakPriority(seg.getObject().getHighway());
seg.getObject().removePointType(stop, seg.getObject().region.stopSign); if (segStopPriority < attStopPriority) {
break; seg.getObject().removePointType(stop, seg.getObject().region.stopSign);
break;
}
} }
} }
} }