Changeset 319 in josm for src/org/openstreetmap/josm/gui/layer
- Timestamp:
- 2007-09-04T10:21:49+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r317 r319 1 // 1 //License: GPL. Copyright 2007 by Immanuel Scholz and others 2 2 package org.openstreetmap.josm.gui.layer; 3 3 … … 104 104 throw new IOException(tr("No time for point {0} x {1}",p.latlon.lat(),p.latlon.lon())); 105 105 Date d = null; 106 107 108 109 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 } 111 111 gps.add(new TimedPoint(d, p.eastNorth)); 112 112 } … … 130 130 ImageEntry e = new ImageEntry(); 131 131 try { 132 133 134 135 132 e.time = ExifReader.readTime(f); 133 } catch (ParseException e1) { 134 continue; 135 } 136 136 if (e.time == null) 137 137 continue; … … 163 163 private static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); 164 164 private MouseAdapter mouseAdapter; 165 166 165 private int currentImage; 166 167 167 public static final class GpsTimeIncorrect extends Exception { 168 168 public GpsTimeIncorrect(String message, Throwable cause) { … … 218 218 Rectangle r = new Rectangle(p.x-e.icon.getIconWidth()/2, p.y-e.icon.getIconHeight()/2, e.icon.getIconWidth(), e.icon.getIconHeight()); 219 219 if (r.contains(ev.getPoint())) { 220 // showImage(e); 221 showImage(i-1); 220 showImage(i-1); 222 221 break; 223 222 } … … 236 235 } 237 236 238 // private void showImage(final ImageEntry e) {239 237 private void showImage(int i) { 240 238 currentImage = i; 241 239 final JPanel p = new JPanel(new BorderLayout()); 242 240 final ImageEntry e = data.get(currentImage); … … 273 271 cent.addActionListener(new ActionListener(){ 274 272 public void actionPerformed(ActionEvent ev) { 275 276 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 }); 280 278 281 279 ActionListener nextprevAction = new ActionListener(){ 282 280 public void actionPerformed(ActionEvent ev) { 283 284 285 currentImage++; 286 if(currentImage>=data.size()-1) next.setEnabled(false); 287 prev.setEnabled(true); 288 289 currentImage--; 290 if(currentImage<=0) prev.setEnabled(false); 291 next.setEnabled(true); 292 293 294 295 296 ((JLabel)vp.getView()).setIcon(loadScaledImage(e.image, Math.max(vp.getWidth(), vp.getHeight()))); 297 298 ((JLabel)vp.getView()).setIcon(new ImageIcon(e.image.getPath())); 299 300 301 Main.map.mapView.zoomTo(e.pos, Main.map.mapView.getScale()); 302 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 }; 305 303 next.setActionCommand("Next"); 306 304 prev.setActionCommand("Previous"); … … 453 451 private void sync(File f) { 454 452 Date exifDate; 455 456 457 458 459 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 } 461 459 if (exifDate == null) { 462 460 JOptionPane.showMessageDialog(Main.parent, tr("There is no EXIF time within the file \"{0}\".", f.getName())); … … 489 487 gpstimezone = Long.valueOf(time)*60*60*1000; 490 488 Main.pref.put("tagimages.delta", ""+delta); 491 489 Main.pref.put("tagimages.gpstimezone", time); 492 490 calculatePosition(); 493 491 return;
Note:
See TracChangeset
for help on using the changeset viewer.