Package org.geoserver.wms

Examples of org.geoserver.wms.GetMapRequest$MandatoryParameters


                linkbase += ".kml";
            } catch (IOException ioe) {
                throw new RuntimeException(ioe);
            }

            GetMapRequest request = context.getRequest();
            int maxFeatures = request.getMaxFeatures();
            int startIndex = (request.getStartIndex() == null) ? 0 : request.getStartIndex().intValue();
            int prevStart = startIndex - maxFeatures;
            int nextStart = startIndex + maxFeatures;
           
            // Previous page, if any
            if (prevStart >= 0) {
View Full Code Here


     */
    public XMLTransformerMap produceMap(WMSMapContent mapContent) throws ServiceException,
            IOException {

        AtomGeoRSSTransformer tx = new AtomGeoRSSTransformer(wms);
        GetMapRequest request = mapContent.getRequest();

        String geometryEncoding = (String) request.getFormatOptions().get("encoding");
        if ("gml".equals(geometryEncoding)) {
            tx.setGeometryEncoding(GeoRSSTransformerBase.GeometryEncoding.GML);
        } else if ("latlong".equals(geometryEncoding)) {
            tx.setGeometryEncoding(GeoRSSTransformerBase.GeometryEncoding.LATLONG);
        } else {
View Full Code Here

   
        final Envelope env = fs.getBounds();
   
        LOGGER.info("about to create map ctx for BasicPolygons with bounds " + env);
   
        GetMapRequest request = createGetMapRequest(MockData.BASIC_POLYGONS);
        request.getRawKvp().put(
                "</script><script>alert('x-scripted');</script><script>", "foo");
        final WMSMapContent map = new WMSMapContent();
        map.getViewport().setBounds(
                new ReferencedEnvelope(env, DefaultGeographicCRS.WGS84));
        map.setMapWidth(300);
        map.setMapHeight(300);
        map.setBgColor(Color.red);
        map.setTransparent(false);
        map.setRequest(request);
   
        StyleInfo styleByName = catalog.getStyleByName("Default");
        Style basicStyle = styleByName.getStyle();
        FeatureLayer layer = new FeatureLayer(fs, basicStyle);
        layer.setTitle("Title");
        map.addLayer(layer);
        request.setFormat("application/openlayers");
        RawMap rawMap = this.mapProducer.produceMap(map);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        rawMap.writeTo(bos);
        String htmlDoc = new String(bos.toByteArray(), "UTF-8");
        // check that weird param is correctly encoded to avoid js code execution
View Full Code Here

        WMS wms = new WMS(getGeoServer());
        reader = new GetMapXmlReader(wms);
    }
   
    public void testCreateRequest() throws Exception {
        GetMapRequest request = (GetMapRequest) reader.createRequest();
        assertNotNull(request);
    }
View Full Code Here

        GetMapRequest request = (GetMapRequest) reader.createRequest();
        assertNotNull(request);
    }
   
    public void testResolveStylesForLayerGroup() throws Exception {
        GetMapRequest request = (GetMapRequest) reader.createRequest();
        BufferedReader input = getResourceInputStream("WMSPostLayerGroupNonDefaultStyle.xml");

        request = (GetMapRequest) reader.read(request, input, new HashMap());
       
        String layer = MockData.BASIC_POLYGONS.getLocalPart();
        assertEquals(1, request.getLayers().size());
        assertTrue(request.getLayers().get(0).getName().endsWith(layer));

        assertEquals(1, request.getStyles().size());
        Style expected = getCatalog().getStyleByName("polygon").getStyle();
        Style style = request.getStyles().get(0);
        assertEquals(expected, style);
    }
View Full Code Here

            getGeoServer().save(geoserverInfo);
        }
    }
   
    public void testCreateRequest() throws Exception {
        GetMapRequest request = (GetMapRequest) reader.createRequest();
        assertNotNull(request);
    }
View Full Code Here

        raw.put("bbox", "-10,-10,10,10");
        raw.put("height", "600");
        raw.put("width", "800");
        raw.put("request", "GetMap");

        GetMapRequest request = (GetMapRequest) reader.createRequest();
        request = (GetMapRequest) reader.read(request, parseKvp(raw), caseInsensitiveKvp(raw));

        String layer = MockData.BASIC_POLYGONS.getLocalPart();
        assertEquals(1, request.getLayers().size());
        assertTrue(request.getLayers().get(0).getName().endsWith(layer));

        assertEquals(1, request.getStyles().size());
        Style expected = getCatalog().getStyleByName(layer).getStyle();
        Style style = request.getStyles().get(0);
        assertEquals(expected, style);

        assertEquals("image/jpeg", request.getFormat());
        assertEquals(600, request.getHeight());
        assertEquals(800, request.getWidth());

        assertNotNull(request.getBbox());
        assertEquals(-10d, request.getBbox().getMinX(), 0);
        assertEquals(-10d, request.getBbox().getMinY(), 0);
        assertEquals(10d, request.getBbox().getMaxX(), 0);
        assertEquals(10d, request.getBbox().getMaxY(), 0);

        assertEquals("epsg:3003", request.getSRS());
    }
View Full Code Here

        kvp.put("buffer", "1");
        kvp.put("palette", "SAFE");
        kvp.put("time", "2006-02-27T22:08:12Z");
        kvp.put("elevation", "4");

        GetMapRequest request = (GetMapRequest) reader.createRequest();
        request = (GetMapRequest) reader.read(request, parseKvp(kvp), kvp);

        assertEquals(Color.BLACK, request.getBgColor());
        assertTrue(request.isTransparent());
        assertTrue(request.isTiled());

        assertEquals(new Point2D.Double(1.2, 3.4), request.getTilesOrigin());
        assertEquals(1, request.getBuffer());

        assertEquals(PaletteManager.safePalette, request.getPalette());
        assertEquals(Arrays.asList(4.0), request.getElevation());

        Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        cal.clear();
        cal.set(2006, 1, 27, 22, 8, 12);
        List<Object> times = request.getTime();
        assertEquals(1, request.getTime().size());
        assertEquals(cal.getTime(), ((DateRange)times.get(0)).getMinValue());
    }
View Full Code Here

import com.vividsolutions.jts.geom.Envelope;

public class DecorationTestSupport {

    protected WMSMapContent createMapContent(double dpi) {
        GetMapRequest request = new GetMapRequest();
        request.setWidth(1000);
        request.setHeight(1000);
        request.setRawKvp(new HashMap<String, String>());
   
        if (dpi > 0) {
            request.getFormatOptions().put("dpi", dpi);
        }
   
        WMSMapContent map = new WMSMapContent(request);
        map.setMapWidth(request.getWidth());
        map.setMapHeight(request.getHeight());
        map.getViewport().setBounds(
                new ReferencedEnvelope(new Envelope(0, 0.01, 0, 0.01),
                        DefaultGeographicCRS.WGS84));
        return map;
    }
View Full Code Here

        raw.put("srs", "epsg:3003");
        raw.put("bbox", "-10,-10,10,10");
        raw.put("height", "600");
        raw.put("width", "800");

        GetMapRequest request = (GetMapRequest) reader.createRequest();
        request = (GetMapRequest) reader.read(request, parseKvp(raw), caseInsensitiveKvp(raw));
        assertEquals(2, request.getStyles().size());
        LayerInfo basicPolygons = getCatalog().getLayerByName(
                MockData.BASIC_POLYGONS.getLocalPart());
        LayerInfo buildings = getCatalog().getLayerByName(MockData.BUILDINGS.getLocalPart());
        assertEquals(basicPolygons.getDefaultStyle().getStyle(), request.getStyles().get(0));
        assertEquals(buildings.getDefaultStyle().getStyle(), request.getStyles().get(1));
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wms.GetMapRequest$MandatoryParameters

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.