private Collection<String> getGridSubsetNames( Optional<Collection<GridSubset>> gridSubsets, TileLayer tileLayer) { return gridSubsets .map(Collection::stream) .map(stream -> stream.map(GridSubset::getName)) .map(stream -> stream.collect(Collectors.toSet())) .orElseGet(() -> tileLayer.getGridSubsets()); }
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; } }
public Set<String> layerGridsets(String layerName) { TileLayer layer; try { layer = layers.getTileLayer(layerName); } catch (GeoWebCacheException e) { throw Throwables.propagate(e); } return layer.getGridSubsets(); }
public Set<String> layerGridsets(String layerName) { TileLayer layer; try { layer = layers.getTileLayer(layerName); } catch (GeoWebCacheException e) { throw Throwables.propagate(e); } return layer.getGridSubsets(); }
private void makeGridSetPulldown(StringBuilder doc, TileLayer tl) { doc.append("<tr><td>Grid Set:</td><td>\n"); Map<String, String> keysValues = new TreeMap<String, String>(); String firstGridSetId = null; for (String gridSetId : tl.getGridSubsets()) { if (firstGridSetId == null) { firstGridSetId = gridSetId; } keysValues.put(gridSetId, gridSetId); } makePullDown(doc, "gridSetId", keysValues, firstGridSetId); doc.append("</td></tr>\n"); }
private void makeGridSetPulldown(StringBuilder doc, TileLayer tl) { doc.append("<tr><td>Grid Set:</td><td>\n"); Map<String, String> keysValues = new TreeMap<String, String>(); String firstGridSetId = null; for (String gridSetId : tl.getGridSubsets()) { if (firstGridSetId == null) { firstGridSetId = gridSetId; } keysValues.put(gridSetId, gridSetId); } makePullDown(doc, "gridSetId", keysValues, firstGridSetId); doc.append("</td></tr>\n"); }
public Set<String> getLayerNamesForGridSets(final Set<String> gridSetIds) { Set<String> layerNames = new TreeSet<String>(); for (TileLayer layer : getTileLayers()) { Set<String> layerGrids = layer.getGridSubsets(); if (!Sets.intersection(gridSetIds, layerGrids).isEmpty()) { layerNames.add(layer.getName()); } } return layerNames; }
public Set<String> getLayerNamesForGridSets(final Set<String> gridSetIds) { Set<String> layerNames = new TreeSet<String>(); for (TileLayer layer : getTileLayers()) { Set<String> layerGrids = layer.getGridSubsets(); if (!Sets.intersection(gridSetIds, layerGrids).isEmpty()) { layerNames.add(layer.getName()); } } return layerNames; }
/** * Returns an immutable list of all the layer's {@link GridSubset} whose {@link GridSet} has a * SRS equal to {@code srs} (may be an alias), or the empty list of none matches. */ public List<GridSubset> getGridSubsetsForSRS(SRS srs) { List<GridSubset> matches = Collections.emptyList(); for (String gridSet : getGridSubsets()) { GridSubset gridSubset = getGridSubset(gridSet); SRS gridSetSRS = gridSubset.getSRS(); if (gridSetSRS.equals(srs)) { if (matches.isEmpty()) { matches = new ArrayList<GridSubset>(2); } matches.add(gridSubset); } } return matches.isEmpty() ? matches : Collections.unmodifiableList(matches); }
private void makeBboxHints(StringBuilder doc, TileLayer tl) { for (String gridSetId : tl.getGridSubsets()) { GridSubset subset = tl.getGridSubset(gridSetId); doc.append("<li>" + gridSetId + ": " + subset.getOriginalExtent().toString() + "</li>\n"); } }
private void makeBboxHints(StringBuilder doc, TileLayer tl) { for (String gridSetId : tl.getGridSubsets()) { GridSubset subset = tl.getGridSubset(gridSetId); doc.append( "<li>" + gridSetId + ": " + subset.getOriginalExtent().toString() + "</li>\n"); } }
private void writeSiteMapIndexLoop() throws IOException { OutputStream os = tile.servletResp.getOutputStream(); String urlPrefix = tile.getUrlPrefix(); Iterable<TileLayer> iter = tLD.getLayerList(); for (TileLayer tl : iter) { if (!tl.isEnabled()) { continue; } Set<String> grids = tl.getGridSubsets(); List<MimeType> mimeTypes = tl.getMimeTypes(); if( grids != null && grids.contains(gridSetBroker.WORLD_EPSG4326.getName()) && mimeTypes != null && mimeTypes.contains(XMLMime.kml) ) { String smStr = "<sitemap><loc>"+urlPrefix+tl.getName()+"/sitemap.xml</loc></sitemap>"; os.write(smStr.getBytes()); } } }
@Test public void initializationTest() { initialize(tl); Set<String> subsets = tl.getGridSubsets(); assertEquals(subsets.size(), 2); assertEquals(subsets.toArray()[0], "EPSG:4326"); assertEquals(subsets.toArray()[1], "EPSG:900913"); }
/** * This method is deprecated, as a layer may be configured for more than one gridset with the * same SRS. * * @deprecated use {@link #getGridSubsetsForSRS(SRS)} in combination with {@link * GridUtil#findBestMatchingGrid} instead */ public GridSubset getGridSubsetForSRS(SRS srs) { for (String gridSet : getGridSubsets()) { GridSubset gridSubset = getGridSubset(gridSet); SRS gridSetSRS = gridSubset.getSRS(); if (gridSetSRS.equals(srs)) { return gridSubset; } } return null; }
public void setUp() { RasterMaskTestUtils.debugToDisk = debugToDisk; layer = TestUtils.createWMSLayer( "image/png", new GridSetBroker(false, false), 3, 3, new BoundingBox(-180, -90, 180, 90)); gridsetId = layer.getGridSubsets().iterator().next(); }
public void truncate(final String layerName, final ReferencedEnvelope bounds) throws GeoWebCacheException { final TileLayer tileLayer = tld.getTileLayer(layerName); final Collection<String> gridSubSets = tileLayer.getGridSubsets(); /* * Create a truncate task for each gridSubset (CRS), format and style */ for (String gridSetId : gridSubSets) { GridSubset layerGrid = tileLayer.getGridSubset(gridSetId); BoundingBox intersectingBounds = getIntersectingBounds(layerName, layerGrid, bounds); if (intersectingBounds == null) { continue; } String styleName = null;// all of them String format = null;// all of them truncate(layerName, styleName, gridSetId, intersectingBounds, format); } }
public void setUp() { RasterMaskTestUtils.debugToDisk = debugToDisk; layer = TestUtils.createWMSLayer( "image/png", new GridSetBroker(false, false), 3, 3, new BoundingBox(-180, -90, 180, 90)); gridsetId = layer.getGridSubsets().iterator().next(); fullCoverage = layer.getGridSubset(gridsetId).getCoverages(); }
@Test public void testTileFuserSuperset() throws Exception { TileLayer layer = createWMSLayer(); // request larger than -30.0,15.0,45.0,30 BoundingBox bounds = new BoundingBox(-35.0, 14.0, 55.0, 39); // One in between int width = (int) bounds.getWidth() * 25; int height = (int) bounds.getHeight() * 25; GridSubset gridSubset = layer.getGridSubset(layer.getGridSubsets().iterator().next()); TileLayerDispatcher tld = mock(TileLayerDispatcher.class); Mockito.when(tld.getTileLayer("test:layer")).thenReturn(layer); StorageBroker sb = mock(StorageBroker.class); WMSTileFuser tileFuser = new WMSTileFuser(tld, sb, fuserRequest(layer, gridSubset, bounds, width, height)); tileFuser.setSecurityDispatcher(secDisp); tileFuser.determineSourceResolution(); tileFuser.determineCanvasLayout(); }
public static GeometryRasterMaskBuilder buildSampleFilterMatrix( final TileLayer layer, final String gridsetId, final int maxMaskLevel) throws Exception { final Geometry entries[] = createSampleEntries(); final GridSubset gridSubset = layer.getGridSubset(layer.getGridSubsets().iterator().next()); final int[] metaTilingFactors = layer.getMetaTilingFactors(); GeometryRasterMaskBuilder matrix = new GeometryRasterMaskBuilder(gridSubset, metaTilingFactors, maxMaskLevel); try { for (Geometry geom : entries) { matrix.setMasksForGeometry(geom); } } finally { matrix.disposeGraphics(); } logImages(new File("target"), matrix); return matrix; }
protected void tileMapsForLayer( XMLBuilder xml, TileLayer layer, String baseUrl, String contextPath) throws IOException { for (String gridSetId : layer.getGridSubsets()) { GridSubset gridSub = layer.getGridSubset(gridSetId); for (MimeType mimeType : layer.getMimeTypes()) { // GridSubset gridSub = iter.next(); xml.indentElement("TileMap") .attribute("title", tileMapTitle(layer)) .attribute("srs", gridSub.getSRS().toString()) .attribute("profile", profileForGridSet(gridSub.getGridSet())) .attribute( "href", tileMapUrl(layer, gridSub, mimeType, baseUrl, contextPath)) .endElement(); } } }