use of net.osmand.router.RoutePlannerFrontEnd in project OsmAnd-tools by osmandapp.
the class DijkstraAlgorithm method main.
public static void main(String[] args) throws IOException, InterruptedException, XmlPullParserException {
File fl = new File("/Users/victorshcherb/osmand/maps/Netherlands_europe_2.obf");
// $NON-NLS-1$ //$NON-NLS-2$
RandomAccessFile raf = new RandomAccessFile(fl, "r");
RoutePlannerFrontEnd fe = new RoutePlannerFrontEnd(false);
Builder builder = RoutingConfiguration.parseFromInputStream(new FileInputStream("/Users/victorshcherb/osmand/repos/resources/routing/routing.xml"));
RoutingConfiguration config = builder.build("car", RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3);
RoutingContext ctx = fe.buildRoutingContext(config, null, new BinaryMapIndexReader[] { new BinaryMapIndexReader(raf, fl) }, RouteCalculationMode.NORMAL);
RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true;
List<RouteSegmentResult> route = fe.searchRoute(ctx, new LatLon(52.28283, 4.8622713), new LatLon(52.326496, 4.8753176), null);
}
use of net.osmand.router.RoutePlannerFrontEnd in project Osmand by osmandapp.
the class CurrentPositionHelper method initCtx.
private void initCtx(OsmandApplication app, List<BinaryMapReaderResource> checkReaders, @NonNull ApplicationMode appMode) {
am = appMode;
String p;
if (am.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
p = GeneralRouterProfile.BICYCLE.name().toLowerCase();
} else if (am.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
p = GeneralRouterProfile.PEDESTRIAN.name().toLowerCase();
} else if (am.isDerivedRoutingFrom(ApplicationMode.CAR)) {
p = GeneralRouterProfile.CAR.name().toLowerCase();
} else {
p = "geocoding";
}
BinaryMapIndexReader[] rs = new BinaryMapIndexReader[checkReaders.size()];
if (rs.length > 0) {
int i = 0;
for (BinaryMapReaderResource rep : checkReaders) {
rs[i++] = rep.getReader(BinaryMapReaderResourceType.STREET_LOOKUP);
}
RoutingConfiguration cfg = app.getDefaultRoutingConfig().build(p, 10, new HashMap<String, String>());
ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, rs);
RoutingConfiguration defCfg = app.getDefaultRoutingConfig().build("geocoding", 10, new HashMap<String, String>());
defCtx = new RoutePlannerFrontEnd(false).buildRoutingContext(defCfg, null, rs);
} else {
ctx = null;
defCtx = null;
}
usedReaders = checkReaders;
}
use of net.osmand.router.RoutePlannerFrontEnd in project Osmand by osmandapp.
the class CurrentPositionHelper method initCtx.
private void initCtx(SampleApplication app, List<BinaryMapIndexReader> checkReaders) {
BinaryMapIndexReader[] rs = checkReaders.toArray(new BinaryMapIndexReader[checkReaders.size()]);
if (rs.length > 0) {
RoutingConfiguration defCfg = RoutingConfiguration.getDefault().build("geocoding", 10, new HashMap<String, String>());
defCtx = new RoutePlannerFrontEnd(false).buildRoutingContext(defCfg, null, rs);
} else {
defCtx = null;
}
usedReaders = checkReaders;
}
Aggregations