Package org.vfny.geoserver.wms

Examples of org.vfny.geoserver.wms.WMSMapContext


        Style style = mockData.getDefaultStyle().getStyle();
        MapLayer mapLayer = new DefaultMapLayer(features, style);
        mapLayer.setTitle("TestPointsTitle");

        WMSMapContext mapContext = new WMSMapContext();
        GetMapRequest request = mockData.createRequest();
        request.setLayers(new MapLayerInfo[] { layer });

        request.setMaxFeatures(2);
        request.setStartIndex(2);
        request.setFormatOptions(Collections.singletonMap("relLinks", "true"));
        MockHttpServletRequest httpreq = (MockHttpServletRequest) request.getHttpServletRequest();
        httpreq.setRequestURL("baseurl");
        mapContext.setRequest(request);

        KMLVectorTransformer transformer = new KMLVectorTransformer(mapContext, mapLayer);
        transformer.setStandAlone(false);
        transformer.setIndentation(2);
View Full Code Here


    public static Test suite() {
        return new OneTimeTestSetup(new RSSGeoRSSTransformerTest());
    }

    public void testLatLongInternal() throws Exception {
        WMSMapContext map = new WMSMapContext(createGetMapRequest(MockData.BASIC_POLYGONS));
        map.addLayer(createMapLayer(MockData.BASIC_POLYGONS));

        Document document = getRSSResponse(map, AtomGeoRSSTransformer.GeometryEncoding.LATLONG);

        Element element = document.getDocumentElement();
        assertEquals("rss", element.getNodeName());
View Full Code Here

            assertEquals(1, item.getElementsByTagName("geo:long").getLength());
        }
    }
   
    public void testSimpleInternal() throws Exception {
        WMSMapContext map = new WMSMapContext(createGetMapRequest(MockData.BASIC_POLYGONS));
        map.addLayer(createMapLayer(MockData.BASIC_POLYGONS));

        Document document = getRSSResponse(map, GeoRSSTransformerBase.GeometryEncoding.SIMPLE);
        print(document);

        Element element = document.getDocumentElement();
View Full Code Here

        }
    }

    public void testFilter() throws Exception {
        // Set up a map context with a filtered layer
        WMSMapContext map = new WMSMapContext(createGetMapRequest(MockData.BUILDINGS));
        MapLayer layer = createMapLayer(MockData.BUILDINGS);
        Filter f = ff.equals(ff.property("ADDRESS"), ff.literal("215 Main Street"));
        layer.setQuery(new DefaultQuery(MockData.BUILDINGS.getLocalPart(), f));
        map.addLayer(layer);
       
        Document document = getRSSResponse(map, AtomGeoRSSTransformer.GeometryEncoding.LATLONG);
        NodeList items = document.getDocumentElement().getElementsByTagName("item");
        assertEquals(1, items.getLength());
    }
View Full Code Here

        assertEquals(1, items.getLength());
    }
   
    public void testReproject() throws Exception {
        // Set up a map context with a projected layer
        WMSMapContext map = new WMSMapContext(createGetMapRequest(MockData.LINES));
        map.addLayer(createMapLayer(MockData.LINES));
       
        Document document = getRSSResponse(map, AtomGeoRSSTransformer.GeometryEncoding.LATLONG);
        NodeList items = document.getDocumentElement().getElementsByTagName("item");
       
        // check all items are there
View Full Code Here

    }

    protected void oneTimeSetUp() throws Exception {
        super.oneTimeSetUp();

        map = new WMSMapContext(createGetMapRequest(MockData.BASIC_POLYGONS));
        map.addLayer(createMapLayer(MockData.BASIC_POLYGONS));
    }
View Full Code Here

    protected void setUpInternal() throws Exception {
        super.setUpInternal();

        mapLayer = createMapLayer(DISPERSED_FEATURES);
       
        mapContext = new WMSMapContext(createGetMapRequest(MockData.BASIC_POLYGONS));
        mapContext.addLayer(mapLayer);
    }
View Full Code Here

    // write the images
    for (int i = 0; i < mapContext.getLayerCount(); i++) {
      MapLayer mapLayer = mapContext.getLayer(i);

      // create a context for this single layer
      WMSMapContext mapContext = new WMSMapContext();
      mapContext.addLayer(mapLayer);
      mapContext.setRequest(this.mapContext.getRequest());
      mapContext.setMapHeight(this.mapContext.getMapHeight());
      mapContext.setMapWidth(this.mapContext.getMapWidth());
      mapContext.setAreaOfInterest(this.mapContext.getAreaOfInterest());
      mapContext.setBgColor(this.mapContext.getBgColor());
      mapContext.setBuffer(this.mapContext.getBuffer());
      mapContext.setContactInformation(this.mapContext
          .getContactInformation());
      mapContext.setKeywords(this.mapContext.getKeywords());
      mapContext.setAbstract(this.mapContext.getAbstract());
      mapContext.setTransparent(true);

      // render the map
      mapProducer.setMapContext(mapContext);
      mapProducer.produceMap();
View Full Code Here

     * @throws IOException if encoding to <code>outStream</code> fails.
     */
    protected void formatImageOutputStream(String format, BufferedImage image,
        OutputStream outStream) throws WmsException, IOException {

      WMSMapContext mapCtx = getMapContext();

        if (mapCtx.isTransparent())
        {
            //GIFOutputStream.writeGIF(outStream, image,GIFOutputStream.STANDARD_256_COLORS, mapCtx.getBgColor());
              //DJB: note I had to make colorTable in the encoder source public to do this!
              //DJB: to add a function "return colorTable.ciLookup.getPaletteIndex(rgb);" to Gif89Encoder
         
          Gif89Encoder gifenc = new Gif89Encoder(image,mapCtx.getBgColor(),2 ); // 2= colour reduction pixel sample factor (1=look at all pixels, but its slow)
            gifenc.setComments("produced by Geoserver");
           
            gifenc.getFrameAt(0).setInterlaced(false);
            gifenc.encode(outStream);
        }
View Full Code Here

        MapContext map = renderer.getContext();
        double width = -1;
        double height = -1;
       
        if (map instanceof WMSMapContext) {
          WMSMapContext wmsMap = (WMSMapContext)map;
          width = wmsMap.getMapWidth();
          height = wmsMap.getMapHeight();
        }
        else {
          //guess a width and height based on the envelope
          Envelope area = map.getAreaOfInterest();
          if (area.getHeight() > 0 && area.getWidth() > 0) {
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.wms.WMSMapContext

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.