public static Annotation GetAnnotation(Properties attributes) {
float llx = 0, lly = 0, urx = 0, ury = 0;
String value;
value = attributes[ElementTags.LLX];
if (value != null) {
llx = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
value = attributes[ElementTags.LLY];
if (value != null) {
lly = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
value = attributes[ElementTags.URX];
if (value != null) {
urx = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
value = attributes[ElementTags.URY];
if (value != null) {
ury = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
String title = attributes[ElementTags.TITLE];
String text = attributes[ElementTags.CONTENT];
if (title != null || text != null) {
return new Annotation(title, text, llx, lly, urx, ury);
}
value = attributes[ElementTags.URL];
if (value != null) {
return new Annotation(llx, lly, urx, ury, value);
}
value = attributes[ElementTags.NAMED];
if (value != null) {
return new Annotation(llx, lly, urx, ury, int.Parse(value));
}
String file = attributes[ElementTags.FILE];
String destination = attributes[ElementTags.DESTINATION];
String page = (String) attributes.Remove(ElementTags.PAGE);
if (file != null) {
if (destination != null) {
return new Annotation(llx, lly, urx, ury, file, destination);
}
if (page != null) {
return new Annotation(llx, lly, urx, ury, file, int.Parse(page));
}
}
if (title == null)
title = "";
if (text == null)
text = "";
return new Annotation(title, text, llx, lly, urx, ury);
}
}