Changeset 5346 in josm for trunk/src/org/openstreetmap/josm/gui/history
- Timestamp:
- 2012-07-17T09:34:34+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r5266 r5346 15 15 16 16 import org.openstreetmap.josm.data.coor.CoordinateFormat; 17 import org.openstreetmap.josm.data.coor.LatLon; 17 18 import org.openstreetmap.josm.data.osm.history.HistoryNode; 18 19 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; … … 256 257 HistoryNode oppositeNode = (HistoryNode) opposite; 257 258 259 LatLon coord = node.getCoords(); 260 LatLon oppositeCoord = oppositeNode.getCoords(); 261 258 262 // display the coordinates 259 263 // 260 lblLat.setText( node.getCoords().latToString(CoordinateFormat.DECIMAL_DEGREES));261 lblLon.setText( node.getCoords().lonToString(CoordinateFormat.DECIMAL_DEGREES));264 lblLat.setText(coord != null ? coord.latToString(CoordinateFormat.DECIMAL_DEGREES) : tr("Deleted")); 265 lblLon.setText(coord != null ? coord.lonToString(CoordinateFormat.DECIMAL_DEGREES) : tr("Deleted")); 262 266 263 267 // update background color to reflect differences in the coordinates 264 268 // 265 if (node.getCoords().lat() == oppositeNode.getCoords().lat()) { 269 if (coord == oppositeCoord || 270 (coord != null && oppositeCoord != null && coord.lat() == oppositeCoord.lat())) { 266 271 lblLat.setBackground(Color.WHITE); 267 272 } else { 268 273 lblLat.setBackground(BGCOLOR_DIFFERENCE); 269 274 } 270 if (node.getCoords().lon() == oppositeNode.getCoords().lon()) { 275 if (coord == oppositeCoord || 276 (coord != null && oppositeCoord != null && coord.lon() == oppositeCoord.lon())) { 271 277 lblLon.setBackground(Color.WHITE); 272 278 } else { 273 279 lblLon.setBackground(BGCOLOR_DIFFERENCE); 274 280 } 275 276 281 } 277 282 … … 322 327 HistoryNode oppositeNode = (HistoryNode) opposite; 323 328 329 LatLon coord = node.getCoords(); 330 LatLon oppositeCoord = oppositeNode.getCoords(); 331 324 332 // update distance 325 333 // 326 double distance = node.getCoords().greatCircleDistance(oppositeNode.getCoords()); 327 if (distance > 0) { 328 lblDistance.setBackground(BGCOLOR_DIFFERENCE); 334 if (coord != null && oppositeCoord != null) { 335 double distance = coord.greatCircleDistance(oppositeCoord); 336 if (distance > 0) { 337 lblDistance.setBackground(BGCOLOR_DIFFERENCE); 338 } else { 339 lblDistance.setBackground(Color.WHITE); 340 } 341 lblDistance.setText(NavigatableComponent.getDistText(distance)); 329 342 } else { 330 lblDistance.setBackground(Color.WHITE); 343 lblDistance.setBackground(coord != oppositeCoord ? BGCOLOR_DIFFERENCE : Color.WHITE); 344 lblDistance.setText(tr("Deleted")); 331 345 } 332 lblDistance.setText(NavigatableComponent.getDistText(distance));333 346 } 334 347 }
Note:
See TracChangeset
for help on using the changeset viewer.