- Timestamp:
- 2009-08-07T23:22:31+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r1915 r1924 59 59 for (Map.Entry<Way, List<Integer>> insertPoint : insertPoints.entrySet()) { 60 60 Way w = insertPoint.getKey(); 61 List<Node> nodesToAdd = new ArrayList<Node>(w.getNodes());61 List<Node> nodesToAdd = w.getNodes(); 62 62 List<Integer> is = insertPoint.getValue(); 63 63 pruneSuccsAndReverse(is); -
trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java
r1847 r1924 39 39 for (Iterator<? extends OsmPrimitive> it = pasteBufferSubset.iterator(); it.hasNext();) { 40 40 OsmPrimitive osm = it.next(); 41 Map<String, String> m = osm.keys;42 if(m == null) {43 continue;44 }45 41 46 for (String key : m.keySet()) {42 for (String key : osm.keySet()) { 47 43 clist.add(new ChangePropertyCommand(selectionSubset, key, osm.get(key))); 48 44 } -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r1898 r1924 281 281 while (chunkIt.hasNext()) { 282 282 Way wayToAdd = new Way(); 283 if (selectedWay.keys != null) { 284 wayToAdd.keys = new HashMap<String, String>(selectedWay.keys); 285 } 283 wayToAdd.setKeys(selectedWay.getKeys()); 286 284 newWays.add(wayToAdd); 287 285 wayToAdd.setNodes(chunkIt.next()); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r1912 r1924 152 152 153 153 Node c = new Node(selectedNode); 154 c. keys = null;154 c.removeAll(); 155 155 c.setSelected(false); 156 156 cmds.add(new ChangeCommand(selectedNode, c)); -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r1899 r1924 236 236 return osm.get(key) != null; 237 237 case ANY_KEY: 238 for (String v:osm. keys.values()) {238 for (String v:osm.getKeys().values()) { 239 239 if (v.equals(value)) 240 240 return true; … … 244 244 return value.equals(osm.get(key)); 245 245 case ANY_KEY_REGEXP: 246 for (String v:osm. keys.values()) {246 for (String v:osm.getKeys().values()) { 247 247 if (valuePattern.matcher(v).matches()) 248 248 return true; -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r1898 r1924 394 394 395 395 Way wnew2 = new Way(); 396 if (wnew.keys != null) { 397 wnew2.keys = new HashMap<String, String>(wnew.keys); 398 } 396 wnew2.setKeys(wnew.getKeys()); 399 397 wnew2.setNodes(n2); 400 398 cmds.add(new AddCommand(wnew2)); -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r1899 r1924 236 236 /** 237 237 * The key/value list for this primitive. 238 */ 238 * @deprecated This field will became private or protected in future, use api instead 239 */ 240 @Deprecated 239 241 public Map<String, String> keys; 242 243 /** 244 * 245 * @return Keys of this primitive. Changes made in returned map are not mapped 246 * back to the primitive, use setKeys() to modify the keys 247 * @since 1924 248 */ 249 public Map<String, String> getKeys() { 250 // TODO More effective map 251 return new HashMap<String, String>(keys); 252 } 253 254 /** 255 * 256 * @since 1924 257 */ 258 public void setKeys(Map<String, String> keys) { 259 if (keys == null) { 260 this.keys = null; 261 } else { 262 this.keys = new HashMap<String, String>(keys); 263 } 264 } 240 265 241 266 /** … … 269 294 270 295 /** 271 * Added in revision 1843272 * Please do not use in plug-ins until this version becomes JOSM tested296 * 297 * @since 1843 273 298 */ 274 299 public final void removeAll() { … … 294 319 295 320 /** 296 * Added in revision 1843297 * Please do not use in plug-ins until this version becomes JOSM tested321 * 322 * @since 1843 298 323 */ 299 324 public final boolean hasKeys() { -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
r1747 r1924 2 2 3 3 import java.util.Collection; 4 import java.util.Map;5 4 6 5 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 31 30 return code; 32 31 } 33 public boolean check( Map<String, String> keys)32 public boolean check(OsmPrimitive primitive) 34 33 { 35 34 if(rules == null) … … 37 36 for(Rule r : rules) 38 37 { 39 String k = keys.get(r.key);38 String k = primitive.get(r.key); 40 39 String bv = OsmUtils.getNamedOsmBoolean(r.boolValue); 41 40 if(k == null || (r.value != null && !k.equals(r.value)) -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r1843 r1924 7 7 import java.util.LinkedList; 8 8 import java.util.List; 9 import java.util.Map ;9 import java.util.Map.Entry; 10 10 11 11 import org.openstreetmap.josm.Main; … … 37 37 areasList = new LinkedList<AreaElemStyle>(); 38 38 } 39 private IconElemStyle getNode( Map<String, String> keys)39 private IconElemStyle getNode(OsmPrimitive primitive) 40 40 { 41 41 IconElemStyle ret = null; 42 Iterator<String> iterator = keys.keySet().iterator(); 43 while(iterator.hasNext()) 44 { 45 String key = iterator.next(); 46 String val = keys.get(key); 42 for (Entry<String, String> entry:primitive.entrySet()) { 43 String key = entry.getKey(); 44 String val = entry.getValue(); 47 45 IconElemStyle style; 48 46 if((style = icons.get("n" + key + "=" + val)) != null) … … 64 62 for(IconElemStyle s : iconsList) 65 63 { 66 if((ret == null || s.priority > ret.priority) && s.check( keys))64 if((ret == null || s.priority > ret.priority) && s.check(primitive)) 67 65 ret = s; 68 66 } 69 67 return ret; 70 68 } 71 private ElemStyle get( Map<String, String> keys, boolean noclosed)69 private ElemStyle get(OsmPrimitive primitive, boolean noclosed) 72 70 { 73 71 AreaElemStyle retArea = null; … … 75 73 String linestring = null; 76 74 HashMap<String, LineElemStyle> over = new HashMap<String, LineElemStyle>(); 77 Iterator<String> iterator = keys.keySet().iterator(); 78 while(iterator.hasNext()) 79 { 80 String key = iterator.next(); 81 String val = keys.get(key); 75 for (Entry<String, String> entry:primitive.entrySet()) { 76 String key = entry.getKey(); 77 String val = entry.getValue(); 82 78 AreaElemStyle styleArea; 83 79 LineElemStyle styleLine; … … 125 121 { 126 122 if((retArea == null || s.priority > retArea.priority) 127 && (!noclosed || !s.closed) && s.check( keys))123 && (!noclosed || !s.closed) && s.check(primitive)) 128 124 retArea = s; 129 125 } … … 131 127 { 132 128 if((retLine == null || s.priority > retLine.priority) 133 && s.check( keys))129 && s.check(primitive)) 134 130 retLine = s; 135 131 } 136 132 for(LineElemStyle s : modifiersList) 137 133 { 138 if(s.check( keys))134 if(s.check(primitive)) 139 135 over.put(s.getCode(), s); 140 136 } … … 158 154 public ElemStyle get(OsmPrimitive osm) 159 155 { 160 return ( osm.keys == null) ? null :161 ((osm instanceof Node) ? getNode(osm .keys) : get(osm.keys,156 return (!osm.hasKeys()) ? null : 157 ((osm instanceof Node) ? getNode(osm) : get(osm, 162 158 osm instanceof Way && !((Way)osm).isClosed())); 163 159 } … … 165 161 public ElemStyle getArea(Way osm) 166 162 { 167 if(osm. keys != null)163 if(osm.hasKeys()) 168 164 { 169 165 /* force area mode also for unclosed ways */ 170 ElemStyle style = get(osm .keys, false);166 ElemStyle style = get(osm, false); 171 167 if(style != null && style instanceof AreaElemStyle) 172 168 return style; … … 177 173 public IconElemStyle getIcon(OsmPrimitive osm) 178 174 { 179 return (osm.keys == null) ? null : getNode(osm.keys);175 return osm.hasKeys() ? getNode(osm): null; 180 176 } 181 177 182 178 public boolean isArea(OsmPrimitive o) 183 179 { 184 if(o. keys != null&& !(o instanceof Node))180 if(o.hasKeys() && !(o instanceof Node)) 185 181 { 186 182 boolean noclosed = o instanceof Way && !((Way)o).isClosed(); … … 200 196 for(AreaElemStyle s : areasList) 201 197 { 202 if(!(s.closed && noclosed) && s.check(o .keys))198 if(!(s.closed && noclosed) && s.check(o)) 203 199 return true; 204 200 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r1910 r1924 85 85 public void copyTo(OsmPrimitive osm) { 86 86 osm.id = id; 87 osm. keys = keys;87 osm.setKeys(keys); 88 88 osm.modified = modified; 89 89 osm.setSelected(selected);
Note:
See TracChangeset
for help on using the changeset viewer.