Package org.geotools.map

Examples of org.geotools.map.MapViewport


    ClientRasterLayerInfo rasterInfo = (ClientRasterLayerInfo) clientLayerInfo;
    RasterLayerRasterizingInfo extraInfo = (RasterLayerRasterizingInfo) rasterInfo
        .getWidgetInfo(RasterLayerRasterizingInfo.WIDGET_KEY);
    ReferencedEnvelope areaOfInterest = mapContext.getAreaOfInterest();
    RasterLayer layer = configurationService.getRasterLayer(clientLayerInfo.getServerLayerId());
    MapViewport port = mapContext.getViewport();
    double rasterScale = port.getScreenArea().getWidth() / port.getBounds().getWidth();
    List<RasterTile> tiles = rasterLayerService.getTiles(clientLayerInfo.getServerLayerId(),
        areaOfInterest.getCoordinateReferenceSystem(), areaOfInterest, rasterScale);
    RasterDirectLayer rasterLayer = new RasterDirectLayer(tiles, layer.getLayerInfo().getTileWidth(), layer
        .getLayerInfo().getTileHeight(), extraInfo.getCssStyle());
    rasterLayer.setTitle(clientLayerInfo.getLabel());
View Full Code Here


                graphics.clearRect(paintArea.x, paintArea.y, paintArea.width, paintArea.height);
            }
           
            validBounds=getContext().worldBounds(paintArea);

            MapViewport mapViewport = new MapViewport( validBounds );
            map.setViewport( mapViewport);

            GTRenderer geotToolsRenderer = getRenderer();

            if (bounds != null && !bounds.isNull()) {
View Full Code Here

        Graphics2D g = (Graphics2D) image.getGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, width, height);

        MapContent mapContent = new MapContent();
        MapViewport viewport = mapContent.getViewport();
        viewport.setBounds(new ReferencedEnvelope(mapArea, DefaultGeographicCRS.WGS84));
        viewport.setScreenArea(new Rectangle(width, height));
        mapContent.addLayer(new FeatureLayer(featureSource, style));

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setRendererHints(renderingHints);
        renderer.setMapContent(mapContent);
        renderer.paint(g, viewport.getScreenArea(), viewport.getBounds());
        return image;
    }
View Full Code Here

    }
   
    @Test
    public void testLineDoubleDash() throws Exception {
        StreamingRenderer renderer = setupLineMap("lineDoubleDash.sld");
        MapViewport viewport = renderer.getMapContent().getViewport();
        ReferencedEnvelope re = viewport.getBounds();
        ReferencedEnvelope shifted = new ReferencedEnvelope(re.getMinX() + 2, re.getMaxX() - 3, re.getMinY() + 2, re.getMaxY() - 3, re.getCoordinateReferenceSystem());
        viewport.setBounds(shifted);
       
        BufferedImage image = RendererBaseTest.showRender("Lines with double dash array (2 fts)", renderer, TIME, shifted);
        ImageAssert.assertEquals(file("doubleDash"), image, 10);
    }
View Full Code Here

            RenderingExecutorEvent event = new RenderingExecutorEvent(this, id);
            listener.onRenderingStarted(event);
           
            // Clone the viewport and mark it as not editable to prevent
            // the temporary MapContents created below from changing it
            MapViewport vp = new MapViewport(mapContent.getViewport());
            vp.setEditable(false);
           
            for (RenderingOperands op : operands) {
                MapContent mc = new SingleLayerMapContent(op.getLayer());
                mc.setViewport(vp);
                op.getRenderer().setMapContent(mc);
View Full Code Here

            }

            mapContent = newMapContent;

            if (mapContent != null) {
                MapViewport viewport = mapContent.getViewport();
                viewport.setMatchingAspectRatio(true);
                Rectangle rect = getVisibleRect();
                if (!rect.isEmpty()) {
                    viewport.setScreenArea(rect);
                }
               
                mapContent.addMapLayerListListener(this);
                mapContent.addMapBoundsListener(this);
View Full Code Here

            if (layer instanceof ComponentListener) {
                addComponentListener((ComponentListener) layer);
            }

            setFullExtent();
            MapViewport viewport = mapContent.getViewport();
            if (viewport.getBounds().isEmpty()) {
                viewport.setBounds(fullExtent);
            }
           
        } finally {
            paramsLock.writeLock().unlock();
        }
View Full Code Here

     * Force the output to be in WGS84
     * @param mc
     * @return
     */
    private WMSMapContent fixViewport(WMSMapContent mc) {
        MapViewport viewport = mc.getViewport();
        if(!CRS.equalsIgnoreMetadata(viewport.getCoordinateReferenceSystem(), DefaultGeographicCRS.WGS84)) {
            viewport.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
            GetMapRequest req = mc.getRequest();
            req.setSRS("EPSG:4326");
            req.setBbox(viewport.getBounds());
        }
       
        return mc;
    }
View Full Code Here

TOP

Related Classes of org.geotools.map.MapViewport

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.