Package org.geoserver.gwc.layer

Examples of org.geoserver.gwc.layer.GeoServerTileLayer


            final GridSetBroker gridsets = gwc.getGridSetBroker();
            Catalog catalog = getCatalog();

            LayerInfo layer = catalog.getLayerByName(name);
            if (layer != null) {
                return new GeoServerTileLayer(layer, defaults, gridsets);
            }
            LayerGroupInfo layerGroup = catalog.getLayerGroupByName(name);
            return new GeoServerTileLayer(layerGroup, defaults, gridsets);
        }
View Full Code Here


        Preconditions.checkState(layer.getId() != null);
        tileLayerInfo.setId(layer.getId());

        final String name;
        final GridSetBroker gridsets = gwc.getGridSetBroker();
        GeoServerTileLayer tileLayer;
        if (layer instanceof LayerGroupInfo) {
            LayerGroupInfo groupInfo = (LayerGroupInfo) layer;
            name = tileLayerName(groupInfo);
            tileLayer = new GeoServerTileLayer(groupInfo, gridsets, tileLayerInfo);
        } else {
            LayerInfo layerInfo = (LayerInfo) layer;
            name = tileLayerName(layerInfo);
            tileLayer = new GeoServerTileLayer(layerInfo, gridsets, tileLayerInfo);
        }

        tileLayerInfo.setName(name);

        if (tileLayerExists) {
View Full Code Here

    protected void onClick(AjaxRequestTarget target) {
        final TileLayer layer = getModelObject();
        if (!(layer instanceof GeoServerTileLayer)) {
            return;
        }
        final GeoServerTileLayer geoserverTileLayer = (GeoServerTileLayer) getModelObject();
        LayerInfo layerInfo = geoserverTileLayer.getLayerInfo();
        if (layerInfo != null) {
            ResourceConfigurationPage resourceConfigPage;
            resourceConfigPage = new ResourceConfigurationPage(layerInfo, false);
            // tell the resource/layer edit page to start up on the tile cache tab
            resourceConfigPage.setSelectedTab(LayerCacheOptionsTabPanel.class);
            if (returnPage != null) {
                resourceConfigPage.setReturnPage(returnPage);
            }
            setResponsePage(resourceConfigPage);
        } else {
            LayerGroupInfo layerGroup = geoserverTileLayer.getLayerGroupInfo();
            WorkspaceInfo workspace = layerGroup.getWorkspace();
            String wsName = workspace == null ? null : workspace.getName();
            Map<String, String> params = new HashMap<String, String>();
            params.put(LayerGroupEditPage.GROUP, layerGroup.getName());
            params.put(LayerGroupEditPage.WORKSPACE, wsName);
View Full Code Here

     * @param info
     * @return
     */
    public static ResourceReference getSpecificLayerIcon(final TileLayer layer) {
        if (layer instanceof GeoServerTileLayer) {
            GeoServerTileLayer gsTileLayer = (GeoServerTileLayer) layer;
            LayerInfo layerInfo = gsTileLayer.getLayerInfo();
            if (layerInfo != null) {
                return CatalogIconFactory.get().getSpecificLayerIcon(layerInfo);
            }
            return CatalogIconFactory.GROUP_ICON;
        }
View Full Code Here

        GeoServerTileLayerInfo tileLayerInfo;

        final GWC mediator = GWC.get();
        final GWCConfig defaultSettings = mediator.getConfig();

        final GeoServerTileLayer tileLayer = isNew ? null : mediator.getTileLayer(layerGroupInfo);

        if (isNew || tileLayer == null) {
            /*
             * Ensure a sane config for defaults, in case automatic cache of new layers is defined
             * and the defaults is misconfigured
View Full Code Here

        gridSetBroker = new GridSetBroker(true, true);

        tileLayerInfo = TileLayerInfoUtil.loadOrCreate(layer, defaults);
        tileLayerGroupInfo = TileLayerInfoUtil.loadOrCreate(layerGroup, defaults);

        tileLayer = new GeoServerTileLayer(layer, gridSetBroker, tileLayerInfo);
        tileLayerGroup = new GeoServerTileLayer(layerGroup, gridSetBroker, tileLayerGroupInfo);

        tld = mock(TileLayerDispatcher.class);
        mockTileLayerDispatcher();

        config = mock(Configuration.class);
View Full Code Here

        List<String> layerNames = Arrays.asList(tileLayerName(layer2), tileLayerName(group2));

        when(tld.addLayer(any(GeoServerTileLayer.class))).thenReturn(config);
        mediator.autoConfigureLayers(layerNames, defaults);

        GeoServerTileLayerInfo expected1 = new GeoServerTileLayer(layer2, defaults, gridSetBroker)
                .getInfo();
        GeoServerTileLayerInfo expected2 = new GeoServerTileLayer(group2, defaults, gridSetBroker)
                .getInfo();

        ArgumentCaptor<GeoServerTileLayer> addCaptor = ArgumentCaptor
                .forClass(GeoServerTileLayer.class);
View Full Code Here

     */
    @Test
    public void testNullsInDimensionAndTimeParameters() throws Exception {
        TileLayerInfoUtil.updateAcceptAllFloatParameterFilter(tileLayerInfo, "ELEVATION", true);
        TileLayerInfoUtil.updateAcceptAllRegExParameterFilter(tileLayerInfo, "TIME", true);
        tileLayer = new GeoServerTileLayer(layer, gridSetBroker, tileLayerInfo);

        GetMapRequest request = new GetMapRequest();
        @SuppressWarnings("unchecked")
        Map<String, String> rawKvp = new CaseInsensitiveMap(new HashMap<String, String>());
        request.setRawKvp(rawKvp);
View Full Code Here

    }

    private GeoServerTileLayer mockTileLayer(String layerName, List<String> gridSetNames)
            throws Exception {

        GeoServerTileLayer tileLayer = mock(GeoServerTileLayer.class);
        when(tld.layerExists(eq(layerName))).thenReturn(true);
        when(tld.getTileLayer(eq(layerName))).thenReturn(tileLayer);
        when(tileLayer.getName()).thenReturn(layerName);
        when(tileLayer.isEnabled()).thenReturn(true);

        final MimeType mimeType1 = MimeType.createFromFormat("image/png");
        final MimeType mimeType2 = MimeType.createFromFormat("image/jpeg");
        when(tileLayer.getMimeTypes()).thenReturn(ImmutableList.of(mimeType1, mimeType2));

        Map<String, GridSubset> subsets = Maps.newHashMap();
        Multimap<SRS, GridSubset> bySrs = LinkedHashMultimap.create();

        GridSetBroker broker = gridSetBroker;

        for (String gsetName : gridSetNames) {
            GridSet gridSet = broker.get(gsetName);
            XMLGridSubset xmlGridSubset = new XMLGridSubset();
            String gridSetName = gridSet.getName();
            xmlGridSubset.setGridSetName(gridSetName);
            GridSubset gridSubSet = xmlGridSubset.getGridSubSet(broker);
            subsets.put(gsetName, gridSubSet);
            bySrs.put(gridSet.getSrs(), gridSubSet);

            when(tileLayer.getGridSubset(eq(gsetName))).thenReturn(gridSubSet);

        }
        for (SRS srs : bySrs.keySet()) {
            List<GridSubset> list = ImmutableList.copyOf(bySrs.get(srs));
            when(tileLayer.getGridSubsetsForSRS(eq(srs))).thenReturn(list);

        }
        when(tileLayer.getGridSubsets()).thenReturn(subsets.keySet());

        // sanity check
        for (String gsetName : gridSetNames) {
            assertTrue(tileLayer.getGridSubsets().contains(gsetName));
            assertNotNull(tileLayer.getGridSubset(gsetName));
        }

        return tileLayer;
    }
View Full Code Here

        MockHttpServletResponse response = super.putAsServletResponse(url, xml, "text/xml");

        assertEquals(HttpServletResponse.SC_OK, response.getStatusCode());

        assertTrue(mediator.tileLayerExists(layerName));
        GeoServerTileLayer tileLayer = (GeoServerTileLayer) mediator.getTileLayerByName(layerName);
        GeoServerTileLayerInfo info = tileLayer.getInfo();
        assertEquals(20, info.getGutter());
        assertEquals(2, tileLayer.getGridSubsets().size());
        assertTrue(tileLayer.getGridSubsets().contains("GoogleCRS84Quad"));
        assertTrue(tileLayer.getGridSubsets().contains("EPSG:4326"));
        assertEquals(ImmutableSet.of("image/png8"), info.getMimeFormats());
        assertEquals(9, info.getMetaTilingX());
        assertEquals(6, info.getMetaTilingY());

        List<ParameterFilter> filters = Lists.newArrayList(info.getParameterFilters());
View Full Code Here

TOP

Related Classes of org.geoserver.gwc.layer.GeoServerTileLayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.