UserLayer layer = (UserLayer) sld.getStyledLayers()[0];
return layer.getUserStyles()[0];
}
Style createTestStyle() throws IllegalFilterException {
StyleFactory sFac = CommonFactoryFinder.getStyleFactory(null);
// The following is complex, and should be built from
// an SLD document and not by hand
PointSymbolizer pointsym = sFac.createPointSymbolizer();
pointsym.setGraphic(sFac.getDefaultGraphic());
Rule rule = sFac.createRule();
rule.setSymbolizers(new Symbolizer[] { polysym(sFac) });
FeatureTypeStyle fts = sFac.createFeatureTypeStyle(new Rule[] { rule });
fts.setFeatureTypeName("polygonfeature");
Rule rule1 = sFac.createRule();
rule.setSymbolizers(new Symbolizer[] { polysym(sFac) });
FeatureTypeStyle fts1 = sFac
.createFeatureTypeStyle(new Rule[] { rule1 });
fts1.setFeatureTypeName("polygonfeature");
Rule rule2 = sFac.createRule();
rule2.setSymbolizers(new Symbolizer[] { linesym(sFac) });
FeatureTypeStyle fts2 = sFac.createFeatureTypeStyle();
fts2.setRules(new Rule[] { rule2 });
fts2.setFeatureTypeName("linefeature");
Rule rule3 = sFac.createRule();
rule3.setSymbolizers(new Symbolizer[] { pointsym });
FeatureTypeStyle fts3 = sFac.createFeatureTypeStyle();
fts3.setRules(new Rule[] { rule3 });
fts3.setFeatureTypeName("pointfeature");
Rule rule4 = sFac.createRule();
rule4.setSymbolizers(new Symbolizer[] { polysym(sFac), linesym(sFac) });
FeatureTypeStyle fts4 = sFac.createFeatureTypeStyle();
fts4.setRules(new Rule[] { rule4 });
fts4.setFeatureTypeName("collFeature");
Rule rule5 = sFac.createRule();
rule5.setSymbolizers(new Symbolizer[] { linesym(sFac) });
FeatureTypeStyle fts5 = sFac.createFeatureTypeStyle();
fts5.setRules(new Rule[] { rule5 });
fts5.setFeatureTypeName("ringFeature");
Style style = sFac.createStyle();
style.setFeatureTypeStyles(new FeatureTypeStyle[] { fts1, fts, fts2,
fts3, fts4, fts5 });
return style;
}