package tim.prune.save; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JScrollPane; import javax.swing.JTable; import tim.prune.ExternalTools; import tim.prune.I18nManager; import tim.prune.data.Altitude; import tim.prune.data.Coordinate; import tim.prune.data.DataPoint; import tim.prune.data.Photo; import tim.prune.data.PhotoList; import tim.prune.data.PhotoStatus; /** * Class to call Exiftool to save coordinate information in jpg files */ public class ExifSaver implements Runnable { private Frame _parentFrame = null; private JDialog _dialog = null; private JCheckBox _overwriteCheckbox = null; private JProgressBar _progressBar = null; private PhotoTableModel _photoTableModel = null; // To preserve timestamps of file use parameter -P // To overwrite file (careful!) use parameter -overwrite_original_in_place // To read all GPS tags, use -GPS:All // To delete all GPS tags, use -GPS:All= // To set Altitude, use -GPSAltitude= and -GPSAltitudeRef= // To set Latitude, use -GPSLatitude= and -GPSLatitudeRef= // To delete all tags with overwrite: exiftool -P -overwrite_original_in_place -GPS:All= // To set altitude with overwrite: exiftool -P -overwrite_original_in_place -GPSAltitude=1234 -GPSAltitudeRef='Above Sea Level' // (setting altitude ref to 0 doesn't work) // To set latitude with overwrite: exiftool -P -overwrite_original_in_place -GPSLatitude='12 34 56.78' -GPSLatitudeRef=N // (latitude as space-separated deg min sec, reference as either N or S) // Same for longitude, reference E or W /** * Constructor * @param inParentFrame parent frame */ public ExifSaver(Frame inParentFrame) { _parentFrame = inParentFrame; } /** * Save exif information to all photos in the list * whose coordinate information has changed since loading * @param inPhotoList list of photos to save * @return true if saved */ public boolean saveExifInformation(PhotoList inPhotoList) { // Check if external exif tool can be called boolean exifToolInstalled = ExternalTools.isExiftoolInstalled(); if (!exifToolInstalled) { // show warning int answer = JOptionPane.showConfirmDialog(_dialog, I18nManager.getText("dialog.saveexif.noexiftool"), I18nManager.getText("dialog.saveexif.title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (answer == JOptionPane.NO_OPTION || answer == JOptionPane.CLOSED_OPTION) { return false; } } // Make model and add all photos to it _photoTableModel = new PhotoTableModel(inPhotoList.getNumPhotos()); for (int i=0; i