Changeset 5397 in josm for trunk/src/org/openstreetmap/josm/io/GpxWriter.java
- Timestamp:
- 2012-08-05T22:40:52+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r5393 r5397 9 9 import java.io.PrintWriter; 10 10 import java.io.UnsupportedEncodingException; 11 import java.util.Arrays; 11 12 import java.util.Collection; 13 import java.util.List; 12 14 import java.util.Map; 13 15 … … 61 63 } 62 64 65 public static List<String> WPT_KEYS = Arrays.asList("ele", "time", "magvar", "geoidheight", 66 "name", "cmt", "desc", "src", GpxData.META_LINKS, "sym", "number", "type", 67 "fix", "sat", "hdop", "vdop", "pdop", "ageofdgpsdata", "dgpsid"); 63 68 @SuppressWarnings("unchecked") 64 69 private void writeAttr(Map<String, Object> attr) { 65 // FIXME this loop is evil, because it does not assure the 66 // correct element order specified by the xml schema. 67 // for now it works, but future extension could get very complex and unmaintainable 68 for (Map.Entry<String, Object> ent : attr.entrySet()) { 69 String k = ent.getKey(); 70 if (k.equals(GpxData.META_LINKS)) { 71 for (GpxLink link : (Collection<GpxLink>) ent.getValue()) { 72 gpxLink(link); 70 for (String key : WPT_KEYS) { 71 Object value = attr.get(key); 72 if (value != null) { 73 if (key.equals(GpxData.META_LINKS)) { 74 for (GpxLink link : (Collection<GpxLink>) value) { 75 gpxLink(link); 76 } 77 } else { 78 simpleTag(key, value.toString()); 73 79 } 74 } else {75 simpleTag(k, ent.getValue().toString());76 80 } 77 81 }
Note:
See TracChangeset
for help on using the changeset viewer.