Package org.geoserver.wms

Examples of org.geoserver.wms.WMSMapContext


        b = new SimpleFeatureBuilder(type2);
        b.add(wkt.read("LINESTRING(0 0, 1 1)"));
        b.add("one");
        features2.add(b.buildFeature("fid.1"));
       
        WMSMapContext context = new WMSMapContext();
        context.addLayer(new MapLayer(DataUtilities.source(features1), null));
        context.addLayer(new MapLayer(DataUtilities.source(features2), null));
        context.setMapWidth(500);
        context.setMapHeight(500);
        context.setAreaOfInterest(new ReferencedEnvelope(-180, 180, -90, 90, DefaultGeographicCRS.WGS84));
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        adapter.write(context, out);
       
        String result = "500;500\n" +
View Full Code Here


            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

        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);

        EncodeHTMLImageMap imageMap = this.mapProducer.produceMap(map);

        assertTestResult("States", imageMap);
    }
View Full Code Here

                .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);

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

    }
View Full Code Here

                .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);

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

                .getFeatureSource("PolygonWithSkippedHoles");
        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);

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

        final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(),
                CRS.decode("EPSG:3004"));

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

        final WMSMapContext map = new WMSMapContext();

        CoordinateReferenceSystem sourceCrs = CRS.decode("EPSG:3004");
        CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:3003");

        MathTransform transform = CRS.findMathTransform(sourceCrs, targetCrs, true);
        Envelope projEnv = JTS.transform(env, transform);
        ReferencedEnvelope refEnv = new ReferencedEnvelope(projEnv, targetCrs);

        map.setAreaOfInterest(refEnv);
        map.setMapWidth(mapWidth);
        map.setMapHeight(mapHeight);
        map.setBgColor(Color.red);
        map.setTransparent(false);

        map.setCoordinateReferenceSystem(targetCrs);
        Style basicStyle = getTestStyle("BasicPolygons.sld");

        map.addLayer(fs, basicStyle);

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

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

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

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

        map.setTransparent(false);

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

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

    }
View Full Code Here

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

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

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

        map.setTransparent(false);

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

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

    }
View Full Code Here

                .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("BuildingCenters.sld");
        map.addLayer(fs, basicStyle);

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

    }
View Full Code Here

TOP

Related Classes of org.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.