Search in sources :

Example 1 with Style

use of org.geotools.styling.Style in project dhis2-core by dhis2.

the class MapUtils method createFeatureLayerFromMapObject.

/**
     * Creates a feature layer based on a map object.
     */
public static Layer createFeatureLayerFromMapObject(InternalMapObject mapObject) {
    Style style = mapObject.getStyle();
    SimpleFeatureType featureType = mapObject.getFeatureType();
    SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
    DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
    featureBuilder.add(mapObject.getGeometry());
    SimpleFeature feature = featureBuilder.buildFeature(null);
    featureCollection.add(feature);
    return new FeatureLayer(featureCollection, style);
}
Also used : FeatureLayer(org.geotools.map.FeatureLayer) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) Style(org.geotools.styling.Style) DefaultFeatureCollection(org.geotools.feature.DefaultFeatureCollection) SimpleFeature(org.opengis.feature.simple.SimpleFeature) SimpleFeatureBuilder(org.geotools.feature.simple.SimpleFeatureBuilder)

Aggregations

DefaultFeatureCollection (org.geotools.feature.DefaultFeatureCollection)1 SimpleFeatureBuilder (org.geotools.feature.simple.SimpleFeatureBuilder)1 FeatureLayer (org.geotools.map.FeatureLayer)1 Style (org.geotools.styling.Style)1 SimpleFeature (org.opengis.feature.simple.SimpleFeature)1 SimpleFeatureType (org.opengis.feature.simple.SimpleFeatureType)1