Ignore:
Timestamp:
2011-03-29T10:23:18+02:00 (14 years ago)
Author:
guardian
Message:

last stable before refactoring

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

Legend:

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

    r25385 r25742  
    1515    private WayPoint prev,curr,next;
    1616    private WayPoint start;
    17     private boolean autoCenter;
     17    private boolean autoCenter;   
     18    private List<WayPoint> ipos; //TODO can become optiized hashtable
     19    private WayPoint ipo;
    1820   
    1921
     
    4547        curr=ls.get(0);
    4648        next=ls.get(1);
     49        ipo=curr;
    4750    }
    4851   
     
    230233            timeSeg=-(getPrev().getTime().getTime()-getCurr().getTime().getTime());
    231234        }
    232         WayPoint w =new WayPoint(Main.map.mapView.getLatLon(m.x, m.y));
     235        WayPoint w =new WayPoint(Main.map.mapView.getLatLon(m.x, m.y));       
    233236        //calc total traversal length
    234237        lengthSeg = getTraversalLength(p2, curr);
     
    329332        return p.getTime().getTime()-start.getTime().getTime(); //TODO assumes timeintervall is constant!!!!
    330333    }
    331    
    332    
    333 
    334     //toggles walking along the track
    335     /* public void play(){
    336    
    337         if (t==null)
    338         {
    339             //start
    340             t= new Timer();
    341             ani=new TimerTask() {           
    342                 @Override
    343                 //some cheap animation stuff
    344                 public void run() {             
    345                     next();
    346                     if(autoCenter) Main.map.mapView.zoomTo(getCurr().getEastNorth());
    347                     Main.map.mapView.repaint();
    348                 }
    349             };
    350             t.schedule(ani,1000,1000);         
    351         }
    352         else
    353         {
    354             //stop
    355             ani.cancel();
    356             ani=null;
    357             t.cancel();
    358             t=null;                 
    359         }
    360     }*/
    361334
    362335    public long getLength() {
     
    374347    }
    375348
     349        public List<WayPoint> interpolate() {
     350                ipos = new LinkedList<WayPoint>();
     351                WayPoint old = getCurr();
     352                for (int i=1;i<ls.size();i++)
     353                {                       
     354                        ipos.addAll(getInterpolatedLine(5));
     355                        next();
     356                }
     357                goTo(old);
     358                return ipos;
     359        }
     360
     361        public void jumpIPO(long relTime) {
     362                int pos = Math.round(relTime/1000);//TODO assumes the time is constant
     363        goTo(pos);
     364        pos=Math.round(relTime/200);
     365        ipo= ipos.get(pos);
     366        if (autoCenter) Main.map.mapView.zoomTo(curr.getCoor());
     367               
     368        }
     369       
     370        public WayPoint getIPO()
     371        {
     372                return ipo;
     373        }
     374
    376375
    377376   
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java

    r25385 r25742  
    3838public class PositionLayer extends Layer implements MouseListener,MouseMotionListener {
    3939    private List<WayPoint> ls;
     40    private List<WayPoint> ipos;
    4041    public GpsPlayer gps;
    4142    private boolean dragIcon=false; //do we move the icon by hand?
     
    4849    public PositionLayer(File video, GpxLayer GpsLayer) {
    4950        super(video.getName());
    50         ls=copyGPSLayer(GpsLayer.data); //TODO This might be outsourced to a seperated track
    51         gps= new GpsPlayer(ls);
     51        ls=copyGPSLayer(GpsLayer.data); //TODO This might be outsourced to a seperated track       
     52        gps= new GpsPlayer(ls);       
    5253        icon = new ImageIcon("images/videomapping.png");
    5354        gpsTimeCode= new SimpleDateFormat("HH:mm:ss");//TODO replace with DF small
     
    5556        Main.map.mapView.addMouseMotionListener(this);                         
    5657        gpsVP = new GPSVideoPlayer(video, gps);
    57         iconPosition=gps.getCurr();
     58        gps.goTo(0);
     59        ipos=gps.interpolate();
     60        iconPosition=gps.getCurr();       
    5861    }
    5962   
     
    158161        g.setColor(Color.CYAN);
    159162        g.setBackground(Color.CYAN);
    160         LinkedList<WayPoint> ipo=(LinkedList<WayPoint>) gps.getInterpolatedLine(5);
    161         for (WayPoint wp : ipo) {
     163        //LinkedList<WayPoint> ipo=(LinkedList<WayPoint>) gps.getInterpolatedLine(5);
     164        for (WayPoint wp : ipos) {
    162165            p=Main.map.mapView.getPoint(wp.getEastNorth());
    163166            g.fillArc(p.x, p.y, 4, 4, 0, 360);
     
    179182        {
    180183            if (gps.getCurr()!=null){
    181             p=Main.map.mapView.getPoint(gps.getCurr().getEastNorth());
     184            p=Main.map.mapView.getPoint(gps.getIPO().getEastNorth());
    182185            icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);         
    183186            g.drawString(gpsTimeCode.format(gps.getCurr().getTime()),p.x-15,p.y-15);
     
    289292            //restrict to GPS track
    290293            iconPosition=gps.getInterpolatedWaypoint(mouse);
    291 
    292294            Main.map.mapView.repaint();
    293295        }
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java

    r25385 r25742  
    3434import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    3535import org.openstreetmap.josm.gui.layer.*;
     36
     37import uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil;
     38
     39import com.sun.jna.NativeLibrary;
    3640
    3741import static org.openstreetmap.josm.tools.I18n.*;
     
    7882        applySettings();
    7983        //further plugin informations are provided by build.xml properties
     84        //NativeLibrary.addSearchPath("vlc", "C:\\Programme\\Video\\VLC"); // this should be the directory that contains libvlc.dll
     85        NativeLibrary.addSearchPath("libvlc", WindowsRuntimeUtil.getVlcInstallDir());
    8086    }
    8187           
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java

    r25385 r25742  
    7777                if(synced) {
    7878                        gps.jump(getGPSTime(time));
     79                        gps.jumpIPO(getGPSTime(time));
    7980                }
    8081               
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/SimpleVideoPlayer.java

    r25385 r25742  
    118118                                      });
    119119                                }
    120                         }, 0L, 200L, TimeUnit.MILLISECONDS);
     120                        }, 0L, 500L, TimeUnit.MILLISECONDS);
    121121            //setDefaultCloseOperation(EXIT_ON_CLOSE);
    122122            addWindowListener(this);
     
    512512
    513513                public void buffering(MediaPlayer arg0) {
    514                         // TODO Auto-generated method stub
     514                        System.out.println("buffering!");
    515515                       
    516516                }
     
    523523                public void opening(MediaPlayer arg0) {
    524524                        // TODO Auto-generated method stub
     525                        System.out.println("opening!");
    525526                       
    526527                }
     
    532533
    533534                public void seekableChanged(MediaPlayer arg0, int arg1) {
    534                         // TODO Auto-generated method stub
     535                        System.out.println("seeking!");
    535536                       
    536537                }
Note: See TracChangeset for help on using the changeset viewer.