Changeset 5502 in josm for trunk/src/org
- Timestamp:
- 2012-09-07T22:18:59+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
r1169 r5502 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 import java.util.Collection; 4 5 import java.util.HashMap; 5 6 import java.util.Map; … … 7 8 /** 8 9 * Base class for various classes in the GPX model. 9 * The "attr" hash is used to store the XML payload10 * (not only XML attributes!)11 10 * 12 11 * @author Frederik Ramm <frederik@remote.org> 13 * 12 * @since 444 14 13 */ 15 14 public class WithAttributes { 16 15 16 /** 17 * The "attr" hash is used to store the XML payload (not only XML attributes!) 18 */ 17 19 public Map<String, Object> attr = new HashMap<String, Object>(0); 18 20 21 /** 22 * Returns the String value to which the specified key is mapped, 23 * or {@code null} if this map contains no String mapping for the key. 24 * 25 * @param key the key whose associated value is to be returned 26 * @return the String value to which the specified key is mapped, 27 * or {@code null} if this map contains no String mapping for the key 28 */ 19 29 public String getString(String key) { 20 30 Object value = attr.get(key); 21 31 return (value instanceof String) ? (String)value : null; 22 32 } 33 34 /** 35 * Returns the Collection value to which the specified key is mapped, 36 * or {@code null} if this map contains no Collection mapping for the key. 37 * 38 * @param key the key whose associated value is to be returned 39 * @return the Collection value to which the specified key is mapped, 40 * or {@code null} if this map contains no Collection mapping for the key 41 * @since 5502 42 */ 43 public Collection<?> getCollection(String key) { 44 Object value = attr.get(key); 45 return (value instanceof Collection<?>) ? (Collection<?>)value : null; 46 } 23 47 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r5501 r5502 25 25 import javax.swing.JCheckBoxMenuItem; 26 26 import javax.swing.JOptionPane; 27 import javax.swing.SwingUtilities;28 27 29 28 import org.openstreetmap.josm.Main; … … 87 86 if (firstTime < 0 && wpt_has_link) { 88 87 firstTime = time; 89 for (GpxLink oneLink : (Collection<GpxLink>) wpt.attr.get(GpxData.META_LINKS)) { 90 lastLinkedFile = oneLink.uri; 91 break; 88 for (Object oneLink : wpt.getCollection(GpxData.META_LINKS)) { 89 if (oneLink instanceof GpxLink) { 90 lastLinkedFile = ((GpxLink)oneLink).uri; 91 break; 92 } 92 93 } 93 94 } 94 95 if (wpt_has_link) { 95 for (GpxLink oneLink : (Collection<GpxLink>) wpt.attr.get(GpxData.META_LINKS)) { 96 if (!oneLink.uri.equals(lastLinkedFile)) { 97 firstTime = time; 96 for (Object oneLink : wpt.getCollection(GpxData.META_LINKS)) { 97 if (oneLink instanceof GpxLink) { 98 String uri = ((GpxLink)oneLink).uri; 99 if (!uri.equals(lastLinkedFile)) { 100 firstTime = time; 101 } 102 lastLinkedFile = uri; 103 break; 98 104 } 99 lastLinkedFile = oneLink.uri;100 break;101 105 } 102 106 }
Note:
See TracChangeset
for help on using the changeset viewer.