diff --git a/mapsys/map_osmload.c b/mapsys/map_osmload.c index e2417dd..30b2f64 100644 --- a/mapsys/map_osmload.c +++ b/mapsys/map_osmload.c @@ -1182,7 +1182,7 @@ struct s_osmareapnt { }; -#define MAX_SUBID 40 +#define MAX_SUBID 250 int osm_area_split_add (struct s_osmmarea *marea) { /* allocate enought memory */ struct map_area *a = NULL; @@ -1191,7 +1191,7 @@ int osm_area_split_add (struct s_osmmarea *marea) { int _debug = 0; float angle_sum; - if (marea->marea->id == 18763935) _debug = 1; + if (marea->marea->id == 22963833) _debug = 0; else return 1; d_printf ("marea: %lld cnt:%d", marea->marea->id, marea->marea->p_cnt); // map_area_add (marea->marea, MHLOAD_RELOAD); @@ -1221,7 +1221,7 @@ int osm_area_split_add (struct s_osmmarea *marea) { while (pt[0].pnr >= 0 && pt_c > 2 && a->subid < MAX_SUBID) { /* st - will keep first pt to start checking polygon * c - count how many angles are above 180° */ - d_printf ("**************** subid:%d pt_c:%d", a->subid, pt_c); + if (_debug) d_printf ("**************** subid:%d pt_c:%d", a->subid, pt_c); for (angle_sum = 0.0, st = -1, c = 0, i = 0; i < pt_c; i++) { if (i == pt_c-1) pt[i].angle = point_angle (pt[i-1].km, pt[i].km, pt[0].km); else if (i == 0) pt[i].angle = point_angle (pt[pt_c-1].km, pt[i].km, pt[i+1].km); @@ -1289,8 +1289,8 @@ int osm_area_split_add (struct s_osmmarea *marea) { if (_debug) d_printf ("select %d [pnr:%d] second:%d", sel, pt[sel].pnr, s); for (i = 0; i < pt_c; i++) { if (i != sel) { - pt[i].sel_angle = point_angle (pt[i].km, pt[st].km, pt[s].km); - pt[i].sel_dist = vec_len (vec_sub (pt[i].km, pt[st].km)); + pt[i].sel_angle = point_angle (pt[i].km, pt[sel].km, pt[s].km); + pt[i].sel_dist = vec_len (vec_sub (pt[i].km, pt[sel].km)); } else { pt[i].sel_angle = -2.0; @@ -1332,11 +1332,12 @@ int osm_area_split_add (struct s_osmmarea *marea) { if (a->p_cnt < 3) { /* found nothing try next one */ - i = sel + 1; if (i >= pt_c) i = 0; - do { - sel = i; - i++; if (i >= pt_c) i = 0; - } while (sel > st && (pt[i].angle > M_PI || pt[sel].angle < M_PI)); +// i = sel + 1; if (i >= pt_c) i = 0; +// do { +// sel = i; +// i++; if (i >= pt_c) i = 0; +// } while (sel > st && (pt[i].angle > M_PI || pt[sel].angle < M_PI)); + sel++; if (sel >= pt_c) sel = 0; } } while (sel > st && a->p_cnt < 3);