Package org.geoserver.wms

Examples of org.geoserver.wms.WMSMapContent


        final FeatureSource<SimpleFeatureType,SimpleFeature> fs = testDS.getFeatureSource("BuildingCenters");
        final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(),WGS84);

        LOGGER.info("about to create map ctx for BuildingCenters with bounds " + env);

        final WMSMapContent map = new WMSMapContent();
        map.getViewport().setBounds(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);
       
        map.setTransparent(false);
               
        Style basicStyle = getTestStyle("BuildingCenters3.sld");
        map.addLayer(new FeatureLayer(fs, basicStyle));
        EncodeHTMLImageMap result = mapProducer.produceMap(map);
       
        assertTestResult("BuildingCenters3", result);

  }
View Full Code Here


        tmp.expandBy(5, 5);
        final ReferencedEnvelope env = new ReferencedEnvelope(tmp,WGS84);
       
        LOGGER.info("about to create map ctx for BuildingCenters with bounds " + env);

        final WMSMapContent map = new WMSMapContent();
        map.getViewport().setBounds(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);
       
        map.setTransparent(false);
               
        Style basicStyle = getTestStyle("BuildingCenters3.sld");
        map.addLayer(new FeatureLayer(fs, basicStyle));
        EncodeHTMLImageMap result = mapProducer.produceMap(map);
       
        assertTestResult("BuildingCenters4", result);

  }
View Full Code Here

                .getFeatureSource("BuildingCentersMultiPoint");
        final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(), WGS84);

        LOGGER.info("about to create map ctx for BuildingCentersMultiPoint with bounds " + env);

        final WMSMapContent map = new WMSMapContent();
        map.getViewport().setBounds(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);

        map.setTransparent(false);

        Style basicStyle = getTestStyle("BuildingCenters.sld");
        map.addLayer(new FeatureLayer(fs, basicStyle));

        EncodeHTMLImageMap result = mapProducer.produceMap(map);
        assertTestResult("BuildingCentersMultiPoint", result);

    }
View Full Code Here

                .getFeatureSource("CollectionSample");
        final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(), WGS84);

        LOGGER.info("about to create map ctx for RoadSegments with bounds " + env);

        final WMSMapContent map = new WMSMapContent();
        map.getViewport().setBounds(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);

        map.setTransparent(false);

        Style basicStyle = getTestStyle("CollectionSample.sld");
        map.addLayer(new FeatureLayer(fs, basicStyle));

        EncodeHTMLImageMap result = mapProducer.produceMap(map);
        assertTestResult("CollectionSample", result);

    }
View Full Code Here

                .getFeatureSource("NoCoords");
        final ReferencedEnvelope env = new ReferencedEnvelope(2.0, 6.0, 2.0, 6.0, WGS84);

        LOGGER.info("about to create map ctx for NamedPlaces with bounds " + env);

        final WMSMapContent map = new WMSMapContent();
        map.getViewport().setBounds(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);

        map.setTransparent(false);

        Style basicStyle = getTestStyle("NamedPlaces.sld");
        map.addLayer(new FeatureLayer(fs, basicStyle));

        EncodeHTMLImageMap result = mapProducer.produceMap(map);
        assertTestResult("NoCoords", result);
    }
View Full Code Here

                .getFeatureSource(s);
        ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(), WGS84);
        LOGGER.info("about to create map ctx for BuildingCenters with bounds "
                + env);
   
        WMSMapContent map = new WMSMapContent();
        map.getViewport().setBounds(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);
        map.setTransparent(false);
        Style basicStyle = getTestStyle(String.format("%s.sld", s));
        map.addLayer(new FeatureLayer(fs, basicStyle));
   
        EncodeHTMLImageMap result = mapProducer.produceMap(map);
        assertTestResult(s, result);
    }
View Full Code Here



    @Override
    void encodeDocumentContents(Document container) {
        WMSMapContent mapContent = context.getMapContent();
        GetMapRequest request = context.getRequest();
        Map formatOptions = request.getFormatOptions();
        LookAtDecoratorFactory lookAtFactory = new LookAtDecoratorFactory();
        LookAtOptions lookAtOptions = new LookAtOptions(formatOptions);

        // compute the layer bounds and the total bounds
        List<ReferencedEnvelope> layerBounds = new ArrayList<ReferencedEnvelope>(mapContent
                .layers().size());
        ReferencedEnvelope aggregatedBounds = computePerLayerQueryBounds(mapContent, layerBounds,
                null);
        if (aggregatedBounds != null) {
            LookAt la = lookAtFactory.buildLookAt(aggregatedBounds, lookAtOptions, false);
View Full Code Here

    public void testExternalImageSize() throws Exception {
        GetMapRequest req = createGetMapRequest(MockData.STREAMS);
        req.setWidth(256);
        req.setHeight(256);

        WMSMapContent mapContent = new WMSMapContent(req);
        mapContent.addLayer(createMapLayer(MockData.STREAMS, "big-local-image"));
       
        mapContent.getViewport().setBounds(new ReferencedEnvelope(-180, 0, -90, 90,
                DefaultGeographicCRS.WGS84));
        mapContent.setMapHeight(256);
        mapContent.setMapWidth(256);

        KMLMapOutputFormat of = new KMLMapOutputFormat(getWMS());
        KMLMap map = of.produceMap(mapContent);

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
View Full Code Here

    }

    @Test
    public void testKmzEmbededPointImageSize() throws Exception {
       
        WMSMapContent mapContent = createMapContext(MockData.POINTS, "big-mark");
       
        File temp = File.createTempFile("test", "kmz", new File("target"));
        temp.delete();
        temp.mkdir();
        temp.deleteOnExit();
View Full Code Here

    }
   
    WMSMapContent createMapContext(QName layer, String style) throws Exception {

        // create a map context
        WMSMapContent mapContent = new WMSMapContent();
        mapContent.addLayer(createMapLayer(layer, style));
        mapContent.setMapHeight(256);
        mapContent.setMapWidth(256);

        GetMapRequest getMapRequest = createGetMapRequest(new QName[]{layer});
        getMapRequest.setWidth(256);
        getMapRequest.setHeight(256);
       
        mapContent.setRequest(getMapRequest);
        mapContent.getViewport().setBounds(
            new ReferencedEnvelope(-180,180,-90,90, DefaultGeographicCRS.WGS84));
        return mapContent;
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wms.WMSMapContent

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.