Package org.geotools.map

Examples of org.geotools.map.MapContent


            if( query != null ){
                featureLayer.setQuery( query );
            }
            layers[0] = featureLayer;
        }
        map = new MapContent();
        map.getViewport().setCoordinateReferenceSystem(getContext().getCRS());
        map.layers().addAll( Arrays.asList(layers));
    }
View Full Code Here


            layerTransformer = new MapfishMapContext(bounds, mapSize, transformer.getRotation(), transformer.getDPI(),
                    transformer.getRequestorDPI(), transformer.isForceLongitudeFirst(), transformer.isDpiSensitiveStyle());
        }


        MapContent content = new MapContent();
        try {
            List<? extends Layer> layers = getLayers(clientHttpRequestFactory, layerTransformer, isFirstLayer);
            content.addLayers(layers);

            StreamingRenderer renderer = new StreamingRenderer();

            RenderingHints hints = new RenderingHints(Collections.<RenderingHints.Key, Object>emptyMap());
            hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
                    RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));
            hints.add(new RenderingHints(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON));
            hints.add(new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
                    RenderingHints.VALUE_COLOR_RENDER_QUALITY));
            hints.add(new RenderingHints(RenderingHints.KEY_DITHERING,
                    RenderingHints.VALUE_DITHER_ENABLE));
            hints.add(new RenderingHints(RenderingHints.KEY_FRACTIONALMETRICS,
                    RenderingHints.VALUE_FRACTIONALMETRICS_ON));
            hints.add(new RenderingHints(RenderingHints.KEY_INTERPOLATION,
                    RenderingHints.VALUE_INTERPOLATION_BICUBIC));
            hints.add(new RenderingHints(RenderingHints.KEY_RENDERING,
                    RenderingHints.VALUE_RENDER_QUALITY));
            hints.add(new RenderingHints(RenderingHints.KEY_STROKE_CONTROL,
                    RenderingHints.VALUE_STROKE_PURE));
            hints.add(new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING,
                    RenderingHints.VALUE_TEXT_ANTIALIAS_ON));

            graphics2D.addRenderingHints(hints);
            renderer.setJava2DHints(hints);
            Map<String, Object> renderHints = Maps.newHashMap();
            if (transformer.isForceLongitudeFirst() != null) {
                renderHints.put(StreamingRenderer.FORCE_EPSG_AXIS_ORDER_KEY, transformer.isForceLongitudeFirst());
            }
            renderer.setRendererHints(renderHints);

            renderer.setMapContent(content);
            renderer.setThreadPool(this.executorService);

            final ReferencedEnvelope mapArea = bounds.toReferencedEnvelope(paintArea, transformer.getDPI());
            renderer.paint(graphics2D, paintArea, mapArea);
        } catch (Exception e) {
            throw ExceptionUtils.getRuntimeException(e);
        } finally {
            content.dispose();
        }
    }
View Full Code Here

   
    @Test
    public void testFillSE11() throws Exception {
        Style style = RendererBaseTest.loadSEStyle(this, "margin/fill.sld");
       
        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(bfs, style));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
       
        BufferedImage image = RendererBaseTest.showRender("MarginFill", renderer, TIME, bounds);
View Full Code Here

   
    @Test
    public void testFillSLD10() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "margin/fill10.sld");
       
        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(bfs, style));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
       
        BufferedImage image = RendererBaseTest.showRender("MarginFill", renderer, TIME, bounds);
View Full Code Here

   
    @Test
    public void testMarkMargin() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "margin/mark-margin.sld");
       
        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(bfs, style));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
       
        BufferedImage image = RendererBaseTest.showRender("MarkMargin", renderer, TIME, bounds);
View Full Code Here

   
    @Test
    public void testFillSingle() throws Exception {
        Style style = RendererBaseTest.loadSEStyle(this, "margin/fill-single.sld");
       
        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(bfs, style));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
       
        BufferedImage image = RendererBaseTest.showRender("MarginFill", renderer, TIME, bounds);
View Full Code Here

    }

    private BufferedImage toImage(SimpleFeatureSource featuerSource, Style style) throws Exception {
        String typeName = featuerSource.getSchema().getTypeName();
       
        MapContent content = new MapContent();
        ReferencedEnvelope dataBounds = featuerSource.getBounds();
        assertNotNull( typeName+" bounds",dataBounds);
        assertFalse( typeName+" bounds empty",dataBounds.isEmpty() );
        assertFalse( typeName+" bounds null",dataBounds.isNull() );
       
        ReferencedEnvelope bounds = JTS.toGeographic(dataBounds);
        assertNotNull(typeName + " world", bounds);
        assertTrue(
                typeName + " world WGS84",
                CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84,
                        bounds.getCoordinateReferenceSystem()));
        assertFalse(typeName + " world empty", bounds.isEmpty());
        assertFalse(typeName + " world null", bounds.isNull());
       
        ReferencedEnvelope reference = JTS.toGeographic( point_test_2d.getBounds() );
        assertNotNull( "reference point_test_2d bounds", reference );
        assertTrue( "reference point_test_2d bounds available", !reference.isEmpty() && !reference.isNull() );
        assertTrue(
                "bounds WGS84",
                CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84,reference.getCoordinateReferenceSystem()));

        content.getViewport().setBounds(reference);
        assertEquals( "map viewport set", reference, content.getViewport().getBounds() );
        assertTrue( "map viewport WGS84",
                CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84,content.getCoordinateReferenceSystem()) );
       
        content.addLayer( new FeatureLayer( featuerSource, style ));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(content);
        renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
       
View Full Code Here

    }

    private BufferedImage renderLabels(SimpleFeatureSource fs, Style style, String title)
            throws Exception {
        MapContent mc = new MapContent();
        mc.getViewport().setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
        mc.addLayer(new FeatureLayer(fs, style));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
        renderer.setMapContent(mc);
       
View Full Code Here

    }

    private void runSingleLayerTest(String styleName, int threshold) throws Exception {
        Style style = RendererBaseTest.loadStyle(this, styleName);

        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(fs, style));

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
        renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
       
View Full Code Here

    @Test
    public void testFTSComposition() throws Exception {
        Style bgStyle = RendererBaseTest.loadStyle(this, "fillSolid.sld");
        Style fgStyle = RendererBaseTest.loadStyle(this, "fillSolidFTS.sld");

        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(bfs, bgStyle));
        mc.addLayer(new FeatureLayer(fs, fgStyle));

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
        renderer.setMapContent(mc);
View Full Code Here

TOP

Related Classes of org.geotools.map.MapContent

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.