diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-11-09 13:30:43 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-11-09 13:30:43 +0100 |
| commit | 5f7fb9bba58710a4f789db670807f7f95c673bcd (patch) | |
| tree | d2ae7f68001b7bfce182ac4eb078002eff2304c8 /main/src | |
| parent | d41c5077db3d8acb42fc5a246ecf317d5037d5aa (diff) | |
| download | cgeo-5f7fb9bba58710a4f789db670807f7f95c673bcd.zip cgeo-5f7fb9bba58710a4f789db670807f7f95c673bcd.tar.gz cgeo-5f7fb9bba58710a4f789db670807f7f95c673bcd.tar.bz2 | |
new: GPX export of travelbugs
* however, in most cases this cannot be re-imported due to missing
geocodes
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/export/GpxSerializer.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/export/GpxSerializer.java b/main/src/cgeo/geocaching/export/GpxSerializer.java index 19f288a..0ac02e9 100644 --- a/main/src/cgeo/geocaching/export/GpxSerializer.java +++ b/main/src/cgeo/geocaching/export/GpxSerializer.java @@ -3,6 +3,7 @@ package cgeo.geocaching.export; import cgeo.geocaching.DataStore; import cgeo.geocaching.Geocache; import cgeo.geocaching.LogEntry; +import cgeo.geocaching.Trackable; import cgeo.geocaching.Waypoint; import cgeo.geocaching.enumerations.CacheAttribute; import cgeo.geocaching.enumerations.LoadFlags; @@ -130,6 +131,7 @@ public final class GpxSerializer { gpx.endTag(PREFIX_GROUNDSPEAK, "long_description"); writeLogs(cache); + writeTravelBugs(cache); gpx.endTag(PREFIX_GROUNDSPEAK, "cache"); gpx.endTag(PREFIX_GPX, "wpt"); @@ -229,6 +231,26 @@ public final class GpxSerializer { gpx.endTag(PREFIX_GROUNDSPEAK, "logs"); } + private void writeTravelBugs(final Geocache cache) throws IOException { + List<Trackable> inventory = cache.getInventory(); + if (inventory.isEmpty()) { + return; + } + gpx.startTag(PREFIX_GROUNDSPEAK, "travelbugs"); + + for (final Trackable trackable : inventory) { + gpx.startTag(PREFIX_GROUNDSPEAK, "travelbug"); + + // in most cases the geocode will be empty (only the guid is known). those travel bugs cannot be imported again! + gpx.attribute("", "ref", trackable.getGeocode()); + XmlUtils.simpleText(gpx, PREFIX_GROUNDSPEAK, "name", trackable.getName()); + + gpx.endTag(PREFIX_GROUNDSPEAK, "travelbug"); + } + + gpx.endTag(PREFIX_GROUNDSPEAK, "travelbugs"); + } + private void writeAttributes(final Geocache cache) throws IOException { if (cache.getAttributes().isEmpty()) { return; |
