Package org.geotools.map

Examples of org.geotools.map.DefaultMapContext


    @Test
    public void testLabelShieldMultilineStretch() throws Exception {
        Style style = RendererBaseTest.loadStyle(this, "textLabelShieldStretch.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


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

        if ( crs == null )
        {
            crs = DefaultGeographicCRS.WGS84;
        }

        final MapContext context = new DefaultMapContext( crs );
        context.addLayer( featureSource, style );
        context.getLayerBounds();

        return context;
    }
View Full Code Here

     * @return an map context with generated test data.
     */
    public MapContext createExampleMap()
    {
        // TODO: Read up on Coordinate Reference System, and pass one to the constructor below:
        final MapContext exampleMap = new DefaultMapContext();

        // Some random height coverage data
        // TODO

        // Some random roads
        // TODO

        // Some random lakes and rivers
        // TODO

        // Some random cities containing building polygons
        // TODO

        // Some random coverage color (population density?)
        // TODO

        try
        {
            //AttributeType geom = AttributeTypeFactory.newAttributeType("the_geom", Point.class);
            AttributeType geom = AttributeTypeFactory.newAttributeType( "the_geom", LineString.class );
            AttributeType roadWidth = AttributeTypeFactory.newAttributeType( "width", Float.class );
            FeatureType ftRoad = FeatureTypes.newFeatureType( new AttributeType[]{ geom, roadWidth }, "road" );

            WKTReader wktReader = new WKTReader();
            //Point geometry = (Point) wktReader.read("POINT (" + lat + " " + lon + ")");
            LineString geometry = (LineString) wktReader.read( "LINESTRING (0 0, 10 10, 10 20, 20 30, 10 40, 15 50)" );
            Float width = new Float( 10 );
            Feature theRoad = ftRoad.create( new Object[]{ geometry, width }, "myRoad" );

            System.out.println( theRoad );

            final FeatureCollection featureCollection = new DefaultFeatureCollection( "roads", ftRoad );

            featureCollection.add( theRoad );

            exampleMap.addLayer( new DefaultMapLayer( featureCollection, new BasicLineStyle() ) );

            System.out.println( "exampleMap = " + exampleMap );
        }
        catch ( SchemaException e )
        {
View Full Code Here

        CoordinateReferenceSystem crs = fs.getSchema().getDefaultGeometry().getCoordinateSystem();
        if ( crs == null )
        {
            crs = DefaultGeographicCRS.WGS84;
        }
        MapContext context = new DefaultMapContext( crs );
        context.addLayer( fs, style[ 0 ] );

        context.getLayerBounds();
        return context;

    }
View Full Code Here

        CoordinateReferenceSystem crs = fs.getSchema().getDefaultGeometry().getCoordinateSystem();
        if ( crs == null )
        {
            crs = DefaultGeographicCRS.WGS84;
        }
        MapContext context = new DefaultMapContext( crs );
        context.addLayer( fs, style[ 0 ] );

        context.getLayerBounds();
        return context;
    }
View Full Code Here

    }

    private MapContext getMapContext(CoordinateReferenceSystem crs, Geometry geographicBoundingBox,
            com.vividsolutions.jts.geom.Envelope areaOfInterest) throws IOException {

        DefaultMapContext mapContext = new DefaultMapContext();

        Style style;
        URL shpfile;
        SimpleFeatureSource source;

        shpfile = getClass().getResource("TM_WORLD_BORDERS.shp");
        source = getFeatureSource(shpfile);
        style = getStyle("TM_WORLD_BORDERS.sld");
        mapContext.addLayer(new DefaultMapLayer(source, style));

        source = getLatLonFeatureSource();
        style = getStyle("latlon.sld");
        mapContext.addLayer(new DefaultMapLayer(source, style));

        shpfile = getClass().getResource("cities.shp");
        source = getFeatureSource(shpfile);
        style = getStyle("cities.sld");
        mapContext.addLayer(new DefaultMapLayer(source, style));

        MapLayer layer = createCrsLayer(geographicBoundingBox, crs);
        mapContext.addLayer(layer);

        return mapContext;
    }
View Full Code Here

    }

    private MapContext getMapContext(CoordinateReferenceSystem crs, Geometry geographicBoundingBox,
            com.vividsolutions.jts.geom.Envelope areaOfInterest) throws IOException {

        DefaultMapContext mapContent = new DefaultMapContext();

        Style style;
        URL shpfile;
        SimpleFeatureSource source;

        shpfile = getClass().getResource("TM_WORLD_BORDERS.shp");
        source = getFeatureSource(shpfile);
        style = getStyle("TM_WORLD_BORDERS.sld");
        mapContent.addLayer(new DefaultMapLayer(source, style));

        source = getLatLonFeatureSource();
        style = getStyle("latlon.sld");
        mapContent.addLayer(new DefaultMapLayer(source, style));

        shpfile = getClass().getResource("cities.shp");
        source = getFeatureSource(shpfile);
        style = getStyle("cities.sld");
        mapContent.addLayer(new DefaultMapLayer(source, style));

        Layer layer = createCrsLayer(geographicBoundingBox, crs);
        mapContent.addLayer(layer);

        return mapContent;
    }
View Full Code Here

TOP

Related Classes of org.geotools.map.DefaultMapContext

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.