Changeset 36054 in osm


Ignore:
Timestamp:
2023-02-21T17:12:09+01:00 (21 months ago)
Author:
taylor.smock
Message:

Fix #22757: Fix repaint after import and delete point (patch by kolesar, modified)

Beyond fixing the repaint after import and delete point, this also fixes some
lint issues.

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

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java

    r34737 r36054  
    99import java.awt.Graphics2D;
    1010import java.awt.Point;
    11 import java.awt.Toolkit;
    1211import java.awt.event.ActionEvent;
    1312
     
    1514import javax.swing.Action;
    1615import javax.swing.Icon;
    17 import javax.swing.ImageIcon;
    1816
    1917import org.openstreetmap.josm.data.Bounds;
     
    3432import org.openstreetmap.josm.tools.ImageProvider;
    3533
     34/**
     35 * The layer for editing GPX data
     36 */
    3637public class EditGpxLayer extends Layer {
    3738
    38     private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(EditGpxPlugin.class.getResource("/images/editgpx_layer.png")));
     39    private static final Icon icon = new ImageProvider("editgpx_layer").get();
     40    /** The data that is being edited */
    3941    public final EditGpxData data;
    40     private GPXLayerImportAction layerImport;
     42    private final GPXLayerImportAction layerImport;
    4143
    4244    /**
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java

    r34737 r36054  
    1212import java.awt.Rectangle;
    1313import java.awt.event.InputEvent;
     14import java.awt.event.KeyEvent;
    1415import java.awt.event.MouseEvent;
    1516import java.util.List;
     
    2930import org.openstreetmap.josm.plugins.editgpx.data.EditGpxTrackSegment;
    3031import org.openstreetmap.josm.plugins.editgpx.data.EditGpxWayPoint;
    31 
     32import org.openstreetmap.josm.tools.Shortcut;
     33
     34/**
     35 * Enter the mode for editing GPX data
     36 */
    3237public class EditGpxMode extends MapMode implements LayerChangeListener {
    3338
     
    4348     */
    4449    public EditGpxMode(MapFrame mapFrame) {
    45         super("editgpx", "editgpx_mode.png", tr("edit gpx tracks"), Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
     50        super("editgpx", "editgpx_mode", tr("edit gpx tracks"),
     51                Shortcut.registerShortcut("editgpx:editgpx_mode", tr("EditGPX Mode"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
     52                Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
    4653        this.mapFrame = mapFrame;
    4754    }
     
    100107                }
    101108            }
     109            currentEditLayer.invalidate();
    102110        }
    103111        oldRect = null;
    104         MainApplication.getMap().mapView.repaint();
    105112    }
    106113
     
    176183            currentEditLayer.initializeImport();
    177184        }
    178         MainApplication.getMap().mapView.repaint();
     185        currentEditLayer.invalidate();
    179186    }
    180187
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxPlugin.java

    r33782 r36054  
    33 */
    44package org.openstreetmap.josm.plugins.editgpx;
    5 
    6 import javax.swing.ImageIcon;
    75
    86import org.openstreetmap.josm.gui.IconToggleButton;
     
    4442        }
    4543    }
    46 
    47     public static ImageIcon loadIcon(String name) {
    48         return new ImageIcon(EditGpxPlugin.class.getResource("/images/editgpx.png"));
    49     }
    5044}
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.java

    r34505 r36054  
    3131/**
    3232 * Import GPX data from available layers.
    33  *
    3433 */
    3534class GPXLayerImportAction extends AbstractAction {
    3635
    37     private EditGpxData data;
    38     public Object importing = new Object(); //used for synchronization
     36    private final EditGpxData data;
     37    public final Object importing = new Object(); //used for synchronization
    3938
    4039    public GPXLayerImportAction(EditGpxData data) {
     
    103102                }
    104103            }
    105             MainApplication.getMap().mapView.repaint();
    106104
    107105        } else {
Note: See TracChangeset for help on using the changeset viewer.