Examples of GridSubset


Examples of org.geowebcache.grid.GridSubset

            for (UpdateSourceDefinition usd : layer.getUpdateSources()) {
                if (usd instanceof GeoRSSFeedDefinition) {
                    final GeoRSSFeedDefinition georssDef = (GeoRSSFeedDefinition) usd;

                    final String gridSetId = georssDef.getGridSetId();
                    final GridSubset gridSubset = layer.getGridSubset(gridSetId);
                    if (gridSubset == null) {
                        throw new IllegalStateException("Layer " + layer.getName()
                                + " has no grid subset " + gridSetId
                                + " as configured by its GeoRSS seeding feed " + georssDef);
                    }
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

    }

    private void launchSeeding(final TileLayer layer, final GeoRSSFeedDefinition pollDef,
            final String gridSetId, final GeometryRasterMaskBuilder tileRangeMask) {

        GridSubset gridSub = layer.getGridSubset(gridSetId);

        long[][] fullCoverage = gridSub.getCoverages();
        long[][] coveredBounds = tileRangeMask.getCoveredBounds();

        BufferedImage[] byLevelMasks = tileRangeMask.getByLevelMasks();

        RasterMask rasterMask = new RasterMask(byLevelMasks, fullCoverage, coveredBounds);

        List<MimeType> mimeList = null;

        if (pollDef.getFormat() != null) {
            MimeType mime;
            try {
                mime = MimeType.createFromFormat(pollDef.getFormat());
                mimeList = new LinkedList<MimeType>();
                mimeList.add(mime);
            } catch (MimeException e) {
                logger.error(e.getMessage());
            }
        }

        if (mimeList == null) {
            mimeList = layer.getMimeTypes();
        }

        Iterator<MimeType> mimeIter = mimeList.iterator();

        // Ask any existing seed jobs started by this feed to terminate
        stopSeeding(true);

        // We do the truncate synchronously to get rid of stale data as quickly as we can
        while (mimeIter.hasNext()) {
            DiscontinuousTileRange dtr = new DiscontinuousTileRange(layer.getName(), gridSetId,
                    gridSub.getZoomStart(), gridSub.getZoomStop(), rasterMask, mimeIter.next(),
                    (Map<String, String>) null);
            try {
                GWCTask[] tasks = seeder.createTasks(dtr, layer, GWCTask.TYPE.TRUNCATE, 1, false);
                tasks[0].doAction();
            } catch (GeoWebCacheException e) {
                logger.error("Problem truncating based on GeoRSS feed: " + e.getMessage());
            } catch (InterruptedException e) {
                logger.info("Task abruptly interrupted.");
                return;
            }
        }

        // If truncate was all that was needed, we can quit now
        if (pollDef.getOperation() == GWCTask.TYPE.TRUNCATE) {
            logger.info("Truncation succeeded, won't seed as stated by poll def: " + pollDef);
            return;
        }

        // ... else we seed
        mimeIter = mimeList.iterator();
        while (mimeIter.hasNext()) {
            DiscontinuousTileRange dtr = new DiscontinuousTileRange(layer.getName(), gridSetId,
                    gridSub.getZoomStart(), gridSub.getZoomStop(), rasterMask, mimeIter.next(),
                    (Map<String, String>) null);

            final int seedingThreads = pollDef.getSeedingThreads();
            GWCTask[] tasks;
            try {
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

        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");
        }
        long[] gridExtent = gridSubset.getGridSetExtent((int) z);
        long y = gridExtent[1] - 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 = gridExtent[1] - gridCov[3] - 1;
            long maxRow = gridExtent[1] - 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

Examples of org.geowebcache.grid.GridSubset

        for (TileSet tileSet : onDiskTileSets) {
            final String gridSetId = tileSet.getGridsetId();
            // final String blobFormat = tileSet.getBlobFormat();
            final Long parametersId = tileSet.getParametersId();
            final GridSubset gs = tileLayer.getGridSubset(gridSetId);
            final int zoomStart = gs.getZoomStart();
            final int zoomStop = gs.getZoomStop();

            for (int zoomLevel = zoomStart; zoomLevel <= zoomStop; zoomLevel++) {
                String gridsetZLevelParamsDirName;
                gridsetZLevelParamsDirName = FilePathGenerator.gridsetZoomLevelDir(gridSetId,
                        zoomLevel);
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

        pyramid = new PagePyramid(coverages, 0, 3);

    }

    public void testCalculatePageInfo() {
        GridSubset gridSubSet = GridSubsetFactory.createGridSubSet(world_EPSG3857);
        long[][] gridSubsetCoverages = gridSubSet.getCoverages();
        int zoomStart = gridSubSet.getZoomStart();
        int zoomStop = gridSubSet.getZoomStop();
        PagePyramid pp = new PagePyramid(gridSubsetCoverages, zoomStart, zoomStop);

        printPyramid(zoomStart, zoomStop, pp);
    }
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

        // str.append("    <ResourceURL format=\"image/png\" resourceType=\"tile\" template=\"http://www.maps.cat/wmts/BlueMarbleNextGeneration/default/BigWorldPixel/{TileMatrix}/{TileRow}/{TileCol}.png\"/>\n");
        str.append("  </Layer>\n");
    }
    
    private void layerWGS84BoundingBox(StringBuilder str, TileLayer layer) {
        GridSubset subset = layer.getGridSubsetForSRS(SRS.getEPSG4326());
        if(subset != null) {
            double[] coords = subset.getOriginalExtent().getCoords();
            str.append("    <ows:WGS84BoundingBox>\n");
            str.append("      <ows:LowerCorner>"+coords[0]+" "+coords[1]+"</ows:LowerCorner>\n");
            str.append("      <ows:UpperCorner>"+coords[2]+" "+coords[3]+"</ows:UpperCorner>\n");
            str.append("    </ows:WGS84BoundingBox>\n");  
        }
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

     
     private void layerGridSubSets(StringBuilder str, TileLayer layer) {
         Iterator<GridSubset> gridSubsets = layer.getGridSubsets().values().iterator();
        
         while(gridSubsets.hasNext()) {
             GridSubset gridSubset = gridSubsets.next();
        
             str.append("    <TileMatrixSetLink>");
             str.append("      <TileMatrixSet>" + gridSubset.getName() + "</TileMatrixSet>\n");
            
             if (! gridSubset.fullGridSetCoverage()) {
                String[] levelNames = gridSubset.getGridNames();
                long[][] wmtsLimits = gridSubset.getWMTSCoverages();

                str.append("      <TileMatrixSetLimits>\n");
                for (int i = 0; i < levelNames.length; i++) {
                    str.append("        <TileMatrixLimits>\n");
                    str.append("          <TileMatrix>" + levelNames[i] + "</TileMatrix>\n");
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

            String layerNameAndSRS = params[2];
            String layerAtSRS = ServletUtils.URLDecode(layerNameAndSRS, conv.servletReq.getCharacterEncoding());
            String[] layerSRSFormatExtension = layerAtSRS.split("@");
           
            TileLayer tl = tld.getTileLayer(layerSRSFormatExtension[0]);
            GridSubset gridSub = tl.getGridSubset(layerSRSFormatExtension[1]);
            MimeType mimeType =  MimeType.createFromExtension(layerSRSFormatExtension[2]);
            ret = tdf.getTileMapDoc(tl, gridSub, gsb, mimeType);
        }
       
        byte[] data = ret.getBytes();
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

            tileLayer = tld.getTileLayer(layerName);
        } catch (GeoWebCacheException e) {
            throw new IllegalArgumentException(e);
        }

        final GridSubset gridSubset = tileLayer.getGridSubset(tileSet.getGridsetId());
        return newPagePyramid(gridSubset);
    }
View Full Code Here

Examples of org.geowebcache.grid.GridSubset

                latToSphericalMercatorY(minY), longToSphericalMercatorX(maxX),
                latToSphericalMercatorY(maxY));

        Hashtable<String, GridSubset> grids = new Hashtable<String, GridSubset>(2);

        GridSubset gridSubset4326 = GridSubsetFactory.createGridSubSet(
                gridSetBroker.WORLD_EPSG4326, bounds4326, 0, 25);

        grids.put(gridSetBroker.WORLD_EPSG4326.getName(), gridSubset4326);

        GridSubset gridSubset900913 = GridSubsetFactory.createGridSubSet(
                gridSetBroker.WORLD_EPSG3857, bounds900913, 0, 25);

        grids.put(gridSetBroker.WORLD_EPSG3857.getName(), gridSubset900913);

        return grids;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.