]> err.no Git - mapper/commitdiff
MapWidgetTester: Add random waypoints to route, try not to jump around so much.
authorKaj-Michael Lang <milang@tal.org>
Tue, 5 Aug 2008 14:19:15 +0000 (17:19 +0300)
committerKaj-Michael Lang <milang@tal.org>
Tue, 5 Aug 2008 14:19:15 +0000 (17:19 +0300)
libs/libgtkmap/map-widget-test.c

index 84690a43abefe20e8bfc56c4a7c9474167cc7366..48ae8d8edc91dd18b80875f74bf1a9edaff8b74d 100644 (file)
@@ -68,6 +68,8 @@ GtkWidget *window, *wvbox;
 GtkWidget *hbox, *zoomer, *btn_left, *btn_right, *btn_up, *btn_down, *vbox;
 GtkWidget *rotate;
 RepoData *rd;
+gint t;
+gdouble slat, slon;
 
 g_thread_init(NULL);
 g_type_init();
@@ -134,13 +136,16 @@ 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);
+slon=slat=0.001;
+for (t=1;t<256;t++) {
+    if (g_random_double()<0.1) {
+        slat=g_random_double_range(-0.0009, 0.0009);
+        slon=g_random_double_range(-0.0009, 0.0009);
+    }
+       path_add_latlon(track, 60.450 + slat, 22.241 + slon, t, 1, 1);
+       path_add_latlon(route, 60.555 + slat, 22.140 + slon, t, 1, 1);
+       if (g_random_double()<0.1)
+               path_add_waypoint(route, 60.555 + slat, 22.140 + slon, "WPT");
 }
 
 gtk_map_add_path(map, track, TRUE);