KML is no more supported but gpsbabel support JSON format in HTML page. Google Directions is no more a separated configure option: there is no reason to distinguish from other Google feature.
Signed-off-by: Guilhem Bonnefille <guilhem.bonnefi...@gmail.com> --- configure.ac | 18 ++---------------- help/C/viking.xml | 8 ++------ src/Makefile.am | 6 +++++- src/babel.c | 2 +- src/datasource_google.c | 4 ++-- src/menu.xml.h | 2 +- src/viktrwlayer.c | 30 +++++++++++++----------------- src/vikwindow.c | 4 ++-- 8 files changed, 28 insertions(+), 46 deletions(-) diff --git a/configure.ac b/configure.ac index 92fc697..5333f58 100644 --- a/configure.ac +++ b/configure.ac @@ -130,7 +130,7 @@ esac AM_CONDITIONAL([BING], [test x$ac_cv_enable_bing = xyes]) AC_ARG_ENABLE(google, AC_HELP_STRING([--enable-google], - [enable Google stuff (Goto and External Open) (default is enable)]), + [enable Google stuff (default is enable)]), [ac_cv_enable_google=$enableval], [ac_cv_enable_google=yes]) AC_CACHE_CHECK([whether to enable Google stuff], @@ -142,19 +142,6 @@ case $ac_cv_enable_google in esac AM_CONDITIONAL([GOOGLE], [test x$ac_cv_enable_google = xyes]) - -AC_ARG_ENABLE(google-directions, AC_HELP_STRING([--enable-google-directions], - [enable Google Directions (default is disabled because it does not work)]), - [ac_cv_enable_google_directions=$enableval], - [ac_cv_enable_google_directions=no]) -AC_CACHE_CHECK([whether to enable Google directions], - [ac_cv_enable_google_directions], [ac_cv_enable_google_directions=yes]) -case $ac_cv_enable_google_directions in - yes) - AC_DEFINE(VIK_CONFIG_GOOGLE_DIRECTIONS, [], [GOOGLE DIRECTIONS]) - ;; -esac - AC_ARG_ENABLE(terraserver, AC_HELP_STRING([--enable-terraserver], [enable Terraserver stuff (default is enable)]), [ac_cv_enable_terraserver=$enableval], @@ -383,8 +370,7 @@ echo "$PACKAGE $VERSION" echo "-------------------------------------------" echo "Alphabetized track & waypoints : $ac_cv_enable_alpha_trw" echo "Bing Maps : $ac_cv_enable_bing" -echo "Google Goto : $ac_cv_enable_google" -echo "Google Directions (Broken) : $ac_cv_enable_google_directions" +echo "Google : $ac_cv_enable_google" echo "Terraserver Maps : $ac_cv_enable_terraserver" echo "Expedia Maps : $ac_cv_enable_expedia" echo "Open Street Map : $ac_cv_enable_openstreetmap" diff --git a/help/C/viking.xml b/help/C/viking.xml index 2b3adbe..fb403d3 100644 --- a/help/C/viking.xml +++ b/help/C/viking.xml @@ -872,13 +872,11 @@ Changes the current tool to add trackpoints to the end of the track. </para> </section> -<!-- <section><title>Extend Using Route Finder</title> <para> Enables the Route Finder tool. Thus on a subsequent left click in the viewport, a route is calculated from the end of track to that point using Google's route service and applied to the track. </para> </section> ---> <section><title>Upload</title> @@ -902,7 +900,6 @@ This selects the track to be used in the <link linkend="filter_with_track">Filte </para> </section> -<!-- <section><title>View Google Directions</title> <para> This option is only available on a track created using the Route Finder tool. @@ -916,7 +913,7 @@ The record of the Google route is stored in the track's comment, so if the comme </para> </note> </section> ---> + </section><!-- End Track Options --> <section><title>Waypoint Properties</title> @@ -1328,7 +1325,6 @@ For Linux you can override this with the setting in the <link linkend="prefs_ext </para> </section> -<!-- <section><title>Route Finder</title> <para> Enable this tool by clicking on the toolbar icon: <guiicon><inlinegraphic fileref="figures/route_finder_18.png"/></guiicon> @@ -1344,7 +1340,7 @@ Right-click: undo last routing (only track removed - not any waypoints) <keycap>Ctrl</keycap>: continue previous track </para> </section> ---> + </section> <section><title>Georef Map Layer Tools</title> diff --git a/src/Makefile.am b/src/Makefile.am index cd7f797..111e88e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -108,7 +108,6 @@ libviking_a_SOURCES = \ datasource_gc.c \ datasource_bfilter.c \ datasources.h \ - google.c google.h \ googlesearch.c googlesearch.h \ dem.c dem.h \ vikdemlayer.h vikdemlayer.c \ @@ -131,6 +130,11 @@ libviking_a_SOURCES += \ bing.c bing.h endif +if GOOGLE +libviking_a_SOURCES += \ + google.c google.h +endif + if TERRASERVER libviking_a_SOURCES += \ terraservermapsource.c terraservermapsource.h \ diff --git a/src/babel.c b/src/babel.c index 20ef0a2..3210539 100644 --- a/src/babel.c +++ b/src/babel.c @@ -305,7 +305,7 @@ gboolean a_babel_convert_from_shellcommand ( VikTrwLayer *vt, const char *input_ gboolean a_babel_convert_from_url ( VikTrwLayer *vt, const char *url, const char *input_type, BabelStatusFunc cb, gpointer user_data ) { - static DownloadMapOptions options = { FALSE, FALSE, NULL, 0, a_check_kml_file}; + static DownloadMapOptions options = { FALSE, FALSE, NULL, 0, NULL}; gint fd_src; int fetch_ret; gboolean ret = FALSE; diff --git a/src/datasource_google.c b/src/datasource_google.c index 10d4991..e85d673 100644 --- a/src/datasource_google.c +++ b/src/datasource_google.c @@ -31,7 +31,7 @@ #include "gpx.h" #include "acquire.h" -#define GOOGLE_DIRECTIONS_STRING "maps.google.com/maps?q=from:%s+to:%s&output=kml" +#define GOOGLE_DIRECTIONS_STRING "maps.google.com/maps?q=from:%s+to:%s&output=js" typedef struct { GtkWidget *from_entry, *to_entry; @@ -103,7 +103,7 @@ static void datasource_google_get_cmd_string ( datasource_google_widgets_t *widg to_quoted = g_strjoinv( "%20", to_split); *cmd = g_strdup_printf( GOOGLE_DIRECTIONS_STRING, from_quoted, to_quoted ); - *input_file_type = g_strdup("kml"); + *input_file_type = g_strdup("google"); g_free(last_from_str); g_free(last_to_str); diff --git a/src/menu.xml.h b/src/menu.xml.h index e60d683..f06f773 100644 --- a/src/menu.xml.h +++ b/src/menu.xml.h @@ -15,7 +15,7 @@ static const char *menu_xml = " <menu action='Acquire'>" " <menuitem action='AcquireGPS'/>" " <menuitem action='AcquireGPSBabel'/>" -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE " <menuitem action='AcquireGoogle'/>" #endif #ifdef VIK_CONFIG_OPENSTREETMAP diff --git a/src/viktrwlayer.c b/src/viktrwlayer.c index f72c83f..5ea5766 100644 --- a/src/viktrwlayer.c +++ b/src/viktrwlayer.c @@ -73,12 +73,8 @@ #include <glib/gstdio.h> #include <glib/gi18n.h> -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS -// This is currently broken as Google have disabled the KML output in Google Maps API v3 -// It has been ifdefed out in the hope that Route Finding functionality will be restored one day... -// Only have 'JSON' and 'XML' see: -// https://developers.google.com/maps/documentation/directions/#DirectionsResponses -#define GOOGLE_DIRECTIONS_STRING "maps.google.com/maps?q=from:%s,%s+to:%s,%s&output=kml" +#ifdef VIK_CONFIG_GOOGLE +#define GOOGLE_DIRECTIONS_STRING "maps.google.com/maps?q=from:%s,%s+to:%s,%s&output=js" #endif #define VIK_TRW_LAYER_TRACK_GC 16 @@ -287,7 +283,7 @@ static void trw_layer_geotagging_track ( gpointer pass_along[6] ); static void trw_layer_geotagging ( gpointer lav[2] ); #endif static void trw_layer_acquire_gps_cb ( gpointer lav[2] ); -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE static void trw_layer_acquire_google_cb ( gpointer lav[2] ); #endif #ifdef VIK_CONFIG_OPENSTREETMAP @@ -335,7 +331,7 @@ static void tool_new_track_release ( VikTrwLayer *vtl, GdkEventButton *event, Vi static gboolean tool_new_track_key_press ( VikTrwLayer *vtl, GdkEventKey *event, VikViewport *vvp ); static gpointer tool_new_waypoint_create ( VikWindow *vw, VikViewport *vvp); static gboolean tool_new_waypoint_click ( VikTrwLayer *vtl, GdkEventButton *event, VikViewport *vvp ); -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE static gpointer tool_route_finder_create ( VikWindow *vw, VikViewport *vvp); static gboolean tool_route_finder_click ( VikTrwLayer *vtl, GdkEventButton *event, VikViewport *vvp ); #endif @@ -404,7 +400,7 @@ static VikToolInterface trw_layer_tools[] = { FALSE, GDK_CURSOR_IS_PIXMAP, &cursor_showpic_pixbuf }, -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE { { "RouteFinder", "vik-icon-Route Finder", N_("Route _Finder"), "<control><shift>F", N_("Route Finder"), 0 }, (VikToolConstructorFunc) tool_route_finder_create, NULL, NULL, NULL, (VikToolMouseFunc) tool_route_finder_click, NULL, NULL, (VikToolKeyFunc) NULL, @@ -2757,7 +2753,7 @@ static void trw_layer_acquire_gps_cb ( gpointer lav[2] ) a_acquire ( vw, vlp, vvp, &vik_datasource_gps_interface ); } -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE /* * Acquire into this TRW Layer from Google Directions */ @@ -3098,7 +3094,7 @@ static void trw_layer_add_menu_items ( VikTrwLayer *vtl, GtkMenu *menu, gpointer gtk_menu_shell_append (GTK_MENU_SHELL (acquire_submenu), item); gtk_widget_show ( item ); -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE item = gtk_menu_item_new_with_mnemonic ( _("From G_oogle Directions...") ); g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_acquire_google_cb), pass_along ); gtk_menu_shell_append (GTK_MENU_SHELL (acquire_submenu), item); @@ -3716,7 +3712,7 @@ static void trw_layer_extend_track_end ( gpointer pass_along[6] ) goto_coord ( pass_along[1], pass_along[0], pass_along[5], &(((VikTrackpoint *)g_list_last(track->trackpoints)->data)->coord) ); } -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE /** * extend a track using route finder */ @@ -4972,7 +4968,7 @@ static void trw_layer_track_use_with_filter ( gpointer pass_along[6] ) a_acquire_set_filter_track ( trk ); } -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE static gboolean is_valid_google_route ( VikTrwLayer *vtl, const gpointer track_id ) { VikTrack *tr = g_hash_table_lookup ( vtl->tracks, track_id ); @@ -5345,7 +5341,7 @@ static gboolean trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *men gtk_menu_shell_append ( GTK_MENU_SHELL(menu), item ); gtk_widget_show ( item ); -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE item = gtk_image_menu_item_new_with_mnemonic ( _("Extend _Using Route Finder") ); gtk_image_menu_item_set_image ( (GtkImageMenuItem*)item, gtk_image_new_from_stock ("Route Finder", GTK_ICON_SIZE_MENU) ); // Own icon - see stock_icons in vikwindow.c g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(trw_layer_extend_track_end_route_finder), pass_along ); @@ -5376,7 +5372,7 @@ static gboolean trw_layer_sublayer_add_menu_items ( VikTrwLayer *l, GtkMenu *men gtk_menu_shell_append ( GTK_MENU_SHELL(upload_submenu), item ); gtk_widget_show ( item ); -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE if ( is_valid_google_route ( l, sublayer ) ) { item = gtk_image_menu_item_new_with_mnemonic ( _("_View Google Directions") ); @@ -6706,7 +6702,7 @@ static gboolean tool_edit_trackpoint_release ( VikTrwLayer *vtl, GdkEventButton } -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE /*** Route Finder ***/ static gpointer tool_route_finder_create ( VikWindow *vw, VikViewport *vvp) { @@ -6759,7 +6755,7 @@ static gboolean tool_route_finder_click ( VikTrwLayer *vtl, GdkEventButton *even g_ascii_dtostr (startlon, G_ASCII_DTOSTR_BUF_SIZE, (gdouble) start.lon), g_ascii_dtostr (endlat, G_ASCII_DTOSTR_BUF_SIZE, (gdouble) end.lat), g_ascii_dtostr (endlon, G_ASCII_DTOSTR_BUF_SIZE, (gdouble) end.lon)); - a_babel_convert_from_url ( vtl, url, "kml", NULL, NULL ); + a_babel_convert_from_url ( vtl, url, "google", NULL, NULL ); g_free ( url ); /* see if anything was done -- a track was added or appended to */ diff --git a/src/vikwindow.c b/src/vikwindow.c index 55f58ea..378aec2 100644 --- a/src/vikwindow.c +++ b/src/vikwindow.c @@ -2445,7 +2445,7 @@ static void acquire_from_file ( GtkAction *a, VikWindow *vw ) a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_file_interface ); } -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE static void acquire_from_google ( GtkAction *a, VikWindow *vw ) { a_acquire(vw, vw->viking_vlp, vw->viking_vvp, &vik_datasource_google_interface ); @@ -3122,7 +3122,7 @@ static GtkActionEntry entries[] = { { "Acquire", GTK_STOCK_GO_DOWN, N_("A_cquire"), NULL, NULL, (GCallback)NULL }, { "AcquireGPS", NULL, N_("From _GPS..."), NULL, N_("Transfer data from a GPS device"), (GCallback)acquire_from_gps }, { "AcquireGPSBabel", NULL, N_("Import File With GPS_Babel..."), NULL, N_("Import file via GPSBabel converter"), (GCallback)acquire_from_file }, -#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS +#ifdef VIK_CONFIG_GOOGLE { "AcquireGoogle", NULL, N_("Google _Directions..."), NULL, N_("Get driving directions from Google"), (GCallback)acquire_from_google }, #endif #ifdef VIK_CONFIG_OPENSTREETMAP -- tg: (ff1f2b3..) t/routing/update-google-api (depends on: master) ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 _______________________________________________ Viking-devel mailing list Viking-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viking-devel Viking home page: http://viking.sf.net/