use of org.geotools.styling.LineSymbolizer in project polymap4-core by Polymap4.
the class LineStyleSerializer method serialize.
@Override
public void serialize(LineStyle style, FeatureTypeStyle fts) {
accessor.set(rule -> rule.symbolizers().stream().map(s -> (LineSymbolizer) s).collect(Collectors.toList()));
// inner line: 2nd LineSymbolizer
style.fill.opt().ifPresent(fillStroke -> {
new StrokeCompositeSerializer(context).accessor.put(rule -> accessor.get().apply(rule).get(1).getStroke()).serialize(fillStroke, fts);
});
// stroke line: 1st LineSymbolizer
style.stroke.opt().ifPresent(outerStroke -> {
set(fts, outerStroke.width, (value, syms) -> {
Literal innerWidth = (Literal) syms.get(1).getStroke().getWidth();
syms.get(0).getStroke().setWidth(ff.add(ff.multiply(value, ff.literal(2)), innerWidth));
});
set(fts, outerStroke.color, (value, syms) -> syms.get(0).getStroke().setColor(value));
set(fts, outerStroke.opacity, (value, syms) -> syms.get(0).getStroke().setOpacity(value));
// XXX linestyle
});
}
Aggregations