Search in sources :

Example 1 with Description

use of org.opengis.style.Description in project sldeditor by robward-scisys.

the class RuleRenderVisitor method visit.

/**
 * Visit.
 *
 * @param rule the rule
 */
/*
     * (non-Javadoc)
     * 
     * @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.Rule)
     */
@SuppressWarnings("deprecation")
@Override
public void visit(Rule rule) {
    Rule copy = null;
    Symbolizer[] symsCopy = null;
    if (!displayOverall) {
        if ((symbolizerIndex >= 0) && (symbolizerIndex < rule.getSymbolizers().length)) {
            symsCopy = new Symbolizer[1];
            symsCopy[0] = copy(rule.getSymbolizers()[symbolizerIndex]);
        }
    }
    // As a catch all copy everything
    if (symsCopy == null) {
        symsCopy = rule.getSymbolizers();
        for (int i = 0; i < symsCopy.length; i++) {
            symsCopy[i] = copy(symsCopy[i]);
        }
    }
    Graphic[] legendCopy = rule.getLegendGraphic();
    for (int i = 0; i < legendCopy.length; i++) {
        legendCopy[i] = copy(legendCopy[i]);
    }
    Description descCopy = rule.getDescription();
    descCopy = copy(descCopy);
    copy = sf.createRule();
    copy.setSymbolizers(symsCopy);
    copy.setDescription(descCopy);
    copy.setLegendGraphic(legendCopy);
    copy.setName(rule.getName());
    Filter filterCopy = null;
    copy.setFilter(filterCopy);
    copy.setElseFilter(rule.isElseFilter());
    if (STRICT && !copy.equals(rule)) {
        throw new IllegalStateException("Was unable to duplicate provided Rule:" + rule);
    }
    pages.push(copy);
}
Also used : Description(org.opengis.style.Description) Filter(org.opengis.filter.Filter) Graphic(org.geotools.styling.Graphic) Rule(org.geotools.styling.Rule) Symbolizer(org.geotools.styling.Symbolizer) LineSymbolizer(org.geotools.styling.LineSymbolizer) PointSymbolizer(org.geotools.styling.PointSymbolizer) RasterSymbolizer(org.geotools.styling.RasterSymbolizer) PolygonSymbolizer(org.geotools.styling.PolygonSymbolizer) TextSymbolizer(org.geotools.styling.TextSymbolizer)

Aggregations

Graphic (org.geotools.styling.Graphic)1 LineSymbolizer (org.geotools.styling.LineSymbolizer)1 PointSymbolizer (org.geotools.styling.PointSymbolizer)1 PolygonSymbolizer (org.geotools.styling.PolygonSymbolizer)1 RasterSymbolizer (org.geotools.styling.RasterSymbolizer)1 Rule (org.geotools.styling.Rule)1 Symbolizer (org.geotools.styling.Symbolizer)1 TextSymbolizer (org.geotools.styling.TextSymbolizer)1 Filter (org.opengis.filter.Filter)1 Description (org.opengis.style.Description)1