LOGGER.info("Empty PolygonSymbolizer, using default fill and stroke.");
}
final StringBuffer styleString = new StringBuffer();
PolygonSymbolizer polySym = (PolygonSymbolizer) sym;
// ** LABEL **
styleString.append("<IconStyle>");
if (!vectorNameDescription) { // if they don't want
// attributes
styleString.append("<color>#00ffffff</color>"); // fully
// transparent
}
styleString.append("<Icon><href>root://icons/palette-3.png</href><x>224</x><w>32</w><h>32</h></Icon>");
styleString.append("</IconStyle>");
// ** FILL **
styleString.append("<PolyStyle><color>");
if (polySym.getFill() != null) // if they specified a fill
{
int opacity = 255; // default to full opacity
if (polySym.getFill().getOpacity() != null) {
float op = getOpacity(polySym.getFill().getOpacity());
opacity = (new Float(255 * op)).intValue();
}
Paint p = ((PolygonStyle2D) style).getFill();
if (p instanceof Color) {
styleString.append("#").append(intToHex(opacity)).append(
colorToHex((Color) p)); // transparancy needs to
// come from the opacity
// value.
} else {
styleString.append("#ffaaaaaa"); // should not occure in
// normal parsing
}
} else { // no fill specified, make transparent
styleString.append("#00aaaaaa");
}
// if there is an outline, specify that we have one, then style it
styleString.append("</color>");
if (polySym.getStroke() != null) {
styleString.append("<outline>1</outline>");
} else {
styleString.append("<outline>0</outline>");
}
styleString.append("</PolyStyle>");
// ** OUTLINE **
if (polySym.getStroke() != null) // if there is an outline
{
styleString.append("<LineStyle><color>");
int opacity = 255; // default to full opacity
if (polySym.getStroke().getOpacity() != null) {
float op = getOpacity(polySym.getStroke().getOpacity());
opacity = (new Float(255 * op)).intValue();
}
Paint p = ((PolygonStyle2D) style).getContour();
if (p instanceof Color) {
styleString.append("#").append(intToHex(opacity)).append(
colorToHex((Color) p)); // transparancy needs to
// come from the opacity
// value.
} else {
styleString.append("#ffaaaaaa"); // should not occure in
// normal parsing
}
styleString.append("</color>");
// stroke width
if (polySym.getStroke().getWidth() != null) {
int width = getWidth(polySym.getStroke().getWidth());
styleString.append("<width>").append(width).append(
"</width>");
}
styleString.append("</LineStyle>");