Ignore:
Timestamp:
2009-07-03T22:19:22+02:00 (15 years ago)
Author:
stoecker
Message:

some more changes and bug fixes related to new projection stuff - GPX should now work also

File:
1 edited

Legend:

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

    r1722 r1724  
    6363import org.openstreetmap.josm.Main;
    6464import org.openstreetmap.josm.actions.RenameLayerAction;
    65 import org.openstreetmap.josm.data.coor.EastNorth;
     65import org.openstreetmap.josm.data.coor.CachedLatLon;
    6666import org.openstreetmap.josm.data.coor.LatLon;
    6767import org.openstreetmap.josm.data.gpx.GpxTrack;
     
    244244        final File image;
    245245        ImageLoader.Entry icon;
    246 
    247246        Date time;
    248         LatLon coor;
    249         EastNorth pos;
     247        CachedLatLon pos;
    250248
    251249        public ImageEntry(File image) {
     
    290288                for (Collection<WayPoint> segment : trk.trackSegs) {
    291289                    for (WayPoint p : segment) {
     290                        LatLon c = p.getCoor();
    292291                        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()));
    294293                        Date d = null;
    295294                        try {
    296295                            d = DateParser.parse((String) p.attr.get("time"));
    297296                        } 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()));
    299298                        }
    300                         gps.add(new TimedPoint(d, p.eastNorth));
     299                        gps.add(new TimedPoint(d, c));
    301300                    }
    302301                }
     
    364363    private static final class TimedPoint implements Comparable<TimedPoint> {
    365364        Date time;
    366         EastNorth pos;
    367         public TimedPoint(Date time, EastNorth pos) {
     365        CachedLatLon pos;
     366
     367        public TimedPoint(Date time, LatLon pos) {
    368368            this.time = time;
    369             this.pos = pos;
     369            this.pos.setCoor(pos);
    370370        }
    371371        public int compareTo(TimedPoint point) {
     
    404404                    if (e.pos == null)
    405405                        continue;
    406                     Point p = Main.map.mapView.getPoint(e.pos);
     406                    Point p = Main.map.mapView.getPoint(e.pos.getEastNorth());
    407407                    Rectangle r = new Rectangle(p.x-ICON_SIZE/2, p.y-ICON_SIZE/2, ICON_SIZE, ICON_SIZE);
    408408                    if (r.contains(ev.getPoint())) {
     
    536536
    537537            if (centerToggle.getModel().isSelected())
    538                 Main.map.mapView.zoomTo(currentImageEntry.pos);
     538                Main.map.mapView.zoomTo(currentImageEntry.pos.getEastNorth());
    539539
    540540            dlg.setTitle(currentImageEntry.image +
    541                     " (" + currentImageEntry.coor.toDisplayString() + ")");
     541                    " (" + currentImageEntry.pos.toDisplayString() + ")");
    542542            dlg.setCursor(Cursor.getDefaultCursor());
    543543        }
     
    612612                }
    613613
    614                 Point p = mv.getPoint(e.pos);
     614                Point p = mv.getPoint(e.pos.getEastNorth());
    615615                Rectangle r = new Rectangle(p.x-ICON_SIZE / 2, p.y-ICON_SIZE / 2, ICON_SIZE, ICON_SIZE);
    616616                if (r.contains(mousePosition)) {
     
    624624            ImageEntry e = data.get(i);
    625625            if (e.pos != null) {
    626                 Point p = mv.getPoint(e.pos);
     626                Point p = mv.getPoint(e.pos.getEastNorth());
    627627                Rectangle r = new Rectangle(p.x-ICON_SIZE / 2, p.y-ICON_SIZE / 2, ICON_SIZE, ICON_SIZE);
    628628                g.drawImage(e.getIcon(), r.x, r.y, null);
     
    686686                Date time = new Date(tp.time.getTime() - (delta+gpstimezone));
    687687                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));
    691689                    break;
    692690                }
     
    696694                e.pos = gps.getLast().pos;
    697695            }
    698             e.coor = Main.proj.eastNorth2latlon(e.pos);
    699696        }
    700697    }
Note: See TracChangeset for help on using the changeset viewer.