From bdd0424ca46073fd4ab30b3c92f445a2c7e0d3d1 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 15 Mar 2019 13:30:52 +0100 Subject: [PATCH] Fix crucial bug for public transport #6687 --- .../java/net/osmand/data/TransportRoute.java | 5 ++- .../osmand/router/TransportRoutePlanner.java | 31 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java index a6bcad107d..b58237dfe0 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/TransportRoute.java @@ -43,7 +43,10 @@ public class TransportRoute extends MapObject { } public List getForwardWays() { - return forwardWays == null ? Collections.emptyList() : forwardWays; + if(forwardWays == null) { + return Collections.emptyList(); + } + return forwardWays; } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index e980f3c870..f61c90be54 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -1,16 +1,9 @@ package net.osmand.router; -import net.osmand.Location; -import net.osmand.binary.BinaryMapIndexReader; -import net.osmand.binary.BinaryMapIndexReader.SearchRequest; -import net.osmand.data.LatLon; -import net.osmand.data.QuadRect; -import net.osmand.data.TransportRoute; -import net.osmand.data.TransportSchedule; -import net.osmand.data.TransportStop; -import net.osmand.osm.edit.Node; -import net.osmand.osm.edit.Way; -import net.osmand.util.MapUtils; +import gnu.trove.iterator.TIntIterator; +import gnu.trove.list.array.TIntArrayList; +import gnu.trove.map.hash.TIntObjectHashMap; +import gnu.trove.map.hash.TLongObjectHashMap; import java.io.IOException; import java.util.ArrayList; @@ -21,10 +14,16 @@ import java.util.List; import java.util.Map; import java.util.PriorityQueue; -import gnu.trove.iterator.TIntIterator; -import gnu.trove.list.array.TIntArrayList; -import gnu.trove.map.hash.TIntObjectHashMap; -import gnu.trove.map.hash.TLongObjectHashMap; +import net.osmand.binary.BinaryMapIndexReader; +import net.osmand.binary.BinaryMapIndexReader.SearchRequest; +import net.osmand.data.LatLon; +import net.osmand.data.QuadRect; +import net.osmand.data.TransportRoute; +import net.osmand.data.TransportSchedule; +import net.osmand.data.TransportStop; +import net.osmand.osm.edit.Node; +import net.osmand.osm.edit.Way; +import net.osmand.util.MapUtils; public class TransportRoutePlanner { @@ -96,7 +95,7 @@ public class TransportRoutePlanner { } else { travelTime += ctx.cfg.stopTime + segmentDist / ctx.cfg.travelSpeed; } - if(travelDist > finishTime + ctx.cfg.finishTimeSeconds) { + if(travelTime > finishTime + ctx.cfg.finishTimeSeconds) { break; } sgms.clear();