/** * Add the given feature collection as a new layer to the end of the list of layers held by this * context and trigger a {@linkplain MapLayerListEvent}. This is a convenience method equivalent * to {@linkplain #addLayer}(new DefaultMapLayer(collection, style). * * @param collection the collection of features for the new layer * @param style a Style object to be used in rendering this layer */ public void addLayer(FeatureCollection featureCollection, Style style) { FeatureType schema = featureCollection.getSchema(); Style layerStyle = checkStyle(style, schema); // checkCRS(schema.getCoordinateReferenceSystem()); // Jody: added for consistency Layer layer = new FeatureLayer(featureCollection, layerStyle); this.layers().add(layer); }
/** * Add the given feature source as a new layer to the end of the list of layers held by this * context and trigger a {@linkplain MapLayerListEvent}. This is a convenience method equivalent * to {@linkplain #addLayer}(new DefaultMapLayer(featureSource, style). * * <p>If a coordinate reference system has not been set for the context an attempt is made to * retrieve one from the new layer and use that as the context's CRS. * * <p>If {@code style} is null, a default style is created using {@linkplain * SLD#createSimpleStyle(org.opengis.feature.simple.SimpleFeatureType)}. * * @param featureSource the source of the features for the new layer * @param style a Style object to be used in rendering this layer. */ public void addLayer(FeatureSource featureSource, Style style) { // checkCRS(featureSource); Style layerStyle = checkStyle(style, featureSource.getSchema()); addLayer(new DefaultMapLayer(featureSource, layerStyle, "")); }
/** * Add the given feature collection as a new layer to the end of the list of layers held by this * context and trigger a {@linkplain MapLayerListEvent}. This is a convenience method equivalent * to {@linkplain #addLayer}(new DefaultMapLayer(collection, style). * * @param collection * the collection of features for the new layer * @param style * a Style object to be used in rendering this layer */ public void addLayer(FeatureCollection featureCollection, Style style) { FeatureType schema = featureCollection.getSchema(); Style layerStyle = checkStyle(style, schema); // checkCRS(schema.getCoordinateReferenceSystem()); // Jody: added for consistency Layer layer = new FeatureLayer(featureCollection, layerStyle); this.layers().add(layer); }
/** * Add the given feature source as a new layer to the end of the list of layers held by this * context and trigger a {@linkplain MapLayerListEvent}. This is a convenience method equivalent * to {@linkplain #addLayer}(new DefaultMapLayer(featureSource, style). * <p> * If a coordinate reference system has not been set for the context an attempt is made to * retrieve one from the new layer and use that as the context's CRS. * <p> * If {@code style} is null, a default style is created using * {@linkplain SLD#createSimpleStyle(org.opengis.feature.simple.SimpleFeatureType)}. * * @param featureSource * the source of the features for the new layer * * @param style * a Style object to be used in rendering this layer. */ public void addLayer(FeatureSource featureSource, Style style) { //checkCRS(featureSource); Style layerStyle = checkStyle(style, featureSource.getSchema()); addLayer(new DefaultMapLayer(featureSource, layerStyle, "")); }