Ignore:
Timestamp:
2007-09-04T10:21:49+02:00 (18 years ago)
Author:
imi
Message:
  • removed MinML2 dependency (use javax.xml)
  • fixed reorder action (thanks Robert)
  • added backup files before saving (thanks Dave)
  • added search for last modifying user (thanks Dave)
  • fixed import of plugin list and added author field (thanks Shaun)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java

    r317 r319  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1//License: GPL. Copyright 2007 by Immanuel Scholz and others
    22package org.openstreetmap.josm.gui.layer;
    33
     
    104104                                                throw new IOException(tr("No time for point {0} x {1}",p.latlon.lat(),p.latlon.lon()));
    105105                                        Date d = null;
    106                     try {
    107                         d = DateParser.parse(p.time);
    108                     } catch (ParseException e) {
    109                         throw new IOException(tr("Cannot read time \"{0}\" from point {1} x {2}",p.time,p.latlon.lat(),p.latlon.lon()));
    110                     }
     106                                        try {
     107                                                d = DateParser.parse(p.time);
     108                                        } catch (ParseException e) {
     109                                                throw new IOException(tr("Cannot read time \"{0}\" from point {1} x {2}",p.time,p.latlon.lat(),p.latlon.lon()));
     110                                        }
    111111                                        gps.add(new TimedPoint(d, p.eastNorth));
    112112                                }
     
    130130                                ImageEntry e = new ImageEntry();
    131131                                try {
    132                         e.time = ExifReader.readTime(f);
    133                 } catch (ParseException e1) {
    134                         continue;
    135                 }
     132                                        e.time = ExifReader.readTime(f);
     133                                } catch (ParseException e1) {
     134                                        continue;
     135                                }
    136136                                if (e.time == null)
    137137                                        continue;
     
    163163        private static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
    164164        private MouseAdapter mouseAdapter;
    165     private int currentImage;
    166    
     165        private int currentImage;
     166
    167167        public static final class GpsTimeIncorrect extends Exception {
    168168                public GpsTimeIncorrect(String message, Throwable cause) {
     
    218218                                        Rectangle r = new Rectangle(p.x-e.icon.getIconWidth()/2, p.y-e.icon.getIconHeight()/2, e.icon.getIconWidth(), e.icon.getIconHeight());
    219219                                        if (r.contains(ev.getPoint())) {
    220                                             //                                          showImage(e);
    221                                             showImage(i-1);
     220                                                showImage(i-1);
    222221                                                break;
    223222                                        }
     
    236235        }
    237236
    238     //  private void showImage(final ImageEntry e) {
    239237        private void showImage(int i) {
    240             currentImage = i;
     238                currentImage = i;
    241239                final JPanel p = new JPanel(new BorderLayout());
    242240                final ImageEntry e = data.get(currentImage);
     
    273271                cent.addActionListener(new ActionListener(){
    274272                        public void actionPerformed(ActionEvent ev) {
    275                             final ImageEntry e = data.get(currentImage);
    276                             if (cent.getModel().isSelected())
    277                                 Main.map.mapView.zoomTo(e.pos, Main.map.mapView.getScale());
    278                         }
    279                     });
     273                                final ImageEntry e = data.get(currentImage);
     274                                if (cent.getModel().isSelected())
     275                                        Main.map.mapView.zoomTo(e.pos, Main.map.mapView.getScale());
     276                        }
     277                });
    280278
    281279                ActionListener nextprevAction = new ActionListener(){
    282280                        public void actionPerformed(ActionEvent ev) {                       
    283                             p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    284                             if (ev.getActionCommand().equals("Next")) {
    285                                 currentImage++;
    286                                 if(currentImage>=data.size()-1) next.setEnabled(false);
    287                                 prev.setEnabled(true);
    288                             } else {
    289                                 currentImage--;
    290                                 if(currentImage<=0) prev.setEnabled(false);
    291                                 next.setEnabled(true);
    292                             }
    293                            
    294                             final ImageEntry e = data.get(currentImage);
    295                             if (scale.getModel().isSelected())
    296                                 ((JLabel)vp.getView()).setIcon(loadScaledImage(e.image, Math.max(vp.getWidth(), vp.getHeight())));
    297                             else
    298                                 ((JLabel)vp.getView()).setIcon(new ImageIcon(e.image.getPath()));
    299                             dlg.setTitle(e.image+" ("+e.coor.toDisplayString()+")");
    300                             if (cent.getModel().isSelected())
    301                                 Main.map.mapView.zoomTo(e.pos, Main.map.mapView.getScale());
    302                             p.setCursor(Cursor.getDefaultCursor());
    303                         }
    304                     };
     281                                p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     282                                if (ev.getActionCommand().equals("Next")) {
     283                                        currentImage++;
     284                                        if(currentImage>=data.size()-1) next.setEnabled(false);
     285                                        prev.setEnabled(true);
     286                                } else {
     287                                        currentImage--;
     288                                        if(currentImage<=0) prev.setEnabled(false);
     289                                        next.setEnabled(true);
     290                                }
     291
     292                                final ImageEntry e = data.get(currentImage);
     293                                if (scale.getModel().isSelected())
     294                                        ((JLabel)vp.getView()).setIcon(loadScaledImage(e.image, Math.max(vp.getWidth(), vp.getHeight())));
     295                                else
     296                                        ((JLabel)vp.getView()).setIcon(new ImageIcon(e.image.getPath()));
     297                                dlg.setTitle(e.image+" ("+e.coor.toDisplayString()+")");
     298                                if (cent.getModel().isSelected())
     299                                        Main.map.mapView.zoomTo(e.pos, Main.map.mapView.getScale());
     300                                p.setCursor(Cursor.getDefaultCursor());
     301                        }
     302                };
    305303                next.setActionCommand("Next");
    306304                prev.setActionCommand("Previous");
     
    453451        private void sync(File f) {
    454452                Date exifDate;
    455         try {
    456                 exifDate = ExifReader.readTime(f);
    457         } catch (ParseException e) {
    458                 JOptionPane.showMessageDialog(Main.parent, tr("The date in file \"{0}\" could not be parsed.", f.getName()));
    459                 return;
    460         }
     453                try {
     454                        exifDate = ExifReader.readTime(f);
     455                } catch (ParseException e) {
     456                        JOptionPane.showMessageDialog(Main.parent, tr("The date in file \"{0}\" could not be parsed.", f.getName()));
     457                        return;
     458                }
    461459                if (exifDate == null) {
    462460                        JOptionPane.showMessageDialog(Main.parent, tr("There is no EXIF time within the file \"{0}\".", f.getName()));
     
    489487                                gpstimezone = Long.valueOf(time)*60*60*1000;
    490488                                Main.pref.put("tagimages.delta", ""+delta);
    491                 Main.pref.put("tagimages.gpstimezone", time);
     489                                Main.pref.put("tagimages.gpstimezone", time);
    492490                                calculatePosition();
    493491                                return;
Note: See TracChangeset for help on using the changeset viewer.