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);
}
Aggregations