@Test public void testGetNeighbours() { CellId center = new CellId(2, 6L); Set<IdRange> expResult = new TreeSet<>(); expResult.add(IdRange.of(1L, 3L)); expResult.add(IdRange.of(5L, 7L)); expResult.add(IdRange.of(-1L, -1L)); Set<IdRange> result = two.getNeighbours(center); assertEquals(expResult, result); }
public Set<IdRange> getNeighbours(CellId center) { if (center.getZoomLevel() != this.zoom) { return null; } OSHDBBoundingBox bbox = this.getCellDimensions(center.getId()); long minlong = bbox.getMinLonLong() - 1L; long minlat = bbox.getMinLatLong() - 1L; long maxlong = bbox.getMaxLonLong() + 1L; long maxlat = bbox.getMaxLatLong() + 1L; OSHDBBoundingBox newbbox = new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); return this.bbox2CellIdRanges(newbbox, false); }
XYGrid implements Serializable { public Set<IdRange> getNeighbours(CellId center) { if (center.getZoomLevel() != this.zoom) { return null; } OSHDBBoundingBox bbox = this.getCellDimensions(center.getId()); long minlong = bbox.getMinLonLong() - 1L; long minlat = bbox.getMinLatLong() - 1L; long maxlong = bbox.getMaxLonLong() + 1L; long maxlat = bbox.getMaxLatLong() + 1L; OSHDBBoundingBox newbbox = new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); return this.bbox2CellIdRanges(newbbox, false); } }
XYGrid implements Serializable { public Set<IdRange> getNeighbours(CellId center) { if (center.getZoomLevel() != this.zoom) { return null; } OSHDBBoundingBox bbox = this.getCellDimensions(center.getId()); long minlong = bbox.getMinLonLong() - 1L; long minlat = bbox.getMinLatLong() - 1L; long maxlong = bbox.getMaxLonLong() + 1L; long maxlat = bbox.getMaxLatLong() + 1L; OSHDBBoundingBox newbbox = new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); return this.bbox2CellIdRanges(newbbox, false); } XYGrid(final int zoom); }
XYGrid implements Serializable { public Set<IdRange> getNeighbours(CellId center) { if (center.getZoomLevel() != this.zoom) { return null; } OSHDBBoundingBox bbox = this.getCellDimensions(center.getId()); long minlong = bbox.getMinLonLong() - 1L; long minlat = bbox.getMinLatLong() - 1L; long maxlong = bbox.getMaxLonLong() + 1L; long maxlat = bbox.getMaxLatLong() + 1L; OSHDBBoundingBox newbbox = new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); return this.bbox2CellIdRanges(newbbox, false); } 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 Set<IdRange> getNeighbours(CellId center) { if (center.getZoomLevel() != this.zoom) { return null; } OSHDBBoundingBox bbox = this.getCellDimensions(center.getId()); long minlong = bbox.getMinLonLong() - 1L; long minlat = bbox.getMinLatLong() - 1L; long maxlong = bbox.getMaxLonLong() + 1L; long maxlat = bbox.getMaxLatLong() + 1L; OSHDBBoundingBox newbbox = new OSHDBBoundingBox(minlong, minlat, maxlong, maxlat); return this.bbox2CellIdRanges(newbbox, false); } 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);  }