* @param element
* The element to retrieve the style from.
* @return The ShapeStyle object retrieved from the element.
*/
public static ShapeStyle retrieveShapeStyle(Element element) {
ShapeStyle style = new ShapeStyle();
// Check the "fill" child-element:
String filled = element.getAttribute("filled");
if ("true".equals(filled)) {
Element fill = element.getElementsByTagName("fill").getItem(0);
style.setFillColor(fill.getAttribute("color"));
style.setFillOpacity(Float.parseFloat(fill.getAttribute("opacity")));
}
// Check the "stroke" child-element:
String stroked = element.getAttribute("stroked");
if ("true".equals(stroked)) {
Element stroke = element.getElementsByTagName("stroke").getItem(0);
style.setFillColor(stroke.getAttribute("color"));
style.setFillOpacity(Float.parseFloat(stroke.getAttribute("opacity")));
style.setStrokeWidth(Integer.parseInt(stroke.getAttribute("strokeweight")));
}
return style;
}