Changeset 21631 in osm
- Timestamp:
- 2010-06-09T22:58:18+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/videomapping
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/videomapping/.classpath
r21555 r21631 5 5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> 6 6 <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/> 7 <classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/vlcj-1.1f.jar"> 7 <classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/jna.jar"/> 8 <classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/vlcj-1.1h.jar"> 8 9 <attributes> 9 <attribute name="javadoc_location" value="jar:file:/ C:/Dokumente und Einstellungen/g/Eigene Dateien/Workspace/vlcj/vlcj-1.1f-javadoc.jar!/"/>10 <attribute name="javadoc_location" value="jar:file:/D:/Projekte/Studium/GeoProjekt/working/vlcj/vlcj-1.1h-javadoc.jar!/"/> 10 11 </attributes> 11 12 </classpathentry> 13 <classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/log4j.jar"/> 12 14 <classpathentry kind="output" path="bin"/> 13 15 </classpath> -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java
r21584 r21631 19 19 private WayPoint prev,curr,next; 20 20 private WayPoint start; 21 private Timer t; 22 private TimerTask ani; //for moving trough the list 21 23 22 24 … … 36 38 super(); 37 39 this.ls = l; 40 //set start position 38 41 start=ls.get(0); 39 42 prev=null; … … 42 45 } 43 46 47 // one secure step forward 44 48 public void next() { 45 49 if(ls.indexOf(curr)+1<ls.size()) … … 54 58 } 55 59 60 //one secure step backward 56 61 public void prev() 57 62 { … … 65 70 } 66 71 72 //select the given waypoint as center 67 73 public void jump(WayPoint p) 68 74 { … … 83 89 } 84 90 85 public void jump(int t) 86 { 87 if ((ls.indexOf(curr)+t>0)&&(ls.indexOf(curr)<ls.size())) 88 { 89 jump(ls.get(ls.indexOf(curr)+t)); //FIXME here is a bug 91 //select the k-th waypoint 92 public void jump(int k) 93 { 94 if ((ls.indexOf(curr)+k>0)&&(ls.indexOf(curr)<ls.size())) 95 { 96 jump(ls.get(ls.indexOf(curr)+k)); //FIXME here is a bug 90 97 } 91 98 } 92 99 93 //gets only points on the line of the GPS track between waypointsnearby the point m100 //gets only points on the line of the GPS track (between waypoints) nearby the point m 94 101 private Point getInterpolated(Point m) 95 102 { … … 145 152 } 146 153 154 //returns a point on the p% of the current selected segment 147 155 private Point getInterpolated(float percent) 148 156 { … … 150 158 int dX,dY; 151 159 Point p; 152 Point leftP,rightP ,highP,lowP;160 Point leftP,rightP; 153 161 Point c = Main.map.mapView.getPoint(getCurr().getEastNorth()); 154 162 Point p1 = Main.map.mapView.getPoint(getCurr().getEastNorth()); … … 157 165 leftP=getLeftPoint(p1, p2); 158 166 rightP=getRightPoint(p1,p2); 159 highP=getHighPoint(p1, p2);160 lowP=getLowPoint(p1, p2);161 167 //we will never go over the segment 162 168 percent=percent/100; … … 200 206 old=old+inc; 201 207 Date t = new Date(old); 202 w.time = t.getTime()/1000; //TODO need better way to set time 208 w.time = t.getTime()/1000; //TODO need better way to set time and sync it 203 209 SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss:S"); 204 210 /*System.out.print(length+"px "); … … 211 217 } 212 218 219 //returns a point and time for the current segment 213 220 private WayPoint getInterpolatedWaypoint(float percentage) 214 221 { … … 218 225 } 219 226 227 //returns n points on the current segment 220 228 public List<WayPoint> getInterpolatedLine(int interval) 221 229 { … … 281 289 } 282 290 291 //returns time in ms relatie to startpoint 283 292 public long getRelativeTime() 284 293 { … … 286 295 } 287 296 288 //jumps to a specif fic time297 //jumps to a specific time 289 298 public void jump(long relTime) { 290 jump(relTime/1000); //TODO ugly quick hack 291 299 int pos = (int) (relTime/1000);//TODO ugly quick hack 300 jump(pos); 301 302 } 303 304 //toggles walking along the track 305 public void play() 306 { 307 if (t==null) 308 { 309 //start 310 t= new Timer(); 311 ani=new TimerTask() { 312 @Override 313 //some cheap animation stuff 314 public void run() { 315 next(); 316 Main.map.mapView.repaint(); 317 } 318 }; 319 t.schedule(ani,1000,1000); 320 } 321 else 322 { 323 //stop 324 ani.cancel(); 325 ani=null; 326 t.cancel(); 327 t=null; 328 } 292 329 } 293 330 -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java
r21584 r21631 44 44 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 45 45 import org.openstreetmap.josm.gui.layer.Layer; 46 import org.openstreetmap.josm.plugins.videomapping.video.GPSVideoPlayer; 46 47 import org.openstreetmap.josm.tools.ImageProvider; 47 48 import org.openstreetmap.josm.tools.Shortcut; 48 49 49 public class PositionLayer extends Layer implements MouseListener,MouseMotionListener, KeyListener { 50 //Basic rendering and GPS layer interaction 51 public class PositionLayer extends Layer implements MouseListener,MouseMotionListener { 50 52 private List<WayPoint> ls; 51 public GpsPlayer l; 52 private Collection<WayPoint> selected; 53 private Timer t; 54 private TimerTask ani; 53 public GpsPlayer player; 55 54 private boolean dragIcon=false; //do we move the icon by hand? 56 55 private WayPoint iconPosition; 57 56 private Point mouse; 58 57 private ImageIcon icon; 59 private SimpleDateFormat df; 58 private SimpleDateFormat mins; 59 private SimpleDateFormat ms; 60 private GPSVideoPlayer gps; 60 61 61 62 public PositionLayer(String name, final List<WayPoint> ls) { 62 63 super(name); 63 64 this.ls=ls; 64 l= new GpsPlayer(ls);65 selected = new ArrayList<WayPoint>(); 65 player= new GpsPlayer(ls); 66 66 67 icon=ImageProvider.get("videomapping.png"); 67 df = new SimpleDateFormat("hh:mm:ss:S"); 68 mins = new SimpleDateFormat("hh:mm:ss:S"); 69 ms= new SimpleDateFormat("mm:ss"); 68 70 Main.map.mapView.addMouseListener(this); 69 71 Main.map.mapView.addMouseMotionListener(this); … … 79 81 @Override 80 82 public Object getInfoComponent() { 81 // TODO Auto-generated method stub82 83 return null; 83 84 } … … 115 116 116 117 @Override 117 //Draw the current position 118 //Draw the current position, infos, waypoints 118 119 public void paint(Graphics2D g, MapView map, Bounds bound) { 119 120 Point p; … … 126 127 g.drawOval(p.x - 2, p.y - 2, 4, 4); 127 128 } 128 g.setColor(Color.RED);129 //draw selected GPS points130 for(WayPoint n:selected)131 {132 p = Main.map.mapView.getPoint(n.getEastNorth());133 g.drawOval(p.x - 2, p.y - 2, 4, 4);134 }135 129 //draw surrounding points 136 130 g.setColor(Color.YELLOW); 137 if( l.getPrev()!=null)138 { 139 p = Main.map.mapView.getPoint( l.getPrev().getEastNorth());131 if(player.getPrev()!=null) 132 { 133 p = Main.map.mapView.getPoint(player.getPrev().getEastNorth()); 140 134 g.drawOval(p.x - 2, p.y - 2, 4, 4); 141 Point p2 = Main.map.mapView.getPoint( l.getCurr().getEastNorth());135 Point p2 = Main.map.mapView.getPoint(player.getCurr().getEastNorth()); 142 136 g.drawLine(p.x, p.y, p2.x, p2.y); 143 137 } 144 if( l.getNext()!=null)145 { 146 p = Main.map.mapView.getPoint( l.getNext().getEastNorth());138 if(player.getNext()!=null) 139 { 140 p = Main.map.mapView.getPoint(player.getNext().getEastNorth()); 147 141 g.drawOval(p.x - 2, p.y - 2, 4, 4); 148 Point p2 = Main.map.mapView.getPoint( l.getCurr().getEastNorth());142 Point p2 = Main.map.mapView.getPoint(player.getCurr().getEastNorth()); 149 143 g.drawLine(p.x, p.y, p2.x, p2.y); 150 144 } … … 152 146 g.setColor(Color.CYAN); 153 147 g.setBackground(Color.CYAN); 154 LinkedList<WayPoint> ipo=(LinkedList<WayPoint>) l.getInterpolatedLine(5);148 LinkedList<WayPoint> ipo=(LinkedList<WayPoint>) player.getInterpolatedLine(5); 155 149 for (WayPoint wp : ipo) { 156 150 p=Main.map.mapView.getPoint(wp.getEastNorth()); … … 166 160 p=Main.map.mapView.getPoint(iconPosition.getEastNorth()); 167 161 icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2); 168 g.drawString( df.format(iconPosition.getTime()),p.x,p.y);162 g.drawString(mins.format(iconPosition.getTime()),p.x-10,p.y-10); 169 163 } 170 164 } 171 165 else 172 166 { 173 if (l.getCurr()!=null){ 174 p=Main.map.mapView.getPoint(l.getCurr().getEastNorth()); 175 icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2); 176 SimpleDateFormat ms=new SimpleDateFormat("mm:ss"); 177 g.drawString(ms.format(l.getRelativeTime()),p.x,p.y); 178 } 179 } 180 } 181 182 private void markNearestWayPoints(Point mouse) { 183 final int MAX=10; 184 Point p; 185 Rectangle rect = new Rectangle(mouse.x-MAX/2,mouse.y-MAX/2,MAX,MAX); 186 //iterate through all possible notes 187 for(WayPoint n : ls) 188 { 189 p = Main.map.mapView.getPoint(n.getEastNorth()); 190 if (rect.contains(p)) 191 { 192 selected.add(n); 193 } 194 195 } 167 if (player.getCurr()!=null){ 168 p=Main.map.mapView.getPoint(player.getCurr().getEastNorth()); 169 icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2); 170 g.drawString(ms.format(player.getRelativeTime()),p.x-10,p.y-10); 171 } 172 } 196 173 } 197 174 … … 215 192 } 216 193 194 //upper left corner like rectangle 195 private Rectangle getIconRect() 196 { 197 Point p = Main.map.mapView.getPoint(player.getCurr().getEastNorth()); 198 return new Rectangle(p.x-icon.getIconWidth()/2,p.y-icon.getIconHeight()/2,icon.getIconWidth(),icon.getIconHeight()); 199 } 200 201 217 202 @Override 218 203 public void visitBoundingBox(BoundingXYVisitor arg0) { 219 // TODO dunno what to do here 220 221 } 222 223 //mark selected points 204 // TODO don't know what to do here 205 206 } 207 224 208 public void mouseClicked(MouseEvent e) { 225 209 } … … 231 215 } 232 216 217 //init drag&drop 233 218 public void mousePressed(MouseEvent e) { 234 219 if(e.getButton() == MouseEvent.BUTTON1) { 235 220 //is it on the cam icon? 236 if ( l.getCurr()!=null)221 if (player.getCurr()!=null) 237 222 { 238 223 if (getIconRect().contains(e.getPoint())) … … 246 231 247 232 } 248 249 public void mouseReleased(MouseEvent e) {250 251 //only on leftclicks ofour layer233 234 // 235 public void mouseReleased(MouseEvent e) { 236 //only leftclicks on our layer 252 237 if(e.getButton() == MouseEvent.BUTTON1) { 253 238 if(dragIcon) … … 257 242 else 258 243 { 259 //JOptionPane.showMessageDialog(Main.parent,"test"); 260 markNearestWayPoints(e.getPoint()); 244 //simple click 261 245 WayPoint wp = getNearestWayPoint(e.getPoint()); 262 246 if(wp!=null) 263 247 { 264 l.jump(wp); 248 player.jump(wp); 249 if(gps!=null) gps.notifyGPSClick(); 265 250 } 266 251 } … … 270 255 } 271 256 272 257 //slide and restrict during movement 273 258 public void mouseDragged(MouseEvent e) { 274 259 if(dragIcon) … … 276 261 mouse=e.getPoint(); 277 262 //restrict to GPS track 278 iconPosition= l.getInterpolatedWaypoint(mouse);263 iconPosition=player.getInterpolatedWaypoint(mouse); 279 264 280 265 Main.map.mapView.repaint(); … … 282 267 } 283 268 284 private Rectangle getIconRect() 285 { 286 Point p = Main.map.mapView.getPoint(l.getCurr().getEastNorth()); 287 return new Rectangle(p.x-icon.getIconWidth()/2,p.y-icon.getIconHeight()/2,icon.getIconWidth(),icon.getIconHeight()); 288 } 289 269 //visualize drag&drop 290 270 public void mouseMoved(MouseEvent e) { 291 292 if (l.getCurr()!=null) 271 if (player.getCurr()!=null) 293 272 { 294 273 if (getIconRect().contains(e.getPoint())) … … 304 283 } 305 284 306 public void keyPressed(KeyEvent e) { 307 int i; 308 System.out.println(e.getKeyCode()); 309 switch(e.getKeyCode()) 310 { 311 case KeyEvent.VK_RIGHT: 312 { 313 l.jump(1); 314 };break; 315 case KeyEvent.VK_LEFT: 316 { 317 l.jump(-1); 318 319 };break; 320 case KeyEvent.VK_SPACE: 321 { 322 ani.cancel(); 323 } 324 } 325 326 } 327 328 public void keyReleased(KeyEvent e) { 329 // TODO Auto-generated method stub 330 331 } 332 333 public void keyTyped(KeyEvent e) { 334 // TODO Auto-generated method stub 335 336 } 337 338 public void pause() 339 { 340 if (t==null) 341 { 342 //start 343 t= new Timer(); 344 TimerTask ani=new TimerTask() { 345 @Override 346 //some cheap animation stuff 347 public void run() { 348 l.next(); 349 Main.map.mapView.repaint(); 350 } 351 }; 352 t.schedule(ani,500,500); 353 //and video 354 355 } 356 else 357 { 358 //stop 359 t.cancel(); 360 t=null; 361 } 362 } 363 364 365 public void backward() { 366 if(l!=null)l.prev(); 367 Main.map.mapView.repaint(); 368 } 369 370 public void forward() { 371 if(l!=null)l.next(); 372 Main.map.mapView.repaint(); 373 } 374 375 376 public void loop() { 377 // TODO Auto-generated method stub 378 379 } 380 285 public void setGPSPlayer(GPSVideoPlayer player) { 286 this.gps = player; 287 288 } 381 289 } -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java
r21584 r21631 37 37 * This Plugin allows you to link a video against a GPS track and playback both synchronously 38 38 */ 39 40 //Here we manage properties and start the other classes 39 41 public class VideoMappingPlugin extends Plugin implements LayerChangeListener{ 40 42 private JMenu VMenu; … … 42 44 private List<WayPoint> ls; 43 45 private JosmAction VAdd,VStart,Vbackward,Vforward,Vloop; 44 private GPSVideoPlayer video;45 private PositionLayer layer;46 private GPSVideoPlayer player; 47 private PositionLayer layer; 46 48 47 49 … … 97 99 public void actionPerformed(ActionEvent arg0) { 98 100 copyGPSLayer(); 101 enableControlMenus(true); 99 102 layer = new PositionLayer("test",ls); 100 Main.main.addLayer(layer); 101 enableControlMenus(true);102 video = new GPSVideoPlayer(new File("C:\\temp\\test.mpg"), layer.l);103 Main.main.addLayer(layer); 104 player = new GPSVideoPlayer(new File("C:\\temp\\test.mpg"), layer.player); 105 layer.setGPSPlayer(player); 103 106 } 104 107 }; … … 107 110 108 111 public void actionPerformed(ActionEvent e) { 109 video.play(); 110 video.jump(605000); 111 layer.l.jump(9*60+20); 112 layer.pause(); 112 //video.play(); 113 //video.jump(605000); 114 //layer.l.jump(9*60+20); 115 //layer.pause(); 116 player.play((9*60+20)*1000); 113 117 } 114 118 }; … … 117 121 118 122 public void actionPerformed(ActionEvent e) { 119 layer.backward();123 //layer.backward(); 120 124 121 125 } … … 125 129 126 130 public void actionPerformed(ActionEvent e) { 127 layer.forward();131 //layer.forward(); 128 132 129 133 } … … 133 137 134 138 public void actionPerformed(ActionEvent e) { 135 layer.loop();139 //layer.loop(); 136 140 137 141 } … … 147 151 148 152 149 //we can only move on ourlayer153 //we can only work on our own layer 150 154 private void enableControlMenus(boolean enabled) 151 155 { -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoFile.java
r21584 r21631 4 4 // a specific synced video 5 5 public class GPSVideoFile extends File{ 6 public long offset; 6 public long offset; //time difference in ms between GPS and Video track 7 7 8 8 public GPSVideoFile(File f, long offset) { -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java
r21584 r21631 1 1 package org.openstreetmap.josm.plugins.videomapping.video; 2 import java.awt.Color; 3 import java.awt.event.ActionEvent; 4 import java.awt.event.ActionListener; 2 5 import java.io.File; 3 6 import java.util.Timer; 4 7 import java.util.TimerTask; 5 8 9 import javax.swing.JButton; 10 11 import org.openstreetmap.josm.command.AddCommand; 12 import org.openstreetmap.josm.data.gpx.WayPoint; 6 13 import org.openstreetmap.josm.plugins.videomapping.GpsPlayer; 7 14 8 9 public class GPSVideoPlayer extends SimpleVideoPlayer{15 //combines video and GPS playback 16 public class GPSVideoPlayer{ 10 17 Timer t; 11 18 TimerTask syncGPSTrack; 12 private GpsPlayer pl; 19 private GpsPlayer gps; 20 private SimpleVideoPlayer video; 21 private JButton syncBtn; 13 22 private GPSVideoFile file; 23 private boolean synced=false; //do we playback the players together? 24 14 25 15 26 public GPSVideoPlayer(File f, final GpsPlayer pl) { 16 27 super(); 17 this.pl = pl; 18 this.file = new GPSVideoFile(f, (long)0);//10,05 19 setFile(file.getAbsoluteFile()); 20 t = new Timer(); 21 syncGPSTrack= new TimerTask() { 22 23 @Override 24 public void run() { 25 pl.next(); 26 //pl.jump(file.offset+) 27 28 this.gps = pl; 29 //test sync 30 video = new SimpleVideoPlayer(); 31 /* 32 long gpsT=(9*60+20)*1000; 33 long videoT=10*60*1000+5*1000; 34 setFile(new GPSVideoFile(f, gpsT-videoT)); */ 35 setFile(new GPSVideoFile(f, 0L)); 36 //extend GUI 37 syncBtn= new JButton("sync"); 38 syncBtn.setBackground(Color.RED); 39 syncBtn.addActionListener(new ActionListener() { 40 //do a sync 41 public void actionPerformed(ActionEvent e) { 42 long diff=gps.getRelativeTime()-video.getTime(); 43 file= new GPSVideoFile(file, diff); 44 syncBtn.setBackground(Color.GREEN); 45 synced=true; 46 gps.play(); 28 47 } 29 }; 30 //t.schedule(syncGPSTrack, 1000, 1000); 48 }); 49 setSyncMode(true); 50 video.addComponent(syncBtn); 51 t = new Timer(); 31 52 } 53 54 public void setSyncMode(boolean b) 55 { 56 if(b) 57 { 58 syncBtn.setVisible(true); 59 } 60 else 61 { 62 syncBtn.setVisible(false); 63 } 64 } 65 66 67 public void setFile(GPSVideoFile f) 68 { 69 70 file=f; 71 video.setFile(f.getAbsoluteFile()); 72 video.play(); 73 } 74 75 public void play(long gpsstart) 76 { 77 jumpToGPSTime(gpsstart); 78 gps.jump(gpsstart); 79 gps.play(); 80 } 81 82 //jumps in video to the corresponding linked time 83 public void jumpToGPSTime(long gpsT) 84 { 85 video.jump(getVideoTime(gpsT)); 86 } 87 88 //calc synced timecode from video 89 private long getVideoTime(long GPStime) 90 { 91 return GPStime-file.offset; 92 } 93 94 //calc corresponding GPS time 95 private long getGPSTime(long videoTime) 96 { 97 return videoTime+file.offset; 98 } 99 100 //when we clicked on the layer, here we update the video position 101 public void notifyGPSClick() { 102 if(synced) jumpToGPSTime(gps.getRelativeTime()); 103 104 } 105 32 106 } -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/SimpleVideoPlayer.java
r21584 r21631 22 22 import javax.swing.Action; 23 23 import javax.swing.JButton; 24 import javax.swing.JComponent; 24 25 import javax.swing.JFrame; 25 26 import javax.swing.JPanel; … … 79 80 df = new SimpleDateFormat("hh:mm:ss:S"); 80 81 scr=new Canvas(); 81 timeline = new JSlider(0,100,0); 82 timeline = new JSlider(0,100,0); //TODO better setup for ticks 82 83 play= new JButton("play"); 83 84 back= new JButton("<"); … … 99 100 //set updater 100 101 ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); 101 executorService.scheduleAtFixedRate(new Syncer(this), 0L, 500L, TimeUnit.MILLISECONDS);102 executorService.scheduleAtFixedRate(new Syncer(this), 0L, 1000L, TimeUnit.MILLISECONDS); 102 103 //setDefaultCloseOperation(EXIT_ON_CLOSE); 103 104 addWindowListener(this); … … 209 210 210 211 public void finished(MediaPlayer arg0) { 211 // TODO Auto-generated method stub 212 212 213 213 } 214 214 215 215 public void lengthChanged(MediaPlayer arg0, long arg1) { 216 // TODO Auto-generated method stub 217 218 } 219 220 public void metaDataAvailable(MediaPlayer arg0, VideoMetaData arg1) {221 // TODO Auto-generated method stub222 216 217 } 218 219 public void metaDataAvailable(MediaPlayer arg0, VideoMetaData data) { 220 scr.setSize(data.getVideoDimension()); 221 pack(); 222 223 223 } 224 224 225 225 public void paused(MediaPlayer arg0) { 226 // TODO Auto-generated method stub 227 226 228 227 } 229 228 230 229 public void playing(MediaPlayer arg0) { 231 // TODO Auto-generated method stub 232 230 233 231 } 234 232 … … 238 236 239 237 public void stopped(MediaPlayer arg0) { 240 // TODO Auto-generated method stub 241 238 242 239 } 243 240 244 241 public void timeChanged(MediaPlayer arg0, long arg1) { 245 // TODO Auto-generated method stub 246 247 } 248 249 250 public void windowActivated(WindowEvent arg0) { 251 // TODO Auto-generated method stub 252 253 } 254 255 public void windowClosed(WindowEvent arg0) { 256 // TODO Auto-generated method stub 257 258 } 242 243 } 244 245 246 public void windowActivated(WindowEvent arg0) { } 247 248 public void windowClosed(WindowEvent arg0) { } 259 249 260 250 //we have to unload and disconnect to the VLC engine … … 266 256 } 267 257 268 public void windowDeactivated(WindowEvent arg0) { 269 // TODO Auto-generated method stub 270 271 } 272 273 public void windowDeiconified(WindowEvent arg0) { 274 // TODO Auto-generated method stub 275 276 } 277 278 public void windowIconified(WindowEvent arg0) { 279 // TODO Auto-generated method stub 280 281 } 282 283 public void windowOpened(WindowEvent arg0) { 284 // TODO Auto-generated method stub 285 286 } 258 public void windowDeactivated(WindowEvent arg0) { } 259 260 public void windowDeiconified(WindowEvent arg0) { } 261 262 public void windowIconified(WindowEvent arg0) { } 263 264 public void windowOpened(WindowEvent arg0) { } 287 265 288 266 public void setFile(File f) 289 267 { 290 268 String mediaPath = f.getAbsoluteFile().toString(); 291 mp.playMedia(mediaPath, mediaOptions); 292 jump(8000); 293 jump(0); 294 mp.stop(); 295 pack(); 269 mp.playMedia(mediaPath, mediaOptions); 270 pack(); 296 271 } 297 272 … … 330 305 } 331 306 307 //allow externals to extend the ui 308 public void addComponent(JComponent c) 309 { 310 controlsPanel.add(c); 311 pack(); 312 } 313 332 314 333 315 } -
applications/editors/josm/plugins/videomapping/test/videotest.java
r21586 r21631 2 2 import java.awt.Canvas; 3 3 import java.awt.Dimension; 4 import java.awt.event.ActionEvent; 5 import java.awt.event.ActionListener; 4 6 import java.io.File; 5 7 8 import javax.swing.JButton; 6 9 import javax.swing.JFileChooser; 7 10 import javax.swing.JFrame; … … 22 25 */ 23 26 public static void main(String[] args) { 24 SimpleVideoPlayer sVP = new SimpleVideoPlayer(); 25 sVP.setFile(new File("C:\\TEMP\\test.mpg")); 26 sVP.play(); 27 sVP.jump(605000); 27 final SimpleVideoPlayer sVP = new SimpleVideoPlayer(); 28 sVP.setFile(new File("C:\\TEMP\\test.mpg")); 29 sVP.play(); //FIXME We have a bug so we get out of sync if we jump before the video is up (and this we CAN'T DETECT!!!) 30 JButton b = new JButton("jump"); 31 b.addActionListener(new ActionListener() { 32 33 public void actionPerformed(ActionEvent e) { 34 sVP.jump(610000); 35 } 36 }); 37 sVP.add(b); 28 38 29 39 }
Note:
See TracChangeset
for help on using the changeset viewer.