]> git.street.me.uk Git - andy/viking.git/blobdiff - src/viktrack.c
Add keyboard accelerators for the Waypoints sublayer menu.
[andy/viking.git] / src / viktrack.c
index 359dc4f8dcda424def8eab621f45c10c75bf883b..e03d8aa2a096f6153d302ce444ddd62b74557963 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <glib.h>
 #include <time.h>
 
 #include <glib.h>
 #include <time.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
+#ifdef HAVE_STRING_H
 #include <string.h>
 #include <string.h>
+#endif
+#ifdef HAVE_MATH_H
 #include <math.h>
 #include <math.h>
+#endif
+
 #include "coords.h"
 #include "vikcoord.h"
 #include "viktrack.h"
 #include "coords.h"
 #include "vikcoord.h"
 #include "viktrack.h"
@@ -108,9 +115,12 @@ VikTrack *vik_track_copy ( const VikTrack *tr )
 VikTrackpoint *vik_trackpoint_new()
 {
   VikTrackpoint *tp = g_malloc0(sizeof(VikTrackpoint));
 VikTrackpoint *vik_trackpoint_new()
 {
   VikTrackpoint *tp = g_malloc0(sizeof(VikTrackpoint));
-  tp->extended = FALSE;
   tp->speed = NAN;
   tp->course = NAN;
   tp->speed = NAN;
   tp->course = NAN;
+  tp->altitude = VIK_DEFAULT_ALTITUDE;
+  tp->hdop = VIK_DEFAULT_DOP;
+  tp->vdop = VIK_DEFAULT_DOP;
+  tp->pdop = VIK_DEFAULT_DOP;
   return tp;
 }
 
   return tp;
 }
 
@@ -369,8 +379,10 @@ gdouble *vik_track_make_elevation_map ( const VikTrack *tr, guint16 num_chunks )
   chunk_length = total_length / num_chunks;
 
   /* Zero chunk_length (eg, track of 2 tp with the same loc) will cause crash */
   chunk_length = total_length / num_chunks;
 
   /* Zero chunk_length (eg, track of 2 tp with the same loc) will cause crash */
-  if (chunk_length <= 0)
+  if (chunk_length <= 0) {
+    g_free(pts);
     return NULL;
     return NULL;
+  }
 
   current_dist = 0.0;
   current_area_under_curve = 0;
 
   current_dist = 0.0;
   current_area_under_curve = 0;