- Timestamp:
- 2008-12-03T00:26:37+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r965 r1101 51 51 for (OsmPrimitive osm : objects) { 52 52 String val = osm.get(key); 53 if(val == null || !value.equals(val)) 54 { 53 if (val == null || !value.equals(val)) { 55 54 this.objects.add(osm); 56 55 } -
trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java
r1000 r1101 9 9 import java.util.Collections; 10 10 import java.util.HashMap; 11 import java.util.HashSet; 11 12 import java.util.List; 12 13 import java.util.Map; 14 import java.util.Set; 13 15 14 16 import javax.swing.JLabel; … … 21 23 import org.openstreetmap.josm.command.ChangePropertyCommand; 22 24 import org.openstreetmap.josm.command.Command; 25 import org.openstreetmap.josm.data.osm.Node; 23 26 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 27 import org.openstreetmap.josm.data.osm.Relation; 25 28 import org.openstreetmap.josm.data.osm.RelationMember; 29 import org.openstreetmap.josm.data.osm.Way; 26 30 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; 31 import org.openstreetmap.josm.data.osm.visitor.Visitor; 27 32 import org.openstreetmap.josm.gui.JMultilineLabel; 28 33 import org.openstreetmap.josm.tools.GBC; … … 114 119 115 120 final JLabel rolesLabel = new JLabel( 116 tr("Roles in relations refer ing to"));121 tr("Roles in relations referring to")); 117 122 p.add(rolesLabel, GBC.std()); 118 123 … … 136 141 if (answer == JOptionPane.YES_OPTION) { 137 142 for (OsmPrimitive primitive : tagCorrectionsMap.keySet()) { 138 List<TagCorrection> tagCorrections = tagCorrectionsMap 139 .get(primitive); 143 List<TagCorrection> tagCorrections = 144 tagCorrectionsMap.get(primitive); 145 146 // create the clone 147 OsmPrimitive clone = null; 148 if (primitive instanceof Way) clone = new Way((Way)primitive); 149 else if (primitive instanceof Node) clone = new Node((Node)primitive); 150 else if (primitive instanceof Relation) clone = new Relation((Relation)primitive); 151 152 // use this structure to remember keys that have been set already so that 153 // they're not dropped by a later step 154 Set<String> keysChanged = new HashSet<String>(); 155 156 // apply all changes to this clone 140 157 for (int i = 0; i < tagCorrections.size(); i++) { 141 if (tagTableMap.get(primitive) 142 .getCorrectionTableModel().getApply(i)) { 158 if (tagTableMap.get(primitive).getCorrectionTableModel().getApply(i)) { 143 159 TagCorrection tagCorrection = tagCorrections.get(i); 144 if (tagCorrection.isKeyChanged()) 145 commands.add(new ChangePropertyCommand( 146 primitive, tagCorrection.oldKey, null)); 147 commands.add(new ChangePropertyCommand(primitive, 148 tagCorrection.newKey, 149 tagCorrection.newValue)); 160 if (tagCorrection.isKeyChanged() && !keysChanged.contains(tagCorrection.oldKey)) clone.remove(tagCorrection.oldKey); 161 clone.put(tagCorrection.newKey, tagCorrection.newValue); 162 keysChanged.add(tagCorrection.newKey); 150 163 } 151 164 } 165 166 // save the clone 167 if (!keysChanged.isEmpty()) commands.add(new ChangeCommand(primitive, clone)); 152 168 } 153 169 for (OsmPrimitive primitive : roleCorrectionMap.keySet()) {
Note:
See TracChangeset
for help on using the changeset viewer.