crop = ECrop.NONE;
maxCrop=0;
}
String type = image.getAttributeValue("type");
Element polygons = image.getChild("polygons");
ImageData imgData = new ImageData(name, crop, maxCrop);
if (polygons!=null){ // it might be an image definition without any polygons defined
List<Element> polygonList = polygons.getChildren("polygon");
for (Element polygon : polygonList) {
String name2 = polygon.getAttributeValue("name");
NamedPolygon poly = new NamedPolygon(name2);
int zIndex = 1;
if (polygon.getAttribute("z-index")!=null){
zIndex = Integer.parseInt(polygon.getAttributeValue("z-index"));
}
List<Element> points = polygon.getChildren("point");
for (Element point : points) {
int x = Integer.parseInt(point.getAttributeValue("x"));
int y = Integer.parseInt(point.getAttributeValue("y"));
poly.addPoint(x, y);
}
imgData.addPolygon(poly,zIndex);
} // end <polygon>
} // end extracting all <polygons>
// Load the image
parseImageDefinitionAndLoad(type, imgData);
} // end extracting <image>