I've had this in my local tree for a while. I can't recall who I
added it for, but I remember he was very happy with it. It adds
the container type and cache type to the bag of tricks for XCSV.
I'm committing this.
Index: csv_util.c
===================================================================
RCS file: /cvsroot/gpsbabel/gpsbabel/csv_util.c,v
retrieving revision 1.33
diff -p -u -r1.33 csv_util.c
--- csv_util.c 19 Apr 2004 19:05:26 -0000 1.33
+++ csv_util.c 14 May 2004 17:52:02 -0000
@@ -801,9 +801,13 @@ xcsv_waypt_pr(const waypoint *wpt)
/* Geocache Terrain as a double */
sprintf(buff, fmp->printfc, wpt->gc_data.terr / 10.0);
} else
- if (strcmp(fmp->key, "GEOCACHE_TYPE") == 0) {
- /* Geocache Type TODO */
- sprintf(buff, fmp->printfc, "Geocache");
+ if (strcmp(fmp->key, "GEOCACHE_CONTAINER") == 0) {
+ /* Geocache Container */
+ sprintf(buff, fmp->printfc, gs_get_container(wpt->gc_data.container));
+ } else
+ if (strcmp(fmp->key, "GEOCACHE_TYPE") == 0) {
+ /* Geocache Type */
+ sprintf(buff, fmp->printfc, gs_get_cachetype(wpt->gc_data.type));
} else {
/* this should probably never happen */
}
Index: gpx.c
===================================================================
RCS file: /cvsroot/gpsbabel/gpsbabel/gpx.c,v
retrieving revision 1.91
diff -p -u -r1.91 gpx.c
--- gpx.c 15 Apr 2004 13:42:20 -0000 1.91
+++ gpx.c 14 May 2004 17:52:03 -0000
@@ -468,7 +468,6 @@ gs_container_mapping{
{ gc_virtual, "Virtual" }
};
-static
geocache_type
gs_mktype(char *t)
{
@@ -483,7 +482,20 @@ gs_mktype(char *t)
return gt_unknown;
}
-static
+const char *
+gs_get_cachetype(geocache_type t)
+{
+ int i;
+ int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]);
+
+ for (i = 0; i < sz; i++) {
+ if (t == gs_type_map[i].type) {
+ return gs_type_map[i].name;
+ }
+ }
+ return "Unknown";
+}
+
geocache_container
gs_mkcont(char *t)
{
@@ -498,6 +510,20 @@ gs_mkcont(char *t)
return gc_unknown;
}
+const char *
+gs_get_container(geocache_container t)
+{
+ int i;
+ int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]);
+
+ for (i = 0; i < sz; i++) {
+ if (t == gs_container_map[i].type) {
+ return gs_type_map[i].name;
+ }
+ }
+ return "Unknown";
+}
+
static
time_t
xml_parse_time( char *cdatastr )
Index: style/README.style
===================================================================
RCS file: /cvsroot/gpsbabel/gpsbabel/style/README.style,v
retrieving revision 1.7
diff -p -u -r1.7 README.style
--- style/README.style 27 Oct 2003 15:06:20 -0000 1.7
+++ style/README.style 14 May 2004 17:52:03 -0000
@@ -301,6 +301,34 @@ The fields used by the XCSV parser are a
example: IFIELD TIMET_TIME,"","%ld"
+ o GEOCACHE_DIFF
+ GEOCACHE_DIFF is valid only for geocaches and represents a DOUBLE
+ PRECISION FLOAT. A "three and a half star" cache would therefore be "3.5"
+
+ example: IFIELD GEOCACHE_DIFF,"","%3.1f"
+
+ o GEOCACHE_TERR
+ GEOCACHE_TERR is valid only for geocaches and represents a DOUBLE
+ PRECISION FLOAT. A "three and a half star" cache would therefore be "3.5"
+
+ example: IFIELD GEOCACHE_TERR,"","%3.1f"
+
+ o GEOCACHE_CONTAINER
+ GEOCACHE_CONTAINER is valid only for geocaches and is heavily influenced
+ by the Groundspeak container types. Examples would include "Micro"
+ and "Virtual".
+
+ example: GEOCACHE_CONTAINER,"","%s"
+
+ o GEOCACHE_TYPE
+ GEOCACHE_TYPE is valid only for geocaches and is heavily influenced
+ by the Groundspeak cache types. Examples would include "Event cache"
+ and "Multi-Cache".
+
+ example: GEOCACHE_TYPE,"","%s"
+
+
+
EXAMPLES:
--------
|