public boolean contains(long x, long y, int z) { if (null == rangeBounds) { return true; } if (z >= getZoomStart() && z <= getZoomStop()) { long[] rB = rangeBounds((int) z); if (rB[0] <= x && rB[2] >= x && rB[1] <= y && rB[3] >= y) { return true; } } return false; }
/** * helper for counting the number of tiles * * @param tr * @return -1 if too many */ private long tileCount(TileRange tr) { final int startZoom = tr.getZoomStart(); final int stopZoom = tr.getZoomStop(); long count = 0; for (int z = startZoom; z <= stopZoom; z++) { long[] gridBounds = tr.rangeBounds(z); final long minx = gridBounds[0]; final long maxx = gridBounds[2]; final long miny = gridBounds[1]; final long maxy = gridBounds[3]; long thisLevel = (1 + maxx - minx) * (1 + maxy - miny); if (thisLevel > (Long.MAX_VALUE / 4) && z != stopZoom) { return -1; } else { count += thisLevel; } } return count; }
/** * Example: nyc_01, nyc_05_1,EPSG_2163_01, EPSG_2163_01_7 (i.e. {@code * <gridsetPrefix>_<zLevel>[_<parametersId>]}) */ private boolean acceptZoomLevelDir(String name) { if (!name.startsWith(gridSetPrefix)) { return false; } if (tr.getZoomStart() == -1 && tr.getZoomStop() == -1) { // All zoomlevels return true; } else { int tmp = findZoomLevel(gridSetPrefix, name); if (tmp < tr.getZoomStart() || tmp > tr.getZoomStop()) { return false; } } String parameter = findParameter(gridSetPrefix, name); if (tr.getParametersId() == null) { return parameter == null; } else { return tr.getParametersId().equals(parameter); } }
+ obj.getZoomStart() + ", " + obj.getZoomStop() + "], Gridset: " + obj.getGridSetId()); + obj.getZoomStart() + ", " + obj.getZoomStop() + "], Gridset: " + obj.getGridSetId());
for (; z <= tr.getZoomStop(); z++) { for (; y <= levelBounds[3]; y += metaY) { for (; x <= levelBounds[2]; x += metaX) { if (z < tr.getZoomStop()) { // but be careful not to go out of index levelBounds = tr.rangeBounds(z + 1); x = levelBounds[0];
/** * Build the paths correspondent to a tile range. For each file we return the associated tiles * range by zoom. */ Map<File, List<long[]>> getFiles(TileRange tileRange) { Map<File, List<long[]>> files = new HashMap<>(); // let's iterate of all the available zoom levels for (int z = tileRange.getZoomStart(); z <= tileRange.getZoomStop(); z++) { long[] range = tileRange.rangeBounds(z); if (range == null) { // this zoom level doesn't have any tiles associated continue; } // get the files and associated tiles for the current zoom level getFiles( files, tileRange.getParametersId(), tileRange.getLayerName(), tileRange.getGridSetId(), tileRange.getMimeType().getFormat(), tileRange.getParameters(), z, range); } return files; }
/** * Build the paths correspondent to a tile range. For each file we return the associated tiles * range by zoom. */ Map<File, List<long[]>> getFiles(TileRange tileRange) { Map<File, List<long[]>> files = new HashMap<>(); // let's iterate of all the available zoom levels for (int z = tileRange.getZoomStart(); z <= tileRange.getZoomStop(); z++) { long[] range = tileRange.rangeBounds(z); if (range == null) { // this zoom level doesn't have any tiles associated continue; } // get the files and associated tiles for the current zoom level getFiles( files, tileRange.getParametersId(), tileRange.getLayerName(), tileRange.getGridSetId(), tileRange.getMimeType().getFormat(), tileRange.getParameters(), z, range); } return files; }