private static GmlStroke getGmlStroke(Element element) {
// TODO brush merge only if brushes are the same kind
// TODO have a "reset brush" parameter
GmlStroke gmlStroke = new GmlStroke();
// Get isDrawing value
try {
String isDrawing = element.getAttributeValue("isDrawing");
if (isDrawing.equalsIgnoreCase("false")) {
gmlStroke.setIsDrawing(false);
}
}
catch (Exception ex) {
}
try {
String layer = element.getAttributeValue("layer");
gmlStroke.setLayer(Integer.parseInt(layer));
}
catch (Exception ex) {
gmlStroke.setLayer(Integer.MIN_VALUE);
}
// Get info
GmlInfo gmlInfo = new GmlInfo();
Element infoElement = element.getChild("info");
if (null != infoElement) {
setGmlGenericContainer(infoElement.getChildren(), gmlInfo);
}
gmlStroke.setInfo(gmlInfo);
// Get Brush
GmlBrush gmlBrush = new GmlBrush();
Element brushElement = element.getChild("brush");
if (null != brushElement) {
setGmlGenericContainer(brushElement.getChildren(), gmlBrush);
}
gmlStroke.setBrush(gmlBrush);
// Get points
List<Element> points = element.getChildren("pt");
List<GmlPoint> gmlPoints = getGmlPoints(points);
gmlStroke.addPoints(gmlPoints);
return gmlStroke;
}