Package org.geotools.map

Examples of org.geotools.map.MapContent$LayerList


        btn.setFont(JMapStatusBar.DEFAULT_FONT);
        btn.setToolTipText(TOOL_TIP);
        add(btn);

        CoordinateReferenceSystem crs = null;
        MapContent mapContent = mapPane.getMapContent();
        if (mapContent != null) {
            crs = mapContent.getCoordinateReferenceSystem();
        }
        displayCRS(crs);

        mapPane.addMapPaneListener(new MapPaneAdapter() {
            @Override
View Full Code Here


        }

        DirectPosition2D pos = ev.getMapPosition();
        report(pos);

        MapContent context = getMapPane().getMapContent();
        for( Layer layer : context.layers() ) {
            if (layer.isSelected()) {
                InfoToolHelper<?> helper = null;

                String layerName = layer.getTitle();
                if (layerName == null || layerName.length() == 0) {
View Full Code Here

            }
        }
       
        private void disconnectFromMapContent() {
            if (contentRef != null) {
                MapContent prevMapContent = contentRef.get();
                contentRef = null;
                if (prevMapContent != null) {
                    prevMapContent.removeMapLayerListListener(this);
                }
               
                table.clear();
            }
        }
View Full Code Here

        @Override
        public void onNewMapContent(MapPaneEvent ev) {
            table.clear();
           
            disconnectFromMapContent();
            MapContent newMapContent = (MapContent) ev.getData();
            connectToMapContent(newMapContent);
           
            if (newMapContent != null) {
                for (Layer layer : newMapContent.layers()) {
                    table.onAddLayer(layer);
                }
            }
        }
View Full Code Here

    public void setup() throws Exception {
        GuiActionRunner.execute(new GuiTask() {
            @Override
            protected void executeInEDT() throws Throwable {
                pane = new MockMapPane();
                pane.setMapContent(new MapContent());
                pane.setScreenArea(SCREEN);
                pane.setDisplayArea(WORLD);
            }
        });
    }
View Full Code Here

  public void saveImage(FeatureCollection<SimpleFeatureType,SimpleFeature> features, String sldFile, File imagefile) throws IOException {
    saveImage(features, getStyleFromSLDFile(sldFile), imagefile);
  }

  public void saveImage(FeatureCollection<SimpleFeatureType,SimpleFeature> features, Style style, File imagefile) throws IOException {
    MapContent mapContent = new MapContent();
    mapContent.addLayer(new FeatureLayer(features, style));
    saveMapContentToImageFile(mapContent, imagefile, features.getBounds());
  }
View Full Code Here

    mapContent.addLayer(new FeatureLayer(features, style));
    saveMapContentToImageFile(mapContent, imagefile, features.getBounds());
  }
 
  public void saveImage(FeatureCollection<SimpleFeatureType,SimpleFeature>[] features, Style[] styles, File imagefile, ReferencedEnvelope bounds) throws IOException {
    MapContent mapContent = new MapContent();
    for (int i = 0; i < features.length; i++) {
      mapContent.addLayer(new FeatureLayer(features[i], styles[i]));
    }
    saveMapContentToImageFile(mapContent, imagefile, bounds);
  }
View Full Code Here

            }
            System.out.println("Exporting layers '" + names + "' to styled image " + imagefile.getPath());

            Style style = getStyleFromSLDFile(sldFile);

            MapContent mapContent = new MapContent();
            for (int i = 0; i < layerNames.length; i++) {
                SimpleFeatureSource featureSource = store.getFeatureSource(layerNames[i]);
                Style featureStyle = style;
                if (featureStyle == null) {
                    featureStyle = getStyle(i);
                }

                if (featureStyle == null) {
                    featureStyle = createStyleFromGeometry((SimpleFeatureType) featureSource.getSchema(), Color.BLUE, Color.CYAN);
                    System.out.println("Created style from geometry '" + featureSource.getSchema().getGeometryDescriptor().getType() + "': " + featureStyle);
                }

                mapContent.addLayer(new org.geotools.map.FeatureLayer(featureSource, featureStyle));

                if (bounds == null) {
                    bounds = featureSource.getBounds();
                } else {
                    bounds.expandToInclude(featureSource.getBounds());
View Full Code Here

     * @param style
     * @return
     */
    public static BufferedImage renderIcon(Style style) {
        int size = findIconSize(style)+1; // size is an int because icons are always square
        MapContent mapContent = new MapContent();
        mapContent.addLayer(new FeatureLayer(sampleData, style));
        BufferedImage image = new BufferedImage(size * Icons.RENDER_SCALE_FACTOR + 1,
                size * Icons.RENDER_SCALE_FACTOR + 1, BufferedImage.TYPE_INT_ARGB);
        Graphics2D graphics = image.createGraphics();
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        graphics.scale(Icons.RENDER_SCALE_FACTOR, Icons.RENDER_SCALE_FACTOR);
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mapContent);
        try {
            try {
                renderer.paint(graphics, new Rectangle(size, size), sampleArea);
            } finally {
                graphics.dispose();
            }
        } finally {
            mapContent.dispose();
        }
        return image;
    }
View Full Code Here

    }

    public SVGGraphics2D createSVGMap(final StreamingRenderer renderer,
            final WMSMapContent mapContent) throws ServiceException, IOException {
        try {
            MapContent map = renderer.getMapContent();
            double width = -1;
            double height = -1;

            if (map instanceof WMSMapContent) {
                WMSMapContent wmsMap = (WMSMapContent) map;
                width = wmsMap.getMapWidth();
                height = wmsMap.getMapHeight();
            } else {
                // get fromt he map content
                Rectangle screenArea = map.getViewport().getScreenArea();
                width = screenArea.getWidth();
                height = screenArea.getHeight();
            }

            if ((height == -1) || (width == -1)) {
View Full Code Here

TOP

Related Classes of org.geotools.map.MapContent$LayerList

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.