Package org.geowebcache.grid

Examples of org.geowebcache.grid.BoundingBox


        wmsParams.put("SRS", layer.backendSRSOverride(gridSubset.getSRS()));
        wmsParams.put("HEIGHT", String.valueOf(gridSubset.getTileHeight()));
        wmsParams.put("WIDTH", String.valueOf(gridSubset.getTileWidth()));
        // strBuilder.append("&TILED=").append(requestTiled);

        BoundingBox bbox = gridSubset.boundsFromIndex(tile.getTileIndex());

        wmsParams.put("BBOX", bbox.toString());

        Map<String, String> fullParameters = tile.getFullParameters();
        if (fullParameters.isEmpty()) {
            fullParameters = layer.getDefaultParameterFilters();
        }
View Full Code Here


        List<String> gridSetNames = Arrays.asList("GlobalCRS84Pixel", "GlobalCRS84Scale",
                "EPSG:4326");
        TileLayer tileLayer = mockTileLayer("mockLayer", gridSetNames);

        // make the request match a tile in the expected gridset
        BoundingBox bounds;
        bounds = tileLayer.getGridSubset(expectedGridset).boundsFromIndex(tileIndex);
        kvp.put("bbox", bounds.toString());

        HttpServletRequest req = mock(HttpServletRequest.class);
        HttpServletResponse resp = mock(HttpServletResponse.class);

        when(req.getCharacterEncoding()).thenReturn("UTF-8");
View Full Code Here

        try {
            cacheInfo = persister.load(reader);
        } finally {
            stream.close();
        }
        layerBounds = new BoundingBox(-10, -10, 100, 50);
        builder = new GridSetBuilder();
        gridset = builder.buildGridset("TestLayer", cacheInfo, layerBounds);
        assertNotNull(gridset);
    }
View Full Code Here

        assertNotNull(gridset);
    }

    public void testBounds() {
        assertTrue(gridset.isTopLeftAligned());
        BoundingBox bounds = gridset.getBounds();
        TileOrigin tileOrigin = cacheInfo.getTileCacheInfo().getTileOrigin();
        assertEquals(tileOrigin.getX(), bounds.getMinX());
        assertEquals(tileOrigin.getY(), bounds.getMaxY());
        assertTrue(bounds.contains(layerBounds));
    }
View Full Code Here

    /**
     * Copy constructor
     */
    public XMLGridSet(XMLGridSet orig) {
        setAlignTopLeft(orig.getAlignTopLeft());
        setExtent(orig.getExtent() == null ? null : new BoundingBox(orig.getExtent()));
        setResolutions(orig.getResolutions() == null ? null : orig.getResolutions().clone());
        setLevels(orig.getLevels());
        setScaleDenominators(orig.getScaleDenominators() == null ? null : orig
                .getScaleDenominators().clone());
        setMetersPerUnit(orig.getMetersPerUnit());
View Full Code Here

        GridSet gridSet;

        String name = getName();
        SRS srs = getSrs();
        BoundingBox extent = getExtent();
        Boolean alignTopLeft = getAlignTopLeft();
        double[] resolutions = getResolutions();
        double[] scaleDenominators = getScaleDenominators();
        Double metersPerUnit = getMetersPerUnit();
        Double pixelSize = getPixelSize();
View Full Code Here

        servletResp.setHeader("geowebcache-cache-result", String.valueOf(cacheResult));
        servletResp.setHeader("geowebcache-tile-index", Arrays.toString(tile.getTileIndex()));
        long[] tileIndex = tile.getTileIndex();
        TileLayer layer = tile.getLayer();
        GridSubset gridSubset = layer.getGridSubset(tile.getGridSetId());
        BoundingBox tileBounds = gridSubset.boundsFromIndex(tileIndex);
        servletResp.setHeader("geowebcache-tile-bounds", tileBounds.toString());
        servletResp.setHeader("geowebcache-gridset", gridSubset.getName());
        servletResp.setHeader("geowebcache-crs", gridSubset.getSRS().toString());

        final long tileTimeStamp = tile.getTSCreated();
        final String ifModSinceHeader = servletReq.getHeader("If-Modified-Since");
View Full Code Here

    /**
     * Copy constructor
     */
    public XMLGridSubset(XMLGridSubset sset) {
        setGridSetName(sset.getGridSetName());
        setExtent(sset.getExtent() == null ? null : new BoundingBox(sset.getExtent()));
        setZoomStart(sset.getZoomStart());
        setZoomStop(sset.getZoomStop());
        setMinCachedLevel(sset.getMinCachedLevel());
        setMaxCachedLevel(sset.getMaxCachedLevel());
    }
View Full Code Here

    /**
     * Builds an XMLGridSubset out of a {@link GridSubset}
     */
    public XMLGridSubset(GridSubset sset) {
        setGridSetName(sset.getName());
        setExtent(sset.getOriginalExtent() == null ? null : new BoundingBox(
                sset.getOriginalExtent()));
        setZoomStart(sset.getZoomStart());
        setZoomStop(sset.getZoomStop());
        setMinCachedLevel(sset.getMinCachedZoom());
        setMaxCachedLevel(sset.getMaxCachedZoom());
View Full Code Here

        final TileCacheInfo tileCacheInfo = info.getTileCacheInfo();
        final SpatialReference spatialReference = tileCacheInfo.getSpatialReference();

        final SRS srs;
        final BoundingBox gridSetExtent;

        final boolean alignTopLeft = true;
        final double[] resolutions;
        /*
         * let scale denoms be null so GridSetFactory computes them based on resolutions. The
         * resulting values will be pretty close to the ones defined in the ArcGIS tiling scheme
         */
        final double[] scaleDenominators = null;
        final Double metersPerUnit;
        final String[] scaleNames = null;
        final int tileWidth = tileCacheInfo.getTileCols();
        final int tileHeight = tileCacheInfo.getTileRows();
        final boolean yCoordinateFirst = false;
        final double pixelSize = 0.0254 / tileCacheInfo.getDPI();// see GridSubset.getDotsPerInch()
        {
            int epsgNumber = spatialReference.getWKID();
            if (0 == epsgNumber) {
            }
            srs = SRS.getSRS(epsgNumber);
        }
        {
            final List<LODInfo> lodInfos = tileCacheInfo.getLodInfos();
            double[][] resAndScales = getResolutions(lodInfos);

            resolutions = resAndScales[0];

            double[] scales = resAndScales[1];
            //TODO: check whether pixelSize computed above should be used instead
            metersPerUnit = (GridSetFactory.DEFAULT_PIXEL_SIZE_METER * scales[0]) / resolutions[0];
        }
        {
            // See "How to calculate the -x parameter used in the examples above" at
            // http://resources.arcgis.com/content/kbase?q=content/kbase&fa=articleShow&d=15558&print=true
            // double XOrigin = spatialReference.getXOrigin();
            // double YOrigin = spatialReference.getYOrigin();
            // XYScale = 40075017 / 360 = ~111319, where 40075017 is the circumference of the earth
            // at the ecuator and 360 the map units at the ecuator
            // final double xyScale = spatialReference.getXYScale();

            final TileOrigin tileOrigin = tileCacheInfo.getTileOrigin();// top left coordinate

            double xmin = tileOrigin.getX();
            double ymax = tileOrigin.getY();
            double ymin = layerBounds.getMinY();
            double xmax = layerBounds.getMaxX();

            // make it so the gridset height matches an integer number of tiles in order for
            // clients (OpenLayers) assuming the tile origin is the lower left corner instead of
            // the upper right to compute tile bounding boxes right
            final double resolution = resolutions[resolutions.length - 1];
            double width = resolution * tileWidth;
            double height = resolution * tileHeight;

            long numTilesWide = (long) Math.ceil((xmax - xmin) / width);
            long numTilesHigh = (long) Math.ceil((ymax - ymin) / height);

            xmax = xmin + (numTilesWide * width);
            ymin = ymax - (numTilesHigh * height);
            gridSetExtent = new BoundingBox(xmin, ymin, xmax, ymax);
        }

        String gridsetName = srs.toString() + "_" + layerName;
        GridSet layerGridset = GridSetFactory.createGridSet(gridsetName, srs, gridSetExtent,
                alignTopLeft, resolutions, scaleDenominators, metersPerUnit, pixelSize, scaleNames,
View Full Code Here

TOP

Related Classes of org.geowebcache.grid.BoundingBox

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.