Package org.geotools.map

Examples of org.geotools.map.FeatureLayer


    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


     * @return the new layer
     */
    protected Layer createLayer(ReferencedEnvelope env) {
        SimpleFeatureCollection fc = singlePolygonFeatureCollection(env);
        Style style = SLD.createSimpleStyle(fc.getSchema());
        return new FeatureLayer(fc, style);
    }
View Full Code Here

            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

    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

  }
 
  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

            mc.setTransparent(true);
            mc.setBuffer(params.getBuffer());
            mc.getViewport().setBounds(new ReferencedEnvelope(getMap.getBbox(), getMap.getCrs()));
            mc.setMapWidth(getMap.getWidth());
            mc.setMapHeight(getMap.getHeight());
            FeatureLayer layer = getLayer(params, style);
            mc.addLayer(layer);
            // setup the env variables just like in the original GetMap
            RenderingVariables.setupEnvironmentVariables(mc);
           
            // setup the transformation from screen to world space
View Full Code Here

        int maxFeatures = getMap.getMaxFeatures() != null ? getMap.getMaxFeatures()
                : Integer.MAX_VALUE;
        definitionQuery.setMaxFeatures(maxFeatures);

        FeatureLayer result = new FeatureLayer(new FeatureInfoFeatureSource(featureSource,
                params.getPropertyNames()), style);
        result.setQuery(definitionQuery);

        return result;
    }
View Full Code Here

     * @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);
View Full Code Here

        map.setTransparent(false);
        map.setRequest(request);

        StyleInfo styleByName = catalog.getStyleByName("Default");
        Style basicStyle = styleByName.getStyle();
        map.addLayer(new FeatureLayer(fs, basicStyle));

        request.setFormat(getMapFormat());
        RenderedImageMap imageMap = this.rasterMapProducer.produceMap(map);
        BufferedImage image = (BufferedImage) imageMap.getImage();
        imageMap.dispose();
View Full Code Here

        List<LayerInfo> layers = getCatalog().getLayers(ftInfo);
        StyleInfo defaultStyle = layers.get(0).getDefaultStyle();
        Style style = defaultStyle.getStyle();

        map.addLayer(new FeatureLayer(ftInfo.getFeatureSource(null, null), style));
    }
View Full Code Here

TOP

Related Classes of org.geotools.map.FeatureLayer

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.