public String getName() { return gridSet.getName(); }
protected void addInternal(GridSet g) { gridSets.put(g.getName(), g); }
@Override public void addGridSet(GridSet gridSet) throws IllegalArgumentException { if (gridSet == null) { throw new NullPointerException(); } throw new UnsupportedOperationException( "This is a read only configuration object, can't add gridset " + gridSet.getName()); }
private void validateGridSet(GridSet gridSet) { if (Objects.isNull(gridSet.getName())) { throw new IllegalArgumentException("GridSet name is not set"); } if (Objects.isNull(gridSet.getGridLevels())) { throw new IllegalArgumentException("GridSet has no levels"); } }
private KMLDebugGridLayer() { super.subSets = new Hashtable<String, GridSubset>(); subSets.put(gridSetBroker.WORLD_EPSG4326.getName(), GridSubsetFactory.createGridSubSet( gridSetBroker.WORLD_EPSG4326, BoundingBox.WORLD4326, 0, 3)); }
public void addGridSet(GridSet gridSet) { log.debug("Adding " + gridSet.getName()); getConfigurations() .stream() .filter(c -> c.canSave(gridSet)) .findFirst() .orElseThrow( () -> new UnsupportedOperationException( "No Configuration is able to save gridset " + gridSet.getName())) .addGridSet(gridSet); }
private KMLDebugGridLayer() { super.subSets = new Hashtable<String, GridSubset>(); subSets.put( gridSetBroker.getWorldEpsg4326().getName(), GridSubsetFactory.createGridSubSet( gridSetBroker.getWorldEpsg4326(), BoundingBox.WORLD4326, 0, 3)); }
public synchronized void put(GridSet gridSet) { remove(gridSet.getName()); addGridSet(gridSet); }
public GridSet getWorldEpsg3857() { // get the internal default. We need it's name, if nothing else. final GridSet internalDefault3857GridSet = getDefaults().worldEpsg3857(); // get the name of the internal default as it may not always be "EPSG:3857" final String internalDefault3857Name = internalDefault3857GridSet.getName(); // Use the highest priority EPSG:3857 gridset we have (either an overriden one, or the // defaults) Optional<GridSet> gridSet = getGridSet(internalDefault3857Name); if (gridSet.isPresent()) { return gridSet.get(); } // probably won't ever hit this, but if 3857 isn't in the configuration at this point, just // return the internal // defaults. return internalDefault3857GridSet; }
@Override protected Matcher<GridSet> infoEquals(GridSet expected) { return new CustomMatcher<GridSet>( "GridSet matching " + expected.getName() + " with " + expected.getDescription()) { @Override public boolean matches(Object item) { return item instanceof GridSet && ((GridSet) item).getName().equals(((GridSet) expected).getName()) && ((GridSet) item) .getDescription() .equals(((GridSet) expected).getDescription()); } }; }
@Override protected Matcher<GridSet> infoEquals(GridSet expected) { return new CustomMatcher<GridSet>( "GridSet matching " + expected.getName() + " with " + expected.getDescription()) { @Override public boolean matches(Object item) { return item instanceof GridSet && ((GridSet) item).getName().equals(((GridSet) expected).getName()) && ((GridSet) item) .getDescription() .equals(((GridSet) expected).getDescription()); } }; }
@Override protected Matcher<GridSet> infoEquals(GridSet expected) { return new CustomMatcher<GridSet>( "GridSet matching " + expected.getName() + " with " + expected.getDescription()) { @Override public boolean matches(Object item) { return item instanceof GridSet && ((GridSet) item).getName().equals(((GridSet) expected).getName()) && ((GridSet) item) .getDescription() .equals(((GridSet) expected).getDescription()); } }; }
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; }
static class CustomLayerImplementation { private String name; private String title; private boolean isAuthorized; private List<String> formats; public CustomLayerImplementation( String name, String title, boolean isAuthorized, List<String> formats) { this.name = name; this.title = title; this.isAuthorized = isAuthorized; this.formats = formats; } }
@Test public void testGridSetList() { Set<String> names = gridSetBroker.getNames(); int i = 0; for (GridSet grid : gridSetBroker.getGridSets()) { assertTrue(names.contains(grid.getName())); i++; } assertEquals(i, names.size()); }
public void testBoundingBoxTricky2() throws Exception { BoundingBox extent = new BoundingBox(-180, -90, 180, 82); SRS srs = SRS.getEPSG4326(); GridSet gridSet = GridSetFactory.createGridSet( "test", srs, extent, false, 4, null, 0.00028, 256, 256, false); assertEquals("test", gridSet.getName()); assertEquals(-180.0, gridSet.tileOrigin()[0]); assertEquals(-90.0, gridSet.tileOrigin()[1]); assertEquals(4, gridSet.getGridLevels().length); Grid grid0 = gridSet.getGridLevels()[0]; assertEquals(180.0 / 256, grid0.getResolution()); assertEquals(2L, grid0.getNumTilesWide()); assertEquals(1L, grid0.getNumTilesHigh()); }