Changeset 32952 in osm for applications/editors/josm


Ignore:
Timestamp:
2016-09-08T21:38:58+02:00 (8 years ago)
Author:
donvip
Message:

fix warnings

Location:
applications/editors/josm/plugins/livegps/src/livegps
Files:
4 edited

Legend:

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

    r30737 r32952  
    1111import java.net.InetAddress;
    1212import java.net.Socket;
     13import java.nio.charset.StandardCharsets;
    1314import java.util.ArrayList;
    1415import java.util.List;
     
    208209        gpsdSocket.getOutputStream().write(new byte[] { 'w', 13, 10 });
    209210
    210         gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream()));
     211        gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream(), StandardCharsets.UTF_8));
    211212        line = gpsdReader.readLine();
    212213        if (line == null)
     
    231232
    232233        if (JSONProtocol == true) {
    233             JsonObject Watch = Json.createObjectBuilder()
     234            JsonObject watch = Json.createObjectBuilder()
    234235                    .add("enable", true)
    235236                    .add("json", true)
    236237                    .build();
    237238
    238             String Request = "?WATCH=" + Watch.toString() + ";\n";
    239             gpsdSocket.getOutputStream().write(Request.getBytes());
     239            String request = "?WATCH=" + watch.toString() + ";\n";
     240            gpsdSocket.getOutputStream().write(request.getBytes(StandardCharsets.UTF_8));
    240241
    241242            connected = true;
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGpsData.java

    r30351 r32952  
    138138    }
    139139
     140    @Override
    140141    public String toString() {
    141142        return getClass().getSimpleName() + "[fix=" + fix + ", lat=" + latLon.lat()
    142         + ", long=" + latLon.lon() + ", speed=" + speed + ", course=" + course + "]";
     143        + ", long=" + latLon.lon() + ", speed=" + speed + ", course=" + course + ']';
    143144    }
    144145
     
    195196        if(way == null && Main.map != null && Main.map.mapView != null) {
    196197            Point xy = Main.map.mapView.getPoint(getLatLon());
    197             way = Main.map.mapView.getNearestWay(xy,
    198                 OsmPrimitive.isUsablePredicate);
     198            way = Main.map.mapView.getNearestWay(xy, OsmPrimitive::isUsable);
    199199        }
    200200        return way;
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGpsDialog.java

    r30506 r32952  
    6464    }
    6565
     66    @Override
    6667    public void propertyChange(PropertyChangeEvent evt) {
    6768        if (!isVisible())
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java

    r30737 r32952  
    2121import org.openstreetmap.josm.data.gpx.GpxTrack;
    2222import org.openstreetmap.josm.data.gpx.WayPoint;
     23import org.openstreetmap.josm.data.preferences.CachingProperty;
     24import org.openstreetmap.josm.data.preferences.ColorProperty;
    2325import org.openstreetmap.josm.gui.MapView;
    2426import org.openstreetmap.josm.gui.layer.GpxLayer;
     
    2830    public static final String C_LIVEGPS_COLOR_POSITION = "color.livegps.position";
    2931    public static final String C_LIVEGPS_COLOR_POSITION_ESTIMATE = "color.livegps.position_estimate";
     32
     33    private static final CachingProperty<Color> COLOR_POSITION = new ColorProperty(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.RED).cached();
     34    private static final CachingProperty<Color> COLOR_POSITION_ESTIMATE = new ColorProperty(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.CYAN).cached();
    3035
    3136    private static final int DEFAULT_REFRESH_INTERVAL = 250;
     
    122127         */
    123128   
    124         g.setColor(Main.pref.getColor(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.CYAN));
     129        g.setColor(COLOR_POSITION_ESTIMATE.get());
    125130        int w, h;
    126131        double ppm = 100 / mv.getDist100Pixel();    /* pixels per metre */
     
    148153        float ccos240 = (float )Math.cos(Math.toRadians(course + 240));
    149154   
    150         g.setColor(Main.pref.getColor(C_LIVEGPS_COLOR_POSITION, Color.RED));
     155        g.setColor(COLOR_POSITION.get());
    151156   
    152157        for (int i = 0; i < TriaThick; i++, TriaHeight--, TriaWidth--) {
     
    166171    }
    167172
     173    @Override
    168174    public void propertyChange(PropertyChangeEvent evt) {
    169175        if (!isVisible()) {
Note: See TracChangeset for help on using the changeset viewer.