Changeset 23988 in osm for applications/editors/josm


Ignore:
Timestamp:
2010-11-01T13:12:05+01:00 (14 years ago)
Author:
guardian
Message:

Refactoring times #1

Location:
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java

    r23667 r23988  
    9090    }
    9191   
     92    //select the k-th waypoint
     93    public void goTo(int k)
     94    {
     95        if (k>0)
     96        {
     97            if ((ls.indexOf(curr)+k>0)&&(ls.indexOf(curr)<ls.size())) //check range
     98            {
     99                goTo(ls.get(k));
     100            }
     101            Main.map.mapView.repaint();
     102        }
     103    }
     104   
    92105    //walk k waypoints forward/backward
    93106    public void move(int k)
     
    100113        Main.map.mapView.repaint(); //seperate modell and view logic...
    101114    }
    102    
    103     //select the k-th waypoint
    104     public void goTo(int k)
    105     {
    106         if (k>0)
    107         {
    108             if ((ls.indexOf(curr)+k>0)&&(ls.indexOf(curr)<ls.size())) //check range
    109             {
    110                 goTo(ls.get(k));
    111             }
    112             Main.map.mapView.repaint();
    113         }
    114     }
    115    
    116115    //go to the position at the timecode e.g.g "14:00:01";
    117     public void jump(Time GPSAbsTime)
     116    public void jump(Date GPSAbsTime)
    118117    {
    119118        Date zero=start.getTime();
    120         Time starttime = new Time(zero.getHours(),zero.getMinutes(),zero.getSeconds());
     119        Date starttime = new Date(zero.getHours(),zero.getMinutes(),zero.getSeconds());
    121120        long diff=GPSAbsTime.getTime()-starttime.getTime();
    122121        goTo(getWaypoint(diff)); //TODO replace Time by Date?
    123122    }
    124    
    125     /*
    126     //go to the position at
    127     public void jump(Date GPSDate)
    128     {
    129         long s,m,h,diff;
    130         //calculate which waypoint is at the offset
    131         System.out.println(start.getTime());
    132         System.out.println(start.getTime().getHours()+":"+start.getTime().getMinutes()+":"+start.getTime().getSeconds());
    133         s=GPSDate.getSeconds()-start.getTime().getSeconds();
    134         m=GPSDate.getMinutes()-start.getTime().getMinutes();
    135         h=GPSDate.getHours()-start.getTime().getHours();
    136         diff=s*1000+m*60*1000+h*60*60*1000; //FIXME ugly hack but nothing else works right
    137         goTo(getWaypoint(diff));
    138     }
    139     */
     123 
    140124    //gets only points on the line of the GPS track (between waypoints) nearby the point m
    141125    private Point getInterpolated(Point m)
     
    340324    //jumps to a specific time
    341325    public void jump(long relTime) {
    342         int pos = Math.round(relTime/1000);//TODO ugly quick hack   
     326        int pos = Math.round(relTime/1000);//TODO assumes the time is constant
    343327        goTo(pos);
    344328        if (autoCenter) Main.map.mapView.zoomTo(curr.getCoor());
     
    346330   
    347331    //toggles walking along the track
    348     public void play()
    349     { /*
     332    /* public void play(){
     333   
    350334        if (t==null)
    351335        {
     
    370354            t.cancel();
    371355            t=null;                 
    372         }*/
    373     }
     356        }
     357    }*/
    374358
    375359    public long getLength() {
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java

    r23667 r23988  
    5050        gps= new GpsPlayer(ls);
    5151        icon = new ImageIcon("images/videomapping.png");
    52         gpsTimeCode= new SimpleDateFormat("hh:mm:ss");
     52        gpsTimeCode= new SimpleDateFormat("hh:mm:ss");//TODO replace with DF small
    5353        Main.map.mapView.addMouseListener(this);
    5454        Main.map.mapView.addMouseMotionListener(this);                         
Note: See TracChangeset for help on using the changeset viewer.