]> git.street.me.uk Git - andy/viking.git/blobdiff - src/coords.h
Only call gps_close() after a successful gps_open().
[andy/viking.git] / src / coords.h
index c27878416d059f2752aa052c0957e2d5f81010d7..ee51a11591d7897e0785e5ead6313cfd51f61889 100644 (file)
@@ -35,6 +35,10 @@ renaming functions and defining LatLon and UTM structs.
 #ifndef _VIKING_COORDS_H
 #define _VIKING_COORDS_H
 
+#include <glib.h>
+
+G_BEGIN_DECLS
+
 struct UTM {
   gdouble northing;
   gdouble easting;
@@ -47,6 +51,8 @@ struct LatLon {
   gdouble lon;
 };
 
+#define COORDS_STR_BUFFER_SIZE 24
+
 int a_coords_utm_equal( const struct UTM *utm1, const struct UTM *utm2 );
 void a_coords_latlon_to_utm ( const struct LatLon *latlon, struct UTM *utm );
 void a_coords_utm_to_latlon ( const struct UTM *utm, struct LatLon *latlon );
@@ -63,6 +69,20 @@ double a_coords_latlon_diff ( const struct LatLon *ll1, const struct LatLon *ll2
  */
 char *a_coords_dtostr ( double d );
 
+/**
+ * Similar to a_coords_dtostr() above, but uses an existing allocated
+ *  buffer thus avoiding the need for malloc/free
+ * Ideal for use where this may be called a lot (e.g. in file saving)
+ */
+void a_coords_dtostr_buffer ( double d, char buffer[COORDS_STR_BUFFER_SIZE] );
+
+/**
+ * Convert a LatLon to strings.
+ *
+ * Use the prefered representation.
+ */
+void a_coords_latlon_to_string ( const struct LatLon *latlon, gchar **lat, gchar **lon );
 
+G_END_DECLS
 
 #endif