/**
* Encodes a KML IconStyle + LineStyle from a polygon style and symbolizer.
*/
protected void setLineStyle(Style style, SimpleFeature feature, Stroke stroke) {
LineStyle ls = style.createAndSetLineStyle();
if (stroke != null) {
// opacity
Double opacity = stroke.getOpacity().evaluate(feature, Double.class);
if (opacity == null || Double.isNaN(opacity)) {
opacity = 1.0;
}
Color color = null;
Expression sc = stroke.getColor();
if (sc != null) {
color = (Color) sc.evaluate(feature, Color.class);
}
if (color == null) {
color = Color.DARK_GRAY;
}
ls.setColor(colorToHex(color, opacity));
// width
Double width = null;
Expression sw = stroke.getWidth();
if (sw != null) {
width = sw.evaluate(feature, Double.class);
}
if (width == null) {
width = 1d;
}
ls.setWidth(width);
} else {
// default
ls.setColor("ffaaaaaa");
ls.setWidth(1);
}
}