@Override public void windowDeactivated(WindowEvent e) { int result = checkAndSave(); switch (result) { case NOTHING: break; case CANCEL: if (yLayer != null) { if (yLayer.data != null) { for (ImageEntry ie : yLayer.data) { ie.discardTmp(); } } yLayer.updateBufferAndRepaint(); } break; case AGAIN: actionPerformed(null); break; case DONE: Main.pref.put("geoimage.timezone", formatTimezone(timezone)); Main.pref.put("geoimage.delta", Long.toString(delta * 1000)); Main.pref.put("geoimage.showThumbs", yLayer.useThumbs); yLayer.useThumbs = cbShowThumbs.isSelected(); yLayer.startLoadThumbs(); // Search whether an other layer has yet defined some bounding box. // If none, we'll zoom to the bounding box of the layer with the photos. boolean boundingBoxedLayerFound = false; for (Layer l : Main.map.mapView.getAllLayers()) { if (l != yLayer) { BoundingXYVisitor bbox = new BoundingXYVisitor(); l.visitBoundingBox(bbox); if (bbox.getBounds() != null) { boundingBoxedLayerFound = true; break; } } } if (!boundingBoxedLayerFound) { BoundingXYVisitor bbox = new BoundingXYVisitor(); yLayer.visitBoundingBox(bbox); Main.map.mapView.zoomTo(bbox); } if (yLayer.data != null) { for (ImageEntry ie : yLayer.data) { ie.applyTmp(); } } yLayer.updateBufferAndRepaint(); break; default: throw new IllegalStateException(); } }
private String statusText() { try { timezone = parseTimezone(tfTimezone.getText().trim()); delta = parseOffset(tfOffset.getText().trim()); } catch (ParseException e) { return e.getMessage(); } // The selection of images we are about to correlate may have changed. // So reset all images. if (yLayer.data != null) { for (ImageEntry ie : yLayer.data) { ie.discardTmp(); } } // Construct a list of images that have a date, and sort them on the date. List<ImageEntry> dateImgLst = getSortedImgList(); // Create a temporary copy for each image for (ImageEntry ie : dateImgLst) { ie.createTmp(); ie.tmp.setPos(null); } GpxDataWrapper selGpx = selectedGPX(false); if (selGpx == null) return tr("No gpx selected"); final long offset_ms = ((long) (timezone * 3600) + delta) * 1000; // in milliseconds lastNumMatched = matchGpxTrack(dateImgLst, selGpx.data, offset_ms); return trn( "<html>Matched <b>{0}</b> of <b>{1}</b> photo to GPX track.</html>", "<html>Matched <b>{0}</b> of <b>{1}</b> photos to GPX track.</html>", dateImgLst.size(), lastNumMatched, dateImgLst.size()); }