Changeset 1724 in josm for trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
- Timestamp:
- 2009-07-03T22:19:22+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r1722 r1724 63 63 import org.openstreetmap.josm.Main; 64 64 import org.openstreetmap.josm.actions.RenameLayerAction; 65 import org.openstreetmap.josm.data.coor. EastNorth;65 import org.openstreetmap.josm.data.coor.CachedLatLon; 66 66 import org.openstreetmap.josm.data.coor.LatLon; 67 67 import org.openstreetmap.josm.data.gpx.GpxTrack; … … 244 244 final File image; 245 245 ImageLoader.Entry icon; 246 247 246 Date time; 248 LatLon coor; 249 EastNorth pos; 247 CachedLatLon pos; 250 248 251 249 public ImageEntry(File image) { … … 290 288 for (Collection<WayPoint> segment : trk.trackSegs) { 291 289 for (WayPoint p : segment) { 290 LatLon c = p.getCoor(); 292 291 if (!p.attr.containsKey("time")) 293 throw new IOException(tr("No time for point {0} x {1}", p.latlon.lat(),p.latlon.lon()));292 throw new IOException(tr("No time for point {0} x {1}",c.lat(),c.lon())); 294 293 Date d = null; 295 294 try { 296 295 d = DateParser.parse((String) p.attr.get("time")); 297 296 } catch (ParseException e) { 298 throw new IOException(tr("Cannot read time \"{0}\" from point {1} x {2}",p.attr.get("time"), p.latlon.lat(),p.latlon.lon()));297 throw new IOException(tr("Cannot read time \"{0}\" from point {1} x {2}",p.attr.get("time"),c.lat(),c.lon())); 299 298 } 300 gps.add(new TimedPoint(d, p.eastNorth));299 gps.add(new TimedPoint(d, c)); 301 300 } 302 301 } … … 364 363 private static final class TimedPoint implements Comparable<TimedPoint> { 365 364 Date time; 366 EastNorth pos; 367 public TimedPoint(Date time, EastNorth pos) { 365 CachedLatLon pos; 366 367 public TimedPoint(Date time, LatLon pos) { 368 368 this.time = time; 369 this.pos = pos;369 this.pos.setCoor(pos); 370 370 } 371 371 public int compareTo(TimedPoint point) { … … 404 404 if (e.pos == null) 405 405 continue; 406 Point p = Main.map.mapView.getPoint(e.pos );406 Point p = Main.map.mapView.getPoint(e.pos.getEastNorth()); 407 407 Rectangle r = new Rectangle(p.x-ICON_SIZE/2, p.y-ICON_SIZE/2, ICON_SIZE, ICON_SIZE); 408 408 if (r.contains(ev.getPoint())) { … … 536 536 537 537 if (centerToggle.getModel().isSelected()) 538 Main.map.mapView.zoomTo(currentImageEntry.pos );538 Main.map.mapView.zoomTo(currentImageEntry.pos.getEastNorth()); 539 539 540 540 dlg.setTitle(currentImageEntry.image + 541 " (" + currentImageEntry. coor.toDisplayString() + ")");541 " (" + currentImageEntry.pos.toDisplayString() + ")"); 542 542 dlg.setCursor(Cursor.getDefaultCursor()); 543 543 } … … 612 612 } 613 613 614 Point p = mv.getPoint(e.pos );614 Point p = mv.getPoint(e.pos.getEastNorth()); 615 615 Rectangle r = new Rectangle(p.x-ICON_SIZE / 2, p.y-ICON_SIZE / 2, ICON_SIZE, ICON_SIZE); 616 616 if (r.contains(mousePosition)) { … … 624 624 ImageEntry e = data.get(i); 625 625 if (e.pos != null) { 626 Point p = mv.getPoint(e.pos );626 Point p = mv.getPoint(e.pos.getEastNorth()); 627 627 Rectangle r = new Rectangle(p.x-ICON_SIZE / 2, p.y-ICON_SIZE / 2, ICON_SIZE, ICON_SIZE); 628 628 g.drawImage(e.getIcon(), r.x, r.y, null); … … 686 686 Date time = new Date(tp.time.getTime() - (delta+gpstimezone)); 687 687 if (time.after(e.time) && lastTP != null) { 688 double x = (lastTP.pos.east()+tp.pos.east())/2; 689 double y = (lastTP.pos.north()+tp.pos.north())/2; 690 e.pos = new EastNorth(x,y); 688 e.pos.setCoor(lastTP.pos.getCenter(tp.pos)); 691 689 break; 692 690 } … … 696 694 e.pos = gps.getLast().pos; 697 695 } 698 e.coor = Main.proj.eastNorth2latlon(e.pos);699 696 } 700 697 }
Note:
See TracChangeset
for help on using the changeset viewer.