Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
- Timestamp:
- 2015-06-20T23:42:21+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r8419 r8510 47 47 @Override 48 48 public boolean fixKeys(Map<String, String> keys, OsmPrimitive osm) { 49 if(osm instanceof Relation && "multipolygon".equals(keys.get("type")) && "administrative".equals(keys.get("boundary"))) { 49 if (osm instanceof Relation && "multipolygon".equals(keys.get("type")) && "administrative".equals(keys.get("boundary"))) { 50 50 keys.put("type", "boundary"); 51 51 return true; … … 81 81 String k = Tag.removeWhiteSpaces(e.getKey()); 82 82 boolean drop = k.isEmpty() || v.isEmpty(); 83 if(!e.getKey().equals(k)) { 84 if(drop || !keys.containsKey(k)) { 83 if (!e.getKey().equals(k)) { 84 if (drop || !keys.containsKey(k)) { 85 85 newKeys.put(e.getKey(), null); 86 if(!drop) 86 if (!drop) 87 87 newKeys.put(k, v); 88 88 } 89 } else if(!e.getValue().equals(v)) { 89 } else if (!e.getValue().equals(v)) { 90 90 newKeys.put(k, v.isEmpty() ? null : v); 91 91 } else if (drop) { … … 124 124 @Override 125 125 public boolean fixKeys(Map<String, String> keys, OsmPrimitive osm) { 126 if(keys.containsKey(oldKey) && !keys.containsKey(newKey)) { 126 if (keys.containsKey(oldKey) && !keys.containsKey(newKey)) { 127 127 keys.put(newKey, keys.get(oldKey)); 128 128 keys.put(oldKey, null); 129 129 return true; 130 } else if(keys.containsKey(oldKey) && keys.containsKey(newKey) && keys.get(oldKey).equals(keys.get(newKey))) { 130 } else if (keys.containsKey(oldKey) && keys.containsKey(newKey) && keys.get(oldKey).equals(keys.get(newKey))) { 131 131 keys.put(oldKey, null); 132 132 return true; … … 166 166 @Override 167 167 public boolean fixKeys(Map<String, String> keys, OsmPrimitive osm) { 168 if(oldValue.equals(keys.get(oldKey)) && (newKey.equals(oldKey) 168 if (oldValue.equals(keys.get(oldKey)) && (newKey.equals(oldKey) 169 169 || !keys.containsKey(newKey) || keys.get(newKey).equals(newValue))) { 170 170 keys.put(newKey, newValue); 171 if(!newKey.equals(oldKey)) 171 if (!newKey.equals(oldKey)) 172 172 keys.put(oldKey, null); 173 173 return true; … … 183 183 @Override 184 184 public boolean checkUpload(APIDataSet apiDataSet) { 185 if(!Main.pref.getBoolean("fix.data.on.upload", true)) 185 if (!Main.pref.getBoolean("fix.data.on.upload", true)) 186 186 return true; 187 187 … … 191 191 for (OsmPrimitive osm : objectsToUpload) { 192 192 Map<String, String> keys = new HashMap<>(osm.getKeys()); 193 if(!keys.isEmpty()) { 193 if (!keys.isEmpty()) { 194 194 boolean modified = false; 195 195 for (FixData fix : deprecated) { 196 if(fix.fixKeys(keys, osm)) 196 if (fix.fixKeys(keys, osm)) 197 197 modified = true; 198 198 } 199 if(modified) 199 if (modified) 200 200 cmds.add(new ChangePropertyCommand(Collections.singleton(osm), keys)); 201 201 } 202 202 } 203 203 204 if(!cmds.isEmpty()) 204 if (!cmds.isEmpty()) 205 205 Main.main.undoRedo.add(new SequenceCommand(tr("Fix deprecated tags"), cmds)); 206 206 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
