@BeforeClass public static void setUp() throws Exception { String fileName = "../../resources/Turn_lanes_test.obf"; File fl = new File(fileName); RandomAccessFile raf = new RandomAccessFile(fl, "r"); fe = new RoutePlannerFrontEnd(false); RoutingConfiguration.Builder builder = RoutingConfiguration.getDefault(); Map<String, String> params = new LinkedHashMap<String, String>(); params.put("car", "true"); params.put("short_way", "true"); RoutingConfiguration config = builder.build("car", RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3, params); BinaryMapIndexReader[] binaryMapIndexReaders = {new BinaryMapIndexReader(raf, fl)}; ctx = fe.buildRoutingContext( config, null, binaryMapIndexReaders, RoutePlannerFrontEnd.RouteCalculationMode.NORMAL); ctx.leftSideNavigation = false; RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; }
public RoutingConfiguration build( String router, Double direction, int memoryLimitMB, String[] specialization) { if (!routers.containsKey(router)) { router = defaultRouter; } RoutingConfiguration i = new RoutingConfiguration(); if (routers.containsKey(router)) { i.router = routers.get(router); if (specialization != null) { for (String s : specialization) { i.router = i.router.specifyParameter(s); } } i.routerName = router; } attributes.put("routerName", router); i.attributes.putAll(attributes); i.initialDirection = direction; i.recalculateDistance = parseSilentFloat( getAttribute(i.router, "recalculateDistanceHelp"), i.recalculateDistance); i.heuristicCoefficient = parseSilentFloat(getAttribute(i.router, "heuristicCoefficient"), i.heuristicCoefficient); i.ZOOM_TO_LOAD_TILES = parseSilentInt(getAttribute(i.router, "zoomToLoadTiles"), i.ZOOM_TO_LOAD_TILES); int desirable = parseSilentInt(getAttribute(i.router, "memoryLimitInMB"), 0); if (desirable != 0) { i.memoryLimitation = desirable * (1 << 20); } else { if (memoryLimitMB == 0) { memoryLimitMB = DEFAULT_MEMORY_LIMIT; } i.memoryLimitation = memoryLimitMB * (1 << 20); } i.planRoadDirection = parseSilentInt(getAttribute(i.router, "planRoadDirection"), i.planRoadDirection); return i; }
public void setHeuristicCoefficient(float heuristicCoefficient) { config.heuristicCoefficient = heuristicCoefficient; }
public void setPlanRoadDirection(int planRoadDirection) { config.planRoadDirection = planRoadDirection; }
public void setRouter(VehicleRouter router) { config.router = router; }