com.graphhopper.storage
Code IndexAdd Codota to your IDE (free)

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

origin: graphhopper/graphhopper

@Override
public String toString() {
  return (isCHPossible() ? "CH|" : "")
      + encodingManager
      + "|" + getDirectory().getDefaultType()
      + "|" + baseGraph.nodeAccess.getDimension() + "D"
      + "|" + baseGraph.extStorage
      + "|" + getProperties().versionsToString();
}
origin: graphhopper/graphhopper

static Directory guessDirectory(GraphStorage store) {
  if (store.getDirectory() instanceof MMapDirectory) {
    throw new IllegalStateException("not supported yet: mmap will overwrite existing storage at the same location");
  }
  String location = store.getDirectory().getLocation();
  boolean isStoring = ((GHDirectory) store.getDirectory()).isStoring();
  return new RAMDirectory(location, isStoring);
}
origin: graphhopper/graphhopper

@Test
public void testEnsureSize() {
  Directory dir = new RAMDirectory();
  graph = newGHStorage(dir, false).create(defaultSize);
  int roughEdgeRowLength = 4 * 8;
  int testIndex = dir.find("edges").getSegmentSize() * 3 / roughEdgeRowLength;
  // we need a big node index to trigger multiple segments, but low enough to avoid OOM
  graph.edge(0, testIndex, 10, true);
  // test if optimize works without error
  graph.optimize();
}
origin: graphhopper/graphhopper

void flush() {
  setNodesHeader();
  setEdgesHeader();
  setWayGeometryHeader();
  wayGeometry.flush();
  nameIndex.flush();
  edges.flush();
  nodes.flush();
  extStorage.flush();
}
origin: graphhopper/graphhopper

@Override
public long getCapacity() {
  long cnt = baseGraph.getCapacity() + properties.getCapacity();
  for (CHGraphImpl cg : chGraphs) {
    cnt += cg.getCapacity();
  }
  return cnt;
}
origin: graphhopper/graphhopper

  @Test
  public void testNoErrorForDACreate() {
    Directory dir = createDir();
    da = dir.find("testing");
    da.create(100);
    da.flush();
  }
}
origin: graphhopper/graphhopper

void setSegmentSize(int bytes) {
  checkInit();
  nodes.setSegmentSize(bytes);
  edges.setSegmentSize(bytes);
  wayGeometry.setSegmentSize(bytes);
  nameIndex.setSegmentSize(bytes);
  extStorage.setSegmentSize(bytes);
}
origin: graphhopper/graphhopper

@Override
public void flush() {
  for (CHGraphImpl cg : chGraphs) {
    cg.setEdgesHeader();
    cg.flush();
  }
  baseGraph.flush();
  properties.flush();
}
origin: graphhopper/graphhopper

@Override
public CHEdgeIteratorState edge(int a, int b) {
  // increase edge array not for shortcuts
  baseGraph.ensureNodeIndex(Math.max(a, b));
  int edgeId = baseGraph.edgeAccess.internalEdgeAdd(baseGraph.nextEdgeId(), a, b);
  CHEdgeIteratorImpl iter = new CHEdgeIteratorImpl(baseGraph, baseGraph.edgeAccess, EdgeFilter.ALL_EDGES);
  boolean ret = iter.init(edgeId, b);
  assert ret;
  return iter;
}
origin: graphhopper/graphhopper

@Override
public void close() {
  properties.close();
  baseGraph.close();
  for (CHGraphImpl cg : chGraphs) {
    cg.close();
  }
}
origin: graphhopper/graphhopper

@Override
protected GraphHopperStorage createGHStorage(EncodingManager em,
                       List<? extends Weighting> weightings, boolean is3D) {
  return new GraphHopperStorage(weightings, new RAMDirectory(),
      em, is3D, new GraphExtension.NoOpExtension()).
      create(1000);
}
origin: graphhopper/graphhopper

@Override
public final CHEdgeIterator setBaseNode(int baseNode) {
  assert baseGraph.isFrozen() : "Traversal CHGraph is only possible if BaseGraph is frozen";
  // always use ch edge access
  setEdgeId(chEdgeAccess.getEdgeRef(baseNode));
  _setBaseNode(baseNode);
  return this;
}
origin: graphhopper/graphhopper

@Override
public final void setAdditionalNodeField(int index, int additionalValue) {
  if (that.extStorage.isRequireNodeField() && that.N_ADDITIONAL >= 0) {
    that.ensureNodeIndex(index);
    long tmp = (long) index * that.nodeEntryBytes;
    that.nodes.setInt(tmp + that.N_ADDITIONAL, additionalValue);
  } else {
    throw new AssertionError("This graph does not provide an additional node field");
  }
}
origin: graphhopper/graphhopper

@Override
public GraphHopperStorage createGHStorage(String location, boolean enabled3D) {
  // reduce segment size in order to test the case where multiple segments come into the game
  GraphHopperStorage gs = newGHStorage(new RAMDirectory(location), enabled3D);
  gs.setSegmentSize(defaultSize / 2);
  gs.create(defaultSize);
  return gs;
}
origin: com.graphhopper/graphhopper-core

@Override
public String toString() {
  return (isCHPossible() ? "CH|" : "")
      + encodingManager
      + "|" + getDirectory().getDefaultType()
      + "|" + baseGraph.nodeAccess.getDimension() + "D"
      + "|" + baseGraph.extStorage
      + "|" + getProperties().versionsToString();
}
com.graphhopper.storage

Most used classes

  • GraphHopperStorage
    This class manages all storage related methods and delegates the calls to the associated graphs. The
  • Graph
    An interface to represent a (geo) graph - suited for efficient storage as it can be requested via in
  • NodeAccess
    This interface specifies how to access properties of the nodes in the graph. Similar to EdgeExplorer
  • LocationIndex
    Provides a way to map real world data "lat,lon" to internal ids/indices of a memory efficient graph
  • QueryResult
    Result of LocationIndex lookup. X=query coordinates S=snapped coordinates: "snapping" real coords to
  • CHGraph,
  • DataAccess,
  • Directory,
  • GHDirectory,
  • RAMDirectory,
  • StorableProperties,
  • TurnCostExtension,
  • LocationIndexTree,
  • CHGraphImpl,
  • EdgeAccess,
  • GHLock,
  • GraphBuilder,
  • GraphEdgeIdFinder$BlockArea,
  • GraphEdgeIdFinder

For IntelliJ IDEA and
Android Studio

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