use of net.osmand.router.RoutePlannerFrontEnd.RouteCalculationMode in project OsmAnd-tools by osmandapp.
the class ManyToOneRoadCalculation method cut.
private void cut(BinaryMapIndexReader reader) throws IOException {
RoutePlannerFrontEnd frontEnd = new RoutePlannerFrontEnd(false);
RoutingConfiguration config = RoutingConfiguration.getDefault().build("car", 1000);
RouteCalculationMode mode = RouteCalculationMode.BASE;
RoutingContext ctx = frontEnd.buildRoutingContext(config, null, new BinaryMapIndexReader[] { reader }, mode);
RouteRegion reg = reader.getRoutingIndexes().get(0);
List<RouteSubregion> baseSubregions = reg.getBaseSubregions();
List<RoutingSubregionTile> tiles = new ArrayList<RoutingContext.RoutingSubregionTile>();
for (RouteSubregion s : baseSubregions) {
List<RoutingSubregionTile> loadTiles = ctx.loadAllSubregionTiles(reader, s);
tiles.addAll(loadTiles);
}
int zoom = 9;
int ty = (int) MapUtils.getTileNumberY(zoom, reg.getTopLatitude());
int by = (int) MapUtils.getTileNumberY(zoom, reg.getBottomLatitude()) + 1;
int lx = (int) MapUtils.getTileNumberX(zoom, reg.getLeftLongitude());
int rx = (int) MapUtils.getTileNumberX(zoom, reg.getRightLongitude()) + 1;
for (int ky = ty + 1; ky < by; ky++) {
for (int kx = lx + 1; kx < rx; kx++) {
cutByQuadrant((kx - 1) << (31 - zoom), (ky - 1) << (31 - zoom), kx << (31 - zoom), ky << (31 - zoom), ctx, tiles);
}
}
}
use of net.osmand.router.RoutePlannerFrontEnd.RouteCalculationMode in project OsmAnd-tools by osmandapp.
the class ManyToOneRoadCalculation method manyToManyCalculation.
private void manyToManyCalculation(BinaryMapIndexReader reader, double top, double bottom) throws IOException {
RoutePlannerFrontEnd frontEnd = new RoutePlannerFrontEnd(false);
RoutingConfiguration config = RoutingConfiguration.getDefault().build("car", 1000);
RouteCalculationMode mode = RouteCalculationMode.BASE;
RoutingContext ctx = frontEnd.buildRoutingContext(config, null, new BinaryMapIndexReader[] { reader }, mode);
RouteRegion reg = reader.getRoutingIndexes().get(0);
List<RouteSubregion> baseSubregions = reg.getBaseSubregions();
List<RoutingSubregionTile> tiles = new ArrayList<RoutingContext.RoutingSubregionTile>();
for (RouteSubregion s : baseSubregions) {
List<RoutingSubregionTile> loadTiles = ctx.loadAllSubregionTiles(reader, s);
tiles.addAll(loadTiles);
}
int st = MapUtils.get31TileNumberY(top);
int sb = MapUtils.get31TileNumberY(bottom);
List<ManyToManySegment> topIntersects = new ArrayList<ManyToManySegment>();
List<ManyToManySegment> bottomIntersects = new ArrayList<ManyToManySegment>();
TLongObjectHashMap<ManyToManySegment> allSegments = initSegments(st, sb, ctx, tiles, topIntersects, bottomIntersects);
filterDisconnected(ctx, allSegments, topIntersects);
filterDisconnected(ctx, allSegments, topIntersects);
System.out.println("TOP " + topIntersects.size());
System.out.println("BOTTOM " + bottomIntersects.size());
calculateManyToMany(ctx, allSegments, topIntersects, bottomIntersects, st, sb);
}
Aggregations