Add transport route
This commit is contained in:
parent
20d2204b2e
commit
6c29a3c865
3 changed files with 7 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.mapcontextmenu.controllers;
|
package net.osmand.plus.mapcontextmenu.controllers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -146,7 +147,7 @@ public class TransportStopController extends MenuController {
|
||||||
|
|
||||||
for (TransportIndexRepository t : reps) {
|
for (TransportIndexRepository t : reps) {
|
||||||
if (t.acceptTransportStop(transportStop)) {
|
if (t.acceptTransportStop(transportStop)) {
|
||||||
List<TransportRoute> rts = t.getRouteForStop(transportStop);
|
Collection<TransportRoute> rts = t.getRouteForStop(transportStop);
|
||||||
if (rts != null) {
|
if (rts != null) {
|
||||||
for (TransportRoute rs : rts) {
|
for (TransportRoute rs : rts) {
|
||||||
TransportStopType type = TransportStopType.findType(rs.getType());
|
TransportStopType type = TransportStopType.findType(rs.getType());
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.resources;
|
package net.osmand.plus.resources;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
|
@ -18,7 +19,7 @@ public interface TransportIndexRepository {
|
||||||
public void searchTransportStops(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude,
|
public void searchTransportStops(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude,
|
||||||
int limit, List<TransportStop> stops, ResultMatcher<TransportStop> matcher);
|
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);
|
public List<RouteInfoLocation> searchTransportRouteStops(double latitude, double longitude, LatLon locationToGo, int zoom);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -56,9 +57,9 @@ public class TransportIndexRepositoryBinary implements TransportIndexRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TransportRoute> getRouteForStop(TransportStop stop){
|
public Collection<TransportRoute> getRouteForStop(TransportStop stop){
|
||||||
try {
|
try {
|
||||||
List<TransportRoute> res = file.getTransportRouteDescriptions(stop);
|
Collection<TransportRoute> res = file.getTransportRoutes(stop.getReferencesToRoutes()).valueCollection();
|
||||||
if(res != null){
|
if(res != null){
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue