Search in sources :

Example 11 with RasterSymbolizer

use of org.opengis.style.RasterSymbolizer in project geotoolkit by Geomatys.

the class Styles method colorInterpolationRaster.

public static MutableStyle colorInterpolationRaster() {
    final List<InterpolationPoint> values = new ArrayList<>();
    values.add(SF.interpolationPoint(1003, SF.literal(new Color(46, 154, 88))));
    values.add(SF.interpolationPoint(1800, SF.literal(new Color(251, 255, 128))));
    values.add(SF.interpolationPoint(2800, SF.literal(new Color(224, 108, 31))));
    values.add(SF.interpolationPoint(3500, SF.literal(new Color(200, 55, 55))));
    values.add(SF.interpolationPoint(4397, SF.literal(new Color(215, 244, 244))));
    final Expression lookup = DEFAULT_CATEGORIZE_LOOKUP;
    final Literal fallback = DEFAULT_FALLBACK;
    final Expression function = SF.interpolateFunction(lookup, values, Method.COLOR, Mode.LINEAR, fallback);
    final ChannelSelection selection = null;
    final Expression opacity = LITERAL_ONE_FLOAT;
    final OverlapBehavior overlap = OverlapBehavior.LATEST_ON_TOP;
    final ColorMap colorMap = SF.colorMap(function);
    final ContrastEnhancement enchance = SF.contrastEnhancement(LITERAL_ONE_FLOAT, ContrastMethod.NONE);
    final ShadedRelief relief = SF.shadedRelief(LITERAL_ONE_FLOAT);
    final Symbolizer outline = null;
    final Unit uom = Units.POINT;
    final String geom = DEFAULT_GEOM;
    final String name = "raster symbol name";
    final Description desc = DEFAULT_DESCRIPTION;
    final RasterSymbolizer symbol = SF.rasterSymbolizer(name, geom, desc, uom, opacity, selection, overlap, colorMap, enchance, relief, outline);
    return SF.style(symbol);
}
Also used : InterpolationPoint(org.geotoolkit.style.function.InterpolationPoint) Description(org.opengis.style.Description) ColorMap(org.opengis.style.ColorMap) ArrayList(java.util.ArrayList) Unit(javax.measure.Unit) ShadedRelief(org.opengis.style.ShadedRelief) PointSymbolizer(org.opengis.style.PointSymbolizer) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) RasterSymbolizer(org.opengis.style.RasterSymbolizer) TextSymbolizer(org.opengis.style.TextSymbolizer) Symbolizer(org.opengis.style.Symbolizer) RasterSymbolizer(org.opengis.style.RasterSymbolizer) ContrastEnhancement(org.opengis.style.ContrastEnhancement) Expression(org.opengis.filter.Expression) ChannelSelection(org.opengis.style.ChannelSelection) Literal(org.opengis.filter.Literal) OverlapBehavior(org.opengis.style.OverlapBehavior)

Example 12 with RasterSymbolizer

use of org.opengis.style.RasterSymbolizer in project geotoolkit by Geomatys.

the class Styles method customRaster.

public static MutableStyle customRaster() {
    final String name = "mySymbol";
    final Description desc = DEFAULT_DESCRIPTION;
    // use the default geometry of the feature
    final String geometry = null;
    final Unit unit = Units.POINT;
    final Expression opacity = LITERAL_ONE_FLOAT;
    final ChannelSelection channels = null;
    final OverlapBehavior overlap = null;
    final ColorMap colormap = null;
    final ContrastEnhancement enhance = null;
    final ShadedRelief relief = null;
    final Symbolizer outline = null;
    final RasterSymbolizer symbol = SF.rasterSymbolizer(name, (String) null, desc, unit, opacity, channels, overlap, colormap, enhance, relief, outline);
    final MutableStyle style = SF.style(symbol);
    return style;
}
Also used : RasterSymbolizer(org.opengis.style.RasterSymbolizer) Description(org.opengis.style.Description) ContrastEnhancement(org.opengis.style.ContrastEnhancement) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) ChannelSelection(org.opengis.style.ChannelSelection) ColorMap(org.opengis.style.ColorMap) Unit(javax.measure.Unit) ShadedRelief(org.opengis.style.ShadedRelief) PointSymbolizer(org.opengis.style.PointSymbolizer) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) RasterSymbolizer(org.opengis.style.RasterSymbolizer) TextSymbolizer(org.opengis.style.TextSymbolizer) Symbolizer(org.opengis.style.Symbolizer) OverlapBehavior(org.opengis.style.OverlapBehavior)

Example 13 with RasterSymbolizer

use of org.opengis.style.RasterSymbolizer in project geotoolkit by Geomatys.

the class GTtoSE100Transformer method visit.

/**
 * Transform a GT rule in jaxb rule or OnlineResource
 */
@Override
public org.geotoolkit.sld.xml.v100.Rule visit(final Rule rule, final Object data) {
    final org.geotoolkit.sld.xml.v100.Rule rt = sld_factory_v100.createRule();
    rt.setName(rule.getName());
    if (rule.getDescription() != null) {
        if (rule.getDescription().getAbstract() != null)
            rt.setAbstract(rule.getDescription().getAbstract().toString());
        if (rule.getDescription().getTitle() != null)
            rt.setTitle(rule.getDescription().getTitle().toString());
    }
    if (rule.isElseFilter()) {
        rt.setElseFilter(sld_factory_v100.createElseFilter());
    } else if (rule.getFilter() != null) {
        rt.setFilter(apply(rule.getFilter()));
    }
    if (rule.getLegend() != null) {
        rt.setLegendGraphic(visit(rule.getLegend(), null));
    }
    rt.setMaxScaleDenominator(rule.getMaxScaleDenominator());
    rt.setMinScaleDenominator(rule.getMinScaleDenominator());
    for (final Symbolizer symbol : rule.symbolizers()) {
        if (symbol instanceof LineSymbolizer) {
            rt.getSymbolizer().add(visit((LineSymbolizer) symbol, null));
        } else if (symbol instanceof PolygonSymbolizer) {
            rt.getSymbolizer().add(visit((PolygonSymbolizer) symbol, null));
        } else if (symbol instanceof PointSymbolizer) {
            rt.getSymbolizer().add(visit((PointSymbolizer) symbol, null));
        } else if (symbol instanceof RasterSymbolizer) {
            rt.getSymbolizer().add(visit((RasterSymbolizer) symbol, null));
        } else if (symbol instanceof TextSymbolizer) {
            rt.getSymbolizer().add(visit((TextSymbolizer) symbol, null));
        } else if (symbol instanceof ExtensionSymbolizer) {
        // TODO provide jaxb parsing for unknowned symbolizers
        // rt.getSymbolizer().add( visit((ExtensionSymbolizer)symbol,null));
        }
    }
    return rt;
}
Also used : RasterSymbolizer(org.opengis.style.RasterSymbolizer) PointSymbolizer(org.opengis.style.PointSymbolizer) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) TextSymbolizer(org.opengis.style.TextSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) ExtensionSymbolizer(org.opengis.style.ExtensionSymbolizer) ExtensionSymbolizer(org.opengis.style.ExtensionSymbolizer) PointSymbolizer(org.opengis.style.PointSymbolizer) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) RasterSymbolizer(org.opengis.style.RasterSymbolizer) TextSymbolizer(org.opengis.style.TextSymbolizer) Symbolizer(org.opengis.style.Symbolizer)

Example 14 with RasterSymbolizer

use of org.opengis.style.RasterSymbolizer in project geotoolkit by Geomatys.

the class SE100toGTTransformer method visit.

/**
 * Transform a SLD v1.0 raster symbolizer in GT raster symbolizer.
 */
public RasterSymbolizer visit(final org.geotoolkit.sld.xml.v100.RasterSymbolizer rst) {
    if (rst == null)
        return null;
    final Expression opacity = (rst.getOpacity() == null) ? filterFactory.literal(1) : visitExpression(rst.getOpacity());
    final ChannelSelection selection = visit(rst.getChannelSelection());
    final OverlapBehavior overlap = visitOverLap(rst.getOverlapBehavior());
    final ColorMap colorMap = visit(rst.getColorMap());
    final ContrastEnhancement enchance = visit(rst.getContrastEnhancement());
    final ShadedRelief relief = visit(rst.getShadedRelief());
    final Symbolizer outline = visit(rst.getImageOutline());
    final Unit uom = Units.POINT;
    final String geom = visitGeom(rst.getGeometry());
    final String name = "";
    final Description desc = StyleConstants.DEFAULT_DESCRIPTION;
    return styleFactory.rasterSymbolizer(name, geom, desc, uom, opacity, selection, overlap, colorMap, enchance, relief, outline);
}
Also used : ContrastEnhancement(org.opengis.style.ContrastEnhancement) Description(org.opengis.style.Description) Expression(org.opengis.filter.Expression) ChannelSelection(org.opengis.style.ChannelSelection) ColorMap(org.opengis.style.ColorMap) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) InternationalString(org.opengis.util.InternationalString) Unit(javax.measure.Unit) ShadedRelief(org.opengis.style.ShadedRelief) PointSymbolizer(org.opengis.style.PointSymbolizer) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) RasterSymbolizer(org.opengis.style.RasterSymbolizer) TextSymbolizer(org.opengis.style.TextSymbolizer) Symbolizer(org.opengis.style.Symbolizer) OverlapBehavior(org.opengis.style.OverlapBehavior)

Example 15 with RasterSymbolizer

use of org.opengis.style.RasterSymbolizer in project geotoolkit by Geomatys.

the class SE110toGTTransformer method visit.

/**
 * Transform a SLD v1.1 raster symbolizer in GT raster symbolizer.
 */
public RasterSymbolizer visit(final RasterSymbolizerType rst) {
    if (rst == null)
        return null;
    final Expression opacity = (rst.getOpacity() == null) ? filterFactory.literal(1) : visitExpression(rst.getOpacity());
    final ChannelSelection selection = visit(rst.getChannelSelection());
    final OverlapBehavior overlap = visitOverLap(rst.getOverlapBehavior());
    final ColorMap colorMap = visit(rst.getColorMap());
    final ContrastEnhancement enchance = visit(rst.getContrastEnhancement());
    final ShadedRelief relief = visit(rst.getShadedRelief());
    final Symbolizer outline = visit(rst.getImageOutline());
    final Unit uom = visitUOM(rst.getUom());
    final Expression geom = notEmpty(visitExpression(rst.getGeometry()));
    final String name = rst.getName();
    final Description desc = visitDescription(rst.getDescription());
    return styleFactory.rasterSymbolizer(name, geom, desc, uom, opacity, selection, overlap, colorMap, enchance, relief, outline);
}
Also used : ContrastEnhancement(org.opengis.style.ContrastEnhancement) Description(org.opengis.style.Description) Expression(org.opengis.filter.Expression) ChannelSelection(org.opengis.style.ChannelSelection) ColorMap(org.opengis.style.ColorMap) Unit(javax.measure.Unit) ShadedRelief(org.opengis.style.ShadedRelief) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) RasterSymbolizer(org.opengis.style.RasterSymbolizer) TextSymbolizer(org.opengis.style.TextSymbolizer) PointSymbolizer(org.opengis.style.PointSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) Symbolizer(org.opengis.style.Symbolizer) OverlapBehavior(org.opengis.style.OverlapBehavior)

Aggregations

RasterSymbolizer (org.opengis.style.RasterSymbolizer)22 PolygonSymbolizer (org.opengis.style.PolygonSymbolizer)15 LineSymbolizer (org.opengis.style.LineSymbolizer)14 PointSymbolizer (org.opengis.style.PointSymbolizer)14 TextSymbolizer (org.opengis.style.TextSymbolizer)14 Symbolizer (org.opengis.style.Symbolizer)13 Expression (org.opengis.filter.Expression)10 ColorMap (org.opengis.style.ColorMap)10 ChannelSelection (org.opengis.style.ChannelSelection)9 ContrastEnhancement (org.opengis.style.ContrastEnhancement)9 ShadedRelief (org.opengis.style.ShadedRelief)9 Unit (javax.measure.Unit)7 Description (org.opengis.style.Description)7 OverlapBehavior (org.opengis.style.OverlapBehavior)7 GridCoverage (org.apache.sis.coverage.grid.GridCoverage)4 SimpleInternationalString (org.apache.sis.util.SimpleInternationalString)4 ExtensionSymbolizer (org.opengis.style.ExtensionSymbolizer)4 IOException (java.io.IOException)3 GridCoverage2D (org.apache.sis.coverage.grid.GridCoverage2D)3 MapLayer (org.apache.sis.portrayal.MapLayer)3