Package org.geotools.map

Examples of org.geotools.map.MapContent


      ReferencedEnvelope read3857 = read26915.transform(mapCRS, true);
     
      // setup map content
      StyleBuilder sb = new StyleBuilder();
        Layer layer = new GridReaderLayer(new GeoTiffReader(testFile), sb.createStyle(sb.createRasterSymbolizer()));
        MapContent mc = new MapContent();
        mc.getViewport().setBounds(read3857);
        mc.addLayer(layer);
       
        StreamingRenderer sr = new StreamingRenderer();
        sr.setMapContent(mc);
        BufferedImage result = RendererBaseTest.showRender("testGridCoverageBoundsReprojection", sr, 1000, read3857);
       
View Full Code Here


        g.dispose();
        GridCoverage2D coverage = new GridCoverageFactory().create("test_red", bi, bounds);
       
        Style rst = sb.createStyle(sb.createRasterSymbolizer());
   
    MapContent mc = new MapContent();
    mc.addLayer(new FeatureLayer(fs, pst));
    mc.addLayer(new GridCoverageLayer(coverage, rst));
   
    StreamingRenderer renderer = new StreamingRenderer();
    renderer.setMapContent(mc);
    BufferedImage img = RendererBaseTest.renderImage(renderer, bounds, null);
   
View Full Code Here

   
    public void testCircle() throws Exception {
        Style pStyle = RendererBaseTest.loadStyle(this, "markCircle.sld");
        Style lStyle = RendererBaseTest.loadStyle(this, "lineGray.sld");
       
        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(lineFS, lStyle));
        mc.addLayer(new FeatureLayer(pointFS, pStyle));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
        renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
       
View Full Code Here

    }
   
    public void testRenderingBufferCircle() throws Exception {
        Style pStyle = RendererBaseTest.loadStyle(this, "markCircle.sld");

        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(pointFS, pStyle));

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
        renderer.setRendererHints(Collections.singletonMap(
                StreamingRenderer.ADVANCED_PROJECTION_HANDLING_KEY, true));
View Full Code Here

    public void testTriangle() throws Exception {
        Style pStyle = RendererBaseTest.loadStyle(this, "markTriangle.sld");
        Style lStyle = RendererBaseTest.loadStyle(this, "lineGray.sld");
       
        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(lineFS, lStyle));
        mc.addLayer(new FeatureLayer(pointFS, pStyle));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
        renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
       
View Full Code Here

   
    public void testDecorative() throws Exception {
        Style pStyle = RendererBaseTest.loadStyle(this, "markDecorative.sld");
        Style lStyle = RendererBaseTest.loadStyle(this, "lineGray.sld");
       
        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(lineFS, lStyle));
        mc.addLayer(new FeatureLayer(pointFS, pStyle));
       
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mc);
        renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON));
       
View Full Code Here

        mapLayerTableViewer.clear();

        pane.setMapLayerTable(this);
        mapLayerTableViewer.setPane(pane);

        MapContent mapContent = pane.getMapContent();
        List<Layer> layers = mapContent.layers();
        for( Layer mapLayer : layers ) {
            mapLayerTableViewer.addLayer(mapLayer);
        }
    }
View Full Code Here

            public void widgetSelected( SelectionEvent e ) {
                Layer selectedMapLayer = mapLayerTableViewer.getSelectedMapLayer();
                if (selectedMapLayer == null) {
                    return;
                }
                MapContent mapContext = pane.getMapContent();
                mapContext.removeLayer(selectedMapLayer);
                mapLayerTableViewer.selectionChanged(null);
            }
        });

        Button showLayersButton = new Button(buttonComposite, SWT.PUSH);
View Full Code Here

    private void moveLayer( int delta ) {
        Layer selectedMapLayer = mapLayerTableViewer.getSelectedMapLayer();
        if (selectedMapLayer == null)
            return;
        List<Layer> layersList = mapLayerTableViewer.getLayersList();
        MapContent mapContent = pane.getMapContent();

        int contextIndex = mapContent.layers().indexOf(selectedMapLayer);

        int viewerIndex = layersList.indexOf(selectedMapLayer);
        int newViewerIndex = viewerIndex + delta;
        if (newViewerIndex < 0 || newViewerIndex > layersList.size() - 1) {
            return;
        }

        /*
        * MapLayerTable stores layers in the reverse order to
        * DefaultMapContext (see comment in javadocs for this class)
        */
        int newContextIndex = contextIndex - delta;
        if (newContextIndex < 0 || newContextIndex > mapContent.layers().size() - 1) {
            return;
        }

        if (contextIndex != newContextIndex) {
            mapContent.moveLayer(contextIndex, newContextIndex);
            pane.redraw();
            Collections.swap(layersList, viewerIndex, newViewerIndex);
            mapLayerTableViewer.refresh();
        }

View Full Code Here

     * @return the transform or {@code null} if either the layer's coordinate system is the same
     *         as that of the map context, or either has a {@code null} CRS.
     */
    public MathTransform getTransform() {
        if (transform == null && !transformFailed && dataCRS != null) {
            MapContent content = getMapContent();
            if (content == null) {
                throw new IllegalStateException("map context should not be null");
            }

            CoordinateReferenceSystem contextCRS = content.getCoordinateReferenceSystem();
            try {
                transform = CRS.findMathTransform(contextCRS, dataCRS, true);
            } catch (Exception ex) {
                LOGGER.warning("Can't transform map context to map layer CRS");
                transformFailed = true;
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.