Changeset 33788 in osm for applications


Ignore:
Timestamp:
2017-11-05T20:04:04+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12643

Location:
applications/editors/josm/plugins/NanoLog
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/NanoLog/build.xml

    r32680 r33788  
    55    <property name="commit.message" value="NanoLog"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="10580"/>
     7    <property name="plugin.main.version" value="12643"/>
    88    <property name="plugin.author" value="Ilya Zverev"/>
    99    <property name="plugin.class" value="nanolog.NanoLogPlugin"/>
  • applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java

    r32638 r33788  
    1616import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
    1717import org.openstreetmap.josm.data.gpx.WayPoint;
     18import org.openstreetmap.josm.tools.Logging;
    1819import org.openstreetmap.josm.tools.UncheckedParseException;
    1920import org.openstreetmap.josm.tools.date.DateUtils;
     
    5253                        break outer;
    5354                    } catch (Exception e) {
    54                         Main.warn(e);
     55                        Logging.warn(e);
    5556                    }
    5657                }
     
    99100
    100101                        } catch (UncheckedParseException e) {
    101                             Main.error("Error while parsing date \"" + curWpTimeStr + '"');
    102                             Main.error(e);
     102                            Logging.error("Error while parsing date \"" + curWpTimeStr + '"');
     103                            Logging.error(e);
    103104                            prevWp = null;
    104105                            prevWpTime = 0;
     
    247248                            prevWpTime = curWpTime;
    248249                        } catch (UncheckedParseException e) {
    249                             Main.error("Error while parsing date \"" + curWpTimeStr + '"');
    250                             Main.error(e);
     250                            Logging.error("Error while parsing date \"" + curWpTimeStr + '"');
     251                            Logging.error(e);
    251252                            prevWp = null;
    252253                            prevWpTime = 0;
  • applications/editors/josm/plugins/NanoLog/src/nanolog/GPXChooser.java

    r32638 r33788  
    33import javax.swing.JDialog;
    44
    5 import org.openstreetmap.josm.Main;
     5import org.openstreetmap.josm.gui.MainApplication;
    66import org.openstreetmap.josm.gui.layer.GpxLayer;
    77import org.openstreetmap.josm.gui.layer.Layer;
     
    2020    public static GpxLayer topLayer() {
    2121        // return first found local layer
    22         for (Layer layer : Main.getLayerManager().getLayers()) {
     22        for (Layer layer : MainApplication.getLayerManager().getLayers()) {
    2323            if (layer instanceof GpxLayer && ((GpxLayer) layer).isLocalFile())
    2424                return (GpxLayer) layer;
  • applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java

    r32638 r33788  
    3737import org.openstreetmap.josm.data.gpx.WayPoint;
    3838import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     39import org.openstreetmap.josm.gui.MainApplication;
    3940import org.openstreetmap.josm.gui.MapView;
    4041import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    4445import org.openstreetmap.josm.gui.layer.Layer;
    4546import org.openstreetmap.josm.tools.ImageProvider;
     47import org.openstreetmap.josm.tools.Logging;
    4648
    4749/**
     
    6567
    6668    public void setupListeners() {
    67         Main.map.mapView.addMouseListener(mouseListener);
    68         Main.map.mapView.addMouseMotionListener(mouseListener);
    69     }
    70 
    71     @Override
    72     public void destroy() {
    73         Main.map.mapView.removeMouseListener(mouseListener);
    74         Main.map.mapView.removeMouseMotionListener(mouseListener);
     69        MainApplication.getMap().mapView.addMouseListener(mouseListener);
     70        MainApplication.getMap().mapView.addMouseMotionListener(mouseListener);
     71    }
     72
     73    @Override
     74    public synchronized void destroy() {
     75        MainApplication.getMap().mapView.removeMouseListener(mouseListener);
     76        MainApplication.getMap().mapView.removeMouseMotionListener(mouseListener);
    7577        super.destroy();
    7678    }
     
    123125                            timeDate = fmt.parse(time);
    124126                        } catch (ParseException e) {
    125                             Main.warn(e);
     127                            Logging.warn(e);
    126128                        }
    127129                        if (message == null || message.length() == 0 || timeDate == null)
     
    132134                            try {
    133135                                pos = new LatLon(Double.parseDouble(lat), Double.parseDouble(lon));
    134                                 direction = new Integer(dir);
     136                                direction = Integer.valueOf(dir);
    135137                            } catch (NumberFormatException e) {
    136                                 Main.trace(e);
     138                                Logging.trace(e);
    137139                            }
    138140                        }
    139                         NanoLogEntry entry = new NanoLogEntry(timeDate, message, pos, direction);
    140                         result.add(entry);
     141                        result.add(new NanoLogEntry(timeDate, message, pos, direction));
    141142                    }
    142143                }
     
    221222        else if (selectedEntry >= log.size())
    222223            selectedEntry = log.size() - 1;
    223         Main.map.repaint();
     224        invalidate();
    224225    }
    225226
     
    231232        else if (selectedEntry >= log.size())
    232233            selectedEntry = log.size() - 1;
    233         Main.map.repaint();
     234        invalidate();
    234235    }
    235236
     
    237238        int newSelected = i >= 0 && i < log.size() ? i : -1;
    238239        if (newSelected != selectedEntry) {
    239 //            System.out.println("selected: " + log.get(newSelected).getMessage());
    240240            selectedEntry = newSelected;
    241241            fireMarkerSelected();
    242             Main.map.mapView.repaint();
     242            invalidate();
    243243        }
    244244    }
     
    261261
    262262        public int nearestEntry(MouseEvent e) {
    263             LatLon ll = Main.map.mapView.getLatLon(e.getX(), e.getY());
     263            LatLon ll = MainApplication.getMap().mapView.getLatLon(e.getX(), e.getY());
    264264            int radius = 8;
    265265            if (ll != null) {
    266                 LatLon lld = Main.map.mapView.getLatLon(e.getX() + radius, e.getY() + radius);
     266                LatLon lld = MainApplication.getMap().mapView.getLatLon(e.getX() + radius, e.getY() + radius);
    267267                double distance = Math.max(lld.lat() - ll.lat(), lld.lon() - ll.lon());
    268268                boolean selectedIsSelected = false;
     
    303303        public void mousePressed(MouseEvent e) {
    304304            int nearest = nearestEntry(e);
    305             if (nearest > 0 && Main.getLayerManager().getActiveLayer() == NanoLogLayer.this) {
     305            if (nearest > 0 && MainApplication.getLayerManager().getActiveLayer() == NanoLogLayer.this) {
    306306                dragging = nearest;
    307307                doDrag(e);
     
    319319        if (gpx == null)
    320320            return;
    321         EastNorth eastNorth = Main.map.mapView.getEastNorth(x, y);
    322         double tolerance = eastNorth.distance(Main.map.mapView.getEastNorth(x + 300, y));
     321        EastNorth eastNorth = MainApplication.getMap().mapView.getEastNorth(x, y);
     322        double tolerance = eastNorth.distance(MainApplication.getMap().mapView.getEastNorth(x + 300, y));
    323323        WayPoint wp = gpx.data.nearestPointOnTrack(eastNorth, tolerance);
    324324        if (wp == null)
     
    329329        Correlator.revertPos(log);
    330330        Correlator.correlate(log, gpx.data, log.get(entry).getTime().getTime() - newTime);
    331         Main.map.mapView.repaint();
     331        MainApplication.getMap().mapView.repaint();
    332332    }
    333333
     
    353353                Correlator.correlate(log, layer.data, offset);
    354354                fireMarkersChanged();
    355                 Main.map.mapView.repaint();
     355                MainApplication.getMap().mapView.repaint();
    356356            }
    357357            // 3. Show non-modal (?) window with a slider and a text input
     
    360360    }
    361361
    362     private class SaveLayer extends JosmAction {
     362    private static class SaveLayer extends JosmAction {
    363363
    364364        SaveLayer() {
  • applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java

    r32638 r33788  
    1111import javax.swing.JList;
    1212
    13 import org.openstreetmap.josm.Main;
     13import org.openstreetmap.josm.gui.MainApplication;
    1414import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    1515import org.openstreetmap.josm.gui.layer.Layer;
     
    4040    public void updateMarkers() {
    4141        List<NanoLogEntry> entries = new ArrayList<>();
    42         for (NanoLogLayer l : Main.getLayerManager().getLayersOfType(NanoLogLayer.class)) {
     42        for (NanoLogLayer l : MainApplication.getLayerManager().getLayersOfType(NanoLogLayer.class)) {
    4343            entries.addAll(l.getEntries());
    4444        }
     
    7878    }
    7979
    80     private class LogListModel extends AbstractListModel<String> {
     80    private static class LogListModel extends AbstractListModel<String> {
    8181        private List<NanoLogEntry> entries;
    8282        private final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss");
  • applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java

    r32638 r33788  
    1212import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.actions.JosmAction;
     14import org.openstreetmap.josm.gui.MainApplication;
    1415import org.openstreetmap.josm.gui.MapFrame;
    1516import org.openstreetmap.josm.plugins.Plugin;
     
    2425    public NanoLogPlugin(PluginInformation info) {
    2526        super(info);
    26         Main.main.menu.fileMenu.insert(new OpenNanoLogLayerAction(), 4);
     27        MainApplication.getMenu().fileMenu.insert(new OpenNanoLogLayerAction(), 4);
    2728    }
    2829
     
    3233            NanoLogPanel panel = new NanoLogPanel();
    3334            newFrame.addToggleDialog(panel);
    34             Main.getLayerManager().addLayerChangeListener(panel);
     35            MainApplication.getLayerManager().addLayerChangeListener(panel);
    3536        }
    3637    }
    3738
    38     private class OpenNanoLogLayerAction extends JosmAction {
     39    private static class OpenNanoLogLayerAction extends JosmAction {
    3940
    4041        OpenNanoLogLayerAction() {
     
    5051                    if (!entries.isEmpty()) {
    5152                        NanoLogLayer layer = new NanoLogLayer(entries);
    52                         Main.getLayerManager().addLayer(layer);
     53                        MainApplication.getLayerManager().addLayer(layer);
    5354                        layer.setupListeners();
    5455                    }
Note: See TracChangeset for help on using the changeset viewer.