]> err.no Git - mapper/commitdiff
MapWidgetTester: Add random track and route to map
authorKaj-Michael Lang <milang@tal.org>
Tue, 5 Aug 2008 13:40:40 +0000 (16:40 +0300)
committerKaj-Michael Lang <milang@tal.org>
Tue, 5 Aug 2008 13:40:40 +0000 (16:40 +0300)
libs/libgtkmap/map-widget-test.c

index 08c6f088709884362fdf2ba7e744be4f4083f9e7..84690a43abefe20e8bfc56c4a7c9474167cc7366 100644 (file)
@@ -7,6 +7,8 @@
 #define TESTREPO "/home/milang/MyDocs/.documents/Maps/OpenStreet"
 
 GtkWidget *map;
+Path *track;
+Path *route;
 
 static gboolean
 map_zoom(GtkWidget *widget, gpointer data)
@@ -127,6 +129,23 @@ gtk_map_set_center_latlon(map, 60.45, 22.25);
 gtk_range_set_value(GTK_RANGE(zoomer), 8);
 gtk_map_set_zoom(map, 8);
 
+gtk_map_set_path_display(map, TRACKS_MASK | ROUTES_MASK);
+
+track=path_new(PATH_TYPE_TRACK, 0);
+route=path_new(PATH_TYPE_ROUTE, 1);
+
+{
+gint t;
+
+for (t=1;t<256;t++) 
+       path_add_latlon(track, 
+               60.4500+g_random_double_range(-0.0008, 0.0008), 
+               22.241+g_random_double_range(-0.0008, 0.0008), t, 1, 1);
+}
+
+gtk_map_add_path(map, track, TRUE);
+gtk_map_add_path(map, route, TRUE);
+
 gdk_threads_enter();
 gtk_main();
 gdk_threads_leave();