From: Kaj-Michael Lang Date: Tue, 5 Aug 2008 14:19:15 +0000 (+0300) Subject: MapWidgetTester: Add random waypoints to route, try not to jump around so much. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=695c8b4d50e3a6d9f59116feefaf0e32bd2dd104;p=mapper MapWidgetTester: Add random waypoints to route, try not to jump around so much. --- diff --git a/libs/libgtkmap/map-widget-test.c b/libs/libgtkmap/map-widget-test.c index 84690a4..48ae8d8 100644 --- a/libs/libgtkmap/map-widget-test.c +++ b/libs/libgtkmap/map-widget-test.c @@ -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);