Package org.geowebcache.grid

Examples of org.geowebcache.grid.BoundingBox


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

        // make the request match a tile in the expected gridset
        BoundingBox bounds;
        bounds = tileLayer.getGridSubset(expectedGridset).boundsFromIndex(tileIndex);

        Envelope reqBbox = new Envelope(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(),
                bounds.getMaxY());
        request.setBbox(reqBbox);

        ArgumentCaptor<ConveyorTile> captor = ArgumentCaptor.forClass(ConveyorTile.class);
        StringBuilder errors = new StringBuilder();
View Full Code Here


        rawKvp.put("layers", tileLayer.getName());

        // tileLayer = mockTileLayer("mockLayer", ImmutableList.of("EPSG:900913", "EPSG:4326"));

        // make the request match a tile in the expected gridset
        BoundingBox bounds;
        bounds = tileLayer.getGridSubset("EPSG:900913").boundsFromIndex(new long[] { 0, 0, 1 });

        Envelope reqBbox = new Envelope(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(),
                bounds.getMaxY());
        request.setBbox(reqBbox);

        assertTrue(tileLayer.getInfo().cachedStyles().size() > 0);

        for (String style : tileLayer.getInfo().cachedStyles()) {
View Full Code Here

                // tl.isInitialized();
                foudAGF = true;
                GridSubset epsg4326 = tl.getGridSubset(gridSetBroker.WORLD_EPSG4326
                        .getName());
                assertTrue(epsg4326.getGridSetBounds().equals(
                        new BoundingBox(-180.0, -90.0, 180.0, 90.0)));
                String mime = tl.getMimeTypes().get(1).getMimeType();
                assertTrue(mime.startsWith("image/")
                        || mime.startsWith("application/vnd.google-earth.kml+xml"));
            }
        }
View Full Code Here

        resp.setEntity(doc.toString(), MediaType.TEXT_HTML);
    }

    private void handleDoSeedPost(Form form, TileLayer tl, Response resp) throws RestletException,
            GeoWebCacheException {
        BoundingBox bounds = null;

        if (form.getFirst("minX").getValue() != null) {
            bounds = new BoundingBox(parseDouble(form, "minX"), parseDouble(form, "minY"),
                    parseDouble(form, "maxX"), parseDouble(form, "maxY"));
        }

        String gridSetId = form.getFirst("gridSetId").getValue();
View Full Code Here

            boolean asPlugin) throws GeoWebCacheException {
        String layerName = layer.getName();

        GridSubset gridSubset = layer.getGridSubset(gridSetStr);

        BoundingBox bbox = gridSubset.getGridSetBounds();
        BoundingBox zoomBounds = gridSubset.getOriginalExtent();

        String res = "resolutions: " + Arrays.toString(gridSubset.getResolutions()) + ",\n";

        String units = "units: \"" + gridSubset.getGridSet().guessMapUnits() + "\",\n";

        String openLayersPath;
        if (asPlugin) {
            openLayersPath = "../../openlayers/OpenLayers.js";
        } else {
            openLayersPath = "../openlayers/OpenLayers.js";
        }

        String page = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n"
                + "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n" + "<title>"
                + layerName
                + " "
                + gridSubset.getName()
                + " "
                + formatStr
                + "</title>\n"
                + "<style type=\"text/css\">\n"
                + "body { font-family: sans-serif; font-weight: bold; font-size: .8em; }\n"
                + "body { border: 0px; margin: 0px; padding: 0px; }\n"
                + "#map { width: 85%; height: 85%; border: 0px; padding: 0px; }\n"
                + "</style>\n"

                + "<script src=\""
                + openLayersPath
                + "\"></script>    \n"
                + "<script type=\"text/javascript\">               \n"
                + "var map, demolayer;                               \n"
                + "  // sets the chosen modifiable parameter        \n"
                + "  function setParam(name, value){                \n"
                + "   str = \"demolayer.mergeNewParams({\" + name + \": '\" + value + \"'})\" \n"
                + "   // alert(str);                                   \n"
                + "   eval(str);                                    \n"
                + "  }                                              \n"

                + "OpenLayers.DOTS_PER_INCH = "
                + gridSubset.getDotsPerInch()
                + ";\n"
                + "OpenLayers.Util.onImageLoadErrorColor = 'transparent';\n"

                + "function init(){\n"
                + "var mapOptions = { \n"
                + res
                + "projection: new OpenLayers.Projection('"
                + gridSubset.getSRS().toString()
                + "'),\n"
                + "maxExtent: new OpenLayers.Bounds("
                + bbox.toString()
                + "),\n"
                + units
                + "controls: []\n"
                + "};\n"
                + "map = new OpenLayers.Map('map', mapOptions );\n"
                + "map.addControl(new OpenLayers.Control.PanZoomBar({\n"
                + "    position: new OpenLayers.Pixel(2, 15)\n"
                + "}));\n"
                + "map.addControl(new OpenLayers.Control.Navigation());\n"
                + "map.addControl(new OpenLayers.Control.Scale($('scale')));\n"
                + "map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));\n"
                + "demolayer = new OpenLayers.Layer.WMS(\n"
                + "\""
                + layerName
                + "\",\"../service/wms\",\n"
                + "{layers: '"
                + layerName
                + "', format: '"
                + formatStr
                + "' },\n"
                + "{ tileSize: new OpenLayers.Size("
                + gridSubset.getTileWidth() + "," + gridSubset.getTileHeight() + ")";

        /*
         * If the gridset has a top left tile origin, lets tell that to open layers. Otherwise it'll
         * calculate tile bounds based on the bbox bottom left corner, leading to misaligned
         * requests.
         */
        GridSet gridSet = gridSubset.getGridSet();
        if (gridSet.isTopLeftAligned()) {
            page += ",\n tileOrigin: new OpenLayers.LonLat(" + bbox.getMinX() + ", "
                    + bbox.getMaxY() + ")";
        }

        page += "});\n" + "map.addLayer(demolayer);\n" + "map.zoomToExtent(new OpenLayers.Bounds("
                + zoomBounds.toString()
                + "));\n"
                + "// The following is just for GetFeatureInfo, which is not cached. Most people do not need this \n"
                + "map.events.register('click', map, function (e) {\n"
                + "  document.getElementById('nodelist').innerHTML = \"Loading... please wait...\";\n"
                + "  var params = {\n" + "    REQUEST: \"GetFeatureInfo\",\n"
View Full Code Here

    public BoundingBox parseLayerBounds(final Reader layerBoundsFile) {

        EnvelopeN envN = (EnvelopeN) getConfiguredXStream().fromXML(layerBoundsFile);

        BoundingBox bbox = new BoundingBox(envN.getXmin(), envN.getYmin(), envN.getXmax(),
                envN.getYmax());

        return bbox;
    }
View Full Code Here

    private String gridsetId;

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

                double minX = layer.getLatLonBoundingBox().getMinX();
                double minY = layer.getLatLonBoundingBox().getMinY();
                double maxX = layer.getLatLonBoundingBox().getMaxX();
                double maxY = layer.getLatLonBoundingBox().getMaxY();

                BoundingBox bounds4326 = new BoundingBox(minX, minY, maxX, maxY);

                log.info("Found layer: " + layer.getName() + " with LatLon bbox "
                        + bounds4326.toString());

                BoundingBox bounds3785 = new BoundingBox(longToSphericalMercatorX(minX),
                        latToSphericalMercatorY(minY), longToSphericalMercatorX(maxX),
                        latToSphericalMercatorY(maxY));

                String[] wmsUrls = { wmsUrl };
View Full Code Here

    private Geometry transformToGridCrs(final Geometry geometryInLayerCrs, final int zoomLevel) {
        final MathTransform worldToGrid;
        if (transformCache[zoomLevel] == null) {
            final long[] coverage = getGridCoverage(zoomLevel);
            final BoundingBox coverageBounds = gridSubset.boundsFromRectangle(coverage);
            worldToGrid = getWorldToGridTransform(coverageBounds, coverage);
            transformCache[zoomLevel] = worldToGrid;
        } else {
            worldToGrid = transformCache[zoomLevel];
        }
View Full Code Here

                } else if (srs.getNumber() == 4326 || srs.getNumber() == 900913
                        || srs.getNumber() == 3857) {
                    log.debug("Skipping " + srs.toString() + " for " + name);
                } else {
                    String gridSetName = name + ":" + srs.toString();
                    BoundingBox extent = new BoundingBox(env.getMinX(), env.getMinY(),
                            env.getMaxX(), env.getMaxY());

                    GridSet gridSet = GridSetFactory.createGridSet(gridSetName, srs, extent, false,
                            25, null, GridSetFactory.DEFAULT_PIXEL_SIZE_METER, 256, 256, false);
                    grids.put(gridSetName, GridSubsetFactory.createGridSubSet(gridSet));
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.