Examples of WMSMapContext


Examples of org.geoserver.wms.WMSMapContext

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

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

        final WMSMapContext map = new WMSMapContext();
        map.setAreaOfInterest(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);

        map.setTransparent(false);

        Style basicStyle = getTestStyle("BuildingCenters2.sld");
        map.addLayer(fs, basicStyle);

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

    }
View Full Code Here

Examples of org.geoserver.wms.WMSMapContext

        final RenderedImageMap imageMap = (RenderedImageMap) value;
        try {
            final RenderedImage image = imageMap.getImage();
            final List<GridCoverage2D> renderedCoverages = imageMap.getRenderedCoverages();
            final WMSMapContext mapContext = imageMap.getMapContext();
            try {
                formatImageOutputStream(image, output, mapContext);
                output.flush();
            } finally {
                // let go of the coverages created for rendering
View Full Code Here

Examples of org.geoserver.wms.WMSMapContext

            this.wms = wms;
            nsSupport.declarePrefix("georss","http://www.georss.org/georss");
        }

        public void encode(Object o) throws IllegalArgumentException {
            WMSMapContext map = (WMSMapContext) o;

            start("feed");

            //title
            element("title", AtomUtils.getFeedTitle(map));
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

                            "xmlns", "http://www.opengis.net/kml/2.2",
                            "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance",
                            "xsi:schemaLocation", "http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd"
                    }));
           
            WMSMapContext mapContext = (WMSMapContext) o;
            GetMapRequest request = mapContext.getRequest();
            MapLayer[] layers = mapContext.getLayers();
           
            //calculate scale denominator
            scaleDenominator = 1;
            try {
               scaleDenominator =
                       RendererUtilities.calculateScale(mapContext.getAreaOfInterest(), mapContext.getMapWidth(), mapContext.getMapHeight(), null);
            }
            catch( Exception e ) {
               LOGGER.log(Level.WARNING, "Error calculating scale denominator", e);
            }
            LOGGER.log(Level.FINE, "scale denominator = " + scaleDenominator);

            //if we have more than one layer ( or a legend was requested ),
            //use the name "GeoServer" to group them
            boolean group = (layers.length > 1) || request.getLegend();

            if (group) {
                StringBuffer sb = new StringBuffer();
                for ( int i = 0; i < layers.length; i++ ) {
                    sb.append( layers[i].getTitle() + "," );
                }
                sb.setLength(sb.length()-1);
              
                start("Document");
                element("name", sb.toString() );
            }

            //for every layer specified in the request
            for (int i = 0; i < layers.length; i++) {
                //layer and info
                MapLayer layer = layers[i];
                MapLayerInfo layerInfo = mapContext.getRequest().getLayers()[i];

                //was a super overlay requested?
                Boolean superoverlay = (Boolean)mapContext.getRequest().getFormatOptions().get("superoverlay");
                superoverlay = (superoverlay == null ? Boolean.FALSE : superoverlay);
                if (superoverlay) {
                    //encode as super overlay
                    encodeSuperOverlayLayer(mapContext, layer);
                } else {
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

      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

Examples of org.vfny.geoserver.wms.WMSMapContext

            nsSupport.declarePrefix("georss", "http://www.georss.org/georss");
            nsSupport.declarePrefix("atom", "http://www.w3.org/2005/Atom");
        }

        public void encode(Object o) throws IllegalArgumentException {
            WMSMapContext map = (WMSMapContext) o;

            AttributesImpl atts = new AttributesImpl();
            atts.addAttribute(null, "version", "version", null, "2.0");

            start("rss", atts);
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

        final String outputFormat = request.getFormat();

        this.delegate = getDelegate(outputFormat);
        // JD:make instance variable in order to release resources later
        // final WMSMapContext map = new WMSMapContext();
        map = new WMSMapContext(request);
        this.delegate.setMapContext(map);

        final Envelope env = request.getBbox();

        // enable on the fly meta tiling if request looks like a tiled one
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

    ShapefileDataStore ds=new ShapefileDataStore(shapeFile.toURL());
   
    final FeatureSource<SimpleFeatureType,SimpleFeature> fs = ds.getFeatureSource("states");
    final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(),WGS84);
   
    final WMSMapContext map = new WMSMapContext();
        map.setAreaOfInterest(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);
        map.setTransparent(false);

        Style basicStyle = getTestStyle("Population.sld");
        map.addLayer(fs, basicStyle);

        this.mapProducer.setOutputFormat("text/html");
        this.mapProducer.setMapContext(map);
        this.mapProducer.produceMap();
        assertTestResult("States", this.mapProducer);
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

        final FeatureSource<SimpleFeatureType,SimpleFeature> fs = testDS.getFeatureSource("BasicPolygons");
        final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(),WGS84);
       
        LOGGER.info("about to create map ctx for BasicPolygons with bounds " + env);

        final WMSMapContext map = new WMSMapContext();
        map.setAreaOfInterest(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);
        map.setTransparent(false);

        Style basicStyle = getTestStyle("default.sld");
        map.addLayer(fs, basicStyle);

        this.mapProducer.setOutputFormat("text/html");
        this.mapProducer.setMapContext(map);
        this.mapProducer.produceMap();
        assertTestResult("BasicPolygons", this.mapProducer);
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

    final FeatureSource<SimpleFeatureType,SimpleFeature> fs = testDS.getFeatureSource("PolygonWithHoles");
        final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(),WGS84);
       
        LOGGER.info("about to create map ctx for BasicPolygons with bounds " + env);

        final WMSMapContext map = new WMSMapContext();
        map.setAreaOfInterest(env);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);
        map.setTransparent(false);

        Style basicStyle = getTestStyle("default.sld");
        map.addLayer(fs, basicStyle);

        this.mapProducer.setOutputFormat("text/html");
        this.mapProducer.setMapContext(map);
        this.mapProducer.produceMap();
        assertTestResult("PolygonWithHoles", this.mapProducer);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.