Index: applications/editors/josm/plugins/videomapping/.classpath
===================================================================
--- applications/editors/josm/plugins/videomapping/.classpath	(revision 21517)
+++ applications/editors/josm/plugins/videomapping/.classpath	(revision 21519)
@@ -5,5 +5,9 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
-	<classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/vlcj/vlcj-1.1f.jar"/>
+	<classpathentry kind="lib" path="C:/Dokumente und Einstellungen/g/Eigene Dateien/Workspace/vlcj/vlcj-1.1f.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="jar:file:/C:/Dokumente und Einstellungen/g/Eigene Dateien/Workspace/vlcj/vlcj-1.1f-javadoc.jar!/"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java	(revision 21517)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java	(revision 21519)
@@ -1,4 +1,8 @@
 package org.openstreetmap.josm.plugins.videomapping;
 
+import java.awt.Point;
+import java.sql.Time;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.ListIterator;
@@ -9,5 +13,5 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 
-//for GPS play control secure stepping througt list
+//for GPS play control, secure stepping through list and interpolation work in current projection
 public class GpsPlayer {
 	private List<WayPoint> ls;
@@ -53,5 +57,5 @@
 			next =curr;
 			curr=prev;
-			prev=ls.get(ls.indexOf(curr)-1);;
+			if(ls.indexOf(curr)==0) prev=null;else 	prev=ls.get(ls.indexOf(curr)-1);
 		}
 		else prev=null;		
@@ -68,5 +72,5 @@
 			}
 			else prev=null;
-			if(ls.indexOf(curr)<ls.size())
+			if(ls.indexOf(curr)+1<ls.size())
 			{
 				next=ls.get(ls.indexOf(curr)+1);
@@ -85,4 +89,153 @@
 	}
 	
+	//gets only points on the line of the GPS track between waypoints nearby the point m
+	private Point getInterpolated(Point m)
+	{
+		Point leftP,rightP,highP,lowP;
+		boolean invalid = false;
+		Point p1 = Main.map.mapView.getPoint(getCurr().getEastNorth());
+		if(getNext()!=null) //TODO outsource certain dub routines
+		{
+			Point p2 = Main.map.mapView.getPoint(getNext().getEastNorth());
+			//determine which point is what
+			if(p1.x<p2.x)
+			{
+				leftP=p1;
+				rightP=p2;
+			}
+			else
+			{
+				leftP=p2;
+				rightP=p1;
+			}
+			if(p1.y<p2.y)
+			{
+				highP=p1;
+				lowP=p2;
+			}
+			else
+			{
+				highP=p2;
+				lowP=p1;
+			}
+			//we might switch to neighbor segment
+			if(m.x<leftP.x)
+			{
+				Point c = Main.map.mapView.getPoint(getCurr().getEastNorth());
+				Point n = Main.map.mapView.getPoint(getNext().getEastNorth());
+				if(n.x<c.x)	next(); else prev();
+				invalid=true;
+				m=leftP;
+				System.out.println("entering left segment");
+			}
+			if(m.x>rightP.x)
+			{
+				Point c = Main.map.mapView.getPoint(getCurr().getEastNorth());
+				Point n = Main.map.mapView.getPoint(getNext().getEastNorth());
+				if(n.x>c.x)	next(); else prev();
+				invalid=true;
+				m=rightP;
+				System.out.println("entering right segment");
+			}
+			//highP = Main.map.mapView.getPoint(l.getCurr().getEastNorth());
+			//lowP = Main.map.mapView.getPoint(l.getNext().getEastNorth());
+			if(!invalid)
+			{
+				float slope=(float)(highP.y-lowP.y) / (float)(highP.x - lowP.x);
+				m.y = highP.y+Math.round(slope*(m.x-highP.x));
+			}
+		}
+		else
+		{
+			//currently we are at the end
+			Point p2 = Main.map.mapView.getPoint(getPrev().getEastNorth());
+			if (p1.x>p2.x)
+			{
+				leftP=p2;
+				rightP=p1;
+			}
+			else
+			{
+				leftP=p1;
+				rightP=p2;
+			}
+			if(m.x>rightP.x)
+			{
+				m=rightP; //we can't move anywhere
+			}
+			else
+			{
+				prev();
+			}
+			
+			
+		}
+		//System.out.println((m));
+		return m;
+	}
+	
+	//gets further infos for a point between two Waypoints
+	public WayPoint getInterpolatedWaypoint(Point m)
+	{	int a,b,length,lengthSeg;
+		long timeSeg;
+		float ratio;
+		Time base;
+		Point p2;
+		
+		Point curr =Main.map.mapView.getPoint(getCurr().getEastNorth());
+		m =getInterpolated(m);
+		if (getNext()!=null)
+		{
+			p2 =Main.map.mapView.getPoint(getNext().getEastNorth());
+			timeSeg=getNext().getTime().getTime()-getCurr().getTime().getTime();
+		}
+		else
+		{
+			p2 =Main.map.mapView.getPoint(getPrev().getEastNorth());
+			timeSeg=-(getPrev().getTime().getTime()-getCurr().getTime().getTime());
+		}
+		WayPoint w =new WayPoint(Main.map.mapView.getLatLon(m.x, m.y));
+		//calc total traversal length
+		a=Math.abs(curr.x-p2.x);
+		b=Math.abs(curr.y-p2.y);
+		lengthSeg= (int) Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
+		a=Math.abs(m.x-p2.x);
+		b=Math.abs(m.y-p2.y);
+		length= (int) Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
+		length=lengthSeg-length;
+		ratio=(float)length/(float)lengthSeg;
+		long inc=(long) (timeSeg*ratio);
+		SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss:S");
+		long old = getCurr().getTime().getTime();
+		old=old+inc;
+		System.out.print(length+"px ");
+		System.out.print(ratio+"% ");
+		System.out.print(inc+"ms ");
+		System.out.println(df.format(old));
+		Date t = new Date(old);
+		//TODO we have to publish the new date to the node...
+		return w;
+	}
+	
+	public List<WayPoint> getInterpolatedLine(int interval)
+	{
+		Point p2;
+		Point curr =Main.map.mapView.getPoint(getCurr().getEastNorth());
+		if (getNext()!=null)
+		{
+			p2 =Main.map.mapView.getPoint(getNext().getEastNorth());
+		}
+		else
+		{
+			p2 =Main.map.mapView.getPoint(getPrev().getEastNorth());
+		}
+		int a=Math.abs(curr.x-p2.x);
+		int b=Math.abs(curr.y-p2.y);
+		int length= (int) Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
+		float step=length/interval;
+		//TODO here we go
+		return null;
+	}
+	
 
 }
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java	(revision 21517)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java	(revision 21519)
@@ -2,6 +2,10 @@
 
 
+import java.sql.Time;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -47,4 +51,5 @@
 	private TimerTask ani;
 	private boolean dragIcon=false; //do we move the icon by hand?
+	private WayPoint iconPosition;
 	private Point mouse;
 	private ImageIcon icon;
@@ -55,15 +60,10 @@
 		l= new GpsPlayer(ls);
 		selected = new ArrayList<WayPoint>();
-		icon=ImageProvider.get("videomapping.png");
-		Action a = new AbstractAction() {
-			public void actionPerformed(ActionEvent e) {
-				// TODO Auto-generated method stub
-				System.err.println("!!!boom!!!");
-			}};		
+		icon=ImageProvider.get("videomapping.png");		
 		Main.map.mapView.addMouseListener(this);
 		Main.map.mapView.addMouseMotionListener(this);
-		
+		Main.map.mapView.getRootPane().getGlassPane().addKeyListener(this);
 		//Main.panel.addKeyListener(this);
-		Main.map.mapView.addKeyListener(this);
+		//Main.map.mapView.addKeyListener(this);
 		//Main.contentPane.getInputMap().put(KeyStroke.getKeyStroke("SPACE"),"pressed");
 		//Main.contentPane.getActionMap().put("pressed",a);
@@ -83,5 +83,5 @@
 		Timer t= new Timer();
 		//t.schedule(ani,2000,2000);
-		l.next();l.next();
+		//l.next();
 		
 	}
@@ -167,8 +167,9 @@
 		if(dragIcon)
 		{
-			if(mouse!=null)
-			{
-				p=mouse;
+			if(iconPosition!=null)
+			{
+				p=Main.map.mapView.getPoint(iconPosition.getEastNorth());
 				icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);
+				g.drawString(iconPosition.getTime().toString(),p.x,p.y);
 			}
 		}
@@ -183,8 +184,8 @@
 	}
 
-	private void markNearestNode(Point mouse) {
+	private void markNearestWayPoints(Point mouse) {
 		final int MAX=10; 
 		Point p;		
-		Rectangle rect = new Rectangle(mouse.x-MAX/2,mouse.y-MAX/2,mouse.x+MAX/2,mouse.y+MAX/2);
+		Rectangle rect = new Rectangle(mouse.x-MAX/2,mouse.y-MAX/2,MAX,MAX);
 		//iterate through all possible notes
 		for(WayPoint n : ls)
@@ -199,9 +200,9 @@
 	}
 	
-	private WayPoint getNearestPoint(Point mouse)
+	private WayPoint getNearestWayPoint(Point mouse)
 	{
 		final int MAX=10;
 		Point p;
-		Rectangle rect = new Rectangle(mouse.x-MAX/2,mouse.y-MAX/2,mouse.x+MAX/2,mouse.y+MAX/2);
+		Rectangle rect = new Rectangle(mouse.x-MAX/2,mouse.y-MAX/2,MAX,MAX);
 		//iterate through all possible notes
 		for(WayPoint n : ls) //TODO this is not very clever, what better way to find this WP?
@@ -261,6 +262,6 @@
 			{
 				//JOptionPane.showMessageDialog(Main.parent,"test");
-				markNearestNode(e.getPoint());
-				WayPoint wp = getNearestPoint(e.getPoint());
+				markNearestWayPoints(e.getPoint());
+				WayPoint wp = getNearestWayPoint(e.getPoint());
 				if(wp!=null)
 				{
@@ -273,20 +274,4 @@
 	}
 	
-	//gets point on the line between
-	private Point getInterpolated(Point m)
-	{		
-		Point highest = Main.map.mapView.getPoint(l.getCurr().getEastNorth());
-		Point smallest = Main.map.mapView.getPoint(l.getNext().getEastNorth());
-		float slope=(float)(highest.y-smallest.y) / (float)(highest.x - smallest.x);
-		
-		m.y = highest.y+Math.round(slope*(m.x-highest.x));
-		if(m.x<smallest.x)
-		{
-			m=smallest;
-		}
-		if(m.x>highest.x) m=highest;
-		System.out.println((m));
-		return m;
-	}
 	
 	public void mouseDragged(MouseEvent e) {		
@@ -295,5 +280,5 @@
 			mouse=e.getPoint();
 			//restrict to GPS track
-			mouse=getInterpolated(mouse);
+			iconPosition=l.getInterpolatedWaypoint(mouse);
 
 			Main.map.mapView.repaint();
@@ -330,9 +315,9 @@
 			case KeyEvent.VK_RIGHT:
 				{
-					l.jump(10);
+					l.jump(1);
 				};break;
 			case KeyEvent.VK_LEFT:
 			{
-				l.jump(-10);
+				l.jump(-1);
 
 			};break;
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java	(revision 21517)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java	(revision 21519)
@@ -36,8 +36,9 @@
 		//setup
 		MapView.addLayerChangeListener(this);
-		
+		//plugin informations are provided by build.xml properties
 	}
 		
 	
+	//only used with GPS layers
 	public void activeLayerChange(Layer oldLayer, Layer newLayer) {
 		if (newLayer instanceof GpxLayer)
Index: applications/editors/josm/plugins/videomapping/test/SimpleVideoPlayer.java
===================================================================
--- applications/editors/josm/plugins/videomapping/test/SimpleVideoPlayer.java	(revision 21519)
+++ applications/editors/josm/plugins/videomapping/test/SimpleVideoPlayer.java	(revision 21519)
@@ -0,0 +1,185 @@
+import java.awt.Adjustable;
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.PropertyChangeListener;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JToggleButton;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.openstreetmap.josm.Main;
+
+import uk.co.caprica.vlcj.binding.LibVlc;
+import uk.co.caprica.vlcj.check.EnvironmentCheckerFactory;
+import uk.co.caprica.vlcj.player.DefaultFullScreenStrategy;
+import uk.co.caprica.vlcj.player.FullScreenStrategy;
+import uk.co.caprica.vlcj.player.MediaPlayer;
+import uk.co.caprica.vlcj.player.MediaPlayerEventAdapter;
+import uk.co.caprica.vlcj.player.MediaPlayerFactory;
+
+//basic class of a videoplayer for one video
+public class SimpleVideoPlayer extends JFrame{
+	private MediaPlayer mp;
+	private Timer t;
+	private JPanel screenPanel,controlsPanel;
+	private JSlider timeline;
+	private JButton play,back,forward;
+	private JToggleButton loop;
+	private JSlider speed;
+	private Canvas scr;
+	
+	public SimpleVideoPlayer(JFrame mainwindow) {
+		super();
+		//TODO new EnvironmentCheckerFactory().newEnvironmentChecker().checkEnvironment();
+		try
+		{
+			String mediaPath = "C:\\Dokumente und Einstellungen\\g\\Eigene Dateien\\Eigene Videos\\23C3-1610-en-fudging_with_firmware.m4v";
+			String[] libvlcArgs = {""};
+			String[] standardMediaOptions = {""}; 
+			String[] mediaOptions = {""};
+			System.out.println("libvlc version: " + LibVlc.INSTANCE.libvlc_get_version());
+			//setup Media Player
+			//TODO we have to deal with unloading things....
+			MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(libvlcArgs);
+		    FullScreenStrategy fullScreenStrategy = new DefaultFullScreenStrategy(mainwindow);
+		    mp = mediaPlayerFactory.newMediaPlayer(fullScreenStrategy);
+		    mp.setStandardMediaOptions(standardMediaOptions);
+		    //mp.addMediaPlayerEventListener(new MediaPlayerEventAdapter() {});
+		    //setup GUI
+		    scr=new Canvas();
+		    timeline = new JSlider(0,100,0);
+		    play= new JButton("play");
+		    back= new JButton("<");
+		    forward= new JButton(">");
+		    loop= new JToggleButton("loop");
+		    speed = new JSlider(0,2,1);
+			speed.setPaintTicks(true);
+			speed.setMajorTickSpacing(5);
+			speed.setOrientation(Adjustable.VERTICAL);
+		    setLayout();
+			addListeners();
+		    //embed player
+			scr.setVisible(true);
+			setVisible(true);
+			mp.setVideoSurface(scr);
+		    mp.playMedia(mediaPath, mediaOptions);
+		    mainwindow.pack();
+		}
+		catch (NoClassDefFoundError e)
+		{
+			System.err.println("Unable to find JNA Java library!");
+		}
+		catch (UnsatisfiedLinkError e)
+		{
+			System.err.println("Unable to find native libvlc library!");
+		}
+	}
+	
+	//creates a layout like the most mediaplayers are...
+	private void setLayout() {
+		this.setLayout(new BorderLayout());
+		screenPanel=new JPanel();
+		screenPanel.setLayout(new BorderLayout());
+		controlsPanel=new JPanel();
+		controlsPanel.setLayout(new FlowLayout());
+		add(screenPanel,BorderLayout.CENTER);
+		add(controlsPanel,BorderLayout.SOUTH);
+		//fill screen panel
+		screenPanel.add(scr,BorderLayout.CENTER);
+		screenPanel.add(timeline,BorderLayout.SOUTH);
+		screenPanel.add(speed,BorderLayout.EAST);
+		controlsPanel.add(play);
+		controlsPanel.add(back);
+		controlsPanel.add(forward);
+		controlsPanel.add(loop);		
+	}
+
+	//add UI functionality
+	private void addListeners() {
+		final float JUMP_LENGTH=1000;
+		final int  LOOP_LENGTH=6000;
+		timeline.addChangeListener(new ChangeListener() {
+			public void stateChanged(ChangeEvent e) {
+				if(!timeline.getValueIsAdjusting())
+				{
+					//recalc to 0.x percent value
+					mp.setPosition((float)timeline.getValue() / 100.0f);
+				}
+			}
+		    });
+		
+		play.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent arg0) {
+				mp.play();
+				
+			}
+		});
+		
+		play.addActionListener(new ActionListener() {
+			
+			public void actionPerformed(ActionEvent arg0) {
+				mp.play();				
+			}
+		});
+		
+		back.addActionListener(new ActionListener() {
+			
+			public void actionPerformed(ActionEvent arg0) {
+				mp.setTime((long) (mp.getTime()-JUMP_LENGTH));
+				
+			}
+		});
+		
+		forward.addActionListener(new ActionListener() {
+			
+			public void actionPerformed(ActionEvent arg0) {
+				mp.setTime((long) (mp.getTime()+JUMP_LENGTH));
+				
+			}
+		});
+		
+		loop.addActionListener(new ActionListener() {
+
+			public void actionPerformed(ActionEvent arg0) {
+			if(!loop.getModel().isPressed())
+			{
+				final long resetpoint=(long) mp.getTime()-LOOP_LENGTH/2;
+				TimerTask ani=new TimerTask() {
+					
+					@Override
+					public void run() {
+						mp.setTime(resetpoint);
+					}
+				};
+				t= new Timer();
+				t.schedule(ani,LOOP_LENGTH/2,LOOP_LENGTH); //first run a half looptime till reset	
+				}
+			else
+			{
+				t.cancel();
+			}
+			}
+		});
+		
+		speed.addChangeListener(new ChangeListener() {
+			
+			public void stateChanged(ChangeEvent arg0) {
+				// TODO get integrated with future VLCj relase
+				
+			}
+		});
+		
+	}
+	
+
+}
Index: applications/editors/josm/plugins/videomapping/test/videotest.java
===================================================================
--- applications/editors/josm/plugins/videomapping/test/videotest.java	(revision 21517)
+++ applications/editors/josm/plugins/videomapping/test/videotest.java	(revision 21519)
@@ -1,2 +1,14 @@
+import java.awt.Canvas;
+import java.awt.Dimension;
+
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import uk.co.caprica.vlcj.player.*;
+
 
 public class videotest {
@@ -6,11 +18,10 @@
 	 */
 	public static void main(String[] args) {
-//		JFileChooser fc = new JFileChooser();
-//		fc.setAcceptAllFileFilterUsed( false );
-//		fc.setFileFilter( new VideoFileFilter() );
-//		if (fc.showOpenDialog( Main.parent )==JFileChooser.APPROVE_OPTION)
-//		{
-//			VideoWindow w = new VideoWindow(fc.getSelectedFile());
-//		}
+		JFrame window = new JFrame("video test");
+		window.setSize(new Dimension(600,600));
+		window.setVisible(true);
+		SimpleVideoPlayer sVP = new SimpleVideoPlayer(window);
+		window.add(sVP);
+		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
 	}
