Changeset 1843 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2009-07-25T18:37:45+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagMergeItem.java
r1655 r1843 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import java.util.HashMap;7 5 8 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 56 54 if (their == null) throw new IllegalArgumentException(tr("parameter '{0}' must not be null", "their")); 57 55 this.key = key; 58 myTagValue = null; 59 if (my.keys != null && my.keys.containsKey(key)) { 60 myTagValue = my.keys.get(key); 61 } 62 theirTagValue = null; 63 if (their.keys != null && their.keys.containsKey(key)) { 64 theirTagValue = their.keys.get(key); 65 } 56 myTagValue = my.get(key); 57 theirTagValue = their.get(key); 66 58 } 67 59 … … 108 100 throw new IllegalStateException(tr("cannot apply undecided tag merge item")); 109 101 } else if (mergeDecision == MergeDecisionType.KEEP_THEIR) { 110 if (theirTagValue == null && primitive.keys != null) {111 primitive. keys.remove(key);102 if (theirTagValue == null) { 103 primitive.remove(key); 112 104 } else if (theirTagValue != null) { 113 if (primitive.keys == null) { 114 primitive.keys = new HashMap<String, String>(); 115 } 116 primitive.keys.put(key, theirTagValue); 105 primitive.put(key, theirTagValue); 117 106 } 118 107 } else if (mergeDecision == MergeDecisionType.KEEP_MINE) { 119 if (myTagValue == null && primitive.keys != null) {120 primitive. keys.remove(key);108 if (myTagValue == null) { 109 primitive.remove(key); 121 110 } else if (myTagValue != null) { 122 if (primitive.keys == null) { 123 primitive.keys = new HashMap<String, String>(); 124 } 125 primitive.keys.put(key, myTagValue); 111 primitive.put(key, myTagValue); 126 112 } 127 113 } else { -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1815 r1843 240 240 HashMap<String, Vector<OsmPrimitive>> map=new HashMap<String, Vector<OsmPrimitive>>(); 241 241 for (OsmPrimitive osm: sel) { 242 if(osm.keys != null) 242 String val=osm.get(key); 243 if(val != null) 243 244 { 244 String val=osm.keys.get(key); 245 if(val != null) 246 { 247 if (map.containsKey(val)) { 248 map.get(val).add(osm); 249 } else { 250 Vector<OsmPrimitive> v = new Vector<OsmPrimitive>(); 251 v.add(osm); 252 map.put(val, v); 253 } 245 if (map.containsKey(val)) { 246 map.get(val).add(osm); 247 } else { 248 Vector<OsmPrimitive> v = new Vector<OsmPrimitive>(); 249 v.add(osm); 250 map.put(val, v); 254 251 } 255 252 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/TagEditorModel.java
r1814 r1843 9 9 import java.util.Collection; 10 10 import java.util.Comparator; 11 import java.util.HashMap;12 11 import java.util.List; 13 12 import java.util.logging.Logger; … … 15 14 import javax.swing.table.AbstractTableModel; 16 15 17 import org.openstreetmap.josm.Main;18 16 import org.openstreetmap.josm.command.ChangePropertyCommand; 19 17 import org.openstreetmap.josm.command.Command; … … 24 22 /** 25 23 * TagEditorModel is a table model. 26 * 27 * 24 * 25 * 28 26 * @author gubaer 29 27 * … … 104 102 /** 105 103 * adds a tag to the model 106 * 104 * 107 105 * @param tag the tag. Must not be null. 108 * 106 * 109 107 * @exception IllegalArgumentException thrown, if tag is null 110 108 */ … … 129 127 /** 130 128 * adds a tag given by a name/value pair to the tag editor model. 131 * 129 * 132 130 * If there is no tag with name <code>name</name> yet, a new {@link TagModel} is created 133 131 * and append to this model. 134 * 132 * 135 133 * If there is a tag with name <code>name</name>, <code>value</code> is merged to the list 136 134 * of values for this tag. 137 * 135 * 138 136 * @param name the name; converted to "" if null 139 137 * @param value the value; converted to "" if null … … 183 181 /** 184 182 * deletes the names of the tags given by tagIndices 185 * 183 * 186 184 * @param tagIndices a list of tag indices 187 185 */ … … 201 199 /** 202 200 * deletes the values of the tags given by tagIndices 203 * 201 * 204 202 * @param tagIndices the lit of tag indices 205 203 */ … … 219 217 /** 220 218 * deletes the tags given by tagIndices 221 * 219 * 222 220 * @param tagIndices the list of tag indices 223 221 */ … … 261 259 /** 262 260 * initializes the model with the tags of an OSM primitive 263 * 261 * 264 262 * @param primitive the OSM primitive 265 263 */ … … 278 276 /** 279 277 * applies the current state of the tag editor model to a primitive 280 * 278 * 281 279 * @param primitive the primitive 282 * 280 * 283 281 */ 284 282 public void applyToPrimitive(OsmPrimitive primitive) { 285 if (primitive.keys == null) { 286 primitive.keys = new HashMap<String, String>(); 287 } else { 288 primitive.keys.clear(); 289 } 283 primitive.removeAll(); 290 284 for (TagModel tag: tags) { 291 285 // tag still holds an unchanged list of different values for the same key. … … 306 300 /** 307 301 * checks whether the tag model includes a tag with a given key 308 * 302 * 309 303 * @param key the key 310 304 * @return true, if the tag model includes the tag; false, otherwise … … 345 339 346 340 for (OsmPrimitive primitive : primitives) { 347 if (primitive.keys == null) { 348 continue; 349 } 350 for (String oldkey : primitive.keys.keySet()) { 341 for (String oldkey : primitive.keySet()) { 351 342 if (!currentkeys.contains(oldkey)) { 352 343 ChangePropertyCommand deleteCommand = … … 367 358 /** 368 359 * replies the list of keys of the tags managed by this model 369 * 360 * 370 361 * @return the list of keys managed by this model 371 362 */ … … 397 388 * updates the name of a tag and sets the dirty state to true if 398 389 * the new name is different from the old name. 399 * 390 * 400 391 * @param tag the tag 401 392 * @param newName the new name … … 412 403 * updates the value value of a tag and sets the dirty state to true if the 413 404 * new name is different from the old name 414 * 405 * 415 406 * @param tag the tag 416 407 * @param newValue the new value … … 426 417 /** 427 418 * replies true, if this model has been updated 428 * 419 * 429 420 * @return true, if this model has been updated 430 421 */ -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r1823 r1843 18 18 import java.awt.TexturePaint; 19 19 import java.awt.event.ActionEvent; 20 import java.awt.event.KeyEvent;21 20 import java.awt.geom.Area; 22 21 import java.awt.image.BufferedImage; … … 38 37 39 38 import org.openstreetmap.josm.Main; 40 import org.openstreetmap.josm.actions.GpxExportAction;41 39 import org.openstreetmap.josm.actions.RenameLayerAction; 42 import org.openstreetmap.josm.actions.SaveAction;43 import org.openstreetmap.josm.actions.SaveAsAction;44 40 import org.openstreetmap.josm.data.conflict.Conflict; 45 41 import org.openstreetmap.josm.data.conflict.ConflictCollection; … … 67 63 import org.openstreetmap.josm.tools.GBC; 68 64 import org.openstreetmap.josm.tools.ImageProvider; 69 import org.openstreetmap.josm.tools.Shortcut;70 65 71 66 /** … … 82 77 /** 83 78 * Replies a new unique name for a data layer 84 * 79 * 85 80 * @return a new unique name for a data layer 86 81 */ … … 497 492 wpt.setTime(); 498 493 } 499 if (n.keys != null && n.keys.containsKey("name")) { 500 wpt.attr.put("name", n.keys.get("name")); 494 String name = n.get("name"); 495 if (name != null) { 496 wpt.attr.put("name", name); 501 497 } 502 498 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r1747 r1843 4 4 import java.util.Collections; 5 5 import java.util.HashMap; 6 import java.util.Iterator; 6 7 import java.util.LinkedList; 7 8 import java.util.List; 8 9 import java.util.Map; 9 import java.util.Iterator; 10 10 11 import org.openstreetmap.josm.Main; 11 12 import org.openstreetmap.josm.data.osm.Node; 12 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 14 import org.openstreetmap.josm.data.osm.OsmUtils; 14 15 import org.openstreetmap.josm.data.osm.Way; 15 import org.openstreetmap.josm.Main;16 16 17 17 public class ElemStyles … … 185 185 { 186 186 boolean noclosed = o instanceof Way && !((Way)o).isClosed(); 187 Iterator<String> iterator = o.key s.keySet().iterator();187 Iterator<String> iterator = o.keySet().iterator(); 188 188 while(iterator.hasNext()) 189 189 { 190 190 String key = iterator.next(); 191 String val = o. keys.get(key);191 String val = o.get(key); 192 192 AreaElemStyle s = areas.get("n" + key + "=" + val); 193 193 if(s == null || (s.closed && noclosed)) -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r1814 r1843 106 106 returnValue.hadEmpty = true; 107 107 } 108 if(s.keys != null && s.keys.size() > 0) { 109 returnValue.hadKeys = true; 110 } 108 returnValue.hadKeys = returnValue.hadKeys | s.hasKeys(); 111 109 } 112 110 return returnValue; … … 220 218 { 221 219 for (OsmPrimitive s : sel) 222 if(s. keys != null && s.keys.size() > 0) {220 if(s.hasKeys()) { 223 221 def = false; 224 222 } … … 381 379 382 380 // no change if same as before 383 if (value.equals(originalValue) || (originalValue == null && (value == null || value.length() == 0))) return;384 385 if (delete_if_empty && value != null && value.length() == 0) {381 if (value.equals(originalValue) || (originalValue == null && value.length() == 0)) return; 382 383 if (delete_if_empty && value.length() == 0) { 386 384 value = null; 387 385 }
Note:
See TracChangeset
for help on using the changeset viewer.