GraphHopperStorage.getExtension
Code IndexAdd Codota to your IDE (free)

Best code snippets using com.graphhopper.storage.GraphHopperStorage.getExtension(Showing top 7 results out of 315)

origin: graphhopper/graphhopper

/**
 * Create a new storage from the specified one without copying the data.
 */
public static GraphHopperStorage newStorage(GraphHopperStorage store) {
  Directory outdir = guessDirectory(store);
  boolean is3D = store.getNodeAccess().is3D();
  return new GraphHopperStorage(store.getCHWeightings(), outdir, store.getEncodingManager(),
      is3D, store.getExtension()).
      create(store.getNodes());
}
origin: graphhopper/graphhopper

@Test
public void testBasicTurnCosts() {
  GraphHopperStorage g = createStorage(createEncodingManager(false));
  initGraph(g);
  TurnCostExtension tcs = (TurnCostExtension) g.getExtension();
  Path p = createAlgo(g, AlgorithmOptions.start().
      weighting(createWeighting(carEncoder, tcs, 40)).
      traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
      calcPath(5, 1);
  // no restriction and costs
  EdgeIteratorState e3_6 = getEdge(g, 5, 6);
  e3_6.setDistance(2);
  assertEquals(Helper.createTList(5, 2, 3, 1), p.calcNodes());
  // now introduce some turn costs
  long tflags = carEncoder.getTurnFlags(false, 2);
  tcs.addTurnInfo(getEdge(g, 5, 2).getEdge(), 2, getEdge(g, 2, 3).getEdge(), tflags);
  p = createAlgo(g, AlgorithmOptions.start().
      weighting(createWeighting(carEncoder, tcs, 40)).
      traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
      calcPath(5, 1);
  assertEquals(Helper.createTList(5, 6, 3, 1), p.calcNodes());
}
origin: graphhopper/graphhopper

@Test
public void testBasicTurnRestriction() {
  GraphHopperStorage g = createStorage(createEncodingManager(true));
  initGraph(g);
  TurnCostExtension tcs = (TurnCostExtension) g.getExtension();
  initTurnRestrictions(g, tcs, carEncoder);
  Path p = createAlgo(g, AlgorithmOptions.start().
      weighting(createWeighting(carEncoder, tcs, 40)).
      traversalMode(TraversalMode.EDGE_BASED_2DIR).build()).
      calcPath(5, 1);
  assertEquals(Helper.createTList(5, 2, 3, 4, 7, 6, 3, 1), p.calcNodes());
  // test 7-6-5 and reverse
  p = createAlgo(g, AlgorithmOptions.start().
      weighting(createWeighting(carEncoder, tcs, 40)).
      traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
      calcPath(5, 7);
  assertEquals(Helper.createTList(5, 6, 7), p.calcNodes());
  p = createAlgo(g, AlgorithmOptions.start().
      weighting(createWeighting(carEncoder, tcs, 40)).
      traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
      calcPath(7, 5);
  assertEquals(Helper.createTList(7, 6, 3, 2, 5), p.calcNodes());
}
origin: graphhopper/graphhopper

@Test
public void testUTurns() {
  GraphHopperStorage g = createStorage(createEncodingManager(true));
  initGraph(g);
  TurnCostExtension tcs = (TurnCostExtension) g.getExtension();
  long tflags = carEncoder.getTurnFlags(true, 0);
  // force u-turn via lowering the cost for it
  EdgeIteratorState e3_6 = getEdge(g, 3, 6);
  e3_6.setDistance(0.1);
  getEdge(g, 3, 2).setDistance(864);
  getEdge(g, 1, 0).setDistance(864);
  tcs.addTurnInfo(getEdge(g, 7, 6).getEdge(), 6, getEdge(g, 6, 5).getEdge(), tflags);
  tcs.addTurnInfo(getEdge(g, 4, 3).getEdge(), 3, e3_6.getEdge(), tflags);
  AlgorithmOptions opts = AlgorithmOptions.start().
      weighting(createWeighting(carEncoder, tcs, 50)).
      traversalMode(TraversalMode.EDGE_BASED_2DIR_UTURN).build();
  Path p = createAlgo(g, opts).calcPath(7, 5);
  assertEquals(Helper.createTList(7, 6, 3, 6, 5), p.calcNodes());
  // no u-turn for 6-3
  opts = AlgorithmOptions.start().
      weighting(createWeighting(carEncoder, tcs, 100)).
      traversalMode(TraversalMode.EDGE_BASED_2DIR_UTURN).build();
  tcs.addTurnInfo(getEdge(g, 6, 3).getEdge(), 3, getEdge(g, 3, 6).getEdge(), tflags);
  p = createAlgo(g, opts).calcPath(7, 5);
  assertEquals(Helper.createTList(7, 6, 3, 2, 5), p.calcNodes());
}
origin: graphhopper/graphhopper

for (String gtfsFile : gtfsFiles) {
  try {
    ((GtfsStorage) graphHopperStorage.getExtension()).loadGtfsFromFile("gtfs_" + id++, new ZipFile(gtfsFile));
  } catch (IOException e) {
    throw new RuntimeException(e);
  FakeWalkNetworkBuilder.buildWalkNetwork(((GtfsStorage) graphHopperStorage.getExtension()).getGtfsFeeds().values(), graphHopperStorage, ptFlagEncoder, Helper.DIST_EARTH);
origin: graphhopper/graphhopper

final GraphHopperStorage g = createStorage(createEncodingManager(false));
initGraph(g);
TurnCostExtension tcs = (TurnCostExtension) g.getExtension();
origin: com.graphhopper/graphhopper-core

/**
 * Create a new storage from the specified one without copying the data.
 */
public static GraphHopperStorage newStorage(GraphHopperStorage store) {
  Directory outdir = guessDirectory(store);
  boolean is3D = store.getNodeAccess().is3D();
  return new GraphHopperStorage(store.getCHWeightings(), outdir, store.getEncodingManager(),
      is3D, store.getExtension()).
      create(store.getNodes());
}
com.graphhopper.storageGraphHopperStoragegetExtension

Popular methods of GraphHopperStorage

  • getAllEdges
  • getBounds
  • getEncodingManager
  • getNodes
  • <init>
  • close
  • create
    After configuring this storage you need to create it explicitly.
  • createEdgeExplorer
  • edge
  • flush
  • getGraph
    This method returns the routing graph for the specified weighting, could be potentially filled with
  • getNodeAccess
  • getGraph,
  • getNodeAccess,
  • loadExisting,
  • freeze,
  • getBaseGraph,
  • getDirectory,
  • getProperties,
  • isFrozen,
  • markNodeRemoved

Popular classes and methods

  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Proxy (java.net)
    This class represents a proxy setting, typically a type (http, socks) and a socket address. A Proxy
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)