Changeset 941 in josm for trunk/src


Ignore:
Timestamp:
2008-09-10T00:30:56+02:00 (16 years ago)
Author:
framm
Message:

+ fixed Osm->GPX conversion to retain timestamps.

Location:
trunk/src/org/openstreetmap/josm/gui/layer
Files:
2 edited

Legend:

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

    r813 r941  
    307307                                }
    308308                        }
    309                         if(earliest != null && latest != null){
     309                        if (earliest != null && latest != null) {
    310310                                DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
    311311                                info.append(tr("Timespan: ") + df.format(new Date((long)(earliest.time * 1000))) + " - "
     
    362362                 ********** STEP 1 - GET CONFIG VALUES **************************
    363363                 ****************************************************************/
    364                 Long startTime = System.currentTimeMillis();
     364                // Long startTime = System.currentTimeMillis();
    365365                Color neutralColor = Main.pref.getColor(marktr("gps point"), "layer "+name, Color.GRAY);
    366366                boolean forceLines = Main.pref.getBoolean("draw.rawgps.lines.force");                     // also draw lines between points belonging to different segments
     
    397397                 ****************************************************************/
    398398                if (!computeCacheInSync) { // don't compute if the cache is good
    399                 WayPoint oldWp = null;
    400                 for (GpxTrack trk : data.tracks) {
     399                        WayPoint oldWp = null;
     400                        for (GpxTrack trk : data.tracks) {
    401401                                if (!forceLines) { // don't draw lines between segments, unless forced to
    402402                                        oldWp = null;
    403                         }
    404                         for (Collection<WayPoint> segment : trk.trackSegs) {
    405                                 for (WayPoint trkPnt : segment) {
     403                                }
     404                                for (Collection<WayPoint> segment : trk.trackSegs) {
     405                                        for (WayPoint trkPnt : segment) {
    406406                                                if (Double.isNaN(trkPnt.latlon.lat()) || Double.isNaN(trkPnt.latlon.lon())) {
    407                                                 continue;
     407                                                        continue;
    408408                                                }
    409409                                                if (oldWp != null) {
    410                                                 double dist = trkPnt.latlon.greatCircleDistance(oldWp.latlon);
    411                                                 double dtime = trkPnt.time - oldWp.time;
    412                                                 double vel = dist/dtime;
     410                                                        double dist = trkPnt.latlon.greatCircleDistance(oldWp.latlon);
     411                                                        double dtime = trkPnt.time - oldWp.time;
     412                                                        double vel = dist/dtime;
    413413
    414414                                                        if (!colored) {
     
    424424                                                        } else {
    425425                                                                trkPnt.drawLine = false;
    426                                                 }
     426                                                        }
    427427                                                } else { // make sure we reset outdated data
    428428                                                        trkPnt.speedLineColor = colors[255];
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r805 r941  
    371371                                }
    372372                                WayPoint wpt = new WayPoint(n.coor);
    373                                 if(n.timestamp != null)
     373                                if (n.timestamp != null)
     374                                {
    374375                                        wpt.attr.put("time", n.timestamp);
     376                                        wpt.setTime();
     377                                }
    375378                                trkseg.add(wpt);
    376379                        }
    377380                }
     381               
     382                // what is this loop meant to do? it creates waypoints but never
     383                // records them?
    378384                for (Node n : data.nodes) {
    379385                        if (n.incomplete || n.deleted || doneNodes.contains(n)) continue;
    380386                        WayPoint wpt = new WayPoint(n.coor);
    381                         if(n.timestamp != null)
     387                        if (n.timestamp != null) {
    382388                                wpt.attr.put("time", n.timestamp);
     389                                wpt.setTime();
     390                        }
    383391                        if (n.keys != null && n.keys.containsKey("name")) {
    384392                                wpt.attr.put("name", n.keys.get("name"));
Note: See TracChangeset for help on using the changeset viewer.