Changeset 5684 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2013-01-28T14:06:52+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/gpx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxConstants.java
r5681 r5684 28 28 public static List<String> WPT_KEYS = Arrays.asList("ele", "time", "magvar", "geoidheight", 29 29 "name", "cmt", "desc", "src", META_LINKS, "sym", "number", "type", 30 "fix", "sat", "hdop", "vdop", "pdop", "ageofdgpsdata", "dgpsid" );30 "fix", "sat", "hdop", "vdop", "pdop", "ageofdgpsdata", "dgpsid", META_EXTENSIONS); 31 31 32 32 } -
trunk/src/org/openstreetmap/josm/data/gpx/IWithAttributes.java
r5681 r5684 5 5 6 6 /** 7 * Object with attributes .7 * Object with attributes (in the context of GPX data). 8 8 */ 9 9 public interface IWithAttributes { 10 11 /** 12 * Returns the Object value to which the specified key is mapped, 13 * or {@code null} if this map contains no mapping for the key. 14 * 15 * @param key the key whose associated value is to be returned 16 * @return the value 17 */ 18 Object get(String key); 10 19 11 20 /** … … 18 27 */ 19 28 String getString(String key); 20 29 21 30 /** 22 * Returns the Collection value to which the specified key is mapped, 31 * Returns the Collection value to which the specified key is mapped, 23 32 * or {@code null} if this map contains no Collection mapping for the key. 24 * 33 * 25 34 * @param key the key whose associated value is to be returned 26 * @return the Collection value to which the specified key is mapped, 35 * @return the Collection value to which the specified key is mapped, 27 36 * or {@code null} if this map contains no Collection mapping for the key 28 37 * @since 5502 29 38 */ 30 Collection<?> getCollection(String key); 39 Collection getCollection(String key); 40 41 /** 42 * Put a key / value pair as a new attribute. 43 * 44 * Overrides key / value pair with the same key (if present). 45 * 46 * @param key the key 47 * @param value the value 48 */ 49 void put(String key, Object value); 50 51 /** 52 * Add a key / value pair that is not part of the GPX schema as an extension. 53 * 54 * @param key the key 55 * @param value the value 56 */ 57 void addExtension(String key, String value); 58 31 59 } -
trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
r5681 r5684 20 20 */ 21 21 public Map<String, Object> attr = new HashMap<String, Object>(0); 22 23 /** 24 * Returns the Object value to which the specified key is mapped, 25 * or {@code null} if this map contains no mapping for the key. 26 * 27 * @param key the key whose associated value is to be returned 28 * @return the value 29 */ 30 @Override 31 public Object get(String key) { 32 return attr.get(key); 33 } 22 34 23 35 /** … … 45 57 */ 46 58 @Override 47 public Collection <?>getCollection(String key) {59 public Collection getCollection(String key) { 48 60 Object value = attr.get(key); 49 return (value instanceof Collection<?>) ? (Collection<?>)value : null; 61 return (value instanceof Collection) ? (Collection)value : null; 62 } 63 64 /** 65 * Put a key / value pair as a new attribute. 66 * 67 * Overrides key / value pair with the same key (if present). 68 * 69 * @param key the key 70 * @param value the value 71 */ 72 @Override 73 public void put(String key, Object value) { 74 attr.put(key, value); 75 } 76 77 /** 78 * Add a key / value pair that is not part of the GPX schema as an extension. 79 * 80 * @param key the key 81 * @param value the value 82 */ 83 @Override 84 public void addExtension(String key, String value) { 85 if (!attr.containsKey(META_EXTENSIONS)) { 86 attr.put(META_EXTENSIONS, new Extensions()); 87 } 88 Extensions ext = (Extensions) attr.get(META_EXTENSIONS); 89 ext.put(key, value); 50 90 } 51 91 }
Note:
See TracChangeset
for help on using the changeset viewer.