Changeset 6161 in osm for applications/editors
- Timestamp:
- 2007-12-26T23:44:43+01:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java
r5427 r6161 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.awt.event.ActionEvent; 5 import java.awt.event.ActionListener;6 6 import java.awt.event.KeyEvent; 7 7 import java.beans.PropertyChangeListener; 8 8 import java.util.ArrayList; 9 import java.util.Collection;10 9 import java.util.List; 11 10 … … 14 13 import javax.swing.JMenuBar; 15 14 import javax.swing.JMenuItem; 16 import javax.swing.KeyStroke;17 15 18 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.actions.JosmAction; 18 import org.openstreetmap.josm.data.gpx.GpxData; 19 19 import org.openstreetmap.josm.gui.MapFrame; 20 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint;21 20 import org.openstreetmap.josm.plugins.Plugin; 22 import org.openstreetmap.josm.actions.JosmAction;23 21 24 22 public class LiveGpsPlugin extends Plugin … … 33 31 List<PropertyChangeListener>listenerQueue; 34 32 35 private Collection<Collection<GpsPoint>> data = new ArrayList<Collection<GpsPoint>>();33 private GpxData data = new GpxData(); 36 34 private LiveGpsLayer lgpslayer; 37 35 38 36 39 40 41 42 37 public class CaptureAction extends JosmAction { 38 public CaptureAction() { 39 super(tr("Capture GPS Track"), "capturemenu", tr("Connect to gpsd server and show current position in LiveGPS layer."), KeyEvent.VK_R, KeyEvent.ALT_MASK, true); 40 } 43 41 44 45 46 47 42 public void actionPerformed(ActionEvent e) { 43 enableTracking(lgpscapture.isSelected()); 44 } 45 } 48 46 49 50 51 52 47 public class CenterAction extends JosmAction { 48 public CenterAction() { 49 super(tr("Center Once"), "centermenu", tr("Center the LiveGPS layer to current position."), KeyEvent.VK_C, 0, true); 50 } 53 51 54 55 56 57 58 59 52 public void actionPerformed(ActionEvent e) { 53 if(lgpslayer != null) { 54 lgpslayer.center(); 55 } 56 } 57 } 60 58 61 62 63 64 59 public class AutoCenterAction extends JosmAction { 60 public AutoCenterAction() { 61 super(tr("Auto-Center"), "autocentermenu", tr("Continuously center the LiveGPS layer to current position."), KeyEvent.VK_HOME, 0, true); 62 } 65 63 66 67 68 69 70 71 64 public void actionPerformed(ActionEvent e) { 65 if(lgpslayer != null) { 66 lgpslayer.center(); 67 } 68 } 69 } 72 70 73 71 public LiveGpsPlugin() … … 79 77 80 78 JosmAction captureAction = new CaptureAction(); 81 JCheckBoxMenuItem captureMenu= new JCheckBoxMenuItem(captureAction);82 lgpsmenu.add( captureMenu);83 captureMenu.setAccelerator(captureAction.shortCut);79 lgpscapture = new JCheckBoxMenuItem(captureAction); 80 lgpsmenu.add(lgpscapture); 81 lgpscapture.setAccelerator(captureAction.shortCut); 84 82 85 83 JosmAction centerAction = new CenterAction(); … … 89 87 90 88 JosmAction autoCenterAction = new AutoCenterAction(); 91 JCheckBoxMenuItem autoCenterMenu= new JCheckBoxMenuItem(autoCenterAction);92 lgpsmenu.add( autoCenterMenu);93 autoCenterMenu.setAccelerator(autoCenterAction.shortCut);89 lgpsautocenter = new JCheckBoxMenuItem(autoCenterAction); 90 lgpsmenu.add(lgpsautocenter); 91 lgpsautocenter.setAccelerator(autoCenterAction.shortCut); 94 92 } 95 93
Note:
See TracChangeset
for help on using the changeset viewer.