public static int getIdOf(Graph g, double latitude, double longitude) { int s = g.getNodes(); NodeAccess na = g.getNodeAccess(); for (int i = 0; i < s; i++) { if (Math.abs(na.getLatitude(i) - latitude) < 1e-4 && Math.abs(na.getLongitude(i) - longitude) < 1e-4) { return i; } } return -1; }
public boolean containsLatitude(Graph g, EdgeIterator iter, double latitude) { NodeAccess na = g.getNodeAccess(); while (iter.next()) { if (Math.abs(na.getLatitude(iter.getAdjNode()) - latitude) < 1e-4) return true; } return false; }