aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-01-28 21:48:20 -0800
committerBananeweizen <bananeweizen@gmx.de>2014-01-28 21:48:20 -0800
commit4d3187e06cc65222641388febd8abf2612e91635 (patch)
tree3660ea04fd0e70cbf94b00c8853038799d8d72ec
parent31fd87ca2db10df42b297e3eec5c7150fe9597ce (diff)
parent8570b49ee4c04acbbe34b623c0cf06285f4f1656 (diff)
downloadcgeo-4d3187e06cc65222641388febd8abf2612e91635.zip
cgeo-4d3187e06cc65222641388febd8abf2612e91635.tar.gz
cgeo-4d3187e06cc65222641388febd8abf2612e91635.tar.bz2
Merge pull request #3584 from Matrikss/master
#3562 Add FavPoints parsing for GSAK GPX
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java13
-rw-r--r--tests/res/raw/gc3t1xg_gsak.gpx310
-rw-r--r--tests/src/cgeo/geocaching/files/GPXParserTest.java7
3 files changed, 330 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 157ea9d..4ad2c3d 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -524,6 +524,19 @@ public abstract class GPXParser extends FileParser {
parentCacheCode = body;
}
});
+
+ gsak.getChild(gsakNamespace, "FavPoints").setEndTextElementListener(new EndTextElementListener() {
+
+ @Override
+ public void end(String favoritePoints) {
+ try {
+ cache.setFavoritePoints(Integer.parseInt(favoritePoints));
+ }
+ catch (final NumberFormatException e) {
+ Log.w("Failed to parse favorite points", e);
+ }
+ }
+ });
}
// c:geo extensions
diff --git a/tests/res/raw/gc3t1xg_gsak.gpx b/tests/res/raw/gc3t1xg_gsak.gpx
new file mode 100644
index 0000000..535d4d1
--- /dev/null
+++ b/tests/res/raw/gc3t1xg_gsak.gpx
@@ -0,0 +1,310 @@
+<?xml version="1.0" encoding="utf-8"?>
+<gpx xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+version="1.0" creator="GSAK"
+xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0/1 http://www.groundspeak.com/cache/1/0/1/cache.xsd http://www.gsak.net/xmlv1/6 http://www.gsak.net/xmlv1/6/gsak.xsd"
+xmlns="http://www.topografix.com/GPX/1/0">
+ <desc>Geocache file generated by GSAK (HasChildren)</desc>
+ <author>GSAK</author>
+ <email>support@gsak.net</email>
+ <time>2014-01-26T19:54:13Z</time>
+ <keywords>cache, geocache, groundspeak</keywords>
+ <bounds minlat="50.1075" minlon="8.65885" maxlat="50.1075" maxlon="8.65885"/>
+ <wpt lat="50.1075" lon="8.65885">
+ <time>2012-08-13T08:00:00Z</time>
+ <name>GC3T1XG</name>
+ <desc>Help by TheGreenTool (3/1)</desc>
+ <url>http://www.geocaching.com/seek/cache_details.aspx?guid=d09416d5-dba9-4347-86a6-12f7b5ef2fff</url>
+ <urlname>Help by TheGreenTool</urlname>
+ <sym>Geocache</sym>
+ <type>Geocache|Traditional Cache</type>
+ <gsak:wptExtension xmlns:gsak="http://www.gsak.net/xmlv1/6">
+ <gsak:UserFlag>true</gsak:UserFlag>
+ <gsak:Lock>false</gsak:Lock>
+ <gsak:DNF>false</gsak:DNF>
+ <gsak:Watch>false</gsak:Watch>
+ <gsak:UserData></gsak:UserData>
+ <gsak:FirstToFind>false</gsak:FirstToFind>
+ <gsak:User2></gsak:User2>
+ <gsak:User3></gsak:User3>
+ <gsak:User4></gsak:User4>
+ <gsak:County></gsak:County>
+ <gsak:UserSort>0</gsak:UserSort>
+ <gsak:SmartName>Help</gsak:SmartName>
+ <gsak:LastGpxDate>2014-01-26</gsak:LastGpxDate>
+ <gsak:Code>GC3T1XG</gsak:Code>
+ <gsak:Resolution></gsak:Resolution>
+ <gsak:IsPremium>false</gsak:IsPremium>
+ <gsak:FavPoints>258</gsak:FavPoints>
+ <gsak:GcNote></gsak:GcNote>
+ <gsak:Guid>d09416d5-dba9-4347-86a6-12f7b5ef2fff</gsak:Guid>
+ <gsak:CacheImages>
+ </gsak:CacheImages>
+ <gsak:LogImages>
+ </gsak:LogImages>
+ <gsak:CustomData>
+Custom_Start:cCode:Custom_Data:GC3T1XG:Custom_End
+
+ </gsak:CustomData>
+ </gsak:wptExtension>
+ <groundspeak:cache id="3106063" available="True" archived="False" xmlns:groundspeak="http://www.groundspeak.com/cache/1/0/1">
+ <groundspeak:name>Help</groundspeak:name>
+ <groundspeak:placed_by>TheGreenTool</groundspeak:placed_by>
+ <groundspeak:owner id="2072379">TheGreenTool</groundspeak:owner>
+ <groundspeak:type>Traditional Cache</groundspeak:type>
+ <groundspeak:container>Small</groundspeak:container>
+ <groundspeak:attributes>
+ <groundspeak:attribute id="1" inc="1">Dogs</groundspeak:attribute>
+ <groundspeak:attribute id="7" inc="1">Takes less than an hour</groundspeak:attribute>
+ <groundspeak:attribute id="13" inc="1">Available at all times</groundspeak:attribute>
+ <groundspeak:attribute id="15" inc="1">Available during winter</groundspeak:attribute>
+ <groundspeak:attribute id="24" inc="1">Wheelchair accessible</groundspeak:attribute>
+ <groundspeak:attribute id="32" inc="1">Bicycles</groundspeak:attribute>
+ <groundspeak:attribute id="33" inc="1">Motorcycles</groundspeak:attribute>
+ <groundspeak:attribute id="34" inc="1">Quads</groundspeak:attribute>
+ <groundspeak:attribute id="35" inc="1">Off-road vehicles</groundspeak:attribute>
+ <groundspeak:attribute id="47" inc="1">Field Puzzle</groundspeak:attribute>
+ <groundspeak:attribute id="63" inc="1">Tourist Friendly</groundspeak:attribute>
+ </groundspeak:attributes>
+ <groundspeak:difficulty>3</groundspeak:difficulty>
+ <groundspeak:terrain>1</groundspeak:terrain>
+ <groundspeak:country>Germany</groundspeak:country>
+ <groundspeak:state>Hessen</groundspeak:state>
+ <groundspeak:short_description html="True"> </groundspeak:short_description>
+ <groundspeak:long_description html="True">Ein Cache für Leute, die keine langen Listingtexte lesen wollen.&lt;br /&gt;
+Dieses Listing beinhaltet alle Informationen, die ihr benötigt.&lt;br /&gt;
+Die Notrufsäule hat absolut NICHTS mit dem Cache zu tun. Lasst sie bitte in Ruhe!&lt;br /&gt;
+&lt;br /&gt;
+A cache for people who don't like reading long listing texts.&lt;br /&gt;
+This listing contains all information you need.&lt;br /&gt;
+Please DO NOT use the emergency telephone! It has absolutely NOTHING to do with the cache.&lt;br /&gt;
+&lt;br /&gt;</groundspeak:long_description>
+ <groundspeak:encoded_hints></groundspeak:encoded_hints>
+ <groundspeak:logs>
+ <groundspeak:log id="378435354">
+ <groundspeak:date>2014-01-24T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="4685592">Holleradhiho</groundspeak:finder>
+ <groundspeak:text encoded="False">Nachdem ich im letzten Jahr den Code nicht rausbekommen habe hat mir meine Freundin den entscheidenden Tipp gegeben. Heute mit den richtigen vorbei gegangen und schnell eingetragen. Vielen Dank für den Cache. Holleradhiho</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378281233">
+ <groundspeak:date>2014-01-22T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="6585656">leontheleon</groundspeak:finder>
+ <groundspeak:text encoded="False">In Francfurt for a business trip, I quickly loaded in the GPS a few caches around my hotel and the station,
+That s awesome to see how much cache there are in Germany.
+
+After the failure yesterday, i have this in my mind....
+
+and suddenly after dinner,
+i tried to found information translating the others log... but I didn't need this HELP,
+before I start to translate it appears clear and loud : I got the key !!!
+
+Wait tomorrow to try this,
+hopefully the taxi droped me 30 min beore my train leave,
+i go
+try
+and open it !
+
+Thanks for this good idea,
+I was so sorry if I can t found this one before to leave !
+
+Come with me little geocoin, you will visite France.
+
+
+362 ème cache trouvée par leontheleon
+Merci à TheGreenTool pour cette cache
+
+362 geocache found by LeontheLeon
+Thanks to TheGreenTool for this cache.
+
+J'ai donné 4 à cette cache grâce à [url=http://www.gcvote.com]GCVote[/url]</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378261404">
+ <groundspeak:date>2014-01-22T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="2969623">bravo1999</groundspeak:finder>
+ <groundspeak:text encoded="False">#2881
+Auf der Dienstreise einen Boxenstopp am Frankfurter Hbf eingelegt und die Zwischenzeit natürlich sinnvoll genutzt.
+Unweit des Hbf diesen Cache erspäht und nach kurzer Andacht dann auch geloggt.
+Klasse Ding, tolle Umsetzung - hat mir sehr gut gefallen - ich liebe Stadtcache, trotz oder vielleicht wg der Muggelei.
+Dafür gibt´s auch von mir einen FavPkt und
+TFTC sagt bravo1999</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378231850">
+ <groundspeak:date>2014-01-22T16:44:49Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="4950075">DovasTeam</groundspeak:finder>
+ <groundspeak:text encoded="False">Sehr gut.
+MfG aus Griechenland.
+Dfdc</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378194961">
+ <groundspeak:date>2014-01-22T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="4005684">Klaye</groundspeak:finder>
+ <groundspeak:text encoded="False">TFTC! #815
+Quickly located, but it took me another while to log. TBs exchanged. Favourite point.</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378280964">
+ <groundspeak:date>2014-01-21T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Didn't find it</groundspeak:type>
+ <groundspeak:finder id="6585656">leontheleon</groundspeak:finder>
+ <groundspeak:text encoded="False">In Francfurt for a business trip, I quickly loaded in the GPS a few caches around my hotel and the station,
+That s awesome to see how much cache there are in Germany.
+
+may be a bit of time during my trip to try my first German cache...
+
+I arrived at 5 pm and before looking for a taxi, I will go for a few ones
+
+______________________________________
+After the faiulure on "Cafe Metropolitan", I quickly tried this one,
+
+After a quick inspection, I see the difficulty level and decided to go direct to the next one because not too much time and this is dark now.
+
+On return walk, I check and see the attributes, quickly see if I can find
+
+I can imagine what could be the container, but not possible to find the solution...
+
+Go for hotel... my mind is boiling to be so close
+
+may be on return tomorrow if I have 15 min free</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378195032">
+ <groundspeak:date>2014-01-21T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="2106220">LouisCyphre</groundspeak:finder>
+ <groundspeak:text encoded="False">Nach einem kleinen Nachtcache in der Nähe sind muffinstarbucks und ich auch noch mal "schnell" hier vorbei. Am schwierigsten war allerdings das Parkplatz finden und Einparken[:D].
+An der Dose hatte ich dann ein kleines Deja-Vu, genau die Dose hatte ich vom gleichen Owner schon vor ein paar Wochen an einer anderen Stelle gemacht[8D].
+TFTC
+#8552</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378187240">
+ <groundspeak:date>2014-01-21T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="1624740">muffinstarbucks</groundspeak:finder>
+ <groundspeak:text encoded="False">[:D]
+
+Ein wirklich cooles Versteck. Nach unserem NC kamen LouisCyphre und ich auch noch hier vorbei. Das Cachemobil am Strassenrand abzustellen war genauso schwierig, wie das Auffinden der Dose. Beides
+klappte zum Glück am Ende aber gut.[^]
+
+Einen Favoritenpunkt hierfür.
+
+TFTC</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="377942548">
+ <groundspeak:date>2014-01-20T16:29:02Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="1366147">FlashCool</groundspeak:finder>
+ <groundspeak:text encoded="False">Schick, schick. Clevere Versteckidee. Heute im 2. Anlauf gut und im Schutze der Dunkelheit finden und heben können.
+
+Danke fürs Aushecken und Verstecken.</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="377136980">
+ <groundspeak:date>2014-01-17T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Write note</groundspeak:type>
+ <groundspeak:finder id="2849267">dl1ely</groundspeak:finder>
+ <groundspeak:text encoded="False">Keine Ahnung, wo die Dose sich verbergen soll, so ganz ohne Hint. Nachdem 2 Polizisten begannen, mir interessiert beim Rumlungern zuzusehen, trat ich lieber den Rückweg zum Bahnhof an. Vielleicht habe ich beim nächsten Umstieg am HBf mehr Glück.</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376948874">
+ <groundspeak:date>2014-01-15T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="613426">Kassabeckabua</groundspeak:finder>
+ <groundspeak:text encoded="False">Nach einem Abendessen und Zwischenstopp heute im zweiten Anlauf. TFTC KBB</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376946408">
+ <groundspeak:date>2014-01-15T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="2040005">Bembelboy</groundspeak:finder>
+ <groundspeak:text encoded="False">Ich war ja schon mal bei der Dose als sie noch am vorigen Platz versteckt war. Seinerzeit fehlte mir die Idee und die Muggeldichte war einfach zu hoch. Zwischenzeitlich hatte ich das neue Versteck auch ausfindig gemacht, doch die Muggeldichte war wieder zu hoch und es war hell. Heute Abend im Dunkeln konnte sie sich meinem Zugriff dann nicht mehr entziehen. Ich hatte ca. 2 Stunden vorher in Hamburg eine ahnliche Dose zu öffnen gehabt. Lustig.
+
+This entry was edited by Bembelboy on Friday, 17 January 2014 at 19:54:02 UTC.</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376892811">
+ <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="7675187">KuWu80</groundspeak:finder>
+ <groundspeak:text encoded="False">Gesucht, gefunden und geloggt. :-)
+
+TFTC !!!!</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376793802">
+ <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Write note</groundspeak:type>
+ <groundspeak:finder id="6306622">Kaiserwurst86</groundspeak:finder>
+ <groundspeak:text encoded="False">TB abgelegt. Da es aber nur eine Kopie ist, kann ich ihn hier online nicht ablegen.</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376766889">
+ <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="7169608">Tom Ato</groundspeak:finder>
+ <groundspeak:text encoded="False">Nach einer kleinen Hilfestellung (DANKE DAFÜR) im zweiten Anlauf gut gelöst.
+Sehr schöne Idee, dafür von mir ein FP!!!
+TB: out
+T4TC!!!</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376741584">
+ <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="5385835">lietuvis28</groundspeak:finder>
+ <groundspeak:text encoded="False">Vor dem dienstlichen Termin noch schnell diese "Dose" gefunden, geöffnet und geloggt.
+
+Ich gebe zu, es bracuht auch bei mir einen 2. Anlauf. Bei meiner letzten Dienstreise nach Frankfurt hatte ich noch die Notrufsäule vor Augen. Diese wollte ich aber nicht ausprobieren.
+Daher ein wenig nachgedacht, nochmal geschaut, etwas "neues" entdeckt und schon lag das Logbuch in meinen Händen.
+
+Für die Idee lasse ich gerne ein Schleifchen hier.
+
+TFTC!
+
+Gruß aus Windeck</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="378209899">
+ <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="2057810">Nerre</groundspeak:finder>
+ <groundspeak:text encoded="False">Mit TurtleSA und Neonfly ging auf große Tour Richtung Frankfurt. Danke für's Verstecken!
+
+Zum Abschluß der Tour ging es nochmal durch die Innenstadt.
+Ein toller Cache! Hier suchten wir lange weil wir es erst übersahen, dann konnten wir aber direkt loggen. Super! Dafür gibt es einen FP. :)</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="377753263">
+ <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="2098778">neonfly</groundspeak:finder>
+ <groundspeak:text encoded="False">Heute bei gutem Wetter eine Tagestour zusammen mit TurtleSA und Nerre nach Frankfurt unternommen.
+Auf dem Weg dorthin haben wir bei Darmstadt auch noch ein paar Dosen geloggt.
+
+Im wesentlichen waren wir östlich in direkter Flugphafennähe unterwegs, sowie anschliessend in Niederrad und FFM Innenstadt.
+
+Dies ist ein Sammellog für alle Caches, manche bekommen auch ein Schleifchen. :=)
+
+Bei der Europatour sind wir nicht alle angegangen und bei einem Cache dieser Serie (Stockholm) hat Nerre ein Ersatzlogbuch gebastelt, da anscheinend die Muggel zugeschlagen hatten. An der richtigen Laterne waren wir.
+
+Der Portier am Café Metropolitan hat uns durch subtile Hinweise weiter geholfen den Kleinen doch noch zu finden. :)
+War eine nette Begegnung. :)
+
+Ansonsten hat sich Frankfurt ganz schön gemacht in den letzten Jahren (war lange nicht mehr dort gewesen).
+
+Grüße an alle Owner sowie unsere spontanen Begleiter im Wald südlich Niederrad und natürlich auch an Nerre und TurtleSA.
+War eine schöne Runde. :)</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376878775">
+ <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="2518165">friendscout</groundspeak:finder>
+ <groundspeak:text encoded="False">Schönes Versteck mit Finger-Abzähl-Übung, dafür einen FP. Merci!</groundspeak:text>
+ </groundspeak:log>
+ <groundspeak:log id="376250428">
+ <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date>
+ <groundspeak:type>Found it</groundspeak:type>
+ <groundspeak:finder id="6167340">eifelmuggel</groundspeak:finder>
+ <groundspeak:text encoded="False">Schön gemacht. Die Dose hatten wir sofort gefunden, aber wie auf bekommen!? Ich kann bestätigen, dass im Listing alles steht, was man braucht. Genau genommen steht da noch etwas zu viel ;-)!
+
+Danke!</groundspeak:text>
+ </groundspeak:log>
+ </groundspeak:logs>
+ <groundspeak:travelbugs>
+ </groundspeak:travelbugs>
+</groundspeak:cache>
+</wpt>
+</gpx>
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java
index dcaad22..d5e03f3 100644
--- a/tests/src/cgeo/geocaching/files/GPXParserTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java
@@ -325,4 +325,11 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
assertEquals("Wasserleitung", cache.getHint());
}
+ public void testGsakFavPoints() throws IOException, ParserException {
+ final List<Geocache> caches = readGPX10(R.raw.gc3t1xg_gsak);
+ assertEquals(1, caches.size());
+ final Geocache cache = caches.get(0);
+ assertEquals(258, cache.getFavoritePoints());
+ }
+
}