Package org.geowebcache.grid

Examples of org.geowebcache.grid.BoundingBox


        }
        /*
         * Get the best fit for the level
         */
        final long[] coverage = getGridCoverage(level);
        final BoundingBox coverageBounds = gridSubset.boundsFromRectangle(coverage);
        final MathTransform worldToGrid = getWorldToGridTransform(coverageBounds, coverage);

        BoundingBox expandedBounds;
        try {
            Envelope coveredLevelEnvelope;
            coveredLevelEnvelope = JTS.transform(aggregatedGeomBounds, worldToGrid);
            Geometry bufferedEnvelopeInGridCrs;
            bufferedEnvelopeInGridCrs = JTS.toGeometry(coveredLevelEnvelope).buffer(
                    ENVELOPE_BUFFER_RATIO);
            coveredLevelEnvelope = bufferedEnvelopeInGridCrs.getEnvelopeInternal();
            MathTransform gridToWorld = worldToGrid.inverse();
            Envelope bufferedEnvelope = JTS.transform(coveredLevelEnvelope, gridToWorld);
            expandedBounds = new BoundingBox(bufferedEnvelope.getMinX(),
                    bufferedEnvelope.getMinY(), bufferedEnvelope.getMaxX(),
                    bufferedEnvelope.getMaxY());
        } catch (TransformException e) {
            throw new RuntimeException(e);
        }
View Full Code Here


                    + ", must be between 0 and " + gridSet.getTileWidth());
        }

        Resource data = null;
        try {
            BoundingBox bbox = convTile.getGridSubset().boundsFromIndex(convTile.getTileIndex());
            data = layer.getFeatureInfo(convTile, bbox, convTile.getGridSubset().getTileHeight(),
                    convTile.getGridSubset().getTileWidth(), i, j);
        } catch (GeoWebCacheException e) {
            throw new OWSException(500, "NoApplicableCode", "", e.getMessage());
        }
View Full Code Here

    private long[][] fullCoverage;

    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();
    }
View Full Code Here

   
    public void testTileFuserResolution() throws Exception {
        TileLayer layer = createWMSLayer();
       
        // request fits inside -30.0,15.0,45.0,30
        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
        height = (int) bounds.getWidth() / 10;
        width = (int) bounds.getWidth() / 10;
        tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
        tileFuser.determineSourceResolution();
        assertEquals(0,tileFuser.srcIdx);
       
        // Zoomed too far in
        height = (int) bounds.getWidth() * 10000;
        width = (int) bounds.getWidth() * 10000;
        tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
        tileFuser.determineSourceResolution();
        assertEquals(10,tileFuser.srcIdx);
    }
View Full Code Here

   
    public void testTileFuserSubset() throws Exception {
        TileLayer layer = createWMSLayer();
       
        // request fits inside -30.0,15.0,45.0,30
        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();
       
View Full Code Here

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

    }

    public void testWriteResponse() throws Exception {
      final 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;
        layer.getGridSubset(layer.getGridSubsets().iterator().next());
        File temp = File.createTempFile("gwc", "wms");
        temp.delete();
        temp.mkdirs();
        try {
          TileLayerDispatcher dispatcher = new TileLayerDispatcher(gridSetBroker) {

        @Override
        public TileLayer getTileLayer(String layerName)
            throws GeoWebCacheException {
          return layer;
        }
           
          }
         
          MockHttpServletRequest request = new MockHttpServletRequest();
          request.setupAddParameter("layers", new String[] { "test:layer" });
          request.setupAddParameter("srs", new String[] { "EPSG:4326" });
          request.setupAddParameter("format", new String[] { "image/png8" });
          request.setupAddParameter("width", width +"");
          request.setupAddParameter("height", height +"");
          request.setupAddParameter("bbox", bounds.toString());
          final File imageTile = new File(getClass().getResource("/image.png").toURI());
         
          StorageBroker broker = new DefaultStorageBroker(
            new FileBlobStore(temp.getAbsolutePath()) {

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

        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 };

            BoundingBox bboxWest = new BoundingBox(bbox.getMinX(), bbox.getMinY(), 0.0,
                    bbox.getMaxY());
            BoundingBox bboxEast = new BoundingBox(0.0, bbox.getMinY(), bbox.getMaxX(),
                    bbox.getMaxY());

            networkLinks = superOverlayNetworLink(layer.getName() + " West", bboxWest,
                    tile.getUrlPrefix() + "/" + gridLocString(gridLocWest) + formatExtension)
                    + superOverlayNetworLink(layer.getName() + " East", bboxEast,
View Full Code Here

        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.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.