osm_webload fixed.. refresh from openstreetmap.

master
steffen 13 years ago
parent 6d74261ba5
commit 168d3b386d

@ -92,7 +92,6 @@ void config_init () {
snprintf (cfg.logpath, LEN_FILENAME, "%s\\wOSMroute\\Logdir\\", szPath);
}
#endif
/* linux version */
#if !defined(__MINGW32CE__) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
char *hd;
@ -120,6 +119,9 @@ void config_init () {
mkdir (fn);
#endif
}
#endif
config_load ();
if (stat(cfg.logpath, &sb) == -1) {
char fn[LEN_FILENAME];
@ -132,8 +134,19 @@ void config_init () {
mkdir (fn);
#endif
}
if (stat(cfg.mappath, &sb) == -1) {
char fn[LEN_FILENAME];
strncpy (fn, cfg.mappath, LEN_FILENAME);
fn[strlen(fn)-1] = 0;
d_printf ("create map dir:%s", fn);
#if !defined(__MINGW32CE__) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
mkdir (fn, 0755);
#else
mkdir (fn);
#endif
config_load ();
}
config_save ();
if (cfg.gps_flags) SETFLAG(gpsflags, GPSF_LOG);
@ -184,6 +197,8 @@ void config_load () {
strncpy (cfg.mappath, value, LEN_FILENAME);
if (!strcmp (keyword, "temppath"))
strncpy (cfg.temppath, value, LEN_FILENAME);
if (!strcmp (keyword, "cachepath"))
strncpy (cfg.cachepath, value, LEN_FILENAME);
if (!strcmp (keyword, "logpath"))
strncpy (cfg.logpath, value, LEN_FILENAME);
#if defined(SPOSMROUTE)
@ -231,6 +246,7 @@ void config_save () {
fprintf (f, "# config file for osmroute\n\n");
fprintf (f, "mappath=%s\n", cfg.mappath);
fprintf (f, "logpath=%s\n", cfg.logpath);
fprintf (f, "cachepath=%s\n", cfg.cachepath);
fprintf (f, "temppath=%s\n", cfg.temppath);
#if defined(SPOSMROUTE)
fprintf (f, "last_lon=%f\n", cfg.last_lon);

@ -52,8 +52,9 @@ void map_init () {
d_printf (" Directory: %s", cfg.mappath);
strncpy (fn, cfg.mappath, LEN_FILENAME);
if (fn[(i=strlen(fn))] == DIR_SEP) fn[i] = '\0';
if (fn[(i=strlen(fn))-1] == DIR_SEP) fn[i] = '\0';
else {
d_printf (" append '%c' to mappath.", DIR_SEP);
cfg.mappath[strlen(cfg.mappath)+1] = '\0';
cfg.mappath[strlen(cfg.mappath)] = DIR_SEP;
}

@ -34,7 +34,7 @@
#define MAP_W_NAMELEN 64
#define MAP_HASH_DEGFACTOR 80.0f
#define MAP_OSMWEB_DELTA 0.025f
#define MAP_OSMWEB_DELTA 0.0125f
#define MAP_LSHASHFACTOR 80
#define MAP_LSFREECNT 4096

@ -659,7 +659,8 @@ int osm_node_load (struct osm_node *node, unsigned long long int id) {
* save the waynode data inside the hash file to read all needed data later on
* and check the waynodes inside the map files.
*/
void osm_waynode_add (struct osm_node *node, long long int nodepos, unsigned long long int id, unsigned short int subid, unsigned short int pnr) {
void osm_waynode_add (struct osm_node *node, long long int nodepos, unsigned long long int id,
unsigned short int subid, unsigned short int pnr) {
struct s_osm_hashnodes *hnodes = NULL;
struct osm_nodehash hash;
struct osm_waynode wn;
@ -1023,7 +1024,8 @@ void osm_marea_new (struct s_osmmarea *a, int max) {
* hash data block. I case the way goes over more hash segments the
* way will be slit into peaces
*
* splitting into peaces does not work yet
* splitting into peaces does not work yet, also taking care of the
* polygons, no angles over 180°.
*
* CALL with NULL will free all unneeded memory
*/
@ -1785,6 +1787,21 @@ void map_load_web (struct map_pos hs, struct map_pos he) {
char fcache[LEN_FILENAME];
} wl[MLWEBMAX];
d_printf ("map_load_web: (%f , %f) --> (%f , %f)", hs.lon, hs.lat, he.lon, he.lat);
/* check for cache directory */
if (stat(cfg.cachepath, &sb) == -1) {
char fn[LEN_FILENAME];
strncpy (fn, cfg.cachepath, LEN_FILENAME);
fn[strlen(fn)-1] = 0;
d_printf ("create cache dir:%s", fn);
#if !defined(__MINGW32CE__) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
mkdir (fn, 0755);
#else
mkdir (fn);
#endif
}
app.status = APPSTATUS_loadfromweb;
#if defined (_LINUX_)
osm_load_from_web_end = he;
@ -1798,6 +1815,8 @@ void map_load_web (struct map_pos hs, struct map_pos he) {
for (h.lat = hs.lat; h.lat < he.lat || cmpf(h.lat, he.lat); h.lat = h.lat + MAP_OSMWEB_DELTA) {
do {
main_wnd_loop (-1,-1);
/* check for any finished forked processes
* if so, call osm_loadfile */
for (i = 0; i < MLWEBMAX; i++) {
if (wl[i].p.used) {
ret = execwait (&wl[i].p);
@ -1811,7 +1830,7 @@ void map_load_web (struct map_pos hs, struct map_pos he) {
for (i = 0; i < MLWEBMAX && wl[i].p.used == 1; i++);
}
while (i >= MLWEBMAX);
while (i >= MLWEBMAX); /* exit if we can fork another process */
y1 = CALC_START (h.lon, MAP_OSMWEB_DELTA);
x1 = CALC_START (h.lat, MAP_OSMWEB_DELTA);

Loading…
Cancel
Save