Ignore:
Timestamp:
2016-09-06T23:29:57+02:00 (8 years ago)
Author:
donvip
Message:

fix deprecation warnings

Location:
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java

    r32548 r32930  
    99
    1010import org.openstreetmap.josm.Main;
     11import org.openstreetmap.josm.data.preferences.ColorProperty;
    1112import org.openstreetmap.josm.gui.util.GuiHelper;
    1213
    1314public class FDSettings {
    14     public Color COLOR_FIXED;
    15     public Color COLOR_NORMAL;
    16     public Color COLOR_DELETE;
    17     public Color COLOR_SELECTEDFRAGMENT;
    18     public Color COLOR_EDITEDFRAGMENT;
    19     public Color COLOR_SIMPLIFIED;
     15    public ColorProperty COLOR_FIXED = new ColorProperty("fastdraw.color.delete", Color.red);
     16    public ColorProperty COLOR_NORMAL = new ColorProperty("fastdraw.color.edit", Color.orange);
     17    public ColorProperty COLOR_DELETE = new ColorProperty("fastdraw.color.fixed", Color.green);
     18    public ColorProperty COLOR_SELECTEDFRAGMENT = new ColorProperty("fastdraw.color.normal", Color.red);
     19    public ColorProperty COLOR_EDITEDFRAGMENT = new ColorProperty("fastdraw.color.select", Color.blue);
     20    public ColorProperty COLOR_SIMPLIFIED = new ColorProperty("fastdraw.color.simplified", Color.orange);
    2021
    2122    public double maxDist;
     
    5152
    5253    public void loadPrefs() {
    53         COLOR_DELETE = Main.pref.getColor("fastdraw.color.delete", Color.red);
    54         COLOR_EDITEDFRAGMENT = Main.pref.getColor("fastdraw.color.edit", Color.orange);
    55         COLOR_FIXED = Main.pref.getColor("fastdraw.color.fixed", Color.green);
    56         COLOR_NORMAL = Main.pref.getColor("fastdraw.color.normal", Color.red);
    57         COLOR_SELECTEDFRAGMENT = Main.pref.getColor("fastdraw.color.select", Color.blue);
    58         COLOR_SIMPLIFIED = Main.pref.getColor("fastdraw.color.simplified", Color.orange);
    59 
    6054        normalStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.normal", "2"));
    6155        deleteStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.delete", "3"));
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java

    r32929 r32930  
    162162        LatLon pp1, pp2;
    163163        p1 = line.getPoint(pts.get(0));
    164         g.setColor(settings.COLOR_FIXED);
     164        g.setColor(settings.COLOR_FIXED.get());
    165165        g.fillOval(p1.x - bigDotSize/2, p1.y - bigDotSize/2, bigDotSize, bigDotSize);
    166166        Color lineColor, initLineColor;
    167         initLineColor = line.wasSimplified() ? settings.COLOR_SIMPLIFIED : settings.COLOR_NORMAL;
     167        initLineColor = line.wasSimplified() ? settings.COLOR_SIMPLIFIED.get() : settings.COLOR_NORMAL.get();
    168168        lineColor = initLineColor;
    169169        int rp, dp;
     
    180180                p2 = line.getPoint(pp2);
    181181                if (shift && highlightedFragmentStart == pp1 && nearestPointIndex < 0) {
    182                     lineColor = settings.COLOR_SELECTEDFRAGMENT;
     182                    lineColor = settings.COLOR_SELECTEDFRAGMENT.get();
    183183                }
    184184                if (!shift && line.isLastPoint(i)) {
    185                     lineColor = settings.COLOR_EDITEDFRAGMENT;
     185                    lineColor = settings.COLOR_EDITEDFRAGMENT.get();
    186186                }
    187187                g.setColor(lineColor);
     
    198198                            // highlight node to delete
    199199                            g.setStroke(settings.deleteStroke);
    200                             g.setColor(settings.COLOR_DELETE);
     200                            g.setColor(settings.COLOR_DELETE.get());
    201201                            g.drawLine(p2.x - 5, p2.y - 5, p2.x + 5, p2.y + 5);
    202202                            g.drawLine(p2.x - 5, p2.y + 5, p2.x + 5, p2.y - 5);
     
    205205                            // highlight node to toggle fixation
    206206                            g.setStroke(settings.deleteStroke);
    207                             g.setColor(line.isFixed(pp2) ? settings.COLOR_NORMAL : settings.COLOR_FIXED);
     207                            g.setColor(line.isFixed(pp2) ? settings.COLOR_NORMAL.get() : settings.COLOR_FIXED.get());
    208208                            g.fillOval(p2.x - bigDotSize/2-2, p2.y - bigDotSize/2-2, bigDotSize+4, bigDotSize+4);
    209209                            g.setStroke(settings.normalStroke);
     
    212212                }
    213213            }
    214             g.setColor(settings.COLOR_FIXED);
     214            g.setColor(settings.COLOR_FIXED.get());
    215215            for (Point p: fixedPoints) {
    216216                g.fillOval(p.x - bigDotSize/2, p.y - bigDotSize/2, bigDotSize, bigDotSize);
Note: See TracChangeset for help on using the changeset viewer.