private KMLDebugGridLayer() { super.subSets = new Hashtable<String, GridSubset>(); subSets.put(gridSetBroker.WORLD_EPSG4326.getName(), GridSubsetFactory.createGridSubSet( gridSetBroker.WORLD_EPSG4326, BoundingBox.WORLD4326, 0, 3)); }
private KMLDebugGridLayer() { super.subSets = new Hashtable<String, GridSubset>(); subSets.put( gridSetBroker.getWorldEpsg4326().getName(), GridSubsetFactory.createGridSubSet( gridSetBroker.getWorldEpsg4326(), BoundingBox.WORLD4326, 0, 3)); }
public static GridSubset createGridSubSet(GridSet gridSet) { GridSubset ret = createGridSubSet( gridSet, gridSet.getOriginalExtent(), 0, gridSet.getGridLevels().length - 1); return ret; }
private Hashtable<String, GridSubset> createGridSubsets(final GridSetBroker gridSetBroker) { final CacheInfo info = this.cacheInfo; final TileCacheInfo tileCacheInfo = info.getTileCacheInfo(); final String layerName = getName(); final GridSetBuilder gsBuilder = new GridSetBuilder(); GridSet gridSet = gsBuilder.buildGridset(layerName, info, layerBounds); getGridsetConfiguration(gridSetBroker).addInternal(gridSet); final List<LODInfo> lodInfos = tileCacheInfo.getLodInfos(); Integer zoomStart = lodInfos.get(0).getLevelID(); Integer zoomStop = lodInfos.get(lodInfos.size() - 1).getLevelID(); GridSubset subSet = GridSubsetFactory.createGridSubSet(gridSet, this.layerBounds, zoomStart, zoomStop); Hashtable<String, GridSubset> subsets = new Hashtable<String, GridSubset>(); subsets.put(gridSet.getName(), subSet); return subsets; }
@Override protected TileLayer getGoodInfo(String id, int rand) throws Exception { return new WMSLayer( id, new String[] {"http://foo"}, "style", Integer.toString(rand), Collections.<String>emptyList(), Collections.<String, GridSubset>singletonMap( "EPSG:4326", GridSubsetFactory.createGridSubSet(broker.getWorldEpsg4326())), Collections.<ParameterFilter>emptyList(), new int[] {3, 3}, "", false, null); } /*(String layerName, String[] wmsURL, String wmsStyles, String wmsLayers,
public void test5gridLevels4326() throws Exception { BoundingBox bbox = new BoundingBox(-124.731422, 24.955967, -66.969849, 49.371735); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 10); long[][] solution = {{0, 0, 0, 0, 0}, {0, 1, 1, 1, 1}, {1, 2, 2, 3, 2}, {2, 5, 5, 6, 3}}; for (int i = 0; i < solution.length; i++) { long[] bounds = grid.getCoverage(i); if (!Arrays.equals(solution[i], bounds)) { System.out.println(Arrays.toString(solution[i]) + " " + Arrays.toString(bounds)); } assertTrue(Arrays.equals(solution[i], bounds)); } }
public GridSubset getGridSubSet(GridSetBroker gridSetBroker) { GridSet gridSet = gridSetBroker.get(getGridSetName()); if (gridSet == null) { log.error("Unable to find GridSet for \"" + getGridSetName() + "\""); return null; } return GridSubsetFactory.createGridSubSet( gridSet, getExtent(), getZoomStart(), getZoomStop(), minCachedLevel, maxCachedLevel); }
public void test1gridLevels900913() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 20037508.34, 20037508.34); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg3857(), bbox, 0, 10); long[][] solution = { {0, 0, 0, 0, 0}, {1, 1, 1, 1, 1}, {2, 2, 3, 3, 2}, {4, 4, 7, 7, 3}, {8, 8, 15, 15, 4} }; for (int i = 0; i < solution.length; i++) { long[] bounds = grid.getCoverage(i); if (!Arrays.equals(solution[i], bounds)) { System.out.println("test1gridLevels900913, level " + i); System.out.println(Arrays.toString(solution[i]) + " " + Arrays.toString(bounds)); } assertTrue(Arrays.equals(solution[i], bounds)); } }
public void test1gridLevels4326() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 180.0, 90.0); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 10); long[][] solution = {{1, 0, 1, 0, 0}, {2, 1, 3, 1, 1}, {4, 2, 7, 3, 2}, {8, 4, 15, 7, 3}}; for (int i = 0; i < solution.length; i++) { long[] bounds = grid.getCoverage(i); if (!Arrays.equals(solution[i], bounds)) { System.out.println( i + " " + Arrays.toString(solution[i]) + " " + Arrays.toString(bounds)); } assertTrue(Arrays.equals(solution[i], bounds)); } }
public void test3gridLevels4326() throws Exception { BoundingBox bbox = new BoundingBox(-10.0, -10.0, 10.0, 10.0); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 10); long[][] solution = { {0, 0, 1, 0, 0}, {1, 0, 2, 1, 1}, {3, 1, 4, 2, 2}, {7, 3, 8, 4, 3}, {15, 7, 16, 8, 4}, {30, 14, 33, 17, 5}, {60, 28, 67, 35, 6}, {120, 56, 135, 71, 7} }; for (int i = 0; i < solution.length; i++) { long[] bounds = grid.getCoverage(i); if (!Arrays.equals(solution[i], bounds)) { System.out.println(Arrays.toString(solution[i]) + " " + Arrays.toString(bounds)); } assertTrue(Arrays.equals(solution[i], bounds)); } }
public void test2gridLevels4326() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 180, 90); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 10); long[][] solution = { {1, 0, 1, 0, 0}, {2, 1, 3, 1, 1}, {4, 2, 7, 3, 2}, {8, 4, 15, 7, 3}, {16, 8, 31, 15, 4}, {32, 16, 63, 31, 5}, {64, 32, 127, 63, 6} }; for (int i = 0; i < solution.length; i++) { long[] bounds = grid.getCoverage(i); if (!Arrays.equals(solution[i], bounds)) { System.out.println(Arrays.toString(solution[i]) + " " + Arrays.toString(bounds)); } assertTrue(Arrays.equals(solution[i], bounds)); } }
public void testCoverageBounds2() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 180, 90); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 1); long[] ret = grid.getCoverage(1); long[] correct = {2, 1, 3, 1, 1}; assertTrue(Arrays.equals(correct, ret)); }
public void test5gridBoundsLoc4326() throws Exception { BoundingBox bbox = new BoundingBox(-124.73, 24.96, -66.97, 49.37); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 10); long[] bestFit = grid.getCoverageBestFit(); long[] solution = {0, 0, 0, 0, 0}; assertTrue(Arrays.equals(bestFit, solution)); }
public void testCoverageBounds() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 180, 90); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 0); long[] ret = grid.getCoverage(0); long[] correct = {1, 0, 1, 0, 0}; assertTrue(Arrays.equals(correct, ret)); }
public void testWMTSCoverage() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 180, 90); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 1, 3); long[][] coverages = grid.getWMTSCoverages(); assertEquals(3, coverages.length); long[] correct = {2, 0, 3, 0}; assertTrue(Arrays.equals(correct, coverages[0])); }
public void testCalculatePageInfo() { GridSubset gridSubSet = GridSubsetFactory.createGridSubSet(world_EPSG3857); long[][] gridSubsetCoverages = gridSubSet.getCoverages(); int zoomStart = gridSubSet.getZoomStart(); int zoomStop = gridSubSet.getZoomStop(); PagePyramid pp = new PagePyramid(gridSubsetCoverages, zoomStart, zoomStop); printPyramid(zoomStart, zoomStop, pp); }
public void testGridIndex() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 180, 90); int zoomStart = 3; int zoomStop = 9; GridSubset grid = GridSubsetFactory.createGridSubSet( gridSetBroker.getWorldEpsg4326(), bbox, zoomStart, zoomStop); String[] gridNames = grid.getGridNames(); for (int i = 0, z = zoomStart; i < gridNames.length; i++, z++) { assertEquals(z, grid.getGridIndex(gridNames[i])); } } }
public void testResolutionsAndScaleDenoms() { double[] resolutions = GridSubsetFactory.createGridSubSet(gridset).getResolutions(); List<LODInfo> lodInfos = cacheInfo.getTileCacheInfo().getLodInfos(); assertEquals(lodInfos.size(), resolutions.length); for (int i = 0; i < resolutions.length; i++) { LODInfo lodInfo = lodInfos.get(i); assertEquals(lodInfo.getResolution(), resolutions[i]); assertEquals( lodInfo.getScale(), gridset.getGridLevels()[i].getScaleDenominator(), 1e-6); } } }
public void testGridNames() throws Exception { BoundingBox bbox = new BoundingBox(0, 0, 180, 90); int zoomStart = 3; int zoomStop = 9; GridSubset grid = GridSubsetFactory.createGridSubSet( gridSetBroker.getWorldEpsg4326(), bbox, zoomStart, zoomStop); String[] gridNames = grid.getGridNames(); final int nlevels = 1 + (grid.getZoomStop() - grid.getZoomStart()); assertEquals(nlevels, gridNames.length); for (String name : gridNames) { assertNotNull(name); } }
private void commonCreateTileFromMetaTileTest(Color[][] colors, RenderedImage metaTileImage) throws Exception { // creating the meta tile BoundingBox boundingBox = new BoundingBox(0, 0, 180, 90); int metaHeight = 2; int metaWidth = 2; GridSubset grid = GridSubsetFactory.createGridSubSet( gridSetBroker.getWorldEpsg4326(), boundingBox, 0, 21); long[] gridPos = {0, 0, 0}; MetaTile metaTile = new MetaTile(grid, ImageMime.png, null, gridPos, metaWidth, metaHeight, null); metaTile.setImage(metaTileImage); // extracting the tiles using the create tile method int width = metaTile.getMetaTileWidth(); int height = metaTile.getMetaTileHeight(); checkImageBorderSameColor(metaTile.createTile(0, 0, width, height), colors[0][0]); checkImageBorderSameColor(metaTile.createTile(width, 0, width, height), colors[0][1]); checkImageBorderSameColor(metaTile.createTile(0, height, width, height), colors[1][0]); checkImageBorderSameColor(metaTile.createTile(width, height, width, height), colors[1][1]); }