Examples of DefaultMapContext


Examples of org.geotools.map.DefaultMapContext

   
    @Test
    public void testBufferPoly() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "polyBuffer.sld");

        DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mc.addLayer(bfs, style);

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setContext(mc);

        RendererBaseTest.showRender("polyBuffer.sld", renderer, TIME, bounds);
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

   
    @Test
    public void testVertices() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "lineVertices.sld");

        DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mc.addLayer(fs, style);

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setContext(mc);

        RendererBaseTest.showRender("lineVertices.sld", renderer, TIME, bounds);
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

   
    @Test
    public void testStartEnd() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "lineStartEnd.sld");

        DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mc.addLayer(fs, style);

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setContext(mc);

        RendererBaseTest.showRender("lineStartEnd.sld", renderer, TIME, bounds);
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

   
    @Test
    public void testIsometric() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "isometric.sld");

        DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mc.addLayer(bfs, style);

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

Examples of org.geotools.map.DefaultMapContext

    //
    // MAP CONTEXT
    //
    //
    // /////////////////////////////////////////////////////////////////
    final MapContext context = new DefaultMapContext(DefaultGeographicCRS.WGS84);
    final Style style = getStyle();
    context.addLayer(gc, style);

    // /////////////////////////////////////////////////////////////////
    //
    // Streaming renderer
    //
    //
    // ///////////////////////////////////////////////////////////////
    final StreamingRenderer renderer = new StreamingRenderer();
    renderer.setContext(context);
    RendererBaseTest.showRender("testGridCoverage", renderer, 1000, context.getLayerBounds());
  }
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

   * @throws Exception
   */
  @Test
    public void paintWrongStyle() throws Exception {
        final GridCoverage2D gc = getGC();
        final MapContext context = new DefaultMapContext(DefaultGeographicCRS.WGS84);
       
        // final Style style = new StyleBuilder().createStyle((Symbolizer) null);
        final Style style = RendererBaseTest.loadStyle(this, "empty.sld");
        context.addLayer(gc, style);

        final StreamingRenderer renderer = new StreamingRenderer();
        CountingRenderListener counter = new CountingRenderListener();
        renderer.addRenderListener(counter);
        renderer.setContext(context);
        BufferedImage image = new BufferedImage(300, 300, BufferedImage.TYPE_4BYTE_ABGR);
        Graphics2D g2d = (Graphics2D) image.getGraphics();
        renderer.paint(g2d, new Rectangle(0,0,300,300), context.getLayerBounds());
        g2d.dispose();
        // make sure no errors and no features
        assertEquals(0, counter.errors);
        assertEquals(0, counter.features);
    }
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

    // MAP CONTEXT
    // We want to show the context in a different CRS
    //
    //
    // /////////////////////////////////////////////////////////////////
    final MapContext context = new DefaultMapContext(DefaultGeographicCRS.WGS84);
    final Style style = getStyle();
    context.addLayer(coverage, style);

    // transform to a new crs
    final CoordinateReferenceSystem destCRS = getProjectedCRS(coverage);

    // ///////////////////////////////////////////////////////////////////
    //
    // Streaming renderer
    //
    // /////////////////////////////////////////////////////////////////
    final StreamingRenderer renderer = new StreamingRenderer();
    renderer.setContext(context);

    ReferencedEnvelope env = context.getLayerBounds();
    env = new ReferencedEnvelope(env.getMinX(), env.getMaxX(), env.getMinY(), env.getMaxY(), DefaultGeographicCRS.WGS84);
    final ReferencedEnvelope newbounds = env.transform(destCRS, true);

    RendererBaseTest.showRender("testGridCoverageReprojection", renderer, 1000, newbounds);
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

        }
        return sources.toArray(new FeatureSource[sources.size()]);
    }

    BufferedImage render(FeatureSource[] sources, Style[] styles) throws Exception {
        DefaultMapContext map = new DefaultMapContext();

        ReferencedEnvelope env = sources[0].getBounds();
        for (int i = 1; i < sources.length; i++) {
            env.expandToInclude(sources[i].getBounds());
        }
        map.setAreaOfInterest(env);
        map.setCoordinateReferenceSystem(env.getCoordinateReferenceSystem());
        for (int i = 0; i < sources.length; i++) {
            if(styles[i] != null) {
                map.addLayer(sources[i], styles[i]);
            }
        }

        try {
            StreamingRenderer r = new StreamingRenderer();
            r.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
            r.setContext(map);
   
            return RendererBaseTest.showRender("testPointLabeling", r, 5000, env);
        } finally {
            map.dispose();
        }
    }
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

   
    @Test
    public void testLabelShield() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "textLabelShield.sld");
       
        DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mc.addLayer(fs, style);
       
        renderer.setContext(mc);
       
        RendererBaseTest.showRender("Labels and shield", renderer, TIME, bounds);
    }
View Full Code Here

Examples of org.geotools.map.DefaultMapContext

   
    @Test
    public void testLabelShieldMultiline() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "textLabelShield.sld");

        DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mc.addLayer(fs_multiline, style);

        renderer.setContext(mc);

        BufferedImage image = RendererBaseTest.showRender("Labels and shield", renderer, TIME,
                bounds);
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.