Search in sources :

Example 11 with Produces

use of org.polymap.core.data.pipeline.Produces in project polymap4-core by Polymap4.

the class FeatureRenameProcessor method featuresResponse.

@Produces(GetFeaturesResponse.class)
public void featuresResponse(GetFeaturesResponse response, ProcessorContext context) throws Exception {
    assert schema != null : "Target schema is not yet initialized. Call getSchema() first.";
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder((SimpleFeatureType) schema);
    // log.debug( "       received features: " + chunk.count() );
    List<Feature> result = new ArrayList(response.count());
    for (Feature feature : response) {
        for (PropertyDescriptor prop : schema.getDescriptors()) {
            Property featureProp = feature.getProperty(prop.getName());
            // the feature may not contain the property if it was not requested
            if (featureProp != null) {
                builder.set(prop.getName(), featureProp.getValue());
            }
        }
        result.add(builder.buildFeature(feature.getIdentifier().getID()));
    }
    // log.debug( "       sending features: " + result.size() );
    context.sendResponse(new GetFeaturesResponse(result));
}
Also used : GetFeaturesResponse(org.polymap.core.data.feature.GetFeaturesResponse) PropertyDescriptor(org.opengis.feature.type.PropertyDescriptor) ArrayList(java.util.ArrayList) Feature(org.opengis.feature.Feature) Property(org.opengis.feature.Property) SimpleFeatureBuilder(org.geotools.feature.simple.SimpleFeatureBuilder) Produces(org.polymap.core.data.pipeline.Produces)

Aggregations

Produces (org.polymap.core.data.pipeline.Produces)11 Consumes (org.polymap.core.data.pipeline.Consumes)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 Query (org.geotools.data.Query)3 BufferedImage (java.awt.image.BufferedImage)2 GetFeatureTypeResponse (org.polymap.core.data.feature.GetFeatureTypeResponse)2 Image (java.awt.Image)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ArrayList (java.util.ArrayList)1 SimpleFeatureBuilder (org.geotools.feature.simple.SimpleFeatureBuilder)1 SimpleFeatureTypeBuilder (org.geotools.feature.simple.SimpleFeatureTypeBuilder)1 Feature (org.opengis.feature.Feature)1 Property (org.opengis.feature.Property)1 PropertyDescriptor (org.opengis.feature.type.PropertyDescriptor)1 GetBoundsRequest (org.polymap.core.data.feature.GetBoundsRequest)1 GetFeaturesRequest (org.polymap.core.data.feature.GetFeaturesRequest)1 GetFeaturesResponse (org.polymap.core.data.feature.GetFeaturesResponse)1 GetFeaturesSizeRequest (org.polymap.core.data.feature.GetFeaturesSizeRequest)1 EncodedImageResponse (org.polymap.core.data.image.EncodedImageResponse)1 ImageEncodeProcessor (org.polymap.core.data.image.ImageEncodeProcessor)1