Changeset 30506 in osm for applications/editors/josm/plugins/livegps/src
- Timestamp:
- 2014-06-30T21:34:02+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsDialog.java
r30351 r30506 14 14 import javax.swing.JLabel; 15 15 import javax.swing.JPanel; 16 import javax.swing.SwingUtilities; 16 17 17 18 import org.openstreetmap.josm.gui.MapFrame; … … 32 33 private JLabel speedLabel; 33 34 private JPanel panel; 35 private LiveGpsStatus status; 36 private LiveGpsData data; 34 37 35 38 /** … … 64 67 if (!isVisible()) 65 68 return; 69 66 70 if("gpsdata".equals(evt.getPropertyName())) { 67 LiveGpsData data = (LiveGpsData) evt.getNewValue(); 68 if(data.isFix()) { 69 // fixLabel.setText("fix"); 70 panel.setBackground(Color.WHITE); 71 latLabel.setText(data.getLatitude() + "deg"); 72 longLabel.setText(data.getLongitude() + "deg"); 73 double mySpeed = data.getSpeed() * 3.6f; 74 speedLabel.setText((Math.round(mySpeed*100)/100) + "km/h"); // m(s to km/h 75 courseLabel.setText(data.getCourse() + "deg"); 71 data = (LiveGpsData) evt.getNewValue(); 76 72 77 String wayString = data.getWayInfo(); 78 if(wayString.length() > 0) { 79 wayLabel.setText(wayString); 73 SwingUtilities.invokeLater(new Runnable() { 74 @Override 75 public void run() { 76 if(data.isFix()) { 77 panel.setBackground(Color.WHITE); 78 latLabel.setText(data.getLatitude() + "deg"); 79 longLabel.setText(data.getLongitude() + "deg"); 80 double mySpeed = data.getSpeed() * 3.6f; 81 speedLabel.setText((Math.round(mySpeed*100)/100) + "km/h"); 82 courseLabel.setText(data.getCourse() + "deg"); 83 84 String wayString = data.getWayInfo(); 85 if(wayString.length() > 0) { 86 wayLabel.setText(wayString); 87 } else { 88 wayLabel.setText(tr("unknown")); 89 } 80 90 } else { 81 wayLabel.setText(tr("unknown")); 91 latLabel.setText(""); 92 longLabel.setText(""); 93 speedLabel.setText(""); 94 courseLabel.setText(""); 95 panel.setBackground(Color.RED); 82 96 } 97 }}); 98 } else if ("gpsstatus".equals(evt.getPropertyName())) { 99 status = (LiveGpsStatus) evt.getNewValue(); 83 100 84 } else { 85 // fixLabel.setText("no fix"); 86 latLabel.setText(""); 87 longLabel.setText(""); 88 speedLabel.setText(""); 89 courseLabel.setText(""); 90 panel.setBackground(Color.RED); 91 } 92 } else if ("gpsstatus".equals(evt.getPropertyName())) { 93 LiveGpsStatus status = (LiveGpsStatus) evt.getNewValue(); 94 statusLabel.setText(status.getStatusMessage()); 95 if(status.getStatus() != LiveGpsStatus.GpsStatus.CONNECTED) { 96 panel.setBackground(Color.RED); 97 } else { 98 panel.setBackground(Color.WHITE); 99 } 101 SwingUtilities.invokeLater(new Runnable() { 102 @Override 103 public void run() { 104 statusLabel.setText(status.getStatusMessage()); 105 if(status.getStatus() != LiveGpsStatus.GpsStatus.CONNECTED) { 106 panel.setBackground(Color.RED); 107 } else { 108 panel.setBackground(Color.WHITE); 109 } 110 }}); 100 111 } 101 102 112 } 103 113 }
Note:
See TracChangeset
for help on using the changeset viewer.