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.
I also disabled the file checking when data is downloaded via
a_babel_convert_from_url function. The reason is this function can be
used to download any sort of data, not only XML. Currently, it is used
to download GPX (for OSM) and HTML (for Google).
An other solution was to select the checking function using the input
type (with a nice serie of tests on strcmp). But as gpsbabel will do the
check, I consider this check is not needed.
Signed-off-by: Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
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],
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],
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"
</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>
</para>
</section>
-<!--
<section><title>View Google Directions</title>
<para>
This option is only available on a track created using the Route Finder tool.
</para>
</note>
</section>
--->
+
</section><!-- End Track Options -->
<section><title>Waypoint Properties</title>
</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>
<keycap>Ctrl</keycap>: continue previous track
</para>
</section>
--->
+
</section>
<section><title>Georef Map Layer Tools</title>
datasource_gc.c \
datasource_bfilter.c \
datasources.h \
- google.c google.h \
googlesearch.c googlesearch.h \
dem.c dem.h \
vikdemlayer.h vikdemlayer.c \
bing.c bing.h
endif
+if GOOGLE
+libviking_a_SOURCES += \
+ google.c google.h
+endif
+
if TERRASERVER
libviking_a_SOURCES += \
terraservermapsource.c terraservermapsource.h \
/************************ FILTER LIST *******************/
// extern VikDataSourceInterface vik_datasource_gps_interface;
-// extern VikDataSourceInterface vik_datasource_google_interface;
/*** Input is TRWLayer ***/
extern VikDataSourceInterface vik_datasource_bfilter_simplify_interface;
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;
#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;
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);
extern VikDataSourceInterface vik_datasource_gps_interface;
extern VikDataSourceInterface vik_datasource_file_interface;
+#ifdef VIK_CONFIG_GOOGLE
extern VikDataSourceInterface vik_datasource_google_interface;
+#endif
#ifdef VIK_CONFIG_OPENSTREETMAP
extern VikDataSourceInterface vik_datasource_osm_interface;
#endif
" <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
#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
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
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
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,
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
*/
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);
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
*/
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 );
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 );
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") );
}
-#ifdef VIK_CONFIG_GOOGLE_DIRECTIONS
+#ifdef VIK_CONFIG_GOOGLE
/*** Route Finder ***/
static gpointer tool_route_finder_create ( VikWindow *vw, VikViewport *vvp)
{
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 */
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 );
{ "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