Package org.geowebcache.grid

Examples of org.geowebcache.grid.GridSubset


    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 {
View Full Code Here


        if (gridSet == null) {
            return null;
        }
        List<String> refereningLayers = new ArrayList<String>();
        for (TileLayer layer : getLayerList()) {
            GridSubset gridSubset = layer.getGridSubset(gridSetName);
            if (gridSubset != null) {
                refereningLayers.add(layer.getName());
            }
        }
        if (refereningLayers.size() > 0) {
View Full Code Here

        if (tilematrixset == null) {
            throw new OWSException(400, "MissingParameterValue", "TILEMATRIXSET",
                    "No TILEMATRIXSET specified");
        }

        GridSubset gridSubset = tileLayer.getGridSubset(tilematrixset);
        if (gridSubset == null) {
            throw new OWSException(400, "InvalidParameterValue", "TILEMATRIXSET",
                    "Unable to match requested TILEMATRIXSET " + tilematrixset
                            + " to those supported by layer");
        }

        final String tileMatrix = values.get("tilematrix");
        if (tileMatrix == null) {
            throw new OWSException(400, "MissingParameterValue", "TILEMATRIX",
                    "No TILEMATRIX specified");
        }
        long z = gridSubset.getGridIndex(tileMatrix);

        if (z < 0) {
            throw new OWSException(400, "InvalidParameterValue", "TILEMATRIX",
                    "Unknown TILEMATRIX " + tileMatrix);
        }

        // WMTS has 0 in the top left corner -> flip y value
        final String tileRow = values.get("tilerow");
        if (tileRow == null) {
            throw new OWSException(400, "MissingParameterValue", "TILEROW", "No TILEROW specified");
        }
       
        final long tilesHigh = gridSubset.getNumTilesHigh((int) z);

        long y = tilesHigh - Long.parseLong(tileRow) - 1;

        String tileCol = values.get("tilecol");
        if (tileCol == null) {
            throw new OWSException(400, "MissingParameterValue", "TILECOLUMN",
                    "No TILECOLUMN specified");
        }
        long x = Long.parseLong(tileCol);

        long[] gridCov = gridSubset.getCoverage((int) z);

        if (x < gridCov[0] || x > gridCov[2]) {
            throw new OWSException(400, "TileOutOfRange", "TILECOLUMN", "Column " + x
                    + " is out of range, min: " + gridCov[0] + " max:" + gridCov[2]);
        }

        if (y < gridCov[1] || y > gridCov[3]) {
            long minRow = tilesHigh - gridCov[3] - 1;
            long maxRow = tilesHigh - gridCov[1] - 1;

            throw new OWSException(400, "TileOutOfRange", "TILEROW", "Row " + tileRow
                    + " is out of range, min: " + minRow + " max:" + maxRow);
        }

        long[] tileIndex = { x, y, z };

        try {
            gridSubset.checkCoverage(tileIndex);
        } catch (OutsideCoverageException e) {

        }

        ConveyorTile convTile = new ConveyorTile(sb, layer, gridSubset.getName(), tileIndex,
                mimeType, fullParameters, request, response);

        convTile.setTileLayer(tileLayer);

        return convTile;
View Full Code Here

        BoundingBox bounds = new BoundingBox(-25.0,17.0,40.0,22);
       
        // One in between
        int width = (int) bounds.getWidth() * 10;
        int height= (int) bounds.getHeight() * 10;
        GridSubset gridSubset = layer.getGridSubset(layer.getGridSubsets().iterator().next());
        WMSTileFuser tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
        tileFuser.determineSourceResolution();
        assertEquals(0.087890625, tileFuser.srcResolution, 0.087890625*0.001);
       
        // Zoomed too far out
View Full Code Here

        BoundingBox bounds = new BoundingBox(-25.0,17.0,40.0,22);
       
        // One in between
        int width = (int) bounds.getWidth() * 10;
        int height= (int) bounds.getHeight() * 10;
        GridSubset gridSubset = layer.getGridSubset(layer.getGridSubsets().iterator().next());
        WMSTileFuser tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
        tileFuser.determineSourceResolution();
        tileFuser.determineCanvasLayout();
       
        assertTrue(tileFuser.srcBounds.contains(bounds));
View Full Code Here

        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());
        WMSTileFuser tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
        tileFuser.determineSourceResolution();
        tileFuser.determineCanvasLayout();
    }
View Full Code Here

        List<String> formatList = new LinkedList<String>();
        formatList.add("image/png");
       
        Hashtable<String,GridSubset> grids = new Hashtable<String,GridSubset>();

        GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.WORLD_EPSG4326, new BoundingBox(-30.0,15.0,45.0,30), 0,10);
       
        grids.put(grid.getName(), grid);
        int[] metaWidthHeight = {3,3};
       
        WMSLayer layer = new WMSLayer("test:layer", urls, "aStyle", "test:layer", formatList, grids, null, metaWidthHeight, "vendorparam=true", false, null);
       
        layer.initialize(gridSetBroker);
View Full Code Here

        if (this.gridSubsets == null) {
            this.gridSubsets = new ArrayList<XMLGridSubset>();
        }

        for (XMLGridSubset xmlGridSubset : gridSubsets) {
            GridSubset gridSubset = xmlGridSubset.getGridSubSet(gridSetBroker);

            if (gridSubset == null) {
                log.error(xmlGridSubset.getGridSetName()
                        + " is not known by the GridSetBroker, skipping for layer " + name);
            } else {
                subSets.put(gridSubset.getName(), gridSubset);
            }

        }

        // Convert version 1.1.x and 1.0.x grid objects
        if (grids != null && !grids.isEmpty()) {
            Iterator<XMLOldGrid> iter = grids.values().iterator();
            while (iter.hasNext()) {
                GridSubset converted = iter.next().convertToGridSubset(gridSetBroker);
                subSets.put(converted.getSRS().toString(), converted);
                // hold it in case the layer is to be saved again
                gridSubsets.add(new XMLGridSubset(converted));
            }
            // Null it for the garbage collector
            grids = null;
View Full Code Here

     * @param tile
     */
    private void handleSuperOverlay(ConveyorKMLTile tile) throws GeoWebCacheException {
        TileLayer layer = tile.getLayer();

        GridSubset gridSubset = tile.getGridSubset();

        // int srsIdx = layer.getSRSIndex(srs);
        BoundingBox bbox = gridSubset.getCoverageBestFitBounds();

        String formatExtension = "." + tile.getMimeType().getFileExtension();
        if (tile.getWrapperMimeType() != null) {
            formatExtension = formatExtension + "." + tile.getWrapperMimeType().getFileExtension();
        }

        long[] gridRect = gridSubset.getCoverageBestFit();
        String networkLinks = null;

        // Check whether we need two tiles for world bounds or not
        if (gridRect[4] > 0 && (gridRect[2] != gridRect[0] || gridRect[3] != gridRect[1])) {
            throw new GeoWebCacheException(layer.getName() + " (" + bbox.toString()
                    + ") is too big for the sub grid set for " + gridSubset.getName()
                    + ", allow for smaller zoom levels.");
        } else if (gridRect[0] != gridRect[2]) {
            long[] gridLocWest = { 0, 0, 0 };
            long[] gridLocEast = { 1, 0, 0 };

View Full Code Here

            throws ServiceException, GeoWebCacheException {
        boolean isRaster = (tile.getMimeType() instanceof ImageMime);

        TileLayer tileLayer = tile.getLayer();

        GridSubset gridSubset = tile.getGridSubset();

        long[] gridLoc = tile.getTileIndex();

        BoundingBox bbox = gridSubset.boundsFromIndex(gridLoc);

        String refreshTags = "";
        int refreshInterval = tileLayer.getExpireClients((int) gridLoc[2]);
        if (refreshInterval > 0) {
            refreshTags = "\n<refreshMode>onInterval</refreshMode>" + "\n<refreshInterval>"
                    + refreshInterval + "</refreshInterval>";
        }
       
        StringBuffer buf = new StringBuffer();

        // 1) Header
        boolean setMaxLod = false;
        if (isRaster && gridLoc[2] < gridSubset.getZoomStop()) {
            setMaxLod = true;
        }
        buf.append(createOverlayHeader(bbox, setMaxLod));

        buf.append("\n<!-- Network links to subtiles -->\n");
        // 2) Network links, only to tiles getCoverages();within bounds

        long[][] linkGridLocs = gridSubset.getSubGrid(gridLoc);

        // 3) Apply secondary filter against linking to empty tiles
        linkGridLocs = KMZHelper.filterGridLocs(tile.getStorageBroker(), tileLayer,
                gridSubset.getName(), tile.getMimeType(), linkGridLocs);

        // int moreData = 0;
        for (int i = 0; i < 4; i++) {
            // Only add this link if it is within the bounds
            if (linkGridLocs[i][2] > 0) {
                BoundingBox linkBbox = gridSubset.boundsFromIndex(linkGridLocs[i]);

                String gridLocStr = gridLocString(linkGridLocs[i]);

                // Always use absolute URLs for these
                String gridLocUrl = tile.getUrlPrefix() + gridLocStr + "."
View Full Code Here

TOP

Related Classes of org.geowebcache.grid.GridSubset

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.