Changeset 25861 in osm
- Timestamp:
- 2011-04-16T21:03:42+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/videomapping
- Files:
-
- 5 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/videomapping/.settings/org.eclipse.core.resources.prefs
r25742 r25861 1 # Tue Mar 22 11:01:15 CET 20111 #Fri Apr 15 18:36:49 CEST 2011 2 2 eclipse.preferences.version=1 3 encoding//uml/oldConcept.uml=UTF-8 4 encoding//uml/oldConcept.umlclass=UTF-8 3 5 encoding//uml/refactoring.uml=UTF-8 4 6 encoding//uml/refactoring.umlclass=UTF-8 7 encoding//uml/rendering.uml=UTF-8 8 encoding//uml/rendering.umlseq=UTF-8 -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPlugin.java
r25796 r25861 207 207 if(fc.showOpenDialog(Main.main.parent)!=JFileChooser.CANCEL_OPTION) 208 208 { 209 //mostRecentFolder=fc.getSelectedFile().getAbsolutePath();210 //saveProperties();209 mostRecentFolder=fc.getSelectedFile().getAbsolutePath(); 210 saveProperties(); 211 211 VideoPositionLayer videoPositionLayer= new VideoPositionLayer(gpsLayer); 212 GPSVideoPlayer gpsVideoPlayer = new GPSVideoPlayer(new SimpleDateFormat("hh:mm:ss") ,videoPositionLayer); 213 gpsVideoPlayer.addVideo(fc.getSelectedFile()); 212 214 } 213 215 -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPositionLayer.java
r25796 r25861 138 138 } 139 139 140 p rivateWayPoint getWayPointBefore(Date GPSTime)140 public WayPoint getWayPointBefore(Date GPSTime) 141 141 { 142 142 assert GPSTime.after(getFirstWayPoint().getTime())==true; … … 196 196 if(p1.getCoor().lon()>p2.getCoor().lon()) return p1; else return p2; 197 197 } 198 199 public Date getGPSDate() 200 { 201 return iconPosition.getTime(); 202 } 198 203 199 204 public void mouseReleased(MouseEvent e) { -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideo.java
r25765 r25861 1 1 package org.openstreetmap.josm.plugins.videomapping.video; 2 import java.awt.Canvas; 2 3 import java.io.File; 3 4 5 import javax.swing.JComponent; 6 4 7 // a specific synced video 5 public class GPSVideo { 8 public class GPSVideo extends Video{ 9 public JComponent SyncComponent; 10 public GPSVideo(File filename, Canvas canvas) { 11 super(filename, canvas); 12 } 6 13 7 14 -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java
r25765 r25861 1 1 package org.openstreetmap.josm.plugins.videomapping.video; 2 import java.awt.BorderLayout; 2 3 import java.awt.Color; 4 import java.awt.FlowLayout; 5 import java.awt.HeadlessException; 3 6 import java.awt.event.ActionEvent; 4 7 import java.awt.event.ActionListener; … … 7 10 import java.sql.Date; 8 11 import java.sql.Time; 12 import java.text.DateFormat; 13 import java.util.Iterator; 14 import java.util.LinkedList; 9 15 import java.util.List; 10 16 import java.util.Timer; … … 13 19 import javax.swing.JButton; 14 20 import javax.swing.JCheckBoxMenuItem; 21 import javax.swing.JPanel; 15 22 16 23 import org.openstreetmap.josm.Main; … … 18 25 import org.openstreetmap.josm.plugins.videomapping.GpsPlayer; 19 26 import org.openstreetmap.josm.plugins.videomapping.VideoObserver; 27 import org.openstreetmap.josm.plugins.videomapping.VideoPositionLayer; 28 29 import static org.openstreetmap.josm.tools.I18n.*; 30 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 20 31 21 32 //extends video playback, major control has the video player 22 public class GPSVideoPlayer 33 public class GPSVideoPlayer extends VideoPlayer 23 34 { 35 private JPanel syncPanel; 36 private List<GPSVideo> videos; 37 private List<JButton> syncButtons; 38 private VideoPositionLayer videoPositionLayer; 39 40 public GPSVideoPlayer(DateFormat videoTimeFormat,VideoPositionLayer videoPositionLayer) throws HeadlessException { 41 super(videoTimeFormat); 42 extendUI(); 43 syncButtons=new LinkedList<JButton>(); 44 this.videoPositionLayer=videoPositionLayer; 45 } 46 47 @Override 48 public GPSVideo addVideo(File Videofile) { 49 50 GPSVideo video=(GPSVideo) super.addVideo(Videofile); 51 videos.add(video); 52 JButton syncButton= new JButton(tr("Sync")); 53 syncButton.setBackground(Color.RED); 54 syncPanel.add(syncButton); 55 syncButton.addActionListener(new ActionListener() { 56 //do a sync 57 public void actionPerformed(ActionEvent e) { 58 GPSVideo v=findVideo((JButton)e.getSource()); 59 doSync(v,videoPositionLayer); 60 } 61 }); 62 return video; 63 } 64 65 protected void doSync(GPSVideo v, VideoPositionLayer layer) { 66 WayPoint first=getFirstGPS(v.getTime(),layer.getGPSDate()); 67 68 } 69 70 //make sure we don't leave the GPS track 71 private WayPoint getFirstGPS(long videoTime, java.util.Date gpsDate) { 72 Date start=new Date(gpsDate.getTime()-videoTime); 73 if(start.before(videoPositionLayer.getFirstWayPoint().getTime())) 74 { 75 return videoPositionLayer.getFirstWayPoint(); 76 } 77 else 78 { 79 return videoPositionLayer.getWayPointBefore(start); 80 } 81 } 82 83 //make sure we don't leave the GPS track 84 private WayPoint getLastGPS(long videoTime, java.util.Date gpsDate) { 85 Date end=new Date(gpsDate.getTime()-videoTime); 86 if(end.after(videoPositionLayer.getLastWayPoint().getTime())) 87 { 88 return videoPositionLayer.getLastWayPoint(); 89 } 90 else 91 { 92 return videoPositionLayer.getWayPointBefore(end); 93 } 94 } 95 96 protected GPSVideo findVideo(JButton source) { 97 for (GPSVideo v : videos) { 98 if (v.SyncComponent==source) return v; 99 } 100 return null; 101 } 102 103 private void extendUI() { 104 syncPanel=new JPanel(new FlowLayout()); 105 screenPanel.add(syncPanel,BorderLayout.EAST); 106 107 } 108 109 110 24 111 25 112 -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/Video.java
r25765 r25861 16 16 } 17 17 18 public long getTime() 19 { 20 return player.getTime(); 21 } 22 18 23 19 24 } -
applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoPlayer.java
r25765 r25861 61 61 public class VideoPlayer extends JFrame implements WindowListener, VideosObserver, VideoPlayerObserver{ 62 62 private static final int notificationIntervall = 1000; 63 pr ivateJPanel screenPanel,controlsPanel,canvasPanel;63 protected JPanel screenPanel,controlsPanel,canvasPanel; 64 64 private JSlider timeline; 65 65 private JButton play,back,forward; … … 94 94 } 95 95 96 public voidaddVideo(File Videofile)96 public Video addVideo(File Videofile) 97 97 { 98 98 Video video = new Video(Videofile,new Canvas()); … … 102 102 pack(); 103 103 startNotificationTimer(); 104 return video; 104 105 } 105 106
Note:
See TracChangeset
for help on using the changeset viewer.