Changeset 6161 in osm for applications/editors


Ignore:
Timestamp:
2007-12-26T23:44:43+01:00 (17 years ago)
Author:
christofd
Message:

using GpxLayer/GpxData instead of RawGpsLayer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java

    r5427 r6161  
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     4
    45import java.awt.event.ActionEvent;
    5 import java.awt.event.ActionListener;
    66import java.awt.event.KeyEvent;
    77import java.beans.PropertyChangeListener;
    88import java.util.ArrayList;
    9 import java.util.Collection;
    109import java.util.List;
    1110
     
    1413import javax.swing.JMenuBar;
    1514import javax.swing.JMenuItem;
    16 import javax.swing.KeyStroke;
    1715
    1816import org.openstreetmap.josm.Main;
     17import org.openstreetmap.josm.actions.JosmAction;
     18import org.openstreetmap.josm.data.gpx.GpxData;
    1919import org.openstreetmap.josm.gui.MapFrame;
    20 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint;
    2120import org.openstreetmap.josm.plugins.Plugin;
    22 import org.openstreetmap.josm.actions.JosmAction;
    2321
    2422public class LiveGpsPlugin extends Plugin
     
    3331    List<PropertyChangeListener>listenerQueue;
    3432   
    35         private Collection<Collection<GpsPoint>> data = new ArrayList<Collection<GpsPoint>>();
     33        private GpxData data = new GpxData();
    3634    private LiveGpsLayer lgpslayer;
    3735   
    3836       
    39         public class CaptureAction extends JosmAction {
    40         public CaptureAction() {
    41                 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);
    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        }
    4341
    44         public void actionPerformed(ActionEvent e) {
    45                 enableTracking(lgpscapture.isSelected());
    46         }
    47         }
     42        public void actionPerformed(ActionEvent e) {
     43            enableTracking(lgpscapture.isSelected());
     44        }
     45    }
    4846
    49         public class CenterAction extends JosmAction {
    50         public CenterAction() {
    51                 super(tr("Center Once"), "centermenu", tr("Center the LiveGPS layer to current position."), KeyEvent.VK_C, 0, true);
    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        }
    5351
    54         public void actionPerformed(ActionEvent e) {
    55                 if(lgpslayer != null) {
    56                         lgpslayer.center();
    57                 }
    58         }
    59         }
     52        public void actionPerformed(ActionEvent e) {
     53            if(lgpslayer != null) {
     54                lgpslayer.center();
     55            }
     56        }
     57    }
    6058
    61         public class AutoCenterAction extends JosmAction {
    62         public AutoCenterAction() {
    63                 super(tr("Auto-Center"), "autocentermenu", tr("Continuously center the LiveGPS layer to current position."), KeyEvent.VK_HOME, 0, true);
    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        }
    6563
    66         public void actionPerformed(ActionEvent e) {
    67                 if(lgpslayer != null) {
    68                         lgpslayer.center();
    69                 }
    70         }
    71         }
     64        public void actionPerformed(ActionEvent e) {
     65            if(lgpslayer != null) {
     66                lgpslayer.center();
     67            }
     68        }
     69    }
    7270
    7371    public LiveGpsPlugin()
     
    7977       
    8078        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);
    8482
    8583        JosmAction centerAction = new CenterAction();
     
    8987
    9088        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);
    9492    }
    9593   
Note: See TracChangeset for help on using the changeset viewer.