Search in sources :

Example 6 with LineSymbolizer

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

the class Styles method colorLine.

public static MutableStyle colorLine() {
    // general informations
    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 offset = LITERAL_ZERO_FLOAT;
    // the visual element
    final Expression color = SF.literal(Color.BLUE);
    final Expression width = FF.literal(4);
    final Expression opacity = LITERAL_ONE_FLOAT;
    final Stroke stroke = SF.stroke(color, width, opacity);
    final LineSymbolizer symbolizer = SF.lineSymbolizer(name, geometry, desc, unit, stroke, offset);
    final MutableStyle style = SF.style(symbolizer);
    return style;
}
Also used : Stroke(org.opengis.style.Stroke) GraphicStroke(org.opengis.style.GraphicStroke) Description(org.opengis.style.Description) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) LineSymbolizer(org.opengis.style.LineSymbolizer) Unit(javax.measure.Unit)

Example 7 with LineSymbolizer

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

the class Styles method uomLine.

public static MutableStyle uomLine() throws URISyntaxException {
    // general informations
    final String name = "mySymbol";
    final Description desc = DEFAULT_DESCRIPTION;
    // use the default geometry of the feature
    final String geometry = null;
    final Unit unit = Units.METRE;
    final Expression offset = LITERAL_ZERO_FLOAT;
    // the visual element
    final Expression color = SF.literal(Color.BLUE);
    final Expression width = FF.literal(400);
    final Expression opacity = LITERAL_ONE_FLOAT;
    final Stroke stroke = SF.stroke(color, width, opacity);
    final LineSymbolizer symbolizer = SF.lineSymbolizer(name, geometry, desc, unit, stroke, offset);
    final MutableStyle style = SF.style(symbolizer);
    return style;
}
Also used : Stroke(org.opengis.style.Stroke) GraphicStroke(org.opengis.style.GraphicStroke) Description(org.opengis.style.Description) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) LineSymbolizer(org.opengis.style.LineSymbolizer) Unit(javax.measure.Unit)

Example 8 with LineSymbolizer

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

the class GTtoSE100Transformer method visit.

/**
 * Transform a GT raster symbolizer in jaxb raster symbolizer.
 */
@Override
public JAXBElement<org.geotoolkit.sld.xml.v100.RasterSymbolizer> visit(final RasterSymbolizer raster, final Object data) {
    final org.geotoolkit.sld.xml.v100.RasterSymbolizer tst = sld_factory_v100.createRasterSymbolizer();
    tst.setGeometry(visitGeometryType(raster.getGeometryPropertyName()));
    if (raster.getChannelSelection() != null) {
        tst.setChannelSelection(visit(raster.getChannelSelection(), null));
    }
    if (raster.getColorMap() != null) {
        tst.setColorMap(visit(raster.getColorMap(), null));
    }
    if (raster.getContrastEnhancement() != null) {
        tst.setContrastEnhancement(visit(raster.getContrastEnhancement(), null));
    }
    if (raster.getImageOutline() != null) {
        final org.geotoolkit.sld.xml.v100.ImageOutline iot = sld_factory_v100.createImageOutline();
        if (raster.getImageOutline() instanceof LineSymbolizer) {
            final LineSymbolizer ls = (LineSymbolizer) raster.getImageOutline();
            iot.setLineSymbolizer(visit(ls, null).getValue());
            tst.setImageOutline(iot);
        } else if (raster.getImageOutline() instanceof PolygonSymbolizer) {
            final PolygonSymbolizer ps = (PolygonSymbolizer) raster.getImageOutline();
            iot.setPolygonSymbolizer(visit(ps, null).getValue());
            tst.setImageOutline(iot);
        }
    }
    tst.setOpacity(visitExpression(raster.getOpacity()));
    if (raster.getOverlapBehavior() != null) {
        tst.setOverlapBehavior(visit(raster.getOverlapBehavior(), null));
    }
    if (raster.getShadedRelief() != null) {
        tst.setShadedRelief(visit(raster.getShadedRelief(), null));
    }
    return sld_factory_v100.createRasterSymbolizer(tst);
}
Also used : PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer)

Example 9 with LineSymbolizer

use of org.opengis.style.LineSymbolizer 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 10 with LineSymbolizer

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

the class GTtoSE110Transformer method visit.

/**
 * Transform a GT raster symbolizer in jaxb raster symbolizer.
 */
@Override
public JAXBElement<RasterSymbolizerType> visit(final RasterSymbolizer raster, final Object data) {
    final RasterSymbolizerType tst = se_factory.createRasterSymbolizerType();
    tst.setName(raster.getName());
    tst.setDescription(visit(raster.getDescription(), null));
    tst.setUom(visitUOM(raster.getUnitOfMeasure()));
    tst.setGeometry(visitExpression(raster.getGeometry()));
    if (raster.getChannelSelection() != null) {
        tst.setChannelSelection(visit(raster.getChannelSelection(), null));
    }
    if (raster.getColorMap() != null) {
        tst.setColorMap(visit(raster.getColorMap(), null));
    }
    if (raster.getContrastEnhancement() != null) {
        tst.setContrastEnhancement(visit(raster.getContrastEnhancement(), null));
    }
    if (raster.getImageOutline() != null) {
        final ImageOutlineType iot = se_factory.createImageOutlineType();
        if (raster.getImageOutline() instanceof LineSymbolizer) {
            final LineSymbolizer ls = (LineSymbolizer) raster.getImageOutline();
            iot.setLineSymbolizer(visit(ls, null).getValue());
            tst.setImageOutline(iot);
        } else if (raster.getImageOutline() instanceof PolygonSymbolizer) {
            final PolygonSymbolizer ps = (PolygonSymbolizer) raster.getImageOutline();
            iot.setPolygonSymbolizer(visit(ps, null).getValue());
            tst.setImageOutline(iot);
        }
    }
    tst.setOpacity(visitExpression(raster.getOpacity()));
    if (raster.getOverlapBehavior() != null) {
        tst.setOverlapBehavior(visit(raster.getOverlapBehavior(), null));
    }
    if (raster.getShadedRelief() != null) {
        tst.setShadedRelief(visit(raster.getShadedRelief(), null));
    }
    return se_factory.createRasterSymbolizer(tst);
}
Also used : PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) ImageOutlineType(org.geotoolkit.se.xml.v110.ImageOutlineType) RasterSymbolizerType(org.geotoolkit.se.xml.v110.RasterSymbolizerType)

Aggregations

LineSymbolizer (org.opengis.style.LineSymbolizer)18 PolygonSymbolizer (org.opengis.style.PolygonSymbolizer)9 Stroke (org.opengis.style.Stroke)8 MutableStyle (org.geotoolkit.style.MutableStyle)7 PointSymbolizer (org.opengis.style.PointSymbolizer)7 Unit (javax.measure.Unit)6 Expression (org.opengis.filter.Expression)6 Description (org.opengis.style.Description)6 TextSymbolizer (org.opengis.style.TextSymbolizer)6 ArrayList (java.util.ArrayList)5 GraphicStroke (org.opengis.style.GraphicStroke)5 GraphicalSymbol (org.opengis.style.GraphicalSymbol)4 RasterSymbolizer (org.opengis.style.RasterSymbolizer)4 ExtensionSymbolizer (org.opengis.style.ExtensionSymbolizer)3 Fill (org.opengis.style.Fill)3 Graphic (org.opengis.style.Graphic)3 Symbolizer (org.opengis.style.Symbolizer)3 Color (java.awt.Color)2 JAXBElement (javax.xml.bind.JAXBElement)2 Marshaller (javax.xml.bind.Marshaller)2