@Test public void testBuild() throws Exception { final int tileSize = 6; final Double z = 99.1; final String sectionId = z.toString(); final List<TileBounds> tileBoundsList = new ArrayList<>(); final Bounds layerBounds = new Bounds(52.0, 22.0, 124.0, 94.0); for (int y = layerBounds.getMinY().intValue(); y < layerBounds.getMaxY(); y += tileSize) { for (int x = layerBounds.getMinX().intValue(); x < layerBounds.getMaxX(); x += tileSize) { tileBoundsList.add(new TileBounds("tile_" + tileBoundsList.size(), sectionId, z, (double) x, (double) y, (double) x + tileSize, (double) y + tileSize)); } } Assert.assertEquals("12x12 tile grid should have been created", 144, tileBoundsList.size()); final int boxSize = 10; final BoxDataPyramidForLayer boxPyramid = new BoxDataPyramidForLayer(z, layerBounds, boxSize, boxSize, tileBoundsList, 4, false, null, null); final List<BoxData> pyramidList = boxPyramid.getPyramidList(); Assert.assertNotNull("missing pyramid", pyramidList); Assert.assertEquals("invalid number of boxes in pyramid", EXPECTED_LIST.length, pyramidList.size()); String expectedLevelPath; String expectedServicePath; for (int i = 0; i < EXPECTED_LIST.length; i++) { expectedLevelPath = EXPECTED_LIST[i][0]; expectedServicePath = EXPECTED_LIST[i][1]; final BoxData boxData = pyramidList.get(i); Assert.assertEquals("invalid level path for box " + i, expectedLevelPath, boxData.getLevelPath()); Assert.assertEquals("invalid service path for box " + i, expectedServicePath, boxData.getServicePath(boxSize, boxSize)); if (boxData.getLevel() == 0) { Assert.assertFalse("level zero box " + i + " should not have children", boxData.hasChildren()); } else { Assert.assertTrue("level N box " + i + " should have children", boxData.hasChildren()); } } }
public List<BoxData> getPyramidList() { return pyramidList; }
BoxDataPyramidForLayer implements Serializable { public List<BoxData> getPyramidList() { return pyramidList; } }
BoxDataPyramidForLayer implements Serializable { public List<BoxData> getPyramidList() { return pyramidList; } BoxDataPyramidForLayer(final double z,
                                  final Bounds layerBounds,
                                  final int boxWidth,
                                  final int boxHeight,
                                  final List<TileBounds> tileBoundsList,
                                  final int maxLevel,
                                  final boolean excludeAlreadyRenderedBoxes,
                                  final String baseBoxPath,
                                  final String pathSuffix); }
BoxDataPyramidForLayer implements Serializable { public List<BoxData> getPyramidList() { return pyramidList; } BoxDataPyramidForLayer(final double z,
                                  final Bounds layerBounds,
                                  final int boxWidth,
                                  final int boxHeight,
                                  final List<TileBounds> tileBoundsList,
                                  final int maxLevel,
                                  final boolean excludeAlreadyRenderedBoxes,
                                  final String baseBoxPath,
                                  final String pathSuffix); double getZ(); List<BoxData> getPyramidList(); List<Integer> getLevelBoxCounts(); int getSize(); }
BoxDataPyramidForLayer implements Serializable { public List<BoxData> getPyramidList() { return pyramidList; } BoxDataPyramidForLayer(final double z,
                                  final Bounds layerBounds,
                                  final int boxWidth,
                                  final int boxHeight,
                                  final List<TileBounds> tileBoundsList,
                                  final int maxLevel,
                                  final boolean excludeAlreadyRenderedBoxes,
                                  final String baseBoxPath,
                                  final String pathSuffix); double getZ(); List<BoxData> getPyramidList(); List<Integer> getLevelBoxCounts(); int getSize();  }