1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
3 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
5 * Copyright (C) 2013, Rob Norris <rw_norris@hotmail.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <glib/gprintf.h>
23 #include <glib/gi18n.h>
27 #include "geonamessearch.h"
29 static gboolean datasource_wikipedia_process ( VikTrwLayer *vtl, const gchar *cmd, const gchar *extra, BabelStatusFunc status_cb, acq_dialog_widgets_t *adw );
31 VikDataSourceInterface vik_datasource_wikipedia_interface = {
32 N_("Create Waypoints from Wikipedia Articles"),
33 N_("Wikipedia Waypoints"),
34 VIK_DATASOURCE_AUTO_LAYER_MANAGEMENT,
35 VIK_DATASOURCE_INPUTTYPE_NONE,
37 FALSE, // Not even using the dialog
38 FALSE, // Own method for getting data - does not fit encapsulation with current thread logic
39 (VikDataSourceInitFunc) NULL,
40 (VikDataSourceCheckExistenceFunc) NULL,
41 (VikDataSourceAddSetupWidgetsFunc) NULL,
42 (VikDataSourceGetCmdStringFunc) NULL,
43 (VikDataSourceProcessFunc) datasource_wikipedia_process,
44 (VikDataSourceProgressFunc) NULL,
45 (VikDataSourceAddProgressWidgetsFunc) NULL,
46 (VikDataSourceCleanupFunc) NULL,
47 (VikDataSourceOffFunc) NULL,
57 * Process selected files and try to generate waypoints storing them in the given vtl
59 static gboolean datasource_wikipedia_process ( VikTrwLayer *vtl, const gchar *cmd, const gchar *extra, BabelStatusFunc status_cb, acq_dialog_widgets_t *adw )
61 struct LatLon maxmin[2] = { {0.0,0.0}, {0.0,0.0} };
63 // Note the order is max part first then min part - thus reverse order of use in min_max function:
64 vik_viewport_get_min_max_lat_lon ( adw->vvp, &maxmin[1].lat, &maxmin[0].lat, &maxmin[1].lon, &maxmin[0].lon );
67 a_geonames_wikipedia_box ( adw->vw, vtl, maxmin );