- Timestamp:
- 2021-03-18T00:57:09+01:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r17429 r17585 423 423 outerWays.add(way); 424 424 425 for (String key : way.keySet()){425 way.visitKeys((p, key, value) -> { 426 426 if (!values.containsKey(key)) { //relation values take precedence 427 values.put(key, way.get(key));428 } else if (!values.get(key).equals( way.get(key))) {427 values.put(key, value); 428 } else if (!values.get(key).equals(value)) { 429 429 conflictingKeys.add(key); 430 430 } 431 } 431 }); 432 432 } 433 433 } -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r17374 r17585 1698 1698 } 1699 1699 // Add tags 1700 for (String key : r.rel.keySet()) { 1701 newRel.put(key, r.rel.get(key)); 1702 } 1700 r.rel.visitKeys((p, key, value) -> newRel.put(key, value)); 1703 1701 // Delete old relation 1704 1702 relationsToDelete.add(r.rel); -
trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java
r14153 r17585 6 6 import java.util.Collection; 7 7 import java.util.Collections; 8 import java.util.Map; 8 9 9 10 import javax.swing.JOptionPane; … … 60 61 private static boolean checkMaxNodes(Collection<OsmPrimitive> primitives, long maxNodes) { 61 62 for (OsmPrimitive osmPrimitive : primitives) { 62 for (String key: osmPrimitive.keySet()) { 63 String value = osmPrimitive.get(key); 63 for (Map.Entry<String, String> entry: osmPrimitive.getKeys().entrySet()) { 64 String key = entry.getKey(); 65 String value = entry.getValue(); 64 66 if (key.length() > Tagged.MAX_TAG_LENGTH) { 65 67 if (osmPrimitive.isDeleted()) { -
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r17333 r17585 64 64 TagCollection tags = new TagCollection(); 65 65 if (primitive != null) { 66 for (String key: primitive.keySet()) { 67 tags.add(new Tag(key, primitive.get(key))); 68 } 66 primitive.visitKeys((p, key, value) -> tags.add(new Tag(key, value))); 69 67 } 70 68 return tags; -
trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
r17584 r17585 1063 1063 return search.isEmpty(); 1064 1064 1065 for (String key: osm.keySet()) { 1066 String value = osm.get(key); 1065 for (Map.Entry<String, String> entry: osm.getKeys().entrySet()) { 1066 String key = entry.getKey(); 1067 String value = entry.getValue(); 1067 1068 if (searchRegex != null) { 1068 1069 -
trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
r17434 r17585 18 18 import org.openstreetmap.josm.data.validation.TestError; 19 19 import org.openstreetmap.josm.tools.Logging; 20 import org.openstreetmap.josm.tools.SubclassFilteredCollection;21 20 22 21 /** … … 224 223 public List<TestError> validatePrimitive(OsmPrimitive p) { 225 224 final List<TestError> errors = new ArrayList<>(); 226 for (final String key : SubclassFilteredCollection.filter(p.keySet(), 227 Pattern.compile(":conditional(:.*)?$").asPredicate())) { 225 final Pattern pattern = Pattern.compile(":conditional(:.*)?$"); 226 p.visitKeys((primitive, key, value) -> { 227 if (!pattern.matcher(key).find()) { 228 return; 229 } 228 230 if (!isKeyValid(key)) { 229 231 errors.add(TestError.builder(this, Severity.WARNING, 3201) … … 231 233 .primitives(p) 232 234 .build()); 233 continue; 234 } 235 final String value = p.get(key); 235 return; 236 } 236 237 final String error = validateValue(key, value); 237 238 if (error != null) { … … 241 242 .build()); 242 243 } 243 } 244 }); 244 245 return errors; 245 246 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/InternetTags.java
r16643 r17585 122 122 @Override 123 123 public void check(OsmPrimitive p) { 124 for (String k : p.keySet()){124 p.visitKeys((primitive, k, value) -> { 125 125 // Test key against URL validator 126 126 if (!doTest(p, k, URL_KEYS, UrlValidator.getInstance(), INVALID_URL)) { … … 128 128 doTest(p, k, EMAIL_KEYS, EmailValidator.getInstance(), INVALID_EMAIL); 129 129 } 130 } 130 }); 131 131 } 132 132 } -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r17116 r17585 643 643 } 644 644 645 for (String key : osm.keySet()) { 646 text.append("<br>").append(key).append('=').append(osm.get(key)); 647 } 645 osm.visitKeys((primitive, key, value) -> text.append("<br>").append(key).append('=').append(value)); 648 646 649 647 final JLabel l = new JLabel( -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
r16674 r17585 164 164 if (o.hasKeys()) { 165 165 add(tr("Tags: ")); 166 for (String key : o.keySet()) { 167 s.append(INDENT).append(INDENT); 168 s.append(String.format("\"%s\"=\"%s\"%n", key, o.get(key))); 169 } 166 o.visitKeys((primitive, key, value) -> s.append(INDENT).append(INDENT).append(String.format("\"%s\"=\"%s\"%n", key, value))); 170 167 } 171 168 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r17462 r17585 659 659 for (IPrimitive osm : newSel) { 660 660 types.add(TaggingPresetType.forPrimitive(osm)); 661 for (String key : osm.keySet()){661 osm.visitKeys((p, key, value) -> { 662 662 if (displayDiscardableKeys || !AbstractPrimitive.getDiscardableKeys().contains(key)) { 663 String value = osm.get(key);664 663 keyCount.put(key, keyCount.containsKey(key) ? keyCount.get(key) + 1 : 1); 665 664 if (valueCount.containsKey(key)) { … … 672 671 } 673 672 } 674 } 673 }); 675 674 } 676 675 for (Entry<String, Map<String, Integer>> e : valueCount.entrySet()) { -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r16468 r17585 368 368 commitPendingEdit(); 369 369 this.tags.clear(); 370 for (String key : primitive.keySet()) { 371 String value = primitive.get(key); 372 this.tags.add(new TagModel(key, value)); 373 } 370 primitive.visitKeys((p, key, value) -> this.tags.add(new TagModel(key, value))); 374 371 sort(); 375 372 TagModel tag = new TagModel(); … … 512 509 513 510 for (OsmPrimitive prim : primitives) { 514 for (String oldkey : prim.keySet()){511 prim.visitKeys((p, oldkey, value) -> { 515 512 if (!currentkeys.contains(oldkey)) { 516 513 commands.add(new ChangePropertyCommand(prim, oldkey, null)); 517 514 } 518 } 515 }); 519 516 } 520 517 -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r16436 r17585 193 193 */ 194 194 protected void cachePrimitiveTags(OsmPrimitive primitive) { 195 for (String key: primitive.keySet()) { 196 String value = primitive.get(key); 197 tagCache.put(key, value); 198 } 195 primitive.visitKeys((p, key, value) -> tagCache.put(key, value)); 199 196 } 200 197
Note:
See TracChangeset
for help on using the changeset viewer.