From 6c29a3c8651955e6bc5a5cca3f44996cc249bd3e Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 29 Jul 2016 18:30:18 +0200 Subject: [PATCH] Add transport route --- .../mapcontextmenu/controllers/TransportStopController.java | 3 ++- .../net/osmand/plus/resources/TransportIndexRepository.java | 3 ++- .../plus/resources/TransportIndexRepositoryBinary.java | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java index f774bfcc74..d5bda3a9b9 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java @@ -1,6 +1,7 @@ package net.osmand.plus.mapcontextmenu.controllers; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import net.osmand.data.LatLon; @@ -146,7 +147,7 @@ public class TransportStopController extends MenuController { for (TransportIndexRepository t : reps) { if (t.acceptTransportStop(transportStop)) { - List rts = t.getRouteForStop(transportStop); + Collection rts = t.getRouteForStop(transportStop); if (rts != null) { for (TransportRoute rs : rts) { TransportStopType type = TransportStopType.findType(rs.getType()); diff --git a/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepository.java b/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepository.java index 9e6df98679..a4eec127cb 100644 --- a/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepository.java +++ b/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepository.java @@ -1,5 +1,6 @@ package net.osmand.plus.resources; +import java.util.Collection; import java.util.List; import net.osmand.ResultMatcher; @@ -18,7 +19,7 @@ public interface TransportIndexRepository { public void searchTransportStops(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int limit, List stops, ResultMatcher matcher); - public List getRouteForStop(TransportStop stop); + public Collection getRouteForStop(TransportStop stop); public List searchTransportRouteStops(double latitude, double longitude, LatLon locationToGo, int zoom); diff --git a/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepositoryBinary.java b/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepositoryBinary.java index aadb5201e7..8da790ef19 100644 --- a/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepositoryBinary.java +++ b/OsmAnd/src/net/osmand/plus/resources/TransportIndexRepositoryBinary.java @@ -5,6 +5,7 @@ import gnu.trove.map.hash.TIntObjectHashMap; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -56,9 +57,9 @@ public class TransportIndexRepositoryBinary implements TransportIndexRepository } @Override - public List getRouteForStop(TransportStop stop){ + public Collection getRouteForStop(TransportStop stop){ try { - List res = file.getTransportRouteDescriptions(stop); + Collection res = file.getTransportRoutes(stop.getReferencesToRoutes()).valueCollection(); if(res != null){ return res; }