public SimpleFeatureCollection areaToFeatureCollection ( @ Nonnull final MapAttribute . MapAttributeValues mapAttributes ) { Assert . isTrue ( mapAttributes . areaOfInterest == this , "map attributes passed in does not contain this area of interest object" ) ; final SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder ( ) ; typeBuilder . setName ( "aoi" ) ; CoordinateReferenceSystem crs = mapAttributes . getMapBounds ( ) . getProjection ( ) ; typeBuilder . add ( "geom" , this . polygon . getClass ( ) , crs ) ; final SimpleFeature feature = SimpleFeatureBuilder . build ( typeBuilder . buildFeatureType ( ) , new Object [ ] { this . polygon } , "aoi" ) ; final DefaultFeatureCollection features = new DefaultFeatureCollection ( ) ; features . add ( feature ) ; return features ; }
Return the area polygon as the only feature in the feature collection .