private void initIndex() { Directory dir = graph.getDirectory(); if (preciseIndexResolution > 0) { Location2NodesNtree tmpIndex; if (graph instanceof LevelGraph) { tmpIndex = new Location2NodesNtreeLG((LevelGraph) graph, dir); } else { tmpIndex = new Location2NodesNtree(graph, dir); } tmpIndex.setResolution(preciseIndexResolution); tmpIndex.setEdgeCalcOnFind(edgeCalcOnSearch); tmpIndex.setSearchRegion(searchRegion); index = tmpIndex; } else { index = new Location2IDQuadtree(graph, dir); index.setResolution(Helper.calcIndexSize(graph.getBounds())); } if (!index.loadExisting()) { index.prepareIndex(); } }