Changeset 5681 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2013-01-27T20:07:53+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 1 added
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r5679 r5681 18 18 */ 19 19 public class GpxData extends WithAttributes { 20 21 public static final String META_PREFIX = "meta.";22 public static final String META_AUTHOR_NAME = META_PREFIX + "author.name";23 public static final String META_AUTHOR_EMAIL = META_PREFIX + "author.email";24 public static final String META_AUTHOR_LINK = META_PREFIX + "author.link";25 public static final String META_COPYRIGHT_AUTHOR = META_PREFIX + "copyright.author";26 public static final String META_COPYRIGHT_LICENSE = META_PREFIX + "copyright.license";27 public static final String META_COPYRIGHT_YEAR = META_PREFIX + "copyright.year";28 public static final String META_DESC = META_PREFIX + "desc";29 public static final String META_KEYWORDS = META_PREFIX + "keywords";30 public static final String META_LINKS = META_PREFIX + "links";31 public static final String META_NAME = META_PREFIX + "name";32 public static final String META_TIME = META_PREFIX + "time";33 public static final String META_EXTENSIONS = META_PREFIX + "extensions";34 35 public static final String JOSM_EXTENSIONS_NAMESPACE_URI = "http://josm.openstreetmap.de/gpx-extensions";36 20 37 21 public File storageFile; -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r3119 r5681 15 15 */ 16 16 17 public interface GpxTrack {17 public interface GpxTrack extends IWithAttributes { 18 18 19 19 Collection<GpxTrackSegment> getSegments(); -
trunk/src/org/openstreetmap/josm/data/gpx/IWithAttributes.java
r5677 r5681 1 // License: GPL. 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 4 import java.util.Collection; 5 import java.util.HashMap;6 import java.util.Map;7 5 8 6 /** 9 * Base class for various classes in the GPX model. 10 * 11 * @author Frederik Ramm <frederik@remote.org> 12 * @since 444 7 * Object with attributes. 13 8 */ 14 public class WithAttributes { 15 16 /** 17 * The "attr" hash is used to store the XML payload (not only XML attributes!) 18 */ 19 public Map<String, Object> attr = new HashMap<String, Object>(0); 9 public interface IWithAttributes { 20 10 21 11 /** … … 27 17 * or {@code null} if this map contains no String mapping for the key 28 18 */ 29 public String getString(String key) { 30 Object value = attr.get(key); 31 return (value instanceof String) ? (String)value : null; 32 } 19 String getString(String key); 33 20 34 21 /** … … 41 28 * @since 5502 42 29 */ 43 public Collection<?> getCollection(String key) { 44 Object value = attr.get(key); 45 return (value instanceof Collection<?>) ? (Collection<?>)value : null; 46 } 30 Collection<?> getCollection(String key); 47 31 } -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrack.java
r5170 r5681 11 11 import org.openstreetmap.josm.data.Bounds; 12 12 13 public class ImmutableGpxTrack implements GpxTrack {13 public class ImmutableGpxTrack extends WithAttributes implements GpxTrack { 14 14 15 private final Map<String, Object> attributes;16 15 private final Collection<GpxTrackSegment> segments; 17 16 private final double length; … … 25 24 } 26 25 } 27 this.attr ibutes= Collections.unmodifiableMap(new HashMap<String, Object>(attributes));26 this.attr = Collections.unmodifiableMap(new HashMap<String, Object>(attributes)); 28 27 this.segments = Collections.unmodifiableCollection(newSegments); 29 28 this.length = calculateLength(); … … 55 54 } 56 55 56 @Override 57 57 public Map<String, Object> getAttributes() { 58 return attr ibutes;58 return attr; 59 59 } 60 60 61 @Override 61 62 public Bounds getBounds() { 62 63 if (bounds == null) … … 66 67 } 67 68 69 @Override 68 70 public double length() { 69 71 return length; 70 72 } 71 73 74 @Override 72 75 public Collection<GpxTrackSegment> getSegments() { 73 76 return segments; 74 77 } 75 78 79 @Override 76 80 public int getUpdateCount() { 77 81 return 0; -
trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
r5502 r5681 1 // License: GPL. 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.gpx; 3 3 … … 7 7 8 8 /** 9 * Default implementation for IWithAttributes. 10 * 9 11 * Base class for various classes in the GPX model. 10 12 * … … 12 14 * @since 444 13 15 */ 14 public class WithAttributes {16 public class WithAttributes implements IWithAttributes, GpxConstants { 15 17 16 18 /** … … 20 22 21 23 /** 22 * Returns the String value to which the specified key is mapped, 24 * Returns the String value to which the specified key is mapped, 23 25 * or {@code null} if this map contains no String mapping for the key. 24 * 26 * 25 27 * @param key the key whose associated value is to be returned 26 * @return the String value to which the specified key is mapped, 28 * @return the String value to which the specified key is mapped, 27 29 * or {@code null} if this map contains no String mapping for the key 28 30 */ 31 @Override 29 32 public String getString(String key) { 30 33 Object value = attr.get(key); 31 34 return (value instanceof String) ? (String)value : null; 32 35 } 33 36 34 37 /** 35 * Returns the Collection value to which the specified key is mapped, 38 * Returns the Collection value to which the specified key is mapped, 36 39 * or {@code null} if this map contains no Collection mapping for the key. 37 * 40 * 38 41 * @param key the key whose associated value is to be returned 39 * @return the Collection value to which the specified key is mapped, 42 * @return the Collection value to which the specified key is mapped, 40 43 * or {@code null} if this map contains no Collection mapping for the key 41 44 * @since 5502 42 45 */ 46 @Override 43 47 public Collection<?> getCollection(String key) { 44 48 Object value = attr.get(key); -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r5671 r5681 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.data.validation; 2 3
Note:
See TracChangeset
for help on using the changeset viewer.