Beispiel #1
0
  /**
   * Default graph is a GraphStorage with an in memory directory and disabled storing on flush.
   * Afterwards you'll need to call GraphStorage. Create to have a usable object. Better use create.
   */
  public GraphHopperStorage build() {
    Directory dir;
    if (mmap) dir = new MMapDirectory(location);
    else dir = new RAMDirectory(location, store);

    GraphHopperStorage graph;
    if (encodingManager.needsTurnCostsSupport() || singleCHWeighting == null)
      graph = new GraphHopperStorage(dir, encodingManager, elevation, new TurnCostExtension());
    else
      graph =
          new GraphHopperStorage(
              Arrays.asList(singleCHWeighting),
              dir,
              encodingManager,
              elevation,
              new TurnCostExtension.NoOpExtension());

    return graph;
  }