/[zanavi_public1]/navit/navit/maptool/boundaries.c
ZANavi

Diff of /navit/navit/maptool/boundaries.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 30 Revision 31
1/**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
1/** 20/**
2 * Navit, a modular navigation system. 21 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2011 Navit Team 22 * Copyright (C) 2005-2011 Navit Team
4 * 23 *
5 * This program is free software; you can redistribute it and/or 24 * This program is free software; you can redistribute it and/or
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 35 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 36 * Boston, MA 02110-1301, USA.
18 */ 37 */
19#include <stdio.h> 38#include <stdio.h>
20#include <string.h> 39#include <string.h>
40#include <ctype.h>
21#include "maptool.h" 41#include "maptool.h"
22 42
23struct boundary { 43char *
24 struct item_bin *ib; 44osm_tag_value(struct item_bin *ib, char *key)
25 GList *segments,*sorted_segments;
26 GList *children;
27 struct rect r;
28};
29
30struct boundary_member {
31 long long wayid;
32 enum geom_poly_segment_type role;
33 struct boundary *boundary;
34};
35
36static guint
37boundary_member_hash(gconstpointer key)
38{ 45{
39 const struct boundary_member *memb=key; 46 char *tag = NULL;
40 return (memb->wayid >> 32)^(memb->wayid & 0xffffffff); 47 int len = strlen(key);
48 while ((tag = item_bin_get_attr(ib, attr_osm_tag, tag)))
49 {
50 if (!strncmp(tag, key, len) && tag[len] == '=')
51 return tag + len + 1;
52 }
53 return NULL;
41} 54}
42
43static gboolean
44boundary_member_equal(gconstpointer a, gconstpointer b)
45{
46 const struct boundary_member *memba=a;
47 const struct boundary_member *membb=b;
48 return (memba->wayid == membb->wayid);
49}
50
51GHashTable *member_hash;
52 55
53static char * 56static char *
54osm_tag_name(struct item_bin *ib) 57osm_tag_name(struct item_bin *ib)
55{ 58{
56 char *tag=NULL; 59 return osm_tag_value(ib, "name");
57 while ((tag=item_bin_get_attr(ib, attr_osm_tag, tag))) { 60}
58 if (!strncmp(tag,"name=",5)) 61
59 return tag+5; 62long long *
60 } 63boundary_relid(struct boundary *b)
64{
65 long long *id;
66 if (!b)
67 return 0;
68 if (!b->ib)
69 return 0;
70 id = item_bin_get_attr(b->ib, attr_osm_relationid, NULL);
71 if (id)
72 return *id;
61 return NULL; 73 return 0;
74}
75
76static void process_boundaries_member(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv)
77{
78 //fprintf(stderr,"process_boundaries_member:001\n");
79
80 struct boundary *b = relation_priv;
81 enum geom_poly_segment_type role = (long) member_priv;
82
83 int *dup;
84 dup=item_bin_get_attr(member,attr_duplicate_way,NULL);
85 // only add way to boundary if this way is not already added
86 if(!dup || *dup==0)
87 {
88 b->segments = g_list_prepend(b->segments, item_bin_to_poly_segment(member, role));
89 }
90 else
91 {
92 fprintf(stderr, "process_boundaries_member: dup=true wayid=%lld\n", item_bin_get_wayid(member));
93 }
94
95 //fprintf(stderr,"process_boundaries_member:099\n");
62} 96}
63 97
64static GList * 98static GList *
65build_boundaries(FILE *boundaries) 99process_boundaries_setup(FILE *boundaries, struct relations *relations)
66{ 100{
67 struct item_bin *ib; 101 struct item_bin *ib;
68 GList *boundaries_list=NULL; 102 GList *boundaries_list = NULL;
103 struct relations_func *relations_func;
104 long long b_counter_1 = 0;
105 // long long b_counter_2 = 0;
69 106
107 //fprintf(stderr,"process_boundaries_setup:001\n");
108
109 relations_func = relations_func_new(process_boundaries_member, NULL);
70 while ((ib=read_item(boundaries))) { 110 while ((ib = read_item(boundaries, 0)))
111 {
112
113 //fprintf(stderr,"********DUMP b ***********\n");
114 //dump_itembin(ib);
115 //fprintf(stderr,"********DUMP b ***********\n");
116
117
71 char *member=NULL; 118 char *member = NULL;
72 struct boundary *boundary=g_new0(struct boundary, 1); 119 struct boundary *boundary=g_new0(struct boundary, 1);
120 char *admin_level = osm_tag_value(ib, "admin_level");
121 char *iso = osm_tag_value(ib, "ISO3166-1");
122
123 b_counter_1++;
124 if ((b_counter_1 % 500) == 0)
125 {
126 fprintf(stderr,"boundaries:B:%lld\n", b_counter_1);
127 }
128
129 //fprintf(stderr,"process_boundaries_setup:002\n");
130 //fprintf(stderr,"== b:%s %s ==\n", iso, admin_level);
131
132 /* disable spain for now since it creates a too large index */
133 if (admin_level && !strcmp(admin_level, "2") && (!iso || strcasecmp(iso, "es")))
134 {
135 if (iso)
136 {
137 struct country_table *country = country_from_iso2(iso);
138 if (!country)
139 {
140 osm_warning("relation", item_bin_get_relationid(ib), 0, "Country Boundary contains unknown ISO3166-1 value '%s'\n", iso);
141 }
142 else
143 {
144 boundary->iso2 = g_strdup(iso);
145 osm_info("relation", item_bin_get_relationid(ib), 0, "Country Boundary for '%s'\n", iso);
146 }
147 boundary->country = country;
148 }
149 else
150 {
151 osm_warning("relation", item_bin_get_relationid(ib), 0, "Country Boundary doesn't contain an ISO3166-1 tag\n");
152 }
153 }
154
155 //b_counter_2 = 0;
73 while ((member=item_bin_get_attr(ib, attr_osm_member, member))) { 156 while ((member = item_bin_get_attr(ib, attr_osm_member, member)))
157 {
158 //fprintf(stderr,"process_boundaries_setup:005\n");
159 //fprintf(stderr,"********DUMP b ***********\n");
160 //dump_itembin(ib);
161 //fprintf(stderr,"********DUMP b ***********\n");
162
163 //b_counter_2++;
164 //fprintf(stderr,"boundaries:M:%lld\n", b_counter_2);
165
74 long long wayid; 166 long long wayid;
75 int read=0; 167 int read = 0;
76 if (sscanf(member,"2:%Ld:%n",&wayid,&read) >= 1) { 168 if (sscanf(member, "2:%Ld:%n", &wayid, &read) >= 1)
77 struct boundary_member *memb=g_new(struct boundary_member, 1); 169 {
78 char *role=member+read; 170 char *rolestr = member + read;
79 memb->wayid=wayid; 171 enum geom_poly_segment_type role;
80 memb->boundary=boundary; 172 if (!strcmp(rolestr, "outer") || !strcmp(rolestr, "exclave"))
81 if (!strcmp(role,"outer"))
82 memb->role=geom_poly_segment_type_way_outer; 173 role = geom_poly_segment_type_way_outer;
83 else if (!strcmp(role,"inner")) 174 else if (!strcmp(rolestr, "inner") || !strcmp(rolestr, "enclave"))
84 memb->role=geom_poly_segment_type_way_inner; 175 role = geom_poly_segment_type_way_inner;
85 else if (!strcmp(role,"")) 176 else if (!strcmp(rolestr, ""))
86 memb->role=geom_poly_segment_type_way_unknown; 177 role = geom_poly_segment_type_way_unknown;
87 else { 178 else
88 printf("Unknown role %s\n",role); 179 {
180 osm_warning("relation", item_bin_get_relationid(ib), 0, "Unknown role %s in member ", rolestr);
181 osm_warning("way", wayid, 1, "\n");
89 memb->role=geom_poly_segment_type_none; 182 role = geom_poly_segment_type_none;
90 }
91 g_hash_table_insert(member_hash, memb, g_list_append(g_hash_table_lookup(member_hash, memb), memb));
92
93 } 183 }
184
185 //fprintf(stderr,"process_boundaries_setup:006 %s %Ld\n", rolestr,wayid);
186
187 relations_add_func(relations, relations_func, boundary, (gpointer) role, 2, wayid);
94 } 188 }
189 }
190
95 boundary->ib=item_bin_dup(ib); 191 boundary->ib = item_bin_dup(ib);
96 boundaries_list=g_list_append(boundaries_list, boundary); 192 boundaries_list = g_list_append(boundaries_list, boundary);
97 } 193 }
194
98 return boundaries_list; 195 return boundaries_list;
99} 196}
100 197
101static void 198GList *
102find_matches(GList *l, struct coord *c) 199boundary_find_matches(GList *l, struct coord *c)
103{ 200{
201 GList *ret = NULL;
202 //fprintf(stderr,"boundary_find_matches:001\n");
104 while (l) { 203 while (l)
204 {
205 //fprintf(stderr,"boundary_find_matches:002\n");
206
105 struct boundary *boundary=l->data; 207 struct boundary *boundary = l->data;
106 if (bbox_contains_coord(&boundary->r, c)) { 208 if (bbox_contains_coord(&boundary->r, c))
107 struct item_bin *ib=boundary->ib; 209 {
210 //fprintf(stderr,"boundary_find_matches:003 id=%lld name=%s\n", item_bin_get_relationid(boundary->ib), osm_tag_name(boundary->ib));
108 if (geom_poly_segments_point_inside(boundary->sorted_segments,c)) 211 if (geom_poly_segments_point_inside(boundary->sorted_segments, c) > 0)
109 printf("%s,",osm_tag_name(ib)); 212 {
110 find_matches(boundary->children, c); 213 //fprintf(stderr,"boundary_find_matches:004\n");
214 ret = g_list_prepend(ret, boundary);
111 } 215 }
216 // children stuff disabled!!
217 // ret = g_list_concat(ret, boundary_find_matches(boundary->children, c));
218 // children stuff disabled!!
219 }
112 l=g_list_next(l); 220 l = g_list_next(l);
221 }
222
223 //fprintf(stderr,"boundary_find_matches:099\n");
224
225 return ret;
226}
227
228GList *
229boundary_find_matches_level(GList *l, struct coord *c, int min_admin_level, int max_admin_level)
230{
231 GList *ret = NULL;
232 char *al;
233 int admin_level;
234 struct boundary *boundary = NULL;
235
236 while (l)
237 {
238 boundary = l->data;
239 al = osm_tag_value(boundary->ib, "admin_level");
240 if (!al)
241 {
242 admin_level = 9999;
113 } 243 }
114} 244 else
115 245 {
116static void 246 admin_level = atoi(al);
117test(GList *boundaries_list)
118{
119 struct item_bin *ib;
120 FILE *f=fopen("country_276.bin.unsorted","r");
121 printf("start\n");
122 while ((ib=read_item(f))) {
123 struct coord *c=(struct coord *)(ib+1);
124 char *name=item_bin_get_attr(ib, attr_town_name, NULL);
125 printf("%s:",name);
126 find_matches(boundaries_list, c);
127 printf("\n");
128 } 247 }
129 fclose(f);
130 printf("end\n");
131}
132 248
133static void 249 if (admin_level < 2)
250 {
251 admin_level = 9999;
252 }
253
254 //fprintf(stderr, "matches 001:this:%d min:%d max:%d\n", admin_level, min_admin_level, max_admin_level);
255
256 if ((admin_level >= min_admin_level) && (admin_level <= max_admin_level))
257 {
258 //fprintf(stderr, "matches 002:level\n");
259 if (bbox_contains_coord(&boundary->r, c))
260 {
261 //fprintf(stderr, "matches 003:bbox\n");
262 if (geom_poly_segments_point_inside(boundary->sorted_segments, c) > 0)
263 {
264 //fprintf(stderr, "matches 004:**found**\n");
265 ret = g_list_prepend(ret, boundary);
266 }
267 }
268 }
269 l = g_list_next(l);
270 }
271
272 return ret;
273}
274
275
276GList *
277boundary_find_matches_single(GList *l, struct coord *c)
278{
279 GList *ret = NULL;
280
281 if (l)
282 {
283 //fprintf(stderr, "bbox:001\n");
284 struct boundary *boundary = l->data;
285 //fprintf(stderr, "bbox:%d %d %d %d\n", boundary->r.l.x, boundary->r.l.y, boundary->r.h.x, boundary->r.h.y);
286 //fprintf(stderr, "c:%d %d\n", c->x, c->y);
287 if (bbox_contains_coord(&boundary->r, c))
288 {
289 //fprintf(stderr, "inside bbox\n");
290 if (geom_poly_segments_point_inside(boundary->sorted_segments, c) > 0)
291 {
292 //fprintf(stderr, "bbox:002\n");
293 ret = g_list_prepend(ret, boundary);
294 }
295 }
296 }
297
298 return ret;
299}
300
301
134dump_hierarchy(GList *l, char *prefix) 302static void dump_hierarchy(GList *l, char *prefix)
135{ 303{
136 char *newprefix=g_alloca(sizeof(char)*(strlen(prefix)+2)); 304 char *newprefix = g_alloca(sizeof(char) * (strlen(prefix) + 2));
137 strcpy(newprefix, prefix); 305 strcpy(newprefix, prefix);
138 strcat(newprefix," "); 306 strcat(newprefix, " ");
139 while (l) { 307 while (l)
308 {
140 struct boundary *boundary=l->data; 309 struct boundary *boundary = l->data;
141 printf("%s:%s\n",prefix,osm_tag_name(boundary->ib)); 310 fprintf(stderr, "%s:childs:%d:%lld:%s\n", prefix, g_list_length(boundary->children), item_bin_get_relationid(boundary->ib), osm_tag_name(boundary->ib));
142 dump_hierarchy(boundary->children, newprefix); 311 dump_hierarchy(boundary->children, newprefix);
143 l=g_list_next(l); 312 l = g_list_next(l);
144 } 313 }
145} 314}
146 315
147static gint
148boundary_bbox_compare(gconstpointer a, gconstpointer b) 316static gint boundary_bbox_compare(gconstpointer a, gconstpointer b)
149{ 317{
150 const struct boundary *boundarya=a; 318 const struct boundary *boundarya = a;
151 const struct boundary *boundaryb=b; 319 const struct boundary *boundaryb = b;
152 long long areaa=bbox_area(&boundarya->r); 320 long long areaa = bbox_area(&boundarya->r);
153 long long areab=bbox_area(&boundaryb->r); 321 long long areab = bbox_area(&boundaryb->r);
154 if (areaa > areab) 322 if (areaa > areab)
155 return 1; 323 return 1;
156 if (areaa < areab) 324 if (areaa < areab)
157 return -1; 325 return -1;
158 return 0; 326 return 0;
159} 327}
160 328
161int 329static GList *
162process_boundaries(FILE *boundaries, FILE *ways) 330process_boundaries_insert(GList *list, struct boundary *boundary)
163{ 331{
164 struct item_bin *ib; 332 // children stuff is totally broken, so it is disabled now!!
165 GList *boundaries_list,*l,*sl,*l2,*ln; 333 /*
166 334 GList *l = list;
167 member_hash=g_hash_table_new_full(boundary_member_hash, boundary_member_equal, NULL, NULL);
168 boundaries_list=build_boundaries(boundaries);
169 while ((ib=read_item(ways))) {
170 long long *wayid=item_bin_get_attr(ib, attr_osm_wayid, NULL);
171 if (wayid) {
172 GList *l=g_hash_table_lookup(member_hash, wayid);
173 while (l) { 335 while (l)
336 {
174 struct boundary_member *memb=l->data; 337 struct boundary *b = l->data;
175 memb->boundary->segments=g_list_prepend(memb->boundary->segments,item_bin_to_poly_segment(ib, memb->role)); 338 if (bbox_contains_bbox(&boundary->r, &b->r))
176 339 {
340 list = g_list_remove(list, b);
341 boundary->children = g_list_prepend(boundary->children, b);
342 l = list;
343 }
344 else if (bbox_contains_bbox(&b->r, &boundary->r))
345 {
346 b->children = process_boundaries_insert(b->children, boundary);
347 return list;
348 }
349 else
350 {
177 l=g_list_next(l); 351 l = g_list_next(l);
178 } 352 }
179 } 353 }
180 } 354 */
355 // children stuff is totally broken, so it is disabled now!!
356
357 return g_list_prepend(list, boundary);
358}
359
360static GList *
361process_boundaries_finish(GList *boundaries_list)
362{
363 //fprintf(stderr,"process_boundaries_finish:001\n");
364
365 GList *l, *sl, *l2, *ln;
366 GList *ret = NULL;
181 l=boundaries_list; 367 l = boundaries_list;
368 char *f1_name = NULL;
369 char *f2_name = NULL;
370 long long b_counter_1 = 0;
371 long long nodes_counter_ = 0;
372 long long ways_counter_ = 0;
373
182 while (l) { 374 while (l)
375 {
183 struct boundary *boundary=l->data; 376 struct boundary *boundary = l->data;
184 int first=1; 377 int first = 1;
185 boundary->sorted_segments=geom_poly_segments_sort(boundary->segments, geom_poly_segment_type_way_right_side); 378 FILE *f = NULL, *fu = NULL;
379
380 b_counter_1++;
381 if ((b_counter_1 % 500) == 0)
382 {
383 fprintf(stderr,"boundaries_f1:B:%lld\n", b_counter_1);
384 }
385
386 //fprintf(stderr,"process_boundaries_finish:002\n");
387
388 // only lowercase country code
389 if (boundary->iso2)
390 {
391 int i99;
392 for (i99 = 0; boundary->iso2[i99]; i99++)
393 {
394 boundary->iso2[i99] = tolower(boundary->iso2[i99]);
395 }
396 }
397 // only lowercase country code
398
399 if (boundary->country)
400 {
401 //fprintf(stderr,"process_boundaries_finish:003\n");
402
403 char *name = g_strdup_printf("country_%s_poly", boundary->iso2);
404 f1_name = g_strdup_printf("country_%s_poly", boundary->iso2);
405 f = tempfile("", name, 1);
406 g_free(name);
407 }
408
409
410
411 // calc bounding box
412 first = 1;
413 nodes_counter_ = 0;
414 ways_counter_ = 0;
186 sl=boundary->sorted_segments; 415 sl = boundary->segments;
187 while (sl) { 416 while (sl)
417 {
188 struct geom_poly_segment *gs=sl->data; 418 struct geom_poly_segment *gs = sl->data;
189 struct coord *c=gs->first; 419 struct coord *c = gs->first;
190 while (c <= gs->last) { 420 while (c <= gs->last)
421 {
191 if (first) { 422 if (first)
423 {
192 boundary->r.l=*c; 424 boundary->r.l = *c;
193 boundary->r.h=*c; 425 boundary->r.h = *c;
194 first=0; 426 first = 0;
427 }
195 } else 428 else
429 {
196 bbox_extend(c, &boundary->r); 430 bbox_extend(c, &boundary->r);
431 }
197 c++; 432 c++;
433 nodes_counter_++;
198 } 434 }
199 sl=g_list_next(sl); 435 sl = g_list_next(sl);
436 ways_counter_++;
200 } 437 }
438
439 //fprintf(stderr, "relid:%lld\n", item_bin_get_relationid(boundary->ib));
440 //fprintf(stderr, "ways:%lld nodes:%lld\n", ways_counter_, nodes_counter_);
441
442 boundary->sorted_segments = geom_poly_segments_sort(boundary->segments, geom_poly_segment_type_way_right_side);
443 sl = boundary->sorted_segments;
444
445 first = 1;
446 while (sl)
447 {
448 //fprintf(stderr,"process_boundaries_finish:004.1\n");
449
450 struct geom_poly_segment *gs = sl->data;
451 struct coord *c = gs->first;
452
453 /*
454 while (c <= gs->last)
455 {
456 if (first)
457 {
458 boundary->r.l = *c;
459 boundary->r.h = *c;
460 first = 0;
461 }
462 else
463 {
464 bbox_extend(c, &boundary->r);
465 }
466 c++;
467
468 //fprintf(stderr,"process_boundaries_finish:004.2 lx=%d ly=%d hx=%d hy=%d\n",boundary->r.l.x,boundary->r.l.y,boundary->r.h.x,boundary->r.h.y);
469
470 }
471 */
472
473 if (f)
474 {
475 struct item_bin *ib = item_bin_2;
476 item_bin_init(ib, type_selected_line);
477 item_bin_add_coord(ib, gs->first, gs->last - gs->first + 1);
478 item_bin_write(ib, f);
479 }
480
481 if (boundary->country)
482 {
483 if (!coord_is_equal(*gs->first, *gs->last))
484 {
485 if (!fu)
486 {
487 char *name = g_strdup_printf("country_%s_broken", boundary->iso2);
488 f2_name = g_strdup_printf("country_%s_broken", boundary->iso2);
489 fprintf(stderr, "*BROKEN* country_%s_broken\n", boundary->iso2);
490 fu = tempfile("", name, 1);
491 g_free(name);
492 }
493 struct item_bin *ib = item_bin_2;
494 item_bin_init(ib, type_selected_point);
495 item_bin_add_coord(ib, gs->first, 1);
496 item_bin_write(ib, fu);
497
498 item_bin_init(ib, type_selected_point);
499 item_bin_add_coord(ib, gs->last, 1);
500 item_bin_write(ib, fu);
501 }
502 }
503 sl = g_list_next(sl);
504
505 if (f2_name)
506 {
507 tempfile_unlink("", f2_name);
508 g_free(f2_name);
509 f2_name = NULL;
510 }
511 }
512
513 ret = process_boundaries_insert(ret, boundary);
201 l=g_list_next(l); 514 l = g_list_next(l);
515
516 if (f)
202 517 {
518 fclose(f);
203 } 519 }
520
521 if (fu)
522 {
523 if (boundary->country)
524 {
525 //osm_warning("relation", item_bin_get_relationid(boundary->ib), 0, "Broken country polygon '%s'\n", boundary->iso2);
526 fprintf(stderr, "*BROKEN* country polygon '%s'\n", boundary->iso2);
527 }
528 fclose(fu);
529 }
530
531 if (f1_name)
532 {
533 tempfile_unlink("", f1_name);
534 g_free(f1_name);
535 f1_name = NULL;
536 }
537 }
538#if 0
204 printf("hierarchy\n"); 539 printf("hierarchy\n");
205 boundaries_list=g_list_sort(boundaries_list, boundary_bbox_compare); 540#endif
541
542 // boundaries_list = g_list_sort(boundaries_list, boundary_bbox_compare); // disable sorting, does not seem to do any good
543
544// children stuff totally broken!!!
545#if 0
546 b_counter_1 = 0;
206 l=boundaries_list; 547 l = boundaries_list;
207 while (l) { 548 while (l)
549 {
550 b_counter_1++;
551 if ((b_counter_1 % 500) == 0)
552 {
553 fprintf(stderr,"boundaries_f2:B:%lld\n", b_counter_1);
554 }
555
208 struct boundary *boundary=l->data; 556 struct boundary *boundary = l->data;
209 ln=l2=g_list_next(l); 557 ln = l2 = g_list_next(l);
210 while (l2) { 558 while (l2)
559 {
211 struct boundary *boundary2=l2->data; 560 struct boundary *boundary2 = l2->data;
212 if (bbox_contains_bbox(&boundary2->r, &boundary->r)) { 561 if (bbox_contains_bbox(&boundary2->r, &boundary->r))
562 {
213 boundaries_list=g_list_remove(boundaries_list, boundary); 563 boundaries_list = g_list_remove(boundaries_list, boundary);
214 boundary2->children=g_list_append(boundary2->children, boundary); 564 boundary2->children = g_list_append(boundary2->children, boundary);
215 printf("found\n");
216 break; 565 break;
217 } 566 }
218 l2=g_list_next(l2); 567 l2 = g_list_next(l2);
219 } 568 }
220 l=ln; 569 l = ln;
221 } 570 }
222 printf("hierarchy done\n"); 571#endif
223 dump_hierarchy(boundaries_list,""); 572// children stuff totally broken!!!
224 printf("test\n"); 573
574 // -- DEBUG --
575 // -- DEBUG --
576 // -- DEBUG --
577 // dump_hierarchy(boundaries_list,""); // --> prints huge amounts of data!! be careful
578 // -- DEBUG --
579 // -- DEBUG --
580 // -- DEBUG --
581
582 return boundaries_list;
583}
584
585GList *
586process_boundaries(FILE *boundaries, FILE *coords, FILE *ways)
587{
225 test(boundaries_list); 588 GList *boundaries_list;
226 return 1; 589 struct relations *relations = relations_new();
590
591 //fprintf(stderr,"process_boundaries:001\n");
592 boundaries_list = process_boundaries_setup(boundaries, relations);
593 //fprintf(stderr,"process_boundaries:001.rp1\n");
594 relations_process(relations, NULL, ways, NULL);
595 //fprintf(stderr,"process_boundaries:001.rp2\n");
596 return process_boundaries_finish(boundaries_list);
227} 597}
598

Legend:
Removed from v.30  
changed lines
  Added in v.31

   
Visit the ZANavi Wiki