Package org.geowebcache.grid

Examples of org.geowebcache.grid.BoundingBox


    public ConveyorTile doNonMetatilingRequest(ConveyorTile tile) throws GeoWebCacheException {
        return null;
    }

    public BoundingBox getBounds(SRS srs) {
        return new BoundingBox(-180.0, -90.0, 180.0, 90.0);
    }
View Full Code Here


    }

    public ConveyorTile getTile(ConveyorTile tile) throws GeoWebCacheException, IOException {
        long[] gridLoc = tile.getTileIndex();

        BoundingBox bbox = tile.getGridSubset().boundsFromIndex(gridLoc);

        String data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<kml xmlns=\"http://earth.google.com/kml/2.1\">\n" + "<Document>\n"
                // +"<!-- Name>DocumentName</Name --->"
                + "<Placemark id=\"PlaceMarkId\">\n"
                // +"<styleUrl>#square</styleUrl>\n"
                + "<name>"
                + gridLoc[0]
                + ","
                + gridLoc[1]
                + ","
                + gridLoc[2]
                + "</name>"
                + "<Style id=\"square\">\n"
                + "<PolyStyle><color>7fffffff</color><colorMode>random</colorMode>\n"
                + "</PolyStyle>\n"
                + "<IconStyle><Icon><href>http://icons.opengeo.org/dynamic/circle/aaffaa_aaffaa_2.png</href></Icon></IconStyle>\n"
                + "<LabelStyle id=\"name\"><color>ffffffff</color><colorMode>normal</colorMode><scale>1.0</scale></LabelStyle>\n"
                + "</Style>\n"
                + "<MultiGeometry>\n"
                + "<Point><coordinates>"
                + ((bbox.getMinX() + bbox.getMaxX()) / 2)
                + ","
                + ((bbox.getMinY() + bbox.getMaxY()) / 2)
                + ",0</coordinates></Point>\n"
                + "<Polygon><outerBoundaryIs><LinearRing>\n"
                + "<coordinates decimal=\".\" cs=\",\" ts=\" \">\n"
                + bbox.getMinX()
                + ","
                + bbox.getMinY()
                + " "
                + bbox.getMaxX()
                + ","
                + bbox.getMinY()
                + " "
                + bbox.getMaxX()
                + ","
                + bbox.getMaxY()
                + " "
                + bbox.getMinX()
                + ","
                + bbox.getMaxY()
                + "</coordinates>\n"
                + "</LinearRing></outerBoundaryIs></Polygon>\n"
                + "</MultiGeometry>\n"
                + "</Placemark>\n" + "</Document>\n" + "</kml>";
View Full Code Here

    }

    public BoundingBox getBboxForGridLoc(SRS srs, int[] gridLoc) {
        double tileWidth = 180.0 / Math.pow(2, gridLoc[2]);

        BoundingBox bbox = new BoundingBox(-180.0 + tileWidth * gridLoc[0], -90.0 + tileWidth
                * gridLoc[1], -180.0 + tileWidth * (gridLoc[0] + 1), -90.0 + tileWidth
                * (gridLoc[1] + 1));

        return bbox;
    }
View Full Code Here

       
        if(srcFormat == null){
            srcFormat = firstMt;
        }

        reqBounds = new BoundingBox(values.get("bbox"));

        reqWidth = Integer.valueOf(values.get("width"));

        reqHeight = Integer.valueOf(values.get("height"));
View Full Code Here

            throw new GeoWebCacheException("Unknown grid set " + gridSetId);
        }

        long[][] coveredGridLevels;

        BoundingBox bounds = req.getBounds();
        if (bounds == null) {
            coveredGridLevels = gridSubset.getCoverages();
        } else {
            coveredGridLevels = gridSubset.getCoverageIntersections(bounds);
        }
View Full Code Here

                throw new ServiceException("No SRS specified");
            }
            srs = SRS.getSRS(requestSrs);
        }

        final BoundingBox bbox;
        {
            String requestBbox = paramValues.get("bbox");
            try {
                bbox = new BoundingBox(requestBbox);
                if (bbox == null || !bbox.isSane()) {
                    throw new ServiceException("The bounding box parameter (" + requestBbox
                            + ") is missing or not sane");
                }
            } catch (NumberFormatException nfe) {
                throw new ServiceException("The bounding box parameter (" + requestBbox
                        + ") is invalid");
            }
        }

        final int tileWidth = Integer.parseInt(values.get("width"));
        final int tileHeight = Integer.parseInt(values.get("height"));

        final List<GridSubset> crsMatchingSubsets = tileLayer.getGridSubsetsForSRS(srs);
        if (crsMatchingSubsets.isEmpty()) {
            throw new ServiceException("Unable to match requested SRS " + srs
                    + " to those supported by layer");
        }

        long[] tileIndexTarget = new long[3];
        GridSubset gridSubset;
        {
            GridSubset bestMatch = findBestMatchingGrid(bbox, crsMatchingSubsets, tileWidth,
                    tileHeight, tileIndexTarget);
            if (bestMatch == null) {
                // proceed as it used to be
                gridSubset = crsMatchingSubsets.get(0);
                tileIndexTarget = null;
            } else {
                gridSubset = bestMatch;
            }
        }
       
        if (fullWMS) {
            // If we support full WMS we need to do a few tests to determine whether
            // this is a request that requires us to recombine tiles to respond.
            long[] tileIndex = null;
            if (tileIndexTarget == null) {
                try {
                    tileIndex = gridSubset.closestIndex(bbox);
                } catch (GridMismatchException gme) {
                    // Do nothing, the null is info enough
                }
            } else {
                tileIndex = tileIndexTarget;
            }

            if (tileIndex == null || gridSubset.getTileWidth() != tileWidth
                    || gridSubset.getTileHeight() != tileHeight
                    || !bbox.equals(gridSubset.boundsFromIndex(tileIndex), 0.02)) {
                log.debug("Recombinining tiles to respond to WMS request");
                ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
                tile.setHint("getmap");
                tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
                return tile;
View Full Code Here

                tile.servletReq.getParameterMap(), tile.servletReq.getCharacterEncoding(), keys);

        // TODO Arent we missing some format stuff here?
        GridSubset gridSubset = tl.getGridSubsetForSRS(SRS.getSRS(values.get("srs")));

        BoundingBox bbox = null;
        try {
            bbox = new BoundingBox(values.get("bbox"));
        } catch (NumberFormatException nfe) {
            log.debug(nfe.getMessage());
        }

        if (bbox == null || !bbox.isSane()) {
            throw new ServiceException("The bounding box parameter (" + values.get("srs")
                    + ") is missing or not sane");
        }

        // long[] tileIndex = gridSubset.closestIndex(bbox);
View Full Code Here

    @Override
    public void setUp() throws Exception {
        mimeType = MimeType.createFromFormat("image/png");
        parameters = null;
        gridSet = new GridSetBroker(true, false).WORLD_EPSG3857;
        BoundingBox extent = new BoundingBox(0, 0, 100, 100);
        boolean alignTopLeft = false;
        int levels = 12;
        Double metersPerUnit = Double.valueOf(1);
        double pixelSize = 1;
        int tileWidth = 100;
View Full Code Here

     * @param z
     * @return
     */
    protected Map<String, String> wmsParams(WMSLayer layer, GridSubset gridSubset, int z,
            int[] widthHeight) throws GeoWebCacheException {
        BoundingBox bbox = gridSubset.getCoverageBounds(z);

        Map<String, String> params = new HashMap<String, String>();
        params.put("SERVICE", "WMS");
        params.put("REQUEST", "GetMap");
        params.put("VERSION", "1.1.1");

        if (this.wmsLayers != null) {
            params.put("LAYERS", this.wmsLayers);
        } else {
            params.put("LAYERS", layer.getName());
        }

        if (this.wmsStyles == null) {
            params.put("STYLES", "");
        } else {
            params.put("STYLES", this.wmsStyles);
        }

        params.put("SRS", layer.backendSRSOverride(gridSubset.getSRS()));

        params.put("BBOX", bbox.toString());
        params.put("WIDTH", String.valueOf(widthHeight[0]));
        params.put("HEIGHT", String.valueOf(widthHeight[1]));
        params.put("FORMAT", ImageMime.tiff.getFormat());
        params.put("FORMAT_OPTIONS", "antialias:none");
        params.put("BGCOLOR", "0xFFFFFF");
View Full Code Here

    TileLayerRestlet tlr;

    protected void setUp() throws Exception {
        GridSetBroker gridSetBroker = new GridSetBroker(false, false);

        BoundingBox extent = new BoundingBox(0, 0, 10E6, 10E6);
        boolean alignTopLeft = false;
        int levels = 10;
        Double metersPerUnit = 1.0;
        double pixelSize = 0.0028;
        int tileWidth = 256;
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.