/** * Returns the current feature type is the current layer is made of vector features, null otherwise * @return */ public SimpleFeatureType getCurrentFeatureType() { if(currentLayer instanceof FeatureLayer) { FeatureLayer fl = (FeatureLayer) currentLayer; return (SimpleFeatureType) fl.getFeatureSource().getSchema(); } return null; }
/** * Adds the feature centroids to the output features, without actually adding the full * geometry (used when doing raster overlays of vector data with a desire to retain the * popups) * @param layer * @param folder */ private void addFeatureCentroids(Layer layer, Folder folder) { try { SimpleFeatureSource source = (SimpleFeatureSource) ((FeatureLayer) layer).getFeatureSource(); SimpleFeatureCollection original = source.getFeatures(); SimpleFeatureCollection centroids = new KMLCentroidFeatureCollection(original); context.setCurrentFeatureCollection(centroids); FeatureLayer centroidsLayer = new FeatureLayer(centroids, layer.getStyle(), layer.getTitle()); List<Feature> features = new SequenceList<Feature>( new FeatureSequenceFactory(context, centroidsLayer)); context.addFeatures(folder, features); } catch(IOException e) { throw new ServiceException( "Failed to load vector data during KML generation", e); } }
FeatureSource<?, ?> fs = layer.getFeatureSource(); Envelope targetRasterSpace = new Envelope(