Changeset 6258 in josm
- Timestamp:
- 2013-09-25T02:56:42+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r6130 r6258 12 12 import java.util.List; 13 13 import java.util.Map; 14 14 import java.util.Map.Entry; 15 15 import java.util.Set; 16 16 import java.util.TreeSet; 17 17 18 import javax.swing.JOptionPane; 18 19 19 import javax.swing.SwingUtilities; 20 20 21 import org.openstreetmap.josm.Main; 21 22 import org.openstreetmap.josm.command.AddCommand; … … 51 52 public class CreateMultipolygonAction extends JosmAction { 52 53 54 /** 55 * Constructs a new {@code CreateMultipolygonAction}. 56 */ 53 57 public CreateMultipolygonAction() { 54 58 super(tr("Create multipolygon"), "multipoly_create", tr("Create multipolygon."), … … 258 262 boolean moveTags = Main.pref.getBoolean("multipoly.movetags", true); 259 263 260 for ( String key : values.keySet()) {264 for (Entry<String, String> entry : values.entrySet()) { 261 265 List<OsmPrimitive> affectedWays = new ArrayList<OsmPrimitive>(); 262 String value = values.get(key); 263 264 for( Way way : innerWays ) { 265 if( way.hasKey(key) && (value.equals(way.get(key))) ) { 266 String key = entry.getKey(); 267 String value = entry.getValue(); 268 269 for (Way way : innerWays) { 270 if (way.hasKey(key) && (value.equals(way.get(key)))) { 266 271 affectedWays.add(way); 267 272 } 268 273 } 269 274 270 if ( moveTags) {275 if (moveTags) { 271 276 // remove duplicated tags from outer ways 272 277 for( Way way : outerWays ) { … … 277 282 } 278 283 279 if (!affectedWays.isEmpty()) {284 if (!affectedWays.isEmpty()) { 280 285 // reset key tag on affected ways 281 286 commands.add(new ChangePropertyCommand(affectedWays, key, null)); … … 283 288 } 284 289 285 if ( moveTags) {290 if (moveTags) { 286 291 // add those tag values to the relation 287 292 288 293 boolean fixed = false; 289 294 Relation r2 = new Relation(relation); 290 for( String key : values.keySet() ) { 291 if( !r2.hasKey(key) && !key.equals("area") ) { 292 if( relation.isNew() ) 293 relation.put(key, values.get(key)); 295 for (Entry<String, String> entry : values.entrySet()) { 296 String key = entry.getKey(); 297 if (!r2.hasKey(key) && !key.equals("area") ) { 298 if (relation.isNew()) 299 relation.put(key, entry.getValue()); 294 300 else 295 r2.put(key, values.get(key));301 r2.put(key, entry.getValue()); 296 302 fixed = true; 297 303 } 298 304 } 299 if ( fixed && !relation.isNew())305 if (fixed && !relation.isNew()) 300 306 commands.add(new ChangeCommand(relation, r2)); 301 307 } -
trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java
r6106 r6258 13 13 import java.util.List; 14 14 import java.util.Map; 15 import java.util.Map.Entry; 15 16 16 17 import org.openstreetmap.josm.Main; … … 40 41 private static final String help = ht("/Action/PasteTags"); 41 42 43 /** 44 * Constructs a new {@code PasteTagsAction}. 45 */ 42 46 public PasteTagsAction() { 43 47 super(tr("Paste Tags"), "pastetags", … … 270 274 271 275 List<Command> commands = new ArrayList<Command>(tags.size()); 272 String v; 273 for (String key: tags.keySet()) { 274 v = tags.get(key); 275 commands.add(new ChangePropertyCommand(selection, key, "".equals(v)?null:v)); 276 for (Entry<String, String> entry: tags.entrySet()) { 277 String v = entry.getValue(); 278 commands.add(new ChangePropertyCommand(selection, entry.getKey(), "".equals(v)?null:v)); 276 279 } 277 280 commitCommands(selection, commands); -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r6248 r6258 895 895 private static void deletePreferenceKeyByPattern(String pattern, Preferences pref) { 896 896 Map<String, Setting> allSettings = pref.getAllSettings(); 897 for (String key : allSettings.keySet()) { 897 for (Entry<String, Setting> entry : allSettings.entrySet()) { 898 String key = entry.getKey(); 898 899 if (key.matches(pattern)) { 899 log("Deleting preferences: 900 pref.putSetting(key, allSettings.get(key).getNullInstance());900 log("Deleting preferences: deleting key from preferences: " + key); 901 pref.putSetting(key, entry.getValue().getNullInstance()); 901 902 } 902 903 } … … 906 907 Map<String, Setting> allSettings = pref.getAllSettings(); 907 908 if (allSettings.containsKey(key)) { 908 log("Deleting preferences: 909 log("Deleting preferences: deleting key from preferences: " + key); 909 910 pref.putSetting(key, allSettings.get(key).getNullInstance()); 910 911 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r6240 r6258 13 13 import java.util.List; 14 14 import java.util.Map; 15 import java.util.Map.Entry; 15 16 import java.util.Set; 16 17 … … 147 148 // Report duplicate house numbers 148 149 String englishDescription = marktr("House number ''{0}'' duplicated"); 149 for ( String key : map.keySet()) {150 List<OsmPrimitive> list = map.get(key);150 for (Entry<String, List<OsmPrimitive>> entry : map.entrySet()) { 151 List<OsmPrimitive> list = entry.getValue(); 151 152 if (list.size() > 1) { 152 153 errors.add(new AddressError(DUPLICATE_HOUSE_NUMBER, list, 153 tr("Duplicate house numbers"), tr(englishDescription, key), englishDescription));154 tr("Duplicate house numbers"), tr(englishDescription, entry.getKey()), englishDescription)); 154 155 } 155 156 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r6241 r6258 15 15 import java.util.List; 16 16 import java.util.Map; 17 import java.util.Map.Entry; 17 18 import java.util.Set; 18 19 … … 207 208 208 209 int nbType=0; 209 for ( String type: typeMap.keySet()) {210 if ( typeMap.get(type)) {210 for (Entry<String, Boolean> entry: typeMap.entrySet()) { 211 if (entry.getValue()) { 211 212 nbType++; 212 213 } -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r6248 r6258 21 21 import java.util.Locale; 22 22 import java.util.Map; 23 import java.util.Map.Entry; 23 24 import java.util.Set; 24 25 import java.util.Stack; … … 665 666 if (!nlists.isEmpty()) { 666 667 Double minDistSq = null; 667 List<Node> nlist;668 for (Double distSq : nlists.keySet()) {669 nlist = nlists.get(distSq);668 for (Entry<Double, List<Node>> entry : nlists.entrySet()) { 669 Double distSq = entry.getKey(); 670 List<Node> nlist = entry.getValue(); 670 671 671 672 // filter nodes to be ignored before determining minDistSq.. … … 754 755 */ 755 756 public final Node getNearestNode(Point p, Predicate<OsmPrimitive> predicate, 756 boolean use _selected, Collection<OsmPrimitive> preferredRefs) {757 boolean useSelected, Collection<OsmPrimitive> preferredRefs) { 757 758 758 759 Map<Double, List<Node>> nlists = getNearestNodesImpl(p, predicate); … … 761 762 if (preferredRefs != null && preferredRefs.isEmpty()) preferredRefs = null; 762 763 Node ntsel = null, ntnew = null, ntref = null; 763 boolean useNtsel = use _selected;764 boolean useNtsel = useSelected; 764 765 double minDistSq = nlists.keySet().iterator().next(); 765 766 766 for (Double distSq : nlists.keySet()) { 767 for (Node nd : nlists.get(distSq)) { 767 for (Entry<Double, List<Node>> entry : nlists.entrySet()) { 768 Double distSq = entry.getKey(); 769 for (Node nd : entry.getValue()) { 768 770 // find the nearest selected node 769 771 if (ntsel == null && nd.isSelected()) { -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r6087 r6258 20 20 import java.util.List; 21 21 import java.util.Map; 22 import java.util.Map.Entry; 22 23 23 24 import javax.swing.AbstractAction; … … 451 452 } 452 453 String text = ""; 453 for (OsmPrimitiveType type: stat.keySet()) { 454 int numPrimitives = stat.get(type) == null ? 0 : stat.get(type); 454 for (Entry<OsmPrimitiveType, Integer> entry: stat.entrySet()) { 455 OsmPrimitiveType type = entry.getKey(); 456 int numPrimitives = entry.getValue() == null ? 0 : entry.getValue(); 455 457 if (numPrimitives == 0) { 456 458 continue; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorter.java
r5630 r6258 10 10 import java.util.List; 11 11 import java.util.Map; 12 import java.util.Map.Entry; 12 13 13 14 import org.openstreetmap.josm.data.osm.RelationMember; … … 65 66 } 66 67 67 /* 68 /** 68 69 * Sort a collection of relation members by the way they are linked. 69 70 * … … 93 94 94 95 // Sort members and add them to result 95 for ( AdditionalSorter s : customMap.keySet()) {96 newMembers.addAll( s.sortMembers(customMap.get(s)));96 for (Entry<AdditionalSorter, List<RelationMember>> entry : customMap.entrySet()) { 97 newMembers.addAll(entry.getKey().sortMembers(entry.getValue())); 97 98 } 98 99 -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r6084 r6258 22 22 import java.util.List; 23 23 import java.util.Map; 24 import java.util.Map.Entry; 24 25 25 26 import javax.swing.AbstractAction; … … 312 313 public void setDefaultChangesetTags(Map<String, String> tags) { 313 314 pnlTagSettings.setDefaultTags(tags); 314 for ( String key: tags.keySet()) {315 if ( key.equals("comment")) {316 changesetCommentModel.setComment( tags.get(key));315 for (Entry<String, String> entry: tags.entrySet()) { 316 if ("comment".equals(entry.getKey())) { 317 changesetCommentModel.setComment(entry.getValue()); 317 318 } 318 319 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r6092 r6258 13 13 import java.util.List; 14 14 import java.util.Map; 15 import java.util.Map.Entry; 15 16 16 17 import javax.swing.DefaultListSelectionModel; … … 369 370 public void initFromTags(Map<String,String> tags) { 370 371 this.tags.clear(); 371 for (String key : tags.keySet()) { 372 String value = tags.get(key); 373 this.tags.add(new TagModel(key,value)); 372 for (Entry<String, String> entry : tags.entrySet()) { 373 this.tags.add(new TagModel(entry.getKey(), entry.getValue())); 374 374 } 375 375 sort(); -
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r6087 r6258 13 13 import java.util.HashMap; 14 14 import java.util.Map; 15 import java.util.Map.Entry; 15 16 16 17 import org.openstreetmap.josm.data.Bounds; … … 368 369 ChangesetQuery csQuery = new ChangesetQuery(); 369 370 370 for (String k: queryParams.keySet()) { 371 for (Entry<String, String> entry: queryParams.entrySet()) { 372 String k = entry.getKey(); 371 373 if (k.equals("uid")) { 372 374 if (queryParams.containsKey("display_name")) … … 378 380 csQuery.forUser(queryParams.get("display_name")); 379 381 } else if (k.equals("open")) { 380 boolean b = parseBoolean( queryParams.get(k), "open");382 boolean b = parseBoolean(entry.getValue(), "open"); 381 383 csQuery.beingOpen(b); 382 384 } else if (k.equals("closed")) { 383 boolean b = parseBoolean( queryParams.get(k), "closed");385 boolean b = parseBoolean(entry.getValue(), "closed"); 384 386 csQuery.beingClosed(b); 385 387 } else if (k.equals("time")) { 386 Date[] dates = parseTime( queryParams.get(k));388 Date[] dates = parseTime(entry.getValue()); 387 389 switch(dates.length) { 388 390 case 1: … … 395 397 } else if (k.equals("bbox")) { 396 398 try { 397 csQuery.inBbox(new Bounds( queryParams.get(k), ","));399 csQuery.inBbox(new Bounds(entry.getValue(), ",")); 398 400 } catch(IllegalArgumentException e) { 399 401 throw new ChangesetQueryUrlException(e); 400 402 } 401 403 } else 402 throw new ChangesetQueryUrlException(tr("Unsupported parameter ''{0}'' in changeset query string", k));404 throw new ChangesetQueryUrlException(tr("Unsupported parameter ''{0}'' in changeset query string", k)); 403 405 } 404 406 return csQuery; -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r6246 r6258 9 9 import java.util.HashMap; 10 10 import java.util.Map; 11 import java.util.Map.Entry; 11 12 import java.util.regex.Matcher; 12 13 import java.util.regex.Pattern; … … 232 233 */ 233 234 public static boolean validateTags(Map<String, String> tags) { 234 String value;235 235 int r; 236 236 int s = tags.size(); … … 242 242 if (r==2 || r==3) return false; if (r==4) return true; 243 243 } 244 for (String key: tags.keySet()) { 245 value = tags.get(key); 244 for (Entry<String, String> entry : tags.entrySet()) { 245 String key = entry.getKey(); 246 String value = entry.getValue(); 246 247 if (key.length() > MAX_KEY_LENGTH) { 247 248 r = warning(tr("Key is too long (max {0} characters):", MAX_KEY_LENGTH), key+"="+value, "tags.paste.keytoolong");
Note:
See TracChangeset
for help on using the changeset viewer.