use of net.osmand.data.TransportRoute in project Osmand by osmandapp.
the class BinaryInspector method printTransportDetailInfo.
private void printTransportDetailInfo(VerboseInfo verbose, BinaryMapIndexReader index, TransportIndex p) throws IOException {
SearchRequest<TransportStop> sr = BinaryMapIndexReader.buildSearchTransportRequest(MapUtils.get31TileNumberX(verbose.lonleft), MapUtils.get31TileNumberX(verbose.lonright), MapUtils.get31TileNumberY(verbose.lattop), MapUtils.get31TileNumberY(verbose.latbottom), -1, null);
List<TransportStop> stops = index.searchTransportIndex(sr);
Map<Long, TransportRoute> rs = new LinkedHashMap<>();
List<String> lrs = new ArrayList<>();
println("\nStops:");
for (TransportStop s : stops) {
lrs.clear();
for (int pnt : s.getReferencesToRoutes()) {
TransportRoute route;
if (!lrs.contains(pnt)) {
TIntObjectHashMap<TransportRoute> pts = index.getTransportRoutes(new int[] { pnt });
route = pts.valueCollection().iterator().next();
rs.put((long) pnt, route);
} else {
route = rs.get(pnt);
}
if (route != null) {
// lrs.add(route.getRef() + " " + route.getName(verbose.lang));
lrs.add(route.getRef() + " " + route.getType());
}
}
println(" " + s.getName(verbose.lang) + ": " + lrs + " " + s.getLocation());
}
println("\nRoutes:");
for (TransportRoute s : rs.values()) {
List<String> stopsString = new ArrayList<>();
for (TransportStop st : s.getForwardStops()) {
stopsString.add(st.getName(verbose.lang));
}
println(" " + s.getRef() + " " + s.getType() + " " + s.getName(verbose.lang) + ": " + stopsString);
}
}
use of net.osmand.data.TransportRoute in project Osmand by osmandapp.
the class BinaryMapIndexReader method testTransportSearch.
private static void testTransportSearch(BinaryMapIndexReader reader) throws IOException {
// test transport
for (TransportIndex i : reader.transportIndexes) {
println("Transport bounds : " + i.left + " " + i.right + " " + i.top + " " + i.bottom);
}
for (TransportStop s : reader.searchTransportIndex(buildSearchTransportRequest(sleft, sright, stop, sbottom, -1, null))) {
println(s.getName());
TIntObjectHashMap<TransportRoute> routes = reader.getTransportRoutes(s.getReferencesToRoutes());
for (net.osmand.data.TransportRoute route : routes.valueCollection()) {
println(" " + route.getRef() + " " + route.getName() + " " + route.getDistance() + " " + route.getAvgBothDistance());
StringBuilder b = new StringBuilder();
for (Way w : route.getForwardWays()) {
b.append(w.getNodes()).append(" ");
}
println(" forward ways: " + b.toString());
}
}
}
use of net.osmand.data.TransportRoute in project Osmand by osmandapp.
the class EntityParser method parserRoute.
public static TransportRoute parserRoute(Relation r, String ref) {
TransportRoute rt = new TransportRoute();
parseMapObject(rt, r, r.getTags());
rt.setRef(ref);
return rt;
}
Aggregations