Examples of WMSMapContext


Examples of org.vfny.geoserver.wms.WMSMapContext

        env = new Envelope(env.getMinX() - shift, env.getMaxX() + shift, env.getMinY() - shift, env
                .getMaxY()
                + shift);

        final WMSMapContext map = new WMSMapContext();
        int w = 400;
        int h = (int) Math.round((env.getHeight() * w) / env.getWidth());
        map.setMapWidth(w);
        map.setMapHeight(h);
        map.setBgColor(BG_COLOR);
        map.setTransparent(true);
        map.setRequest(new GetMapRequest(getWMS()));

        addToMap(map, MockData.FORESTS);
        addToMap(map, MockData.LAKES);
        addToMap(map, MockData.STREAMS);
        addToMap(map, MockData.NAMED_PLACES);
        addToMap(map, MockData.ROAD_SEGMENTS);
        addToMap(map, MockData.PONDS);
        addToMap(map, MockData.BUILDINGS);
        addToMap(map, MockData.DIVIDED_ROUTES);
        addToMap(map, MockData.BRIDGES);
        addToMap(map, MockData.MAP_NEATLINE);

        map.setAreaOfInterest(new ReferencedEnvelope(env, DefaultGeographicCRS.WGS84));

        this.rasterMapProducer.setOutputFormat(getMapFormat());
        this.rasterMapProducer.setMapContext(map);
        this.rasterMapProducer.produceMap();

View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

        env = new Envelope(env.getMinX() - shift, env.getMaxX() + shift, env.getMinY() - shift, env
                .getMaxY()
                + shift);

        WMSMapContext map = new WMSMapContext();
        map.setRequest(new GetMapRequest(getWMS()));
        map.addLayer(fSource, style);
        map.setAreaOfInterest(new ReferencedEnvelope(env, DefaultGeographicCRS.WGS84));
        map.setMapWidth(w);
        map.setMapHeight(h);
        map.setBgColor(BG_COLOR);
        map.setTransparent(false);

        this.rasterMapProducer.setOutputFormat(getMapFormat());
        this.rasterMapProducer.setMapContext(map);
        this.rasterMapProducer.produceMap();
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

     * </p>
     */
    @SuppressWarnings("unchecked")
    private RenderedImage forceRenderingError(final Exception renderExceptionToThrow) throws Exception {

        final WMSMapContext map = new WMSMapContext();
        map.setMapWidth(100);
        map.setMapHeight(100);
        map.setRequest(new GetMapRequest(getWMS()));
        final ReferencedEnvelope bounds = new ReferencedEnvelope(-180, 180, -90, 90, DefaultGeographicCRS.WGS84);
        map.setAreaOfInterest(bounds);

        final FeatureTypeInfo ftInfo = getCatalog().getFeatureTypeByName(STREAMS.getNamespaceURI(), STREAMS.getLocalPart());

        final FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) ftInfo.getFeatureSource(null, null);
       
        DecoratingFeatureSource<SimpleFeatureType, SimpleFeature> source;
        // This source should make the renderer fail when asking for the features
        source = new DecoratingFeatureSource<SimpleFeatureType, SimpleFeature>(featureSource) {
            @Override
            public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatures(Query query)
                    throws IOException {
                throw new RuntimeException(renderExceptionToThrow);
                // return delegate.getFeatures(query);
            }
        };
       
        StyleInfo someStyle = getCatalog().getStyles().get(0);
        map.addLayer(source, someStyle.getStyle());
        this.rasterMapProducer.setOutputFormat(getMapFormat());
        this.rasterMapProducer.setMapContext(map);
        this.rasterMapProducer.produceMap();

        return this.rasterMapProducer.getImage();
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

        ds.createSchema(type);
        ds.addFeatures(new SimpleFeature[] { f1, f2, f3 });

        FeatureSource fs = ds.getFeatureSource("test");

        final WMSMapContext map = new WMSMapContext();
        map.setAreaOfInterest(new ReferencedEnvelope(-250, 250, -250, 250, null));
        map.setMapWidth(300);
        map.setMapHeight(300);
        map.setBgColor(Color.red);
        map.setTransparent(false);

        Style basicStyle = getCatalog().getStyleByName("Default").getStyle();
        map.addLayer(fs, basicStyle);

        SVGMapProducer producer = new SVGMapProducer(SvgMapProducerProxy.MIME_TYPE,
                SvgMapProducerProxy.OUTPUT_FORMATS);
        producer.setMapContext(map);
        producer.produceMap();
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

        Template template = cfg.getTemplate("OpenLayersMapTemplate.ftl");
        assertNotNull(template);

        GetMapRequest request = createGetMapRequest(MockData.BASIC_POLYGONS);
        WMSMapContext mapContext = new WMSMapContext();
        mapContext.addLayer(createMapLayer(MockData.BASIC_POLYGONS));
        mapContext.setRequest(request);
        mapContext.setMapWidth(256);
        mapContext.setMapHeight(256);

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        HashMap map = new HashMap();
        map.put("context", mapContext);
        map.put("request", mapContext.getRequest());
        map.put("maxResolution", new Double(0.0005)); // just a random number
        map.put("baseUrl", "http://localhost:8080/geoserver/wms");
        map.put("parameters", new ArrayList());
        map.put("layerName", "layer");
        map.put("units", "degrees");
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

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

    // create a map context
    WMSMapContext mapContext = new WMSMapContext();
    mapContext.addLayer(createMapLayer(MockData.BASIC_POLYGONS));
    mapContext.addLayer(createMapLayer(MockData.BUILDINGS));
    mapContext.setMapHeight(256);
    mapContext.setMapWidth(256);

    GetMapRequest getMapRequest = createGetMapRequest(new QName[] {
        MockData.BASIC_POLYGONS, MockData.BUILDINGS });
    mapContext.setRequest(getMapRequest);

    // create hte map producer
    mapProducer = new KMZMapProducer(getWMS());
    mapProducer.setMapContext(mapContext);
    mapProducer.produceMap();
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

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

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

Examples of org.vfny.geoserver.wms.WMSMapContext

   
    @SuppressWarnings("unchecked")
    public void testExternalGraphicBackround() throws Exception {
        // see http://jira.codehaus.org/browse/GEOS-1947
        MapLayer mapLayer = createMapLayer( MockData.POINTS,  "Bridge");
        WMSMapContext mapContext = new WMSMapContext(createGetMapRequest(MockData.POINTS));
        mapContext.addLayer(mapLayer);
        KMLVectorTransformer transformer = new KMLVectorTransformer(mapContext, mapLayer);
        transformer.setIndentation(2);

        FeatureSource <SimpleFeatureType, SimpleFeature> featureSource;
        featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) mapLayer.getFeatureSource();
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

   
    @SuppressWarnings("unchecked")
    public void testFilteredData() throws Exception {
        MapLayer mapLayer = createMapLayer( MockData.BASIC_POLYGONS,  "SingleFeature");
       
        WMSMapContext mapContext = new WMSMapContext(createGetMapRequest(MockData.BASIC_POLYGONS));
        mapContext.addLayer(mapLayer);
       
        KMLVectorTransformer transformer = new KMLVectorTransformer(mapContext, mapLayer);
        transformer.setIndentation(2);

        FeatureSource <SimpleFeatureType, SimpleFeature> featureSource;
View Full Code Here

Examples of org.vfny.geoserver.wms.WMSMapContext

        HashMap formatOptions = new HashMap();
        formatOptions.put("kmplacemark", new Boolean(doPlacemarks));
        formatOptions.put("kmscore", new Integer(0));
        getMapRequest.setFormatOptions(formatOptions);

        WMSMapContext mapContext = new WMSMapContext(getMapRequest);
        mapContext.addLayer(mapLayer);
        mapContext.setMapHeight(1024);
        mapContext.setMapWidth(1024);

        // create the map producer
        KMZMapProducer mapProducer = new KMZMapProducer(getWMS());
        mapProducer.setMapContext(mapContext);
        mapProducer.produceMap();
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.