@Test public void testGetCellDimensions() { long cellId = 0L; OSHDBBoundingBox expResult = new OSHDBBoundingBox(-180.0, -90.0, -90.0 - OSHDB.GEOM_PRECISION, 0.0 - OSHDB.GEOM_PRECISION); OSHDBBoundingBox result = two.getCellDimensions(cellId); assertEquals(expResult, result); cellId = 6L; expResult = new OSHDBBoundingBox(0.0, 0.0, 90.0 - OSHDB.GEOM_PRECISION, 90.0); result = two.getCellDimensions(cellId); assertEquals(expResult, result); cellId = 7L; expResult = new OSHDBBoundingBox(90.0, 0.0, 180.0 - OSHDB.GEOM_PRECISION, 90.0); result = two.getCellDimensions(cellId); assertEquals(expResult, result); cellId = 0L; expResult = new OSHDBBoundingBox(-180.0, -90.0, 180.0 - OSHDB.GEOM_PRECISION, 90.0); result = zero.getCellDimensions(cellId); assertEquals(expResult, result); cellId = 0L; expResult = new OSHDBBoundingBox(-180.0, -90.0, 0.0 - OSHDB.GEOM_PRECISION, 90.0); XYGrid instance = new XYGrid(1); result = instance.getCellDimensions(cellId); assertEquals(expResult, result); }
public OSHDBBoundingBox getCellDimensions(final long cellId) { int x = (int) (cellId % zoompow); int y = (int) ((cellId - x) / zoompow); long lon = (long) ((x * cellWidth) - (180.0 * OSHDB.GEOM_PRECISION_TO_LONG)); long lat = (long) ((y * cellWidth) - (90.0 * OSHDB.GEOM_PRECISION_TO_LONG)); final long minlong = lon; final long maxlong = (long) (lon + cellWidth) - 1L; final long minlat; final long maxlat; if (zoom == 0) { minlat = (long) (-90.0 * OSHDB.GEOM_PRECISION_TO_LONG); maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else if (lat == ((long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG) - cellWidth)) { minlat = lat; maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else { minlat = lat; maxlat = (long) (lat + cellWidth) - 1L; } return new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); }
XYGrid implements Serializable { public OSHDBBoundingBox getCellDimensions(final long cellId) { int x = (int) (cellId % zoompow); int y = (int) ((cellId - x) / zoompow); long lon = (long) ((x * cellWidth) - (180.0 * OSHDB.GEOM_PRECISION_TO_LONG)); long lat = (long) ((y * cellWidth) - (90.0 * OSHDB.GEOM_PRECISION_TO_LONG)); final long minlong = lon; final long maxlong = (long) (lon + cellWidth) - 1L; final long minlat; final long maxlat; if (zoom == 0) { minlat = (long) (-90.0 * OSHDB.GEOM_PRECISION_TO_LONG); maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else if (lat == ((long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG) - cellWidth)) { minlat = lat; maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else { minlat = lat; maxlat = (long) (lat + cellWidth) - 1L; } return new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); } }
XYGrid implements Serializable { public OSHDBBoundingBox getCellDimensions(final long cellId) { int x = (int) (cellId % zoompow); int y = (int) ((cellId - x) / zoompow); long lon = (long) ((x * cellWidth) - (180.0 * OSHDB.GEOM_PRECISION_TO_LONG)); long lat = (long) ((y * cellWidth) - (90.0 * OSHDB.GEOM_PRECISION_TO_LONG)); final long minlong = lon; final long maxlong = (long) (lon + cellWidth) - 1L; final long minlat; final long maxlat; if (zoom == 0) { minlat = (long) (-90.0 * OSHDB.GEOM_PRECISION_TO_LONG); maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else if (lat == ((long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG) - cellWidth)) { minlat = lat; maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else { minlat = lat; maxlat = (long) (lat + cellWidth) - 1L; } return new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); } XYGrid(final int zoom); }
XYGrid implements Serializable { public OSHDBBoundingBox getCellDimensions(final long cellId) { int x = (int) (cellId % zoompow); int y = (int) ((cellId - x) / zoompow); long lon = (long) ((x * cellWidth) - (180.0 * OSHDB.GEOM_PRECISION_TO_LONG)); long lat = (long) ((y * cellWidth) - (90.0 * OSHDB.GEOM_PRECISION_TO_LONG)); final long minlong = lon; final long maxlong = (long) (lon + cellWidth) - 1L; final long minlat; final long maxlat; if (zoom == 0) { minlat = (long) (-90.0 * OSHDB.GEOM_PRECISION_TO_LONG); maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else if (lat == ((long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG) - cellWidth)) { minlat = lat; maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else { minlat = lat; maxlat = (long) (lat + cellWidth) - 1L; } return new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); } XYGrid(final int zoom); static OSHDBBoundingBox getBoundingBox(final CellId cellID); static OSHDBBoundingBox getBoundingBox(final CellId cellID, boolean enlarge); long getId(double longitude, double latitude); long getId(long longitude, long latitude); long getId(OSHDBBoundingBox bbx); double getCellWidth(); OSHDBBoundingBox getCellDimensions(final long cellId); long getEstimatedIdCount(final OSHDBBoundingBox data); int getLevel(); Set<IdRange> bbox2CellIdRanges(OSHDBBoundingBox bbox, boolean enlarge); Set<IdRange> getNeighbours(CellId center); }
XYGrid implements Serializable { public OSHDBBoundingBox getCellDimensions(final long cellId) { int x = (int) (cellId % zoompow); int y = (int) ((cellId - x) / zoompow); long lon = (long) ((x * cellWidth) - (180.0 * OSHDB.GEOM_PRECISION_TO_LONG)); long lat = (long) ((y * cellWidth) - (90.0 * OSHDB.GEOM_PRECISION_TO_LONG)); final long minlong = lon; final long maxlong = (long) (lon + cellWidth) - 1L; final long minlat; final long maxlat; if (zoom == 0) { minlat = (long) (-90.0 * OSHDB.GEOM_PRECISION_TO_LONG); maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else if (lat == ((long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG) - cellWidth)) { minlat = lat; maxlat = (long) (90.0 * OSHDB.GEOM_PRECISION_TO_LONG); } else { minlat = lat; maxlat = (long) (lat + cellWidth) - 1L; } return new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); } XYGrid(final int zoom); static OSHDBBoundingBox getBoundingBox(final CellId cellID); static OSHDBBoundingBox getBoundingBox(final CellId cellID, boolean enlarge); long getId(double longitude, double latitude); long getId(long longitude, long latitude); long getId(OSHDBBoundingBox bbx); double getCellWidth(); OSHDBBoundingBox getCellDimensions(final long cellId); long getEstimatedIdCount(final OSHDBBoundingBox data); int getLevel(); Set<IdRange> bbox2CellIdRanges(OSHDBBoundingBox bbox, boolean enlarge); Set<IdRange> getNeighbours(CellId center);  }