Changeset 33078 in osm for applications
- Timestamp:
- 2016-11-20T12:38:12+01:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/livegps
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/.project
r32286 r33078 16 16 </arguments> 17 17 </buildCommand> 18 <buildCommand> 19 <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> 20 <arguments> 21 </arguments> 22 </buildCommand> 18 23 </buildSpec> 19 24 <natures> 20 25 <nature>org.eclipse.jdt.core.javanature</nature> 26 <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> 21 27 </natures> 22 28 </projectDescription> -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
r33045 r33078 129 129 connect(); 130 130 } catch (IOException iox) { 131 fireGpsStatusChangeEvent( 131 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTION_FAILED, tr("Connection Failed")); 132 132 try { 133 133 Thread.sleep(1000); 134 134 } catch (InterruptedException ignore) { 135 135 Main.trace(ignore); 136 136 } 137 137 } … … 191 191 192 192 Main.info("LiveGps: trying to connect to gpsd at " + gpsdHost + ":" + gpsdPort); 193 fireGpsStatusChangeEvent( 193 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting")); 194 194 195 195 InetAddress[] addrs = InetAddress.getAllByName(gpsdHost); … … 210 210 * First emit the "w" symbol. The older version will activate, the newer one will ignore it. 211 211 */ 212 gpsdSocket.getOutputStream().write(new byte[] { 'w', 13, 10});212 gpsdSocket.getOutputStream().write(new byte[] {'w', 13, 10}); 213 213 214 214 gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream(), StandardCharsets.UTF_8)); … … 287 287 288 288 if (speedJson != null) 289 speed = (float )speedJson.doubleValue();289 speed = (float) speedJson.doubleValue(); 290 290 if (trackJson != null) 291 course = (float )trackJson.doubleValue();291 course = (float) trackJson.doubleValue(); 292 292 if (epxJson != null) 293 epx = (float )epxJson.doubleValue();293 epx = (float) epxJson.doubleValue(); 294 294 if (epyJson != null) 295 epy = (float )epyJson.doubleValue();295 epy = (float) epyJson.doubleValue(); 296 296 297 297 return new LiveGpsData(lat, lon, course, speed, epx, epy); … … 299 299 300 300 private LiveGpsData ParseOld(String line) { 301 String words[];301 String[] words; 302 302 double lat = 0; 303 303 double lon = 0; -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsData.java
r33045 r33078 24 24 private Way way; 25 25 26 /**27 * @param latitude28 * @param longitude29 * @param course30 * @param speed31 * @param haveFix32 */33 26 public LiveGpsData(double latitude, double longitude, float course, float speed) { 34 super();35 27 this.fix = true; 36 28 this.latLon = new LatLon(latitude, longitude); … … 38 30 this.speed = speed; 39 31 } 40 /** 41 * @param latitude 42 * @param longitude 43 * @param course 44 * @param speed 45 * @param haveFix 46 * @param epx 47 * @param epy 48 */ 32 49 33 public LiveGpsData(double latitude, double longitude, float course, float speed, float epx, float epy) { 50 super();51 34 this.fix = true; 52 35 this.latLon = new LatLon(latitude, longitude); … … 63 46 return this.course; 64 47 } 48 65 49 /** 66 50 * @param course the course to set … … 69 53 this.course = course; 70 54 } 55 71 56 /** 72 57 * @return the haveFix … … 75 60 return this.fix; 76 61 } 62 77 63 /** 78 64 * @param haveFix the haveFix to set … … 81 67 this.fix = haveFix; 82 68 } 69 83 70 /** 84 71 * @return the latitude … … 87 74 return this.latLon.lat(); 88 75 } 76 89 77 /** 90 78 * @return the longitude … … 93 81 return this.latLon.lon(); 94 82 } 83 95 84 /** 96 85 * @return the speed in metres per second! … … 99 88 return this.speed; 100 89 } 90 101 91 /** 102 92 * @param speed the speed to set … … 113 103 } 114 104 115 /**116 * @param latLon117 */118 105 public void setLatLon(LatLon latLon) { 119 106 this.latLon = latLon; -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsDialog.java
r33045 r33078 34 34 private LiveGpsData data; 35 35 36 /**37 * @param name38 * @param iconName39 * @param tooltip40 * @param shortcut41 * @param preferredHeight42 */43 36 public LiveGpsDialog(final MapFrame mapFrame) { 44 37 super(tr("Live GPS"), "livegps", tr("Show GPS data."), … … 46 39 KeyEvent.VK_G, Shortcut.ALT_CTRL_SHIFT), 100); 47 40 panel = new JPanel(); 48 panel.setLayout(new GridLayout(6, 2));41 panel.setLayout(new GridLayout(6, 2)); 49 42 panel.add(new JLabel(tr("Status"))); 50 43 panel.add(statusLabel = new JLabel()); … … 94 87 panel.setBackground(Color.RED); 95 88 } 96 } });89 } }); 97 90 } else if ("gpsstatus".equals(evt.getPropertyName())) { 98 91 status = (LiveGpsStatus) evt.getNewValue(); … … 107 100 panel.setBackground(Color.WHITE); 108 101 } 109 } });102 } }); 110 103 } 111 104 } -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
r33045 r33078 32 32 public static final String C_LIVEGPS_COLOR_POSITION_ESTIMATE = "color.livegps.position_estimate"; 33 33 34 private static final CachingProperty<Color> COLOR_POSITION = new ColorProperty(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.RED).cached(); 35 private static final CachingProperty<Color> COLOR_POSITION_ESTIMATE = new ColorProperty(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.CYAN).cached(); 34 private static final CachingProperty<Color> COLOR_POSITION = 35 new ColorProperty(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.RED).cached(); 36 private static final CachingProperty<Color> COLOR_POSITION_ESTIMATE = 37 new ColorProperty(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.CYAN).cached(); 36 38 37 39 private static final int DEFAULT_REFRESH_INTERVAL = 250; … … 98 100 long current = date.getTime(); 99 101 100 rv.grow(-(int) (rv.getHeight() * centerFactor), -(int)(rv.getWidth() * centerFactor));102 rv.grow(-(int) (rv.getHeight() * centerFactor), -(int) (rv.getWidth() * centerFactor)); 101 103 102 104 if (!rv.contains(P) || (centerInterval > 0 && current - lastCenter >= centerInterval)) { … … 132 134 double ppm = 100 / mv.getDist100Pixel(); /* pixels per metre */ 133 135 134 w = (int )Math.round(lastData.getEpx() * ppm);135 h = (int )Math.round(lastData.getEpy() * ppm);136 w = (int) Math.round(lastData.getEpx() * ppm); 137 h = (int) Math.round(lastData.getEpy() * ppm); 136 138 137 139 if (w > TriaWidth || h > TriaWidth) { … … 147 149 int[] y = new int[4]; 148 150 float course = lastData.getCourse(); 149 float csin = (float )Math.sin(Math.toRadians(course));150 float ccos = (float )Math.cos(Math.toRadians(course));151 float csin120 = (float )Math.sin(Math.toRadians(course + 120));152 float ccos120 = (float )Math.cos(Math.toRadians(course + 120));153 float csin240 = (float )Math.sin(Math.toRadians(course + 240));154 float ccos240 = (float )Math.cos(Math.toRadians(course + 240));151 float csin = (float) Math.sin(Math.toRadians(course)); 152 float ccos = (float) Math.cos(Math.toRadians(course)); 153 float csin120 = (float) Math.sin(Math.toRadians(course + 120)); 154 float ccos120 = (float) Math.cos(Math.toRadians(course + 120)); 155 float csin240 = (float) Math.sin(Math.toRadians(course + 240)); 156 float ccos240 = (float) Math.cos(Math.toRadians(course + 240)); 155 157 156 158 g.setColor(COLOR_POSITION.get()); … … 223 225 Main.pref.putInteger(C_REFRESH_INTERVAL, refreshInterval); 224 226 Main.pref.putInteger(C_CENTER_INTERVAL, centerInterval); 225 Main.pref.putInteger(C_CENTER_FACTOR, (int )centerFactor);227 Main.pref.putInteger(C_CENTER_FACTOR, (int) centerFactor); 226 228 227 229 /* -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsPlugin.java
r33045 r33078 180 180 acquirer.addPropertyChangeListener(lgpslayer); 181 181 acquirer.addPropertyChangeListener(lgpsdialog); 182 for (PropertyChangeListener listener : listenerQueue) 182 for (PropertyChangeListener listener : listenerQueue) { 183 183 acquirer.addPropertyChangeListener(listener); 184 } 184 185 185 186 acquirerThread.start(); -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsStatus.java
r33045 r33078 7 7 */ 8 8 public class LiveGpsStatus { 9 public enum GpsStatus {CONNECTING, CONNECTED, DISCONNECTED, CONNECTION_FAILED}; 9 public enum GpsStatus { 10 CONNECTING, CONNECTED, DISCONNECTED, CONNECTION_FAILED 11 } 12 10 13 private String statusMessage; 11 14 private GpsStatus status; 12 15 13 /**14 * @param status15 * @param statusMessage16 */17 16 public LiveGpsStatus(GpsStatus status, String statusMessage) { 18 17 super(); … … 20 19 this.statusMessage = statusMessage; 21 20 } 22 /** 21 22 /** 23 23 * @return the status 24 24 */ … … 26 26 return this.status; 27 27 } 28 28 29 /** 29 30 * @param status the status to set … … 32 33 this.status = status; 33 34 } 35 34 36 /** 35 37 * @return the statusMessage … … 38 40 return this.statusMessage; 39 41 } 42 40 43 /** 41 44 * @param statusMessage the statusMessage to set
Note:
See TracChangeset
for help on using the changeset viewer.