Add transport route

This commit is contained in:
Victor Shcherb 2016-07-29 18:30:18 +02:00
parent 20d2204b2e
commit 6c29a3c865
3 changed files with 7 additions and 4 deletions

View file

@ -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<TransportRoute> rts = t.getRouteForStop(transportStop);
Collection<TransportRoute> rts = t.getRouteForStop(transportStop);
if (rts != null) {
for (TransportRoute rs : rts) {
TransportStopType type = TransportStopType.findType(rs.getType());

View file

@ -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<TransportStop> stops, ResultMatcher<TransportStop> matcher);
public List<TransportRoute> getRouteForStop(TransportStop stop);
public Collection<TransportRoute> getRouteForStop(TransportStop stop);
public List<RouteInfoLocation> searchTransportRouteStops(double latitude, double longitude, LatLon locationToGo, int zoom);

View file

@ -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<TransportRoute> getRouteForStop(TransportStop stop){
public Collection<TransportRoute> getRouteForStop(TransportStop stop){
try {
List<TransportRoute> res = file.getTransportRouteDescriptions(stop);
Collection<TransportRoute> res = file.getTransportRoutes(stop.getReferencesToRoutes()).valueCollection();
if(res != null){
return res;
}