Skip to content

Commit df928c0

Browse files
committed
map download now working, next step is generation of menu based on json
to be defined together with @jkoan ändrad: navit/gui/internal/gui_internal_map_downloader.c
1 parent dd547b0 commit df928c0

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

navit/gui/internal/gui_internal_map_downloader.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <navit/command.h>
1111
#include <navit/config_.h>
1212
#include <navit/transform.h>
13+
#include <navit/network.h>
1314

1415
#include "gui_internal.h"
1516
#include "coord.h"
@@ -18,8 +19,10 @@
1819
#include "gui_internal_widget.h"
1920
#include "gui_internal_priv.h"
2021
#include "gui_internal_map_downloader.h"
21-
#include "network.h"
22+
#include "cJSON.h"
2223
#include <pthread.h>
24+
#include <stdio.h>
25+
#include <string.h>
2326

2427
pthread_t dl_thread;
2528
struct map_download_info dl_info;
@@ -30,10 +33,10 @@ struct map_download_info dl_info;
3033
*
3134
* @param the navit object from which we can fetch the mapset to enable
3235
*
33-
* @returns Returns mapset_add_attr() result
36+
* @returns nothing
3437
*/
3538

36-
int enable_map(struct navit *navit, char * map_path) {
39+
void enable_map(struct navit *navit, char * map_path) {
3740
int ret;
3841
struct attr attr;
3942

@@ -60,11 +63,11 @@ int enable_map(struct navit *navit, char * map_path) {
6063
struct attr map_a;
6164
map_a.type=attr_map;
6265
map_a.u.map=new_map;
66+
map_a.u.data=NULL;
6367
ret = mapset_add_attr(ms, &map_a);
6468
dbg(lvl_error, "Enabled map %s with result %i\n", map_path, ret);
6569
navit_draw(navit);
6670
}
67-
return ret;
6871
}
6972

7073

@@ -145,12 +148,15 @@ void gui_internal_map_downloader(struct gui_priv *this, struct widget *wm, void
145148
} else {
146149
dbg(lvl_error, "Download will be started\n");
147150
strcpy (dl_info.url,
148-
g_strdup_printf ("http://www.navit-project.org/maps/osm_bbox_11.3,47.9,11.7,48.2.osm.bz2"));
151+
g_strdup_printf ("https://github.com/jkoan/gh-actions-mapserver/releases/download/2021-07-21/europe-germany-thueringen-2021-07-21.bin"));
149152
strcpy (dl_info.url,
150-
g_strdup_printf ("http://maps9.navit-project.org/api/map/?bbox=-125.94,32.43,-114.08,42.07&timestamp=161223"));
153+
g_strdup_printf ("https://github.com/jkoan/gh-actions-mapserver/releases/download/2021-07-21/europe-germany-schleswig-holstein-2021-07-21.bin"));
151154
strcpy (dl_info.url,
152-
g_strdup_printf ("http://maps9.navit-project.org/api/map/?bbox=-123.7,36.9,-120.5,38.7&timestamp=161223"));
153-
dl_info.name = g_strdup("west.bin");
155+
g_strdup_printf ("https://github.com/jkoan/gh-actions-mapserver/releases/download/2021-07-21/australia-oceania-cook-islands-2021-07-21.bin"));
156+
gchar* ret;
157+
158+
ret = g_strrstr(dl_info.url, "/");
159+
dl_info.name = g_strdup(++ret);
154160
dl_info.path = g_strjoin(NULL, getenv("NAVIT_SHAREDIR"), "/maps/", dl_info.name, NULL);
155161
dl_info.xml = g_strjoin(NULL, getenv("NAVIT_SHAREDIR"), "/maps/", dl_info.name, ".xml", NULL);
156162
dbg(lvl_error," %s -> %s %s\n", dl_info.url, dl_info.name, dl_info.path);

0 commit comments

Comments
 (0)