Changeset 23667 in osm


Ignore:
Timestamp:
2010-10-17T16:29:50+02:00 (14 years ago)
Author:
guardian
Message:

added autocenter, jump to

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

Legend:

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

    r23529 r23667  
    117117    public void jump(Time GPSAbsTime)
    118118    {
    119         goTo(getWaypoint(GPSAbsTime.getTime()-start.getTime().getTime())); //TODO replace Time by Date?
     119        Date zero=start.getTime();
     120        Time starttime = new Time(zero.getHours(),zero.getMinutes(),zero.getSeconds());
     121        long diff=GPSAbsTime.getTime()-starttime.getTime();
     122        goTo(getWaypoint(diff)); //TODO replace Time by Date?
    120123    }
    121124   
     
    339342        int pos = Math.round(relTime/1000);//TODO ugly quick hack   
    340343        goTo(pos);
    341         //if (autoCenter) Main.map.mapView.
     344        if (autoCenter) Main.map.mapView.zoomTo(curr.getCoor());
    342345    }
    343346   
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java

    r23529 r23667  
    122122        Point p;
    123123        //TODO Source out redundant calculations
    124         //TODO make icon transparent
    125124        //draw all GPS points
    126125        g.setColor(Color.YELLOW); //new Color(0,255,0,128)
     
    172171                icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);             
    173172                //g.drawString(mins.format(iconPosition.getTime()),p.x-10,p.y-10); //TODO when synced we might wan't to use a different layout
    174                 g.drawString(gpsTimeCode.format(iconPosition.getTime()),p.x-10,p.y-10);
     173                g.drawString(gpsTimeCode.format(iconPosition.getTime()),p.x-15,p.y-15);
    175174            }
    176175        }
     
    180179            p=Main.map.mapView.getPoint(gps.getCurr().getEastNorth());
    181180            icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);         
    182             g.drawString(gpsTimeCode.format(gps.getCurr().getTime()),p.x-10,p.y-10);
     181            g.drawString(gpsTimeCode.format(gps.getCurr().getTime()),p.x-15,p.y-15);
    183182            }
    184183        }
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java

    r23529 r23667  
    11package org.openstreetmap.josm.plugins.videomapping;
    22
     3import java.awt.BorderLayout;
     4import java.awt.Panel;
    35import java.awt.event.ActionEvent;
    46import java.awt.event.KeyEvent;
     
    68import java.text.SimpleDateFormat;
    79import java.util.Date;
     10
     11import javax.swing.Box;
     12import javax.swing.InputVerifier;
     13import javax.swing.JButton;
    814import javax.swing.JCheckBoxMenuItem;
     15import javax.swing.JComponent;
     16import javax.swing.JDialog;
    917import javax.swing.JFileChooser;
     18import javax.swing.JFormattedTextField;
    1019import javax.swing.JMenu;
    1120import javax.swing.JMenuItem;
    1221import javax.swing.JOptionPane;
     22import javax.swing.JPanel;
    1323import javax.swing.JRadioButtonMenuItem;
     24import javax.swing.text.MaskFormatter;
    1425
    1526import org.openstreetmap.josm.Main;
     
    4657      private final String VM_JUMPLENGTH="videomapping.jumplength";
    4758      private final String VM_LOOPLENGTH="videomapping.looplength";
     59      private String deinterlacer;
    4860      private boolean autocenter;
    49       private String deinterlacer;
    5061      private Integer jumplength,looplength;
    5162      private String mru;
     
    114125                        VRemove.setEnabled(true);
    115126                        layer.getVideoPlayer().setSubtitleAction(VSubTitles);
     127                        player=layer.getVideoPlayer();
    116128                    }
    117129                }
     
    127139       
    128140        VStart = new JosmAction(tr("Play/Pause"), "audio-playpause", tr("starts/pauses video playback"),
    129                 Shortcut.registerShortcut("videomapping:startstop","",KeyEvent.VK_NUMPAD5, Shortcut.GROUP_DIRECT), false) {
     141                Shortcut.registerShortcut("videomapping:startstop","Video: "+tr("Play/Pause"),KeyEvent.VK_NUMPAD5, Shortcut.GROUP_DIRECT), false) {
    130142           
    131143            public void actionPerformed(ActionEvent e) {                               
     
    134146        };
    135147        Vbackward = new JosmAction(tr("Backward"), "audio-prev", tr("jumps n sec back"),
    136                 Shortcut.registerShortcut("videomapping:backward","",KeyEvent.VK_NUMPAD4, Shortcut.GROUP_DIRECT), false) {
     148                Shortcut.registerShortcut("videomapping:backward","Video: "+tr("Backward"),KeyEvent.VK_NUMPAD4, Shortcut.GROUP_DIRECT), false) {
    137149            public void actionPerformed(ActionEvent e) {
    138150                player.backward();
     151            }
     152        };
     153        Vforward= new JosmAction(tr("Forward"), "audio-next", tr("jumps n sec forward"),
     154                Shortcut.registerShortcut("videomapping:forward","Video: "+tr("Forward"),KeyEvent.VK_NUMPAD6, Shortcut.GROUP_DIRECT), false) {
     155           
     156            public void actionPerformed(ActionEvent e) {
     157                player.forward();
     158                           
     159            }
     160        };
     161        Vfaster= new JosmAction(tr("Faster"), "audio-faster", tr("faster playback"),
     162                Shortcut.registerShortcut("videomapping:faster","Video: "+tr("Faster"),KeyEvent.VK_NUMPAD8, Shortcut.GROUP_DIRECT), false) {
     163           
     164            public void actionPerformed(ActionEvent e) {
     165                player.faster();
     166                           
     167            }
     168        };
     169        Vslower= new JosmAction(tr("Slower"), "audio-slower", tr("slower playback"),
     170                Shortcut.registerShortcut("videomapping:slower","Video: "+tr("Slower"),KeyEvent.VK_NUMPAD2, Shortcut.GROUP_DIRECT), false) {
     171           
     172            public void actionPerformed(ActionEvent e) {
     173                player.slower();
    139174                           
    140175            }
     
    142177        VJump= new JosmAction(tr("Jump To"), "jumpto", tr("jumps to the entered gps time"),null, false) {         
    143178            public void actionPerformed(ActionEvent e) {
    144                 String s =JOptionPane.showInputDialog(tr("please enter GPS timecode"),"10:07:57");
    145                 SimpleDateFormat format= new SimpleDateFormat("hh:mm:ss");
    146                 Date t;
    147                 try {
    148                     t = format.parse(s);
    149                     if (t!=null)
    150                         {                           
    151                             player.jumpToGPSTime(t.getTime());
    152                         }                       
    153                 } catch (ParseException e1) {
    154                     // TODO Auto-generated catch block
    155                     e1.printStackTrace();
    156                 }
    157                            
    158             }
    159         };
    160         Vforward= new JosmAction(tr("Forward"), "audio-next", tr("jumps n sec forward"),
    161                 Shortcut.registerShortcut("videomapping:forward","",KeyEvent.VK_NUMPAD6, Shortcut.GROUP_DIRECT), false) {
    162            
    163             public void actionPerformed(ActionEvent e) {
    164                 player.forward();
    165                            
    166             }
    167         };
    168         Vfaster= new JosmAction(tr("Faster"), "audio-faster", tr("faster playback"),
    169                 Shortcut.registerShortcut("videomapping:faster","",KeyEvent.VK_NUMPAD8, Shortcut.GROUP_DIRECT), false) {
    170            
    171             public void actionPerformed(ActionEvent e) {
    172                 player.faster();
    173                            
    174             }
    175         };
    176         Vslower= new JosmAction(tr("Slower"), "audio-slower", tr("slower playback"),
    177                 Shortcut.registerShortcut("videomapping:slower","",KeyEvent.VK_NUMPAD2, Shortcut.GROUP_DIRECT), false) {
    178            
    179             public void actionPerformed(ActionEvent e) {
    180                 player.slower();
    181                            
    182             }
     179                String s;
     180                try {
     181                JOptionPane d=new JOptionPane(tr("Jump to"), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
     182                JFormattedTextField inp = new JFormattedTextField(new MaskFormatter("##:##:##"));
     183                inp.setText("00:00:01");
     184                inp.setInputVerifier(new InputVerifier() {                                     
     185                                        @Override
     186                                        public boolean verify(JComponent input) {
     187                                                // TODO Auto-generated method stub
     188                                                return false;
     189                                        }
     190                                });
     191                //TODO here we should show the GPS time range to the user
     192                if(d.showConfirmDialog(Main.main.panel,inp, tr("Jump to"),JOptionPane.OK_CANCEL_OPTION)==JOptionPane.OK_OPTION)
     193                {
     194                        s=inp.getText();
     195                        Date t;
     196                        SimpleDateFormat sdf= new SimpleDateFormat("hh:mm:ss");
     197                        t = sdf.parse(s);
     198                        if (t!=null)
     199                        {
     200                            player.jumpToGPSTime(t.getTime());
     201                        }                       
     202                }
     203                } catch (ParseException e1) {
     204                            // TODO Auto-generated catch block
     205                            e1.printStackTrace();
     206                    }
     207
     208            }
     209                           
     210           
    183211        };
    184212        Vloop= new JosmAction(tr("Loop"), "loop", tr("loops n sec around current position"),
    185                 Shortcut.registerShortcut("videomapping:loop","",KeyEvent.VK_NUMPAD7, Shortcut.GROUP_DIRECT), false) {
     213                Shortcut.registerShortcut("videomapping:loop","Video: "+tr("loop"),KeyEvent.VK_NUMPAD7, Shortcut.GROUP_DIRECT), false) {
    186214           
    187215            public void actionPerformed(ActionEvent e) {
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java

    r23529 r23667  
    44import java.awt.event.ActionListener;
    55import java.io.File;
     6import java.sql.Date;
    67import java.sql.Time;
    78import java.util.List;
     
    1213import javax.swing.JCheckBoxMenuItem;
    1314
     15import org.openstreetmap.josm.Main;
    1416import org.openstreetmap.josm.data.gpx.WayPoint;
    1517import org.openstreetmap.josm.plugins.videomapping.GpsPlayer;
     
    6163            public void playing(long time) {
    6264                //sync the GPS back
    63                 if(synced) gps.jump(getGPSTime(time));
     65                if(synced) {
     66                        gps.jump(getGPSTime(time));
     67                }
    6468               
    6569            }
     
    148152    public void jumpToGPSTime(long gpsT)
    149153    {
    150        /* if(!synced)
     154        if(!synced)
    151155        {
    152156            //when not synced we can just move the icon to the right position           
    153             gps.jump(new Date(gpsT));
     157            gps.jump(new Time(gpsT));
    154158            Main.map.mapView.repaint();
    155         }*/
     159        }
    156160        video.jump(getVideoTime(gpsT));
    157161    }
Note: See TracChangeset for help on using the changeset viewer.