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; }
levelBounds = tr.rangeBounds(z); x = levelBounds[0]; y = levelBounds[1]; levelBounds = tr.rangeBounds(z); x = lastGridLoc[0] + metaX; y = lastGridLoc[1]; levelBounds = tr.rangeBounds(z + 1); x = levelBounds[0]; y = levelBounds[1];
/** * 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; }