public FastestWeighting(FlagEncoder encoder) { this(encoder, new HintsMap(0)); }
private void initCHAlgoFactoryDecorator() { if (!chFactoryDecorator.hasWeightings()) { for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { for (String chWeightingStr : chFactoryDecorator.getWeightingsAsStrings()) { // ghStorage is null at this point Weighting weighting = createWeighting(new HintsMap(chWeightingStr), encoder, null); chFactoryDecorator.addWeighting(weighting); } } } }
private void initLMAlgoFactoryDecorator() { if (lmFactoryDecorator.hasWeightings()) return; for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { for (String lmWeightingStr : lmFactoryDecorator.getWeightingsAsStrings()) { Weighting weighting = createWeighting(new HintsMap(lmWeightingStr), encoder, null); lmFactoryDecorator.addWeighting(weighting); } } }
@Test public void testCalcTime() { GenericWeighting weighting = new GenericWeighting(encoder, new HintsMap()); EdgeIteratorState edge = graph.getEdgeIteratorState(0, 1); assertEquals(edgeWeight, weighting.calcMillis(edge, false, EdgeIterator.NO_EDGE), .1); }
@Test public void testRoadAttributeRestriction() { EdgeIteratorState edge = graph.getEdgeIteratorState(0, 1); Weighting instance = new GenericWeighting(encoder, new HintsMap().put(GenericWeighting.HEIGHT_LIMIT, 4.0)); assertEquals(edgeWeight, instance.calcWeight(edge, false, EdgeIterator.NO_EDGE), 1e-8); instance = new GenericWeighting(encoder, new HintsMap().put(GenericWeighting.HEIGHT_LIMIT, 5.0)); assertEquals(Double.POSITIVE_INFINITY, instance.calcWeight(edge, false, EdgeIterator.NO_EDGE), 1e-8); }
queryGraph.lookup(Collections.singletonList(qr)); HintsMap hintsMap = new HintsMap(); RouteResource.initHints(hintsMap, uriInfo.getQueryParameters());
Collection<AlgoHelperEntry> prepares = createAlgos(hopper, new HintsMap().setWeighting("shortest").setVehicle("car"), TraversalMode.NODE_BASED);
@Test public void testCalcInstructionsForDataFlagEncoder() { final Graph g = new GraphBuilder(dataFlagManager).create(); final NodeAccess na = g.getNodeAccess(); na.setNode(1, 48.982618, 13.122021); na.setNode(2, 48.982565, 13.121597); na.setNode(3, 48.982611, 13.121012); na.setNode(4, 48.982336, 13.121002); ReaderWay w = new ReaderWay(1); w.setTag("highway", "tertiary"); g.edge(1, 2, 5, true).setFlags(dataFlagEncoder.handleWayTags(w, 1, 0)); g.edge(2, 4, 5, true).setFlags(dataFlagEncoder.handleWayTags(w, 1, 0)); g.edge(2, 3, 5, true).setFlags(dataFlagEncoder.handleWayTags(w, 1, 0)); Path p = new Dijkstra(g, new GenericWeighting(dataFlagEncoder, new HintsMap()), TraversalMode.NODE_BASED).calcPath(1, 3); assertTrue(p.isFound()); InstructionList wayList = p.calcInstructions(tr); assertEquals(3, wayList.size()); }
@Test public void testDisabledRoadAttributes() { DataFlagEncoder simpleEncoder = new DataFlagEncoder(); EncodingManager simpleEncodingManager = new EncodingManager(simpleEncoder); Graph simpleGraph = new GraphBuilder(simpleEncodingManager).create(); ReaderWay way = new ReaderWay(27l); way.setTag("highway", "primary"); way.setTag("maxspeed", "10"); way.setTag("maxheight", "4.4"); // 0-1 simpleGraph.edge(0, 1, 1, true); AbstractRoutingAlgorithmTester.updateDistancesFor(simpleGraph, 0, 0.00, 0.00); AbstractRoutingAlgorithmTester.updateDistancesFor(simpleGraph, 1, 0.01, 0.01); simpleGraph.getEdgeIteratorState(0, 1).setFlags(simpleEncoder.handleWayTags(way, 1, 0)); Weighting instance = new GenericWeighting(simpleEncoder, new HintsMap().put(GenericWeighting.HEIGHT_LIMIT, 5.0)); EdgeIteratorState edge = simpleGraph.getEdgeIteratorState(0, 1); assertEquals(edgeWeight, instance.calcWeight(edge, false, EdgeIterator.NO_EDGE), 1e-8); } }
this.na = graph.getNodeAccess(); encoder = hopper.getEncodingManager().getEncoder("car"); HintsMap map = new HintsMap("fastest"). setVehicle("car");
Weighting weighting = hopper.createWeighting(hints, encoder, hopper.getGraphHopperStorage()); HintsMap defaultHints = new HintsMap().put(Parameters.CH.DISABLE, true).put(Parameters.Landmark.DISABLE, true) .setVehicle(hints.getVehicle()).setWeighting(hints.getWeighting()); final HintsMap lmHints = new HintsMap(defaultHints).put(Parameters.Landmark.DISABLE, false); prepare.add(new AlgoHelperEntry(ghStorage, AlgorithmOptions.start(astarbiOpts).hints(lmHints).build(), idx, "astarbi|landmarks|" + weighting) { @Override final HintsMap chHints = new HintsMap(defaultHints).put(Parameters.CH.DISABLE, false); Weighting pickedWeighting = null; for (Weighting tmpWeighting : hopper.getCHFactoryDecorator().getWeightings()) {
public FastestWeighting(FlagEncoder encoder) { this(encoder, new HintsMap(0)); }
private void initCHAlgoFactoryDecorator() { if (!chFactoryDecorator.hasWeightings()) for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { for (String chWeightingStr : chFactoryDecorator.getWeightingsAsStrings()) { Weighting weighting = createWeighting(new HintsMap(chWeightingStr), encoder); chFactoryDecorator.addWeighting(weighting); } } }
private void initLMAlgoFactoryDecorator() { if (lmFactoryDecorator.hasWeightings()) return; for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { for (String lmWeightingStr : lmFactoryDecorator.getWeightingsAsStrings()) { Weighting weighting = createWeighting(new HintsMap(lmWeightingStr), encoder, null); lmFactoryDecorator.addWeighting(weighting); } } }
private void initCHAlgoFactoryDecorator() { if (!chFactoryDecorator.hasWeightings()) { for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { for (String chWeightingStr : chFactoryDecorator.getWeightingsAsStrings()) { // ghStorage is null at this point Weighting weighting = createWeighting(new HintsMap(chWeightingStr), encoder, null); chFactoryDecorator.addWeighting(weighting); } } } }
private void initCHAlgoFactoryDecorator() { if (!chFactoryDecorator.hasWeightings()) { for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { for (String chWeightingStr : chFactoryDecorator.getWeightingsAsStrings()) { Weighting weighting = createWeighting(new HintsMap(chWeightingStr), encoder, null); chFactoryDecorator.addWeighting(weighting); } } } }
private void initLMAlgoFactoryDecorator() { if (lmFactoryDecorator.hasWeightings()) return; for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { for (String lmWeightingStr : lmFactoryDecorator.getWeightingsAsStrings()) { Weighting weighting = createWeighting(new HintsMap(lmWeightingStr), encoder, null); lmFactoryDecorator.addWeighting(weighting); } } }
hints(new HintsMap().put("weighting", "fastest").put("vehicle", firstEncoder.toString())). build(); MapMatching mapMatching = new MapMatching(hopper, opts);
HintsMap hints = new HintsMap(); for (Entry<String, String> entry : algoOptions.getHints().toMap().entrySet()) { hints.put(entry.getKey(), entry.getValue());
HintsMap hints = new HintsMap(); for (Entry<String, String> entry : algoOptions.getHints().toMap().entrySet()) { hints.put(entry.getKey(), entry.getValue());