- Timestamp:
- 2019-10-06T00:32:07+02:00 (5 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r15419 r15427 184 184 185 185 String lengthstr = SystemOfMeasurement.getSystemOfMeasurement().getDistText( 186 ways.stream().collect( 187 Collectors.summingDouble(w -> { 188 return w.getLength(); 189 }))); 186 ways.stream().mapToDouble(Way::getLength).sum()); 190 187 191 188 double err = askSimplifyWays(trn( -
trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java
r15396 r15427 5 5 6 6 import java.text.NumberFormat; 7 import java.util.Collections; 7 8 import java.util.Locale; 8 9 import java.util.Map; … … 73 74 * @since 3406 74 75 */ 75 public static final Map<String, SystemOfMeasurement> ALL_SYSTEMS = Stream.of(METRIC, CHINESE, IMPERIAL, NAUTICAL_MILE) 76 .collect(Collectors.toMap(SystemOfMeasurement::getName, Function.identity())); 76 public static final Map<String, SystemOfMeasurement> ALL_SYSTEMS = Collections.unmodifiableMap( 77 Stream.of(METRIC, CHINESE, IMPERIAL, NAUTICAL_MILE) 78 .collect(Collectors.toMap(SystemOfMeasurement::getName, Function.identity()))); 77 79 78 80 /** -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r15398 r15427 436 436 437 437 /** 438 * Ensures a unique name among gpx layers 438 439 * @param attrs attributes of/for an gpx track, written to if the name appeared previously in {@code counts}. 439 440 * @param counts a {@code HashMap} of previously seen names, associated with their count. -
trunk/src/org/openstreetmap/josm/data/validation/tests/SharpAngles.java
r15406 r15427 9 9 import java.util.Map; 10 10 import java.util.Map.Entry; 11 import java.util.Objects; 11 12 import java.util.TreeSet; 12 13 … … 20 21 import org.openstreetmap.josm.data.validation.TestError; 21 22 import org.openstreetmap.josm.tools.Geometry; 22 import org.openstreetmap.josm.tools. Logging;23 import org.openstreetmap.josm.tools.bugreport.BugReport; 23 24 24 25 /** … … 56 57 try { 57 58 checkWayForSharpAngles(way); 58 } catch (Exception e) { 59 Logging.error("Way https://osm.org/way/{0} caused an error ({1})", way.getUniqueId(), e); 60 throw e; 59 } catch (RuntimeException e) { 60 throw BugReport.intercept(e).put("way", way); 61 61 } 62 62 } … … 159 159 severityBreakPoints.put(maxAngle * 2 / 3, Severity.WARNING); 160 160 } 161 162 @Override 163 public int hashCode() { 164 return 31 * super.hashCode() + Objects.hash(ignoreHighways, maxAngle, maxLength); 165 } 166 167 @Override 168 public boolean equals(Object obj) { 169 if (this == obj) 170 return true; 171 if (!super.equals(obj) || getClass() != obj.getClass()) 172 return false; 173 SharpAngles other = (SharpAngles) obj; 174 return Objects.equals(ignoreHighways, other.ignoreHighways) 175 && Double.doubleToLongBits(maxAngle) == Double.doubleToLongBits(other.maxAngle) 176 && Double.doubleToLongBits(maxLength) == Double.doubleToLongBits(other.maxLength); 177 } 161 178 } 162 -
trunk/src/org/openstreetmap/josm/gui/io/importexport/GeoJSONImporter.java
r15424 r15427 52 52 progressMonitor.worked(1); 53 53 MainApplication.getLayerManager().addLayer(new OsmDataLayer(data, file.getName(), file)); 54 } catch ( finalException e) {54 } catch (IOException | IllegalDataException e) { 55 55 Logging.error("Error while reading json file!"); 56 56 Logging.error(e); -
trunk/src/org/openstreetmap/josm/io/GeoJSONReader.java
r15424 r15427 89 89 private void parseFeature(final JsonObject feature) { 90 90 JsonValue geometry = feature.get(GEOMETRY); 91 if (geometry != null && geometry.getValueType() .equals(JsonValue.ValueType.OBJECT)) {91 if (geometry != null && geometry.getValueType() == JsonValue.ValueType.OBJECT) { 92 92 parseGeometry(feature, geometry.asJsonObject()); 93 93 } else { 94 94 JsonValue properties = feature.get(PROPERTIES); 95 if (properties != null && properties.getValueType() .equals(JsonValue.ValueType.OBJECT)) {95 if (properties != null && properties.getValueType() == JsonValue.ValueType.OBJECT) { 96 96 parseNonGeometryFeature(feature, properties.asJsonObject()); 97 97 } else { … … 104 104 // get relation type 105 105 JsonValue type = properties.get(TYPE); 106 if (type == null || properties.getValueType() .equals(JsonValue.ValueType.STRING)) {106 if (type == null || properties.getValueType() == JsonValue.ValueType.STRING) { 107 107 Logging.warn(tr("Relation/non-geometry feature without type found: {0}", feature)); 108 108 return; … … 258 258 } 259 259 260 private void fillTagsFromFeature(final JsonObject feature, final OsmPrimitive primitive) {260 private static void fillTagsFromFeature(final JsonObject feature, final OsmPrimitive primitive) { 261 261 if (feature != null) { 262 262 primitive.setKeys(getTags(feature)); … … 264 264 } 265 265 266 private void parseUnknown(final JsonObject object) {266 private static void parseUnknown(final JsonObject object) { 267 267 Logging.warn(tr("Unknown json object found {0}", object)); 268 268 } 269 269 270 private void parseNullGeometry(JsonObject feature) {270 private static void parseNullGeometry(JsonObject feature) { 271 271 Logging.warn(tr("Geometry of feature {0} is null", feature)); 272 272 } 273 273 274 private Map<String, String> getTags(final JsonObject feature) {274 private static Map<String, String> getTags(final JsonObject feature) { 275 275 final Map<String, String> tags = new TreeMap<>(); 276 276 277 277 if (feature.containsKey(PROPERTIES) && !feature.isNull(PROPERTIES)) { 278 278 JsonValue properties = feature.get(PROPERTIES); 279 if (properties != null && JsonValue.ValueType.OBJECT.equals(properties.getValueType())) {279 if (properties != null && properties.getValueType() == JsonValue.ValueType.OBJECT) { 280 280 for (Map.Entry<String, JsonValue> stringJsonValueEntry : properties.asJsonObject().entrySet()) { 281 281 final JsonValue value = stringJsonValueEntry.getValue(); -
trunk/src/org/openstreetmap/josm/io/GeoJSONServerReader.java
r15424 r15427 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.util.Objects; 7 8 … … 32 33 progressMonitor.beginTask(tr("Contacting Server…"), 10); 33 34 return new GeoJSONImporter().parseDataSet(url); 34 } catch ( Exception e) {35 } catch (IOException | IllegalDataException e) { 35 36 throw new OsmTransferException(e); 36 37 } finally { -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r15401 r15427 140 140 fieldName += '_'; 141 141 } 142 fieldName = fieldName.replace All(":", "_");142 fieldName = fieldName.replace(':', '_'); 143 143 try { 144 144 Object c = current.peek(); -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java
r15424 r15427 39 39 */ 40 40 @Test 41 public void test () throws Exception {41 public void testReadGeoJson() throws Exception { 42 42 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geo.json"))) { 43 43 final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader()
Note:
See TracChangeset
for help on using the changeset viewer.