for (int i=0; i<imgNodes.getLength(); ++i) {
Node imgNode = imgNodes.item(i);
if (imgNode.getNodeType() == Node.ELEMENT_NODE) {
Element imgElem = (Element) imgNode;
if ("geoimage".equals(imgElem.getTagName())) {
ImageEntry entry = new ImageEntry();
NodeList attrNodes = imgElem.getChildNodes();
for (int j=0; j<attrNodes.getLength(); ++j) {
Node attrNode = attrNodes.item(j);
if (attrNode.getNodeType() == Node.ELEMENT_NODE) {
Element attrElem = (Element) attrNode;
try {
switch(attrElem.getTagName()) {
case "file":
entry.setFile(new File(attrElem.getTextContent()));
break;
case "position":
double lat = Double.parseDouble(attrElem.getAttribute("lat"));
double lon = Double.parseDouble(attrElem.getAttribute("lon"));
entry.setPos(new LatLon(lat, lon));
break;
case "speed":
entry.setSpeed(Double.parseDouble(attrElem.getTextContent()));
break;
case "elevation":
entry.setElevation(Double.parseDouble(attrElem.getTextContent()));
break;
case "gps-time":
entry.setGpsTime(new Date(Long.parseLong(attrElem.getTextContent())));
break;
case "exif-orientation":
entry.setExifOrientation(Integer.parseInt(attrElem.getTextContent()));
break;
case "exif-time":
entry.setExifTime(new Date(Long.parseLong(attrElem.getTextContent())));
break;
case "exif-gps-time":
entry.setExifGpsTime(new Date(Long.parseLong(attrElem.getTextContent())));
break;
case "exif-coordinates":
entry.setExifCoor(new LatLon(
Double.parseDouble(attrElem.getAttribute("lat")),
Double.parseDouble(attrElem.getAttribute("lon"))));
break;
case "exif-image-direction":
entry.setExifImgDir(Double.parseDouble(attrElem.getTextContent()));
break;
case "is-new-gps-data":
if (Boolean.parseBoolean(attrElem.getTextContent())) {
entry.flagNewGpsData();
}
}
// TODO: handle thumbnail loading
} catch (NumberFormatException e) {
// nothing