Changeset 6258 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2013-09-25T02:56:42+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 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);
Note:
See TracChangeset
for help on using the changeset viewer.