Changeset 25385 in osm for applications/editors/josm
- Timestamp:
- 2011-02-21T17:03:51+01:00 (14 years ago)
- 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
r25250 r25385 30 30 } 31 31 32 //jumps to the waypoint x ms from the beginning 32 33 public WayPoint getWaypoint(long relTime) 33 34 { … … 115 116 //go to the position e.g. "14.4.2010 14:00:01"; 116 117 public void jump(Date GPSAbsTime) 117 { 118 { 118 119 Date zero=start.getTime();//TODO better Time wayfinding 119 Date starttime = new Date(zero.getHours(),zero.getMinutes(),zero.getSeconds()); 120 //patch to get same datebase 121 Date starttime = (Date) GPSAbsTime.clone(); 122 starttime.setHours(zero.getHours()); 123 starttime.setMinutes(zero.getMinutes()); 124 starttime.setSeconds(zero.getSeconds()); 120 125 long diff=GPSAbsTime.getTime()-starttime.getTime(); 121 goTo(getWaypoint(diff)); 122 } 123 124 //jumps to a specific time since the beginning 126 goTo(getWaypoint(diff)); 127 } 128 129 //jumps to a specific time since the beginning, called by Video 125 130 public void jump(long relTime) { 126 131 int pos = Math.round(relTime/1000);//TODO assumes the time is constant … … 128 133 if (autoCenter) Main.map.mapView.zoomTo(curr.getCoor()); 129 134 } 130 135 131 136 132 137 //gets only points on the line of the GPS track (between waypoints) nearby the point m … … 238 243 w.time = t.getTime()/1000; //TODO need better way to set time and sync it 239 244 SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss:S"); 240 /*System.out.print(length+"px ");241 System.out.print(ratio+"% ");242 System.out.print(inc+"ms ");243 System.out.println(df.format(t.getTime()));+*/244 245 System.out.println(df.format(w.getTime())); 245 246 //TODO we have to publish the new date to the node... … … 374 375 375 376 376 377 377 378 378 } -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java
r25250 r25385 51 51 gps= new GpsPlayer(ls); 52 52 icon = new ImageIcon("images/videomapping.png"); 53 gpsTimeCode= new SimpleDateFormat(" hh:mm:ss");//TODO replace with DF small53 gpsTimeCode= new SimpleDateFormat("HH:mm:ss");//TODO replace with DF small 54 54 Main.map.mapView.addMouseListener(this); 55 55 Main.map.mapView.addMouseMotionListener(this); 56 56 gpsVP = new GPSVideoPlayer(video, gps); 57 iconPosition=gps.getCurr(); 57 58 } 58 59 … … 253 254 } 254 255 else 255 { 256 { 256 257 //simple click 257 WayPoint wp = getNearestWayPoint(e.getPoint());258 WayPoint wp = getNearestWayPoint(e.getPoint()); 258 259 if(wp!=null) 259 260 { 260 gps.goTo(wp); 261 //jump if we know position 262 if(wp.attr.containsKey("synced")) 263 { 264 if(gpsVP!=null) gpsVP.jumpToGPSTime(new Date(gps.getRelativeTime())); //call videoplayers to set right position 265 } 261 //jump if unsynced 262 if (gpsVP.isSynced()) 263 { 264 //jump if we know position 265 if(wp.attr.containsKey("synced")) 266 { 267 gps.goTo(wp); 268 if(gpsVP!=null) gpsVP.jumpToGPSTime(new Date(gps.getRelativeTime())); //call videoplayers to set right position 269 } 270 } 271 else 272 { 273 //otherwise let user mark possible sync point 274 gps.goTo(wp); 275 } 276 266 277 } 267 278 } … … 308 319 return gpsVP; 309 320 } 321 322 public String getGPSTime() 323 { 324 return gpsTimeCode.format(iconPosition.getTime()); 325 } 310 326 } -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java
r25291 r25385 5 5 import java.awt.event.ActionEvent; 6 6 import java.awt.event.KeyEvent; 7 import java.io.File; 7 8 import java.text.ParseException; 8 9 import java.text.SimpleDateFormat; … … 73 74 VMenu.setEnabled(false); 74 75 addMenuItems(); 75 enableControlMenus( true);76 enableControlMenus(false); 76 77 loadSettings(); 77 78 applySettings(); … … 87 88 GpsLayer=((GpxLayer) newLayer); 88 89 //TODO append to GPS Layer menu 89 } 90 else 91 {/* 92 VAdd.setEnabled(false); 93 if(newLayer instanceof PositionLayer) 94 { 95 enableControlMenus(true); 96 } 97 else 98 { 99 enableControlMenus(false); 100 }*/ 101 } 102 90 } 103 91 } 104 92 … … 109 97 public void layerRemoved(Layer arg0) { 110 98 if(Main.main.getActiveLayer()==null) VMenu.setEnabled(false); 111 } //well ok we have a local copy of the GPS track....99 } //well ok we have allready a local copy of the GPS track.... 112 100 113 101 //register main controls … … 117 105 118 106 public void actionPerformed(ActionEvent arg0) { 119 JFileChooser fc = new JFileChooser( "C:\\TEMP\\");120 //fc.setSelectedFile(new File(mru));107 JFileChooser fc = new JFileChooser(mru); 108 fc.setSelectedFile(new File(mru)); 121 109 if(fc.showOpenDialog(Main.main.parent)!=JFileChooser.CANCEL_OPTION) 122 110 { 123 saveSettings(); 111 //save selected path 112 mru=fc.getSelectedFile().getAbsolutePath(); 113 Main.pref.put(VM_MRU, mru); 124 114 enableControlMenus(true); 125 115 layer = new PositionLayer(fc.getSelectedFile(),GpsLayer); … … 185 175 JOptionPane d=new JOptionPane(tr("Jump to"), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 186 176 final JFormattedTextField inp = new JFormattedTextField(new MaskFormatter("##:##:##")); 187 inp.setText( "00:00:01");177 inp.setText(layer.getGPSTime()); 188 178 inp.setInputVerifier(new InputVerifier() { 189 179 @Override 190 180 public boolean verify(JComponent input) { 191 // TODO Auto-generated method stub192 181 return false; 193 182 } 194 183 }); 184 //hack to set the focus 195 185 SwingUtilities.invokeLater(new Runnable() { 196 186 public void run() { … … 202 192 { 203 193 Date t; 204 SimpleDateFormat sdf= new SimpleDateFormat(" hh:mm:ss");194 SimpleDateFormat sdf= new SimpleDateFormat("HH:mm:ss"); 205 195 t = sdf.parse(inp.getText()); 206 196 if (t!=null) … … 324 314 Vforward.setEnabled(enabled); 325 315 Vloop.setEnabled(enabled); 316 Vfaster.setEnabled(enabled); 317 Vslower.setEnabled(enabled); 318 VJump.setEnabled(enabled); 319 326 320 } 327 321 … … 338 332 if((temp!=null)&&(temp.length()!=0)) looplength=Integer.valueOf(temp); else looplength=6000; 339 333 temp=Main.pref.get(VM_MRU); 340 if((temp!=null)&&(temp.length()!=0)) mru=Main.pref.get(VM_MRU);else mru=System.getProperty("user.home"); 334 if((temp!=null)&&(temp.length()!=0)) mru=Main.pref.get(VM_MRU);else mru=System.getProperty("user.home"); 341 335 } 342 336 … … 362 356 Main.pref.put(VM_DEINTERLACER, deinterlacer); 363 357 Main.pref.put(VM_JUMPLENGTH, jumplength.toString()); 364 Main.pref.put(VM_LOOPLENGTH, looplength.toString()); 365 Main.pref.put(VM_MRU, mru); 358 Main.pref.put(VM_LOOPLENGTH, looplength.toString()); 366 359 } 367 360 -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java
r25291 r25385 3 3 import java.awt.event.ActionEvent; 4 4 import java.awt.event.ActionListener; 5 import java.awt.event.WindowEvent; 5 6 import java.io.File; 6 7 import java.sql.Date; … … 47 48 //do a sync 48 49 public void actionPerformed(ActionEvent e) { 49 long diff=gps.getRelativeTime()-video.getTime(); //FIXME differenzierter betrachten 50 file= new GPSVideoFile(file, diff); 51 syncBtn.setBackground(Color.GREEN); 52 synced=true; 53 markSyncedPoints(); 54 video.play(); 55 //gps.play(); 50 if (!synced) 51 { 52 //FIXME doesn't work correctly after a resync 53 //determine time offset 54 long diff=gps.getRelativeTime()-video.getTime(); //FIXME differenzierter betrachten 55 file= new GPSVideoFile(file, diff); 56 syncBtn.setBackground(Color.GREEN); 57 synced=true; 58 markSyncedPoints(); 59 video.play(); 60 //gps.play(); 61 } 62 else 63 { 64 //let user resync again 65 synced=false; 66 syncBtn.setBackground(null); 67 } 56 68 } 57 69 }); … … 190 202 public boolean isSynced() 191 203 { 192 return isSynced();204 return synced; 193 205 } 194 206 … … 266 278 subtTitleComponent=a; 267 279 } 280 281 public void close() 282 { 283 video.windowClosing(new WindowEvent(video,1)); 284 } 285 268 286 269 287 -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/SimpleVideoPlayer.java
r25291 r25385 118 118 }); 119 119 } 120 }, 0L, 1000L, TimeUnit.MILLISECONDS);120 }, 0L, 200L, TimeUnit.MILLISECONDS); 121 121 //setDefaultCloseOperation(EXIT_ON_CLOSE); 122 122 addWindowListener(this); … … 294 294 public void windowClosing(WindowEvent evt) { 295 295 if(LOG.isDebugEnabled()) {LOG.debug("windowClosing(evt=" + evt + ")");} 296 pause(); 297 //FIXME stop timers etc. 296 298 mp.release(); 297 299 mp = null; 298 System.exit(0);299 300 } 300 301
Note:
See TracChangeset
for help on using the changeset viewer.