Changeset 11385 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2016-12-13T01:57:37+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r10662 r11385 239 239 for (ImageryInfo info : layers) { 240 240 for (ImageryInfo def : defaultLayers) { 241 if (isSimilar(def, info)) { 242 if (def.getId() != null && !addedIds.contains(def.getId())) { 243 if (!defaultLayerIds.containsKey(def.getId())) { 244 // ignore ids used more than once (have been purged from the map) 245 continue; 246 } 247 newAddedIds.add(def.getId()); 248 if (info.getId() == null) { 249 info.setId(def.getId()); 250 changed = true; 251 } 241 if (isSimilar(def, info) && def.getId() != null && !addedIds.contains(def.getId())) { 242 if (!defaultLayerIds.containsKey(def.getId())) { 243 // ignore ids used more than once (have been purged from the map) 244 continue; 245 } 246 newAddedIds.add(def.getId()); 247 if (info.getId() == null) { 248 info.setId(def.getId()); 249 changed = true; 252 250 } 253 251 } -
trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java
r10716 r11385 134 134 } 135 135 } else { 136 if (filter.mode == SearchMode.replace) { 137 if (filter.hiding) { 138 hiddenFilters.clear(); 139 disabledFilters.clear(); 140 } 136 if (filter.mode == SearchMode.replace && filter.hiding) { 137 hiddenFilters.clear(); 138 disabledFilters.clear(); 141 139 } 142 140 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r11383 r11385 1050 1050 int counter = 0; 1051 1051 for (OsmPrimitive o : (OsmPrimitive[]) referrers) { 1052 if (dataSet == o.dataSet && o instanceof Way) { 1053 if (++counter >= n) 1054 return true; 1055 } 1052 if (dataSet == o.dataSet && o instanceof Way && ++counter >= n) 1053 return true; 1056 1054 } 1057 1055 return false; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r11360 r11385 645 645 PolyData result = null; 646 646 for (PolyData combined : outerPolygons) { 647 if (combined.contains(inner.poly) != Intersection.OUTSIDE) { 648 if (result == null || result.contains(combined.poly) == Intersection.INSIDE) { 649 result = combined; 650 } 647 if (combined.contains(inner.poly) != Intersection.OUTSIDE 648 && (result == null || result.contains(combined.poly) == Intersection.INSIDE)) { 649 result = combined; 651 650 } 652 651 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r10693 r11385 314 314 String authority = urlMatcher.group(PARSE_URL_AUTHORITY); 315 315 if ("file".equals(scheme)) { // Special case - file: allows an empty authority 316 if (!"".equals(authority)) { 317 if (authority.contains(":")) { // but cannot allow trailing : 318 setErrorMessage(tr("URL contains an invalid authority: {0}", authority)); 319 return false; 320 } 316 if (!"".equals(authority) && authority.contains(":")) { // but cannot allow trailing : 317 setErrorMessage(tr("URL contains an invalid authority: {0}", authority)); 318 return false; 321 319 } 322 320 // drop through to continue validation -
trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
r11384 r11385 65 65 for (Node n : w.getNodes()) { 66 66 if (!isPowerTower(n)) { 67 if (!isPowerAllowed(n) && IN_DOWNLOADED_AREA.test(n)) { 68 if (!w.isFirstLastNode(n) || !isPowerStation(n)) { 69 error = TestError.builder(this, Severity.WARNING, POWER_LINES) 70 .message(tr("Missing power tower/pole within power line")) 71 .primitives(n); 72 errorNode = n; 73 } 67 if (!isPowerAllowed(n) && IN_DOWNLOADED_AREA.test(n) && (!w.isFirstLastNode(n) || !isPowerStation(n))) { 68 error = TestError.builder(this, Severity.WARNING, POWER_LINES) 69 .message(tr("Missing power tower/pole within power line")) 70 .primitives(n); 71 errorNode = n; 74 72 } 75 73 } else if (fixValue == null) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r11381 r11385 466 466 withErrors.put(p, "HTML"); 467 467 } 468 if (checkValues && key != null && value != null && !value.isEmpty() && presetsValueData != null) { 469 if (!isTagIgnored(key, value)) { 470 if (!isKeyInPresets(key)) { 471 String prettifiedKey = harmonizeKey(key); 472 String fixedKey = harmonizedKeys.get(prettifiedKey); 473 if (fixedKey != null && !"".equals(fixedKey) && !fixedKey.equals(key)) { 474 // misspelled preset key 475 final TestError.Builder error = TestError.builder(this, Severity.WARNING, MISSPELLED_KEY) 476 .message(tr("Misspelled property key"), marktr("Key ''{0}'' looks like ''{1}''."), key, fixedKey) 477 .primitives(p); 478 if (p.hasKey(fixedKey)) { 479 errors.add(error.build()); 480 } else { 481 errors.add(error.fix(() -> new ChangePropertyKeyCommand(p, key, fixedKey)).build()); 482 } 483 withErrors.put(p, "WPK"); 468 if (checkValues && key != null && value != null && !value.isEmpty() && presetsValueData != null && !isTagIgnored(key, value)) { 469 if (!isKeyInPresets(key)) { 470 String prettifiedKey = harmonizeKey(key); 471 String fixedKey = harmonizedKeys.get(prettifiedKey); 472 if (fixedKey != null && !"".equals(fixedKey) && !fixedKey.equals(key)) { 473 // misspelled preset key 474 final TestError.Builder error = TestError.builder(this, Severity.WARNING, MISSPELLED_KEY) 475 .message(tr("Misspelled property key"), marktr("Key ''{0}'' looks like ''{1}''."), key, fixedKey) 476 .primitives(p); 477 if (p.hasKey(fixedKey)) { 478 errors.add(error.build()); 484 479 } else { 485 errors.add(TestError.builder(this, Severity.OTHER, INVALID_VALUE) 486 .message(tr("Presets do not contain property key"), marktr("Key ''{0}'' not in presets."), key) 487 .primitives(p) 488 .build()); 489 withErrors.put(p, "UPK"); 480 errors.add(error.fix(() -> new ChangePropertyKeyCommand(p, key, fixedKey)).build()); 490 481 } 491 } else if (!isTagInPresets(key, value)) { 492 // try to fix common typos and check again if value is still unknown 493 String fixedValue = harmonizeValue(prop.getValue()); 494 Map<String, String> possibleValues = getPossibleValues(presetsValueData.get(key)); 495 if (possibleValues.containsKey(fixedValue)) { 496 final String newKey = possibleValues.get(fixedValue); 497 // misspelled preset value 498 errors.add(TestError.builder(this, Severity.WARNING, MISSPELLED_VALUE) 499 .message(tr("Misspelled property value"), 500 marktr("Value ''{0}'' for key ''{1}'' looks like ''{2}''."), prop.getValue(), key, fixedValue) 501 .primitives(p) 502 .fix(() -> new ChangePropertyCommand(p, key, newKey)) 503 .build()); 504 withErrors.put(p, "WPV"); 505 } else { 506 // unknown preset value 507 errors.add(TestError.builder(this, Severity.OTHER, INVALID_VALUE) 508 .message(tr("Presets do not contain property value"), 509 marktr("Value ''{0}'' for key ''{1}'' not in presets."), prop.getValue(), key) 510 .primitives(p) 511 .build()); 512 withErrors.put(p, "UPV"); 513 } 482 withErrors.put(p, "WPK"); 483 } else { 484 errors.add(TestError.builder(this, Severity.OTHER, INVALID_VALUE) 485 .message(tr("Presets do not contain property key"), marktr("Key ''{0}'' not in presets."), key) 486 .primitives(p) 487 .build()); 488 withErrors.put(p, "UPK"); 514 489 } 515 } 516 } 517 if (checkFixmes && key != null && value != null && !value.isEmpty()) { 518 if ((value.toLowerCase(Locale.ENGLISH).contains("fixme") 519 || value.contains("check and delete") 520 || key.contains("todo") || key.toLowerCase(Locale.ENGLISH).contains("fixme")) 521 && !withErrors.contains(p, "FIXME")) { 522 errors.add(TestError.builder(this, Severity.OTHER, FIXME) 523 .message(tr("FIXMES")) 524 .primitives(p) 525 .build()); 526 withErrors.put(p, "FIXME"); 527 } 528 } 529 } 490 } else if (!isTagInPresets(key, value)) { 491 // try to fix common typos and check again if value is still unknown 492 String fixedValue = harmonizeValue(prop.getValue()); 493 Map<String, String> possibleValues = getPossibleValues(presetsValueData.get(key)); 494 if (possibleValues.containsKey(fixedValue)) { 495 final String newKey = possibleValues.get(fixedValue); 496 // misspelled preset value 497 errors.add(TestError.builder(this, Severity.WARNING, MISSPELLED_VALUE) 498 .message(tr("Misspelled property value"), 499 marktr("Value ''{0}'' for key ''{1}'' looks like ''{2}''."), prop.getValue(), key, fixedValue) 500 .primitives(p) 501 .fix(() -> new ChangePropertyCommand(p, key, newKey)) 502 .build()); 503 withErrors.put(p, "WPV"); 504 } else { 505 // unknown preset value 506 errors.add(TestError.builder(this, Severity.OTHER, INVALID_VALUE) 507 .message(tr("Presets do not contain property value"), 508 marktr("Value ''{0}'' for key ''{1}'' not in presets."), prop.getValue(), key) 509 .primitives(p) 510 .build()); 511 withErrors.put(p, "UPV"); 512 } 513 } 514 } 515 if (checkFixmes && key != null && value != null && !value.isEmpty() && isFixme(key, value) && !withErrors.contains(p, "FIXME")) { 516 errors.add(TestError.builder(this, Severity.OTHER, FIXME) 517 .message(tr("FIXMES")) 518 .primitives(p) 519 .build()); 520 withErrors.put(p, "FIXME"); 521 } 522 } 523 } 524 525 private static boolean isFixme(String key, String value) { 526 return key.toLowerCase(Locale.ENGLISH).contains("fixme") || key.contains("todo") 527 || value.toLowerCase(Locale.ENGLISH).contains("fixme") || value.contains("check and delete"); 530 528 } 531 529
Note:
See TracChangeset
for help on using the changeset viewer.