use of org.polymap.core.style.model.feature.FilterStyleProperty in project polymap4-core by Polymap4.
the class StyleCompositeSerializer method defaultFeatureTypeStyle.
protected FeatureTypeStyle defaultFeatureTypeStyle(org.geotools.styling.Style result, Style style, Symbolizer... symbolizers) {
Rule rule = sf.createRule();
// handle visibleIf
FilterStyleProperty visibleIf = (FilterStyleProperty) style.visibleIf.get();
if (visibleIf instanceof ScaleRangeFilter) {
rule.setMinScaleDenominator(((ScaleRangeFilter) visibleIf).minScale.get());
rule.setMaxScaleDenominator(((ScaleRangeFilter) visibleIf).maxScale.get());
} else if (visibleIf instanceof ConstantFilter) {
Filter filter = ((ConstantFilter) visibleIf).filter();
if (!filter.equals(Filter.INCLUDE)) {
rule.setFilter(filter);
}
} else {
throw new RuntimeException("Unhandled Style.visibleIf type: " + visibleIf.getClass());
}
for (Symbolizer s : symbolizers) {
rule.symbolizers().add(s);
}
;
FeatureTypeStyle fts = sf.createFeatureTypeStyle();
fts.rules().add(rule);
result.featureTypeStyles().add(fts);
return fts;
}
Aggregations