Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r18693 r18753 945 945 if (value != null) { 946 946 try { 947 int i = Integer.parseInt(value);947 final int i = Integer.parseInt(value); 948 948 // Sanity checks 949 949 if ((!GpxConstants.PT_SAT.equals(gpxKey) || i >= 0) && 950 950 (!GpxConstants.PT_DGPSID.equals(gpxKey) || (0 <= i && i <= 1023))) { 951 wpt.put(gpxKey, value);951 wpt.put(gpxKey, i); 952 952 } 953 953 } catch (NumberFormatException e) { … … 964 964 if (value != null) { 965 965 try { 966 double d = Double.parseDouble(value);966 final double d = Double.parseDouble(value); 967 967 // Sanity checks 968 968 if (!GpxConstants.PT_MAGVAR.equals(gpxKey) || (0.0 <= d && d < 360.0)) { 969 wpt.put(gpxKey, value);969 wpt.put(gpxKey, d); 970 970 } 971 971 } catch (NumberFormatException e) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r18742 r18753 626 626 } 627 627 628 ArrayList<String> refs = new ArrayList< String>();628 ArrayList<String> refs = new ArrayList<>(); 629 629 if (colored == ColorMode.REF) { 630 630 for (Line segment : getLinesIterable(null)) { … … 639 639 } 640 640 } 641 if ( refs.size() > 0) {641 if (!refs.isEmpty()) { 642 642 Collections.sort(refs); 643 643 String[] a = {}; … … 660 660 661 661 if (colored == ColorMode.HDOP) { 662 color = hdopScale.getColor(( Float) trkPnt.get(GpxConstants.PT_HDOP));662 color = hdopScale.getColor((Number) trkPnt.get(GpxConstants.PT_HDOP)); 663 663 } else if (colored == ColorMode.QUALITY) { 664 color = qualityScale.getColor(( Integer) trkPnt.get(GpxConstants.RTKLIB_Q));664 color = qualityScale.getColor((Number) trkPnt.get(GpxConstants.RTKLIB_Q)); 665 665 } else if (colored == ColorMode.FIX) { 666 666 Object fixval = trkPnt.get(GpxConstants.PT_FIX); … … 671 671 } 672 672 } 673 } else if (colored == ColorMode.REF) { 674 if (trkPnt.get(GpxConstants.PT_DGPSID) != null) { 675 String refval = trkPnt.get(GpxConstants.PT_DGPSID).toString(); 676 int i = refs.indexOf(refval); 677 if (i >= 0) { 678 color = refScale.getColor(i); 679 } 673 } else if (colored == ColorMode.REF && trkPnt.get(GpxConstants.PT_DGPSID) != null) { 674 String refVal = trkPnt.get(GpxConstants.PT_DGPSID).toString(); 675 int i = refs.indexOf(refVal); 676 if (i >= 0) { 677 color = refScale.getColor(i); 680 678 } 681 679 } … … 852 850 if (hdopCircle && trkPnt.get(GpxConstants.PT_HDOP) != null) { 853 851 // hdop value 854 float hdop = ( Float) trkPnt.get(GpxConstants.PT_HDOP);852 float hdop = ((Number) trkPnt.get(GpxConstants.PT_HDOP)).floatValue(); 855 853 if (hdop < 0) { 856 854 hdop = 0; -
trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java
r17763 r18753 245 245 WayPoint p1 = it.next(); 246 246 assertEquals(new LatLon(47.0, 9.0), p1.getCoor()); 247 assertEquals( "123",p1.get(GpxConstants.PT_ELE));247 assertEquals(123, (double) p1.get(GpxConstants.PT_ELE)); 248 248 assertEquals("2018-08-01T10:00:00Z", String.valueOf(p1.get(GpxConstants.PT_TIME))); 249 249 WayPoint p2 = it.next(); 250 250 assertEquals(new LatLon(47.1, 9.1), p2.getCoor()); 251 assertEquals( "456",p2.get(GpxConstants.PT_ELE));251 assertEquals(456, (double) p2.get(GpxConstants.PT_ELE)); 252 252 assertEquals("2018-08-01T10:01:00Z", String.valueOf(p2.get(GpxConstants.PT_TIME))); 253 253 WayPoint p3 = it.next(); 254 254 assertEquals(new LatLon(47.05, 9.05), p3.getCoor()); 255 assertEquals( "789",p3.get(GpxConstants.PT_ELE));255 assertEquals(789, (double) p3.get(GpxConstants.PT_ELE)); 256 256 assertEquals("2018-08-01T10:02:00Z", String.valueOf(p3.get(GpxConstants.PT_TIME))); 257 257 }
Note:
See TracChangeset
for help on using the changeset viewer.