Changeset 32952 in osm for applications/editors
- Timestamp:
- 2016-09-08T21:38:58+02:00 (8 years ago)
- 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 11 11 import java.net.InetAddress; 12 12 import java.net.Socket; 13 import java.nio.charset.StandardCharsets; 13 14 import java.util.ArrayList; 14 15 import java.util.List; … … 208 209 gpsdSocket.getOutputStream().write(new byte[] { 'w', 13, 10 }); 209 210 210 gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream() ));211 gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream(), StandardCharsets.UTF_8)); 211 212 line = gpsdReader.readLine(); 212 213 if (line == null) … … 231 232 232 233 if (JSONProtocol == true) { 233 JsonObject Watch = Json.createObjectBuilder()234 JsonObject watch = Json.createObjectBuilder() 234 235 .add("enable", true) 235 236 .add("json", true) 236 237 .build(); 237 238 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)); 240 241 241 242 connected = true; -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsData.java
r30351 r32952 138 138 } 139 139 140 @Override 140 141 public String toString() { 141 142 return getClass().getSimpleName() + "[fix=" + fix + ", lat=" + latLon.lat() 142 + ", long=" + latLon.lon() + ", speed=" + speed + ", course=" + course + "]";143 + ", long=" + latLon.lon() + ", speed=" + speed + ", course=" + course + ']'; 143 144 } 144 145 … … 195 196 if(way == null && Main.map != null && Main.map.mapView != null) { 196 197 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); 199 199 } 200 200 return way; -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsDialog.java
r30506 r32952 64 64 } 65 65 66 @Override 66 67 public void propertyChange(PropertyChangeEvent evt) { 67 68 if (!isVisible()) -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
r30737 r32952 21 21 import org.openstreetmap.josm.data.gpx.GpxTrack; 22 22 import org.openstreetmap.josm.data.gpx.WayPoint; 23 import org.openstreetmap.josm.data.preferences.CachingProperty; 24 import org.openstreetmap.josm.data.preferences.ColorProperty; 23 25 import org.openstreetmap.josm.gui.MapView; 24 26 import org.openstreetmap.josm.gui.layer.GpxLayer; … … 28 30 public static final String C_LIVEGPS_COLOR_POSITION = "color.livegps.position"; 29 31 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(); 30 35 31 36 private static final int DEFAULT_REFRESH_INTERVAL = 250; … … 122 127 */ 123 128 124 g.setColor( Main.pref.getColor(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.CYAN));129 g.setColor(COLOR_POSITION_ESTIMATE.get()); 125 130 int w, h; 126 131 double ppm = 100 / mv.getDist100Pixel(); /* pixels per metre */ … … 148 153 float ccos240 = (float )Math.cos(Math.toRadians(course + 240)); 149 154 150 g.setColor( Main.pref.getColor(C_LIVEGPS_COLOR_POSITION, Color.RED));155 g.setColor(COLOR_POSITION.get()); 151 156 152 157 for (int i = 0; i < TriaThick; i++, TriaHeight--, TriaWidth--) { … … 166 171 } 167 172 173 @Override 168 174 public void propertyChange(PropertyChangeEvent evt) { 169 175 if (!isVisible()) {
Note:
See TracChangeset
for help on using the changeset viewer.