Update transport route / add new method

This commit is contained in:
Victor Shcherb 2020-05-01 15:25:02 +02:00
parent 97ae3c0bcd
commit 27c19e483b

View file

@ -65,8 +65,12 @@ public class TransportRoute extends MapObject {
return forwardWays;
}
public void mergeForwardWays() {
mergeRouteWays(forwardWays);
resortWaysToStopsOrder(forwardWays, forwardStops);
}
public static void mergeRouteWays(List<Way> forwardWays) {
boolean changed = true;
// combine as many ways as possible
while (changed && forwardWays != null) {
@ -129,10 +133,13 @@ public class TransportRoute extends MapObject {
}
}
}
if (forwardStops.size() > 0) {
}
public static Map<Way, int[]> resortWaysToStopsOrder(List<Way> forwardWays, List<TransportStop> forwardStops) {
final Map<Way, int[]> orderWays = new HashMap<Way, int[]>();
if (forwardWays != null && forwardStops.size() > 0) {
// resort ways to stops order
final Map<Way, int[]> orderWays = new HashMap<Way, int[]>();
for (Way w : getForwardWays()) {
for (Way w : forwardWays) {
int[] pair = new int[] { 0, 0 };
Node firstNode = w.getFirstNode();
TransportStop st = forwardStops.get(0);
@ -175,6 +182,7 @@ public class TransportRoute extends MapObject {
}
}
return orderWays;
}