Ignore:
Timestamp:
2009-12-07T21:16:15+01:00 (14 years ago)
Author:
bastiK
Message:

geoimage: make thumbnails optional + cosmetics (see #4101)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r2566 r2592  
    3737import javax.swing.ButtonGroup;
    3838import javax.swing.JButton;
     39import javax.swing.JCheckBox;
    3940import javax.swing.JComboBox;
    4041import javax.swing.JFileChooser;
     
    149150                            if (!sel.getName().equals(wrapper.name)) {
    150151                                JOptionPane.showMessageDialog(
    151                                                 Main.parent,
     152                                        Main.parent,
    152153                                        tr("File {0} is loaded yet under the name \"{1}\"", sel.getName(), wrapper.name),
    153154                                        tr("Error"),
     
    173174                    x.printStackTrace();
    174175                    JOptionPane.showMessageDialog(
    175                                 Main.parent,
    176                                 tr("Error while parsing {0}",sel.getName())+": "+x.getMessage(),
    177                                 tr("Error"),
    178                                 JOptionPane.ERROR_MESSAGE
    179                                 );
     176                            Main.parent,
     177                            tr("Error while parsing {0}",sel.getName())+": "+x.getMessage(),
     178                            tr("Error"),
     179                            JOptionPane.ERROR_MESSAGE
     180                            );
    180181                    return;
    181182                } catch (IOException x) {
    182183                    x.printStackTrace();
    183184                    JOptionPane.showMessageDialog(
    184                                 Main.parent,
    185                                 tr("Could not read \"{0}\"",sel.getName())+"\n"+x.getMessage(),
    186                                 tr("Error"),
    187                                 JOptionPane.ERROR_MESSAGE
    188                                 );
     185                            Main.parent,
     186                            tr("Could not read \"{0}\"",sel.getName())+"\n"+x.getMessage(),
     187                            tr("Error"),
     188                            JOptionPane.ERROR_MESSAGE
     189                            );
    189190                    return;
    190191                }
     
    293294            cbTimezones = new JComboBox(vtTimezones);
    294295
    295             String tzId = Main.pref.get("tagimages.timezoneid", "");
     296            String tzId = Main.pref.get("geoimage.timezoneid", "");
    296297            TimeZone defaultTz;
    297298            if (tzId.length() == 0) {
     
    351352
    352353                public void actionPerformed(ActionEvent arg0) {
    353                     JFileChooser fc = new JFileChooser(Main.pref.get("tagimages.lastdirectory"));
     354                    JFileChooser fc = new JFileChooser(Main.pref.get("geoimage.lastdirectory"));
    354355                    fc.setAcceptAllFileFilterUsed(false);
    355356                    fc.setMultiSelectionEnabled(false);
     
    387388            while (! isOk) {
    388389                int answer = JOptionPane.showConfirmDialog(
    389                                 Main.parent, panel,
    390                                 tr("Synchronize time from a photo of the GPS receiver"),
    391                                 JOptionPane.OK_CANCEL_OPTION,
    392                                 JOptionPane.QUESTION_MESSAGE
    393                                 );
     390                        Main.parent, panel,
     391                        tr("Synchronize time from a photo of the GPS receiver"),
     392                        JOptionPane.OK_CANCEL_OPTION,
     393                        JOptionPane.QUESTION_MESSAGE
     394                        );
    394395                if (answer == JOptionPane.CANCEL_OPTION) {
    395396                    return;
     
    413414                String tzValue = selectedTz.substring(pos + 1, selectedTz.length() - 1);
    414415
    415                 Main.pref.put("tagimages.timezoneid", tzId);
     416                Main.pref.put("geoimage.timezoneid", tzId);
    416417                tfOffset.setText(Long.toString(delta / 1000));
    417418                tfTimezone.setText(tzValue);
     
    476477        panelTf.add(new JLabel(tr("Timezone: ")), gc);
    477478
    478         float gpstimezone = Float.parseFloat(Main.pref.get("tagimages.doublegpstimezone", "0.0"));
     479        float gpstimezone = Float.parseFloat(Main.pref.get("geoimage.doublegpstimezone", "0.0"));
    479480        if (gpstimezone == 0.0) {
    480             gpstimezone = - Long.parseLong(Main.pref.get("tagimages.gpstimezone", "0"));
     481            gpstimezone = - Long.parseLong(Main.pref.get("geoimage.gpstimezone", "0"));
    481482        }
    482483        tfTimezone = new JTextField();
     
    498499        panelTf.add(new JLabel(tr("Offset:")), gc);
    499500
    500         long delta = Long.parseLong(Main.pref.get("tagimages.delta", "0")) / 1000;
     501        long delta = Long.parseLong(Main.pref.get("geoimage.delta", "0")) / 1000;
    501502        tfOffset = new JTextField();
    502503        tfOffset.setText(Long.toString(delta));
     
    557558        panelTf.add(rbUntaggedImg, gc);
    558559
     560        gc.gridx = 0;
     561        gc.gridy = 5;
     562        gc.gridwidth = 2;
     563        gc.gridheight = 1;
     564        gc.fill = GridBagConstraints.NONE;
     565        gc.weightx = gc.weighty = 0.0;
     566        yLayer.loadThumbs = Main.pref.getBoolean("geoimage.showThumbs", false);
     567        JCheckBox cbShowThumbs = new JCheckBox(tr("Show Thumbnail images on the map"), yLayer.loadThumbs);
     568        panelTf.add(cbShowThumbs, gc);
     569
    559570        ButtonGroup group = new ButtonGroup();
    560571        group.add(rbAllImg);
     
    573584        GpxDataWrapper selectedGpx = null;
    574585        while (! isOk) {
    575                 ExtendedDialog dialog = new ExtendedDialog(
    576                                 Main.parent,
     586            ExtendedDialog dialog = new ExtendedDialog(
     587                    Main.parent,
    577588                tr("Correlate images with GPX track"),
    578589                new String[] { tr("Correlate"), tr("Auto-Guess"), tr("Cancel") }
    579                                 );
    580 
    581                 dialog.setContent(panel);
    582                 dialog.setButtonIcons(new String[] { "ok.png", "dialogs/geoimage/gpx2imgManual.png", "cancel.png" });
    583                 dialog.showDialog();
    584                 int answer = dialog.getValue();
     590                    );
     591
     592            dialog.setContent(panel);
     593            dialog.setButtonIcons(new String[] { "ok.png", "dialogs/geoimage/gpx2imgManual.png", "cancel.png" });
     594            dialog.showDialog();
     595            int answer = dialog.getValue();
    585596            if(answer != 1 && answer != 2)
    586597                return;
     
    624635            }
    625636
    626             Main.pref.put("tagimages.doublegpstimezone", Double.toString(gpstimezone));
    627             Main.pref.put("tagimages.gpstimezone", Long.toString(- ((long) gpstimezone)));
    628             Main.pref.put("tagimages.delta", Long.toString(delta * 1000));
    629 
     637            yLayer.loadThumbs = cbShowThumbs.isSelected();
     638
     639            Main.pref.put("geoimage.doublegpstimezone", Double.toString(gpstimezone));
     640            Main.pref.put("geoimage.gpstimezone", Long.toString(- ((long) gpstimezone)));
     641            Main.pref.put("geoimage.delta", Long.toString(delta * 1000));
     642            Main.pref.put("geoimage.showThumbs", yLayer.loadThumbs);
    630643            isOk = true;
     644
     645            if (yLayer.loadThumbs) {
     646                Thread tl = new Thread(new ThumbsLoader(yLayer.data));
     647                tl.setPriority(Thread.MIN_PRIORITY);
     648                tl.start();
     649            }
     650
    631651        }
    632652
Note: See TracChangeset for help on using the changeset viewer.