Search in sources :

Example 1 with SymbolizerType

use of org.geotoolkit.se.xml.v110.SymbolizerType in project geotoolkit by Geomatys.

the class SE110toGTTransformer method visitRule.

/**
 * Trasnform SLD v1.1 rule in GT Rule.
 */
public MutableRule visitRule(final org.geotoolkit.se.xml.v110.RuleType rt) throws FactoryException {
    final MutableRule rule = styleFactory.rule();
    rule.setName(rt.getName());
    rule.setDescription(visitDescription(rt.getDescription()));
    rule.setElseFilter(rt.getElseFilter() != null);
    rule.setFilter(visitFilter(rt.getFilter()));
    rule.setLegendGraphic(visitLegend(rt.getLegendGraphic()));
    rule.setMaxScaleDenominator((rt.getMaxScaleDenominator() == null) ? Double.MAX_VALUE : rt.getMaxScaleDenominator());
    rule.setMinScaleDenominator((rt.getMinScaleDenominator() == null) ? 0 : rt.getMinScaleDenominator());
    if (rt.getSymbolizer() == null || rt.getSymbolizer().isEmpty()) {
    } else {
        for (final JAXBElement<?> jax : rt.getSymbolizer()) {
            final Object st = jax.getValue();
            if (st == null) {
                continue;
            } else if (st instanceof SymbolizerType) {
                rule.symbolizers().add(visit((SymbolizerType) st));
            } else if (st instanceof Symbolizer) {
                rule.symbolizers().add((Symbolizer) st);
            }
        }
    }
    return rule;
}
Also used : MutableRule(org.geotoolkit.style.MutableRule) PointSymbolizerType(org.geotoolkit.se.xml.v110.PointSymbolizerType) SymbolizerType(org.geotoolkit.se.xml.v110.SymbolizerType) TextSymbolizerType(org.geotoolkit.se.xml.v110.TextSymbolizerType) LineSymbolizerType(org.geotoolkit.se.xml.v110.LineSymbolizerType) RasterSymbolizerType(org.geotoolkit.se.xml.v110.RasterSymbolizerType) PolygonSymbolizerType(org.geotoolkit.se.xml.v110.PolygonSymbolizerType) 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)

Example 2 with SymbolizerType

use of org.geotoolkit.se.xml.v110.SymbolizerType in project geotoolkit by Geomatys.

the class SE110toGTTransformer method visitRanges.

// Sub elements -------------------------------------------------------------
public Map<Expression, List<Symbolizer>> visitRanges(final List<JAXBElement<RangeType>> types) {
    final Map<Expression, List<Symbolizer>> ranges = new LinkedHashMap<Expression, List<Symbolizer>>();
    for (final JAXBElement<RangeType> type : types) {
        final RangeType rt = type.getValue();
        final Expression exp = visitExpression(rt.getThreshold());
        final List<Symbolizer> symbols = new ArrayList<Symbolizer>();
        for (final JAXBElement<? extends SymbolizerType> jst : rt.getSymbolizer()) {
            final SymbolizerType st = jst.getValue();
            if (st == null)
                continue;
            symbols.add(visit(st));
        }
        ranges.put(exp, symbols);
    }
    return ranges;
}
Also used : RangeType(org.geotoolkit.se.xml.vext.RangeType) Expression(org.opengis.filter.Expression) ArrayList(java.util.ArrayList) PointSymbolizerType(org.geotoolkit.se.xml.v110.PointSymbolizerType) SymbolizerType(org.geotoolkit.se.xml.v110.SymbolizerType) TextSymbolizerType(org.geotoolkit.se.xml.v110.TextSymbolizerType) LineSymbolizerType(org.geotoolkit.se.xml.v110.LineSymbolizerType) RasterSymbolizerType(org.geotoolkit.se.xml.v110.RasterSymbolizerType) PolygonSymbolizerType(org.geotoolkit.se.xml.v110.PolygonSymbolizerType) ArrayList(java.util.ArrayList) List(java.util.List) 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) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with SymbolizerType

use of org.geotoolkit.se.xml.v110.SymbolizerType in project geotoolkit by Geomatys.

the class SE110toGTTransformer method visitSymbolizers.

// Symbolizers---------------------------------------------------------------
/**
 * Transform a SLD v1.1 symbolizers in GT Symbolizers.
 */
public Collection<? extends Symbolizer> visitSymbolizers(final List<JAXBElement<? extends SymbolizerType>> objs) {
    if (objs == null || objs.isEmpty()) {
        return Collections.emptyList();
    }
    final Collection<Symbolizer> rs = new ArrayList<Symbolizer>();
    for (JAXBElement<? extends SymbolizerType> jax : objs) {
        final SymbolizerType st = jax.getValue();
        if (st == null)
            continue;
        rs.add(visit(st));
    }
    return rs;
}
Also used : ArrayList(java.util.ArrayList) PointSymbolizerType(org.geotoolkit.se.xml.v110.PointSymbolizerType) SymbolizerType(org.geotoolkit.se.xml.v110.SymbolizerType) TextSymbolizerType(org.geotoolkit.se.xml.v110.TextSymbolizerType) LineSymbolizerType(org.geotoolkit.se.xml.v110.LineSymbolizerType) RasterSymbolizerType(org.geotoolkit.se.xml.v110.RasterSymbolizerType) PolygonSymbolizerType(org.geotoolkit.se.xml.v110.PolygonSymbolizerType) 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)

Aggregations

LineSymbolizerType (org.geotoolkit.se.xml.v110.LineSymbolizerType)3 PointSymbolizerType (org.geotoolkit.se.xml.v110.PointSymbolizerType)3 PolygonSymbolizerType (org.geotoolkit.se.xml.v110.PolygonSymbolizerType)3 RasterSymbolizerType (org.geotoolkit.se.xml.v110.RasterSymbolizerType)3 SymbolizerType (org.geotoolkit.se.xml.v110.SymbolizerType)3 TextSymbolizerType (org.geotoolkit.se.xml.v110.TextSymbolizerType)3 LineSymbolizer (org.opengis.style.LineSymbolizer)3 PointSymbolizer (org.opengis.style.PointSymbolizer)3 PolygonSymbolizer (org.opengis.style.PolygonSymbolizer)3 RasterSymbolizer (org.opengis.style.RasterSymbolizer)3 Symbolizer (org.opengis.style.Symbolizer)3 TextSymbolizer (org.opengis.style.TextSymbolizer)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 RangeType (org.geotoolkit.se.xml.vext.RangeType)1 MutableRule (org.geotoolkit.style.MutableRule)1 Expression (org.opengis.filter.Expression)1