Package org.geotools.map

Examples of org.geotools.map.MapContent


     * @param crs data coordinate reference system
     */
    protected void setCRS( CoordinateReferenceSystem crs ) {
        this.dataCRS = crs;

        MapContent content = getMapContent();
        if (content == null) {
            throw new IllegalStateException("map context should not be null");
        }

        final CoordinateReferenceSystem contextCRS = content.getCoordinateReferenceSystem();
        transformRequired = false;
        if (contextCRS != null && crs != null && !CRS.equalsIgnoreMetadata(contextCRS, dataCRS)) {
            transformRequired = true;
        }
    }
View Full Code Here


    }
   
    @Test
    public void resizingPaneFiresEvent() {
        window.show(new Dimension(WIDTH, HEIGHT));
        MapContent mapContent = createMapContent(createMatchedBounds(mapPane.getVisibleRect()));
        mapPane.setMapContent(mapContent);
       
        listener.setExpected(MapPaneEvent.Type.DISPLAY_AREA_CHANGED);
        window.resizeTo(new Dimension(WIDTH * 2, HEIGHT * 2));
        assertTrue( listener.await(MapPaneEvent.Type.DISPLAY_AREA_CHANGED, WAIT_TIMEOUT) );
View Full Code Here

        assertMoveImage(10, 0);
    }
   
    private void assertMoveImage(int dx, int dy) {
        window.show(new Dimension(WIDTH, HEIGHT));
        MapContent mapContent = createMapContent(createMatchedBounds(mapPane.getVisibleRect()));

        // Wait for the display area and new map content events to be
        // processed
        listener.setExpected(MapPaneEvent.Type.DISPLAY_AREA_CHANGED);
        listener.setExpected(MapPaneEvent.Type.NEW_MAPCONTENT);
        mapPane.setMapContent(mapContent);
       
        assertTrue(listener.await(MapPaneEvent.Type.DISPLAY_AREA_CHANGED, WAIT_TIMEOUT));
        assertTrue(listener.await(MapPaneEvent.Type.NEW_MAPCONTENT, WAIT_TIMEOUT));
        ReferencedEnvelope startEnv = mapContent.getViewport().getBounds();
       
        listener.setExpected(MapPaneEvent.Type.DISPLAY_AREA_CHANGED);
        mapPane.moveImage(dx, dy);
        assertTrue(listener.await(MapPaneEvent.Type.DISPLAY_AREA_CHANGED, WAIT_TIMEOUT));
       
View Full Code Here

                window.component().setVisible(false);
            }
        });
       
        ReferencedEnvelope fullBounds = createMatchedBounds(mapPane.getVisibleRect());
        MapContent mapContent = createMapContent(fullBounds);
       
        ReferencedEnvelope subBounds = new ReferencedEnvelope(
                fullBounds.getMinX(), fullBounds.getMinX() + fullBounds.getWidth() / 2,
                fullBounds.getMinY(), fullBounds.getMinY() + fullBounds.getHeight() / 2,
                fullBounds.getCoordinateReferenceSystem());
       
        mapContent.getViewport().setBounds(subBounds);
        listener.setExpected(MapPaneEvent.Type.NEW_MAPCONTENT);
        mapPane.setMapContent(mapContent);
       
        // wait for the map pane to be ready
        assertTrue(listener.await(MapPaneEvent.Type.NEW_MAPCONTENT, WAIT_TIMEOUT));
View Full Code Here

     *
     * @param boundsOfLayers 0 or more bounds for layers
     * @return new map content
     */
    protected MapContent createMapContent(ReferencedEnvelope ...boundsOfLayers) {
        MapContent mapContent = new MapContent();
        if (boundsOfLayers != null) {
            for (ReferencedEnvelope env : boundsOfLayers) {
                mapContent.addLayer(createLayer(env));
            }
        }
        return mapContent;
    }
View Full Code Here

    protected MockRenderer renderer;
   
    protected void setup() {
        executor = new DefaultRenderingExecutor();
        listener = new WaitingRenderingExecutorListener();
        mapContent = new MapContent();
        mapContent.getViewport().setBounds(WORLD);
        mapContent.getViewport().setScreenArea(PANE);
    }
View Full Code Here

    private static final ReferencedEnvelope WORLD =
            new ReferencedEnvelope(150, 152, -33, -35, DefaultGeographicCRS.WGS84);

    @Test(expected=IllegalArgumentException.class)
    public void nullArgToCtorThrowsException() {
        MapContent mc = new SingleLayerMapContent(null);
    }
View Full Code Here

        Shell shell = new Shell(display);
        File openFile = JFileDataStoreChooser.showOpenFile(new String[]{"*.shp"}, shell); //$NON-NLS-1$

        try {
            if (openFile != null && openFile.exists()) {
                MapContent mapContent = mapPane.getMapContent();
                FileDataStore store = FileDataStoreFinder.getDataStore(openFile);
                SimpleFeatureSource featureSource = store.getFeatureSource();
                Style style = Utils.createStyle(openFile, featureSource);
                FeatureLayer featureLayer = new FeatureLayer(featureSource, style);
                mapContent.addLayer(featureLayer);
                mapPane.redraw();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

            AbstractGridCoverage2DReader tiffReader = format.getReader(openFile);
            StyleFactoryImpl sf = new StyleFactoryImpl();
            RasterSymbolizer symbolizer = sf.getDefaultRasterSymbolizer();
            Style defaultStyle = SLD.wrapSymbolizers(symbolizer);

            MapContent mapContent = mapPane.getMapContent();
            Layer layer = new GridReaderLayer(tiffReader, defaultStyle);
            layer.setTitle(openFile.getName());
            mapContent.addLayer(layer);
            mapPane.redraw();
        }
    }
View Full Code Here

    }
   
    @Test(expected=UnsupportedOperationException.class)
    public void addLayerThrowsException() {
        Layer layer = new MockLayer(WORLD);
        MapContent mc = new SingleLayerMapContent(layer);
       
        Layer layer2 = new MockLayer(WORLD);
        mc.addLayer(layer2);
    }
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.