Package org.geotools.map

Examples of org.geotools.map.MapContext


        }

        GridCoverage2D coverage = createCoverage();
        Style style = createCoverageStyle("1");

        MapContext context = new MapContext();
        context.addLayer(coverage, style);
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setContext(context);

        RenderListener listener = new RenderListener() {
            public void featureRenderer(SimpleFeature feature) {}
View Full Code Here


        expect(fs.getSchema()).andReturn(testLineFeatureType).anyTimes();
        expect(fs.getSupportedHints()).andReturn(new HashSet()).anyTimes();
        replay(fs);
       
        // build map context
        MapContext mapContext = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mapContext.addLayer(fs, createLineStyle());
       
        // setup the renderer and listen for errors
        final StreamingRenderer sr = new StreamingRenderer();
        sr.setContext(mapContext);
        sr.addRenderListener(new RenderListener() {
View Full Code Here

        final Envelope world = new Envelope(0, 50, 0, -100);
        final AffineTransform worldToScreen = AffineTransform.getRotateInstance(Math.toRadians(90), 0, 0);
        DefaultFeatureCollection fc = new DefaultFeatureCollection();
        fc.add(createPoint(0, 0));
        fc.add(createPoint(world.getMaxX(), world.getMinY()));
        MapContext mapContext = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        mapContext.addLayer((FeatureCollection)fc, createPointStyle());
        BufferedImage image = new BufferedImage(screen.width, screen.height,
                BufferedImage.TYPE_4BYTE_ABGR);
        final StreamingRenderer sr = new StreamingRenderer();
        sr.setContext(mapContext);
        sr.paint(image.createGraphics(), screen, worldToScreen);
View Full Code Here

 
        public void testPointLabeling() throws Exception {
            FeatureCollection collection = createPointFeatureCollection();
            Style style = loadStyle("PointStyle.sld");
            assertNotNull(style);
            MapContext map = new DefaultMapContext(DefaultGeographicCRS.WGS84);
            map.addLayer(collection, style);

            StreamingRenderer renderer = new StreamingRenderer();
            renderer.setContext(map);
            ReferencedEnvelope env = map.getLayerBounds();
            int boundary = 10;
            env = new ReferencedEnvelope(env.getMinX() - boundary, env.getMaxX() + boundary,
                    env.getMinY() - boundary, env.getMaxY() + boundary, null);
            RendererBaseTest.showRender("testPointLabeling", renderer, timout, env);
        }
View Full Code Here

  
    public void testLineLabeling() throws Exception {
        FeatureCollection collection = createLineFeatureCollection();
        Style style = loadStyle("LineStyle.sld");
        assertNotNull(style);
        MapContext map = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        map.addLayer(collection, style);

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setContext(map);
        ReferencedEnvelope env = map.getLayerBounds();
        int boundary = 10;
        env = new ReferencedEnvelope(env.getMinX() - boundary, env.getMaxX() + boundary, env
                .getMinY()
                - boundary, env.getMaxY() + boundary, null);
       
View Full Code Here

     */
    public void testLineLabelingUom() throws Exception {
        FeatureCollection collection = createLineFeatureCollection();
        Style style = loadStyle("LineStyleUom.sld");
        assertNotNull(style);
        MapContext map = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        map.addLayer(collection, style);

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setContext(map);
        ReferencedEnvelope env = map.getLayerBounds();
        int boundary = 10000;
        env = new ReferencedEnvelope(env.getMinX() - boundary, env.getMaxX() + boundary, env
                .getMinY()
                - boundary, env.getMaxY() + boundary, null);
       
View Full Code Here

 
  public void testPolyLabeling() throws Exception{   
    FeatureCollection collection=createPolyFeatureCollection();
    Style style=loadStyle("PolyStyle.sld");
    assertNotNull(style);
    MapContext map = new DefaultMapContext(DefaultGeographicCRS.WGS84);
        map.addLayer(collection, style);
        StreamingRenderer renderer=new StreamingRenderer();
        renderer.setContext(map);
        ReferencedEnvelope env = map.getLayerBounds();
        int boundary=10;
        env = new ReferencedEnvelope(env.getMinX() - boundary, env.getMaxX() + boundary,
            env.getMinY() - boundary, env.getMaxY() + boundary, null);
        RendererBaseTest.showRender("testPolyLabeling", renderer, timout, env);
  }
View Full Code Here

     */
    public MapContext getContext() {
        if(mapContent instanceof MapContext) {
            return (MapContext) mapContent;
        } else {
            MapContext context = new MapContext( mapContent );
            return context;
        }
    }
View Full Code Here

    // ////////////////////////////////////////////////////////////////////
    //
    // CREATING MAP CONTEXT
    //
    // ////////////////////////////////////////////////////////////////////
    final MapContext map = new DefaultMapContext(DefaultGeographicCRS.WGS84);
    map.addLayer(ft, style);
    map.setAreaOfInterest(map.getLayerBounds());

    // ////////////////////////////////////////////////////////////////////
    //
    // CREATING STREAMING RENDERER
    //
    // ////////////////////////////////////////////////////////////////////
    final StreamingRenderer renderer = new StreamingRenderer();
    renderer.setContext(map);
    renderer.setRendererHints(rendererHints);

    // ////////////////////////////////////////////////////////////////////
    //
    // SHOWING RENDERER
    //
    // ////////////////////////////////////////////////////////////////////
    RendererBaseTest.showRender("testSimplePolygonRender", renderer, 1000,
        map.getLayerBounds());

  }
View Full Code Here

    // ////////////////////////////////////////////////////////////////////
    //
    // CREATING MAP CONTEXT
    //
    // ////////////////////////////////////////////////////////////////////
    final MapContext map = new DefaultMapContext(DefaultGeographicCRS.WGS84);
    map.addLayer(ft, style);
    map.setAreaOfInterest(map.getLayerBounds());

    // ////////////////////////////////////////////////////////////////////
    //
    // CREATING STREAMING RENDERER
    //
    // ////////////////////////////////////////////////////////////////////
    final StreamingRenderer renderer = new StreamingRenderer();
    renderer.setContext(map);
    renderer.setRendererHints(rendererHints);

    // ////////////////////////////////////////////////////////////////////
    //
    // SHOWING RENDERER
    //
    // ////////////////////////////////////////////////////////////////////
    ReferencedEnvelope env = map.getLayerBounds();
    env = new ReferencedEnvelope(env.getMinX() - 20, env.getMaxX() + 20,
        env.getMinY() - 20, env.getMaxY() + 20, map
            .getCoordinateReferenceSystem());
    RendererBaseTest
        .showRender("testSimpleLineRender", renderer, 1000, env);

  }
View Full Code Here

TOP

Related Classes of org.geotools.map.MapContext

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.