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 |
|
20 |
/**
|
21 |
* Navit, a modular navigation system.
|
22 |
* Copyright (C) 2005-2008 Navit Team
|
23 |
*
|
24 |
* This program is free software; you can redistribute it and/or
|
25 |
* modify it under the terms of the GNU General Public License
|
26 |
* version 2 as published by the Free Software Foundation.
|
27 |
*
|
28 |
* This program is distributed in the hope that it will be useful,
|
29 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
30 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
31 |
* GNU General Public License for more details.
|
32 |
*
|
33 |
* You should have received a copy of the GNU General Public License
|
34 |
* along with this program; if not, write to the
|
35 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
36 |
* Boston, MA 02110-1301, USA.
|
37 |
*/
|
38 |
|
39 |
#include <stdio.h>
|
40 |
#include <string.h>
|
41 |
#include <glib.h>
|
42 |
#include "coord.h"
|
43 |
#include "debug.h"
|
44 |
#include "item.h"
|
45 |
#include "map.h"
|
46 |
#include "transform.h"
|
47 |
|
48 |
struct item_name
|
49 |
{
|
50 |
enum item_type item;
|
51 |
char *name;
|
52 |
};
|
53 |
|
54 |
struct item_range item_range_all = { type_none, type_last };
|
55 |
|
56 |
struct default_flags
|
57 |
{
|
58 |
enum item_type type;
|
59 |
int flags;
|
60 |
};
|
61 |
|
62 |
struct item busy_item;
|
63 |
|
64 |
struct default_flags default_flags2[] = { { type_street_nopass, NAVIT_AF_PBH }, { type_street_0, NAVIT_AF_ALL }, { type_street_1_city, NAVIT_AF_ALL }, { type_street_2_city, NAVIT_AF_ALL }, { type_street_3_city, NAVIT_AF_ALL }, { type_street_4_city, NAVIT_AF_ALL }, { type_highway_city, NAVIT_AF_MOTORIZED_FAST }, { type_street_1_land, NAVIT_AF_ALL }, { type_street_2_land, NAVIT_AF_ALL }, { type_street_3_land, NAVIT_AF_ALL }, { type_street_4_land, NAVIT_AF_ALL }, { type_street_n_lanes, NAVIT_AF_MOTORIZED_FAST }, { type_highway_land, NAVIT_AF_MOTORIZED_FAST }, { type_roundabout, NAVIT_AF_ALL }, { type_ferry, NAVIT_AF_ALL }, { type_cycleway, NAVIT_AF_PBH }, { type_track_paved, NAVIT_AF_ALL }, { type_track_gravelled, NAVIT_AF_ALL }, { type_track_unpaved, NAVIT_AF_ALL }, { type_track_ground, NAVIT_AF_ALL }, { type_track_grass, NAVIT_AF_ALL }, { type_footway, NAVIT_AF_PBH }, { type_living_street, NAVIT_AF_ALL }, { type_street_service, NAVIT_AF_ALL }, { type_street_parking_lane, NAVIT_AF_ALL }, { type_bridleway, NAVIT_AF_PBH }, { type_path, NAVIT_AF_PBH }, { type_steps, NAVIT_AF_PBH }, { type_ramp_highway_land, NAVIT_AF_MOTORIZED_FAST }, { type_ramp_street_4_city, NAVIT_AF_ALL }, { type_ramp_street_3_city, NAVIT_AF_ALL }, { type_ramp_street_2_city, NAVIT_AF_ALL }, { type_street_pedestrian, NAVIT_AF_PBH }, };
|
65 |
|
66 |
|
67 |
struct item_name item_names[] = {
|
68 |
#define ITEM2(x,y) ITEM(y)
|
69 |
#define ITEM(x) { type_##x, #x },
|
70 |
#include "item_def.h"
|
71 |
#undef ITEM2
|
72 |
#undef ITEM
|
73 |
};
|
74 |
|
75 |
static GHashTable *default_flags_hash;
|
76 |
|
77 |
int *
|
78 |
item_get_default_flags(enum item_type type)
|
79 |
{
|
80 |
if (!default_flags_hash)
|
81 |
{
|
82 |
int i;
|
83 |
default_flags_hash = g_hash_table_new(NULL, NULL);
|
84 |
for (i = 0; i < sizeof(default_flags2) / sizeof(struct default_flags); i++)
|
85 |
{
|
86 |
g_hash_table_insert(default_flags_hash, (void *) (long) default_flags2[i].type, &default_flags2[i].flags);
|
87 |
}
|
88 |
}
|
89 |
return g_hash_table_lookup(default_flags_hash, (void *) (long) type);
|
90 |
}
|
91 |
|
92 |
void item_cleanup(void)
|
93 |
{
|
94 |
if (default_flags_hash)
|
95 |
g_hash_table_destroy(default_flags_hash);
|
96 |
}
|
97 |
|
98 |
void item_coord_rewind(struct item *it)
|
99 |
{
|
100 |
it->meth->item_coord_rewind(it->priv_data);
|
101 |
}
|
102 |
|
103 |
int item_coord_get(struct item *it, struct coord *c, int count)
|
104 |
{
|
105 |
return it->meth->item_coord_get(it->priv_data, c, count);
|
106 |
}
|
107 |
|
108 |
int item_coord_set(struct item *it, struct coord *c, int count, enum change_mode mode)
|
109 |
{
|
110 |
if (!it->meth->item_coord_set)
|
111 |
{
|
112 |
return 0;
|
113 |
}
|
114 |
|
115 |
return it->meth->item_coord_set(it->priv_data, c, count, mode);
|
116 |
}
|
117 |
|
118 |
int item_coord_get_within_selection(struct item *it, struct coord *c, int count, struct map_selection *sel)
|
119 |
{
|
120 |
int i, ret = it->meth->item_coord_get(it->priv_data, c, count);
|
121 |
struct coord_rect r;
|
122 |
struct map_selection *curr;
|
123 |
if (ret <= 0 || !sel)
|
124 |
return ret;
|
125 |
r.lu = c[0];
|
126 |
r.rl = c[0];
|
127 |
for (i = 1; i < ret; i++)
|
128 |
{
|
129 |
if (r.lu.x > c[i].x)
|
130 |
r.lu.x = c[i].x;
|
131 |
if (r.rl.x < c[i].x)
|
132 |
r.rl.x = c[i].x;
|
133 |
if (r.rl.y > c[i].y)
|
134 |
r.rl.y = c[i].y;
|
135 |
if (r.lu.y < c[i].y)
|
136 |
r.lu.y = c[i].y;
|
137 |
}
|
138 |
curr = sel;
|
139 |
while (curr)
|
140 |
{
|
141 |
struct coord_rect *sr = &curr->u.c_rect;
|
142 |
if (r.lu.x <= sr->rl.x && r.rl.x >= sr->lu.x && r.lu.y >= sr->rl.y && r.rl.y <= sr->lu.y)
|
143 |
return ret;
|
144 |
curr = curr->next;
|
145 |
}
|
146 |
return 0;
|
147 |
}
|
148 |
|
149 |
int item_coord_get_pro(struct item *it, struct coord *c, int count, enum projection to)
|
150 |
{
|
151 |
int ret = item_coord_get(it, c, count);
|
152 |
int i;
|
153 |
enum projection from = map_projection(it->map);
|
154 |
if (from != to)
|
155 |
for (i = 0; i < count; i++)
|
156 |
transform_from_to(c + i, from, c + i, to);
|
157 |
return ret;
|
158 |
}
|
159 |
|
160 |
int item_coord_is_node(struct item *it)
|
161 |
{
|
162 |
if (it->meth->item_coord_is_node)
|
163 |
return it->meth->item_coord_is_node(it->priv_data);
|
164 |
return 0;
|
165 |
}
|
166 |
|
167 |
void item_attr_rewind(struct item *it)
|
168 |
{
|
169 |
it->meth->item_attr_rewind(it->priv_data);
|
170 |
}
|
171 |
|
172 |
int item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr)
|
173 |
{
|
174 |
if (it->meth)
|
175 |
{
|
176 |
return it->meth->item_attr_get(it->priv_data, attr_type, attr);
|
177 |
}
|
178 |
else
|
179 |
{
|
180 |
dbg(0, "not method found\n");
|
181 |
return 0;
|
182 |
}
|
183 |
}
|
184 |
|
185 |
int item_attr_set(struct item *it, struct attr *attr, enum change_mode mode)
|
186 |
{
|
187 |
if (!it->meth->item_attr_set)
|
188 |
return 0;
|
189 |
return it->meth->item_attr_set(it->priv_data, attr, mode);
|
190 |
}
|
191 |
|
192 |
struct item * item_new(char *type, int zoom)
|
193 |
{
|
194 |
struct item * it;
|
195 |
|
196 |
it = g_new0(struct item, 1);
|
197 |
|
198 |
/* FIXME evaluate arguments */
|
199 |
|
200 |
return it;
|
201 |
}
|
202 |
|
203 |
// not working yet!!!!! ------
|
204 |
/*
|
205 |
void item_dup(struct item *src, struct item *dst)
|
206 |
{
|
207 |
int size;
|
208 |
void *priv_data;
|
209 |
|
210 |
dst = g_new0(struct item, 1);
|
211 |
dst->type=src->type;
|
212 |
dst->id_hi=src->id_hi;
|
213 |
dst->id_lo=src->id_lo;
|
214 |
|
215 |
dst->priv_data=g_malloc(size);
|
216 |
memcpy(dst->priv_data, src->priv_data, size);
|
217 |
// int len = (ib->len + 1) * 4;
|
218 |
|
219 |
}
|
220 |
*/
|
221 |
// not working yet!!!!! ------
|
222 |
|
223 |
// return: 1 -> don't put it into search index
|
224 |
// 0 -> yes, put it into search index
|
225 |
int item_not_for_search_index(enum item_type i_type)
|
226 |
{
|
227 |
|
228 |
if (i_type == type_house_number_interpolation_even)
|
229 |
{
|
230 |
return 1;
|
231 |
}
|
232 |
// exclude "unknown street" types from search index --> dont do this, otherwise we dont find all the good things :-)
|
233 |
//else if (i_type == type_street_unkn)
|
234 |
//{
|
235 |
// return 1;
|
236 |
//}
|
237 |
else if (i_type == type_house_number_interpolation_odd)
|
238 |
{
|
239 |
return 1;
|
240 |
}
|
241 |
else if (i_type == type_house_number_interpolation_all)
|
242 |
{
|
243 |
return 1;
|
244 |
}
|
245 |
else if (i_type == type_house_number_interpolation_alphabetic)
|
246 |
{
|
247 |
return 1;
|
248 |
}
|
249 |
else if (i_type == type_poly_airport)
|
250 |
{
|
251 |
return 1;
|
252 |
}
|
253 |
else if (i_type == type_poly_apron)
|
254 |
{
|
255 |
return 1;
|
256 |
}
|
257 |
else if (i_type == type_poly_terminal)
|
258 |
{
|
259 |
return 1;
|
260 |
}
|
261 |
else if (i_type == type_border_national_park)
|
262 |
{
|
263 |
return 1;
|
264 |
}
|
265 |
else if (i_type == type_border_political)
|
266 |
{
|
267 |
return 1;
|
268 |
}
|
269 |
else if (i_type == type_height_line_1)
|
270 |
{
|
271 |
return 1;
|
272 |
}
|
273 |
else if (i_type == type_height_line_2)
|
274 |
{
|
275 |
return 1;
|
276 |
}
|
277 |
else if (i_type == type_height_line_3)
|
278 |
{
|
279 |
return 1;
|
280 |
}
|
281 |
else if (i_type == type_poly_wood)
|
282 |
{
|
283 |
return 1;
|
284 |
}
|
285 |
else if (i_type == type_poly_greenfield)
|
286 |
{
|
287 |
return 1;
|
288 |
}
|
289 |
else if (i_type == type_poly_reservoir)
|
290 |
{
|
291 |
return 1;
|
292 |
}
|
293 |
else if (i_type == type_poly_playground)
|
294 |
{
|
295 |
return 1;
|
296 |
}
|
297 |
else if (i_type == type_poly_land)
|
298 |
{
|
299 |
return 1;
|
300 |
}
|
301 |
else if (i_type == type_poly_marsh)
|
302 |
{
|
303 |
return 1;
|
304 |
}
|
305 |
else if (i_type == type_poly_mud)
|
306 |
{
|
307 |
return 1;
|
308 |
}
|
309 |
else if (i_type == type_poly_water)
|
310 |
{
|
311 |
return 1;
|
312 |
}
|
313 |
else if (i_type == type_poly_wood)
|
314 |
{
|
315 |
return 1;
|
316 |
}
|
317 |
else if (i_type == type_poly_place1)
|
318 |
{
|
319 |
return 1;
|
320 |
}
|
321 |
else if (i_type == type_poly_place2)
|
322 |
{
|
323 |
return 1;
|
324 |
}
|
325 |
else if (i_type == type_poly_place3)
|
326 |
{
|
327 |
return 1;
|
328 |
}
|
329 |
else if (i_type == type_poly_place4)
|
330 |
{
|
331 |
return 1;
|
332 |
}
|
333 |
else if (i_type == type_poly_place5)
|
334 |
{
|
335 |
return 1;
|
336 |
}
|
337 |
else if (i_type == type_poly_place6)
|
338 |
{
|
339 |
return 1;
|
340 |
}
|
341 |
else if (i_type == type_ferry)
|
342 |
{
|
343 |
return 1;
|
344 |
}
|
345 |
else if (i_type == type_water_canal)
|
346 |
{
|
347 |
return 1;
|
348 |
}
|
349 |
else if (i_type == type_water_drain)
|
350 |
{
|
351 |
return 1;
|
352 |
}
|
353 |
else if (i_type == type_water_river)
|
354 |
{
|
355 |
return 1;
|
356 |
}
|
357 |
else if (i_type == type_poly_water)
|
358 |
{
|
359 |
return 1;
|
360 |
}
|
361 |
else if (i_type == type_water_stream)
|
362 |
{
|
363 |
return 1;
|
364 |
}
|
365 |
else
|
366 |
{
|
367 |
return 0;
|
368 |
}
|
369 |
|
370 |
return 0;
|
371 |
}
|
372 |
|
373 |
int item_is_town_label_major(enum item_type i_type)
|
374 |
{
|
375 |
if (i_type == type_town_label_1e6)
|
376 |
{
|
377 |
return 1;
|
378 |
}
|
379 |
else if (i_type == type_town_label_2e6)
|
380 |
{
|
381 |
return 1;
|
382 |
}
|
383 |
else if (i_type == type_town_label_5e6)
|
384 |
{
|
385 |
return 1;
|
386 |
}
|
387 |
else if (i_type == type_town_label_1e7)
|
388 |
{
|
389 |
return 1;
|
390 |
}
|
391 |
else
|
392 |
{
|
393 |
return 0;
|
394 |
}
|
395 |
|
396 |
return 0;
|
397 |
}
|
398 |
|
399 |
int item_is_town_label_no_major(enum item_type i_type)
|
400 |
{
|
401 |
if (i_type == type_town_label_0e0)
|
402 |
{
|
403 |
return 1;
|
404 |
}
|
405 |
else if (i_type == type_town_label_1e0)
|
406 |
{
|
407 |
return 1;
|
408 |
}
|
409 |
else if (i_type == type_town_label_2e0)
|
410 |
{
|
411 |
return 1;
|
412 |
}
|
413 |
else if (i_type == type_town_label_5e0)
|
414 |
{
|
415 |
return 1;
|
416 |
}
|
417 |
else if (i_type == type_town_label_1e1)
|
418 |
{
|
419 |
return 1;
|
420 |
}
|
421 |
else if (i_type == type_town_label_2e1)
|
422 |
{
|
423 |
return 1;
|
424 |
}
|
425 |
else if (i_type == type_town_label_5e1)
|
426 |
{
|
427 |
return 1;
|
428 |
}
|
429 |
else if (i_type == type_town_label_1e2)
|
430 |
{
|
431 |
return 1;
|
432 |
}
|
433 |
else if (i_type == type_town_label_2e2)
|
434 |
{
|
435 |
return 1;
|
436 |
}
|
437 |
else if (i_type == type_town_label_5e2)
|
438 |
{
|
439 |
return 1;
|
440 |
}
|
441 |
else if (i_type == type_town_label_1e3)
|
442 |
{
|
443 |
return 1;
|
444 |
}
|
445 |
else if (i_type == type_town_label_2e3)
|
446 |
{
|
447 |
return 1;
|
448 |
}
|
449 |
else if (i_type == type_town_label_5e3)
|
450 |
{
|
451 |
return 1;
|
452 |
}
|
453 |
else if (i_type == type_town_label_1e4)
|
454 |
{
|
455 |
return 1;
|
456 |
}
|
457 |
else if (i_type == type_town_label_2e4)
|
458 |
{
|
459 |
return 1;
|
460 |
}
|
461 |
else if (i_type == type_town_label_5e4)
|
462 |
{
|
463 |
return 1;
|
464 |
}
|
465 |
else if (i_type == type_town_label_1e5)
|
466 |
{
|
467 |
return 1;
|
468 |
}
|
469 |
else if (i_type == type_town_label_2e5)
|
470 |
{
|
471 |
return 1;
|
472 |
}
|
473 |
else if (i_type == type_town_label_5e5)
|
474 |
{
|
475 |
return 1;
|
476 |
}
|
477 |
else if (i_type == type_town_label)
|
478 |
{
|
479 |
return 1;
|
480 |
}
|
481 |
/* major town */
|
482 |
/*
|
483 |
else if (i_type == type_town_label_1e6)
|
484 |
{
|
485 |
return 1;
|
486 |
}
|
487 |
else if (i_type == type_town_label_2e6)
|
488 |
{
|
489 |
return 1;
|
490 |
}
|
491 |
else if (i_type == type_town_label_5e6)
|
492 |
{
|
493 |
return 1;
|
494 |
}
|
495 |
else if (i_type == type_town_label_1e7)
|
496 |
{
|
497 |
return 1;
|
498 |
}
|
499 |
*/
|
500 |
else
|
501 |
{
|
502 |
return 0;
|
503 |
}
|
504 |
|
505 |
return 0;
|
506 |
}
|
507 |
|
508 |
int item_is_district_label(enum item_type i_type)
|
509 |
{
|
510 |
if (i_type == type_district_label_0e0)
|
511 |
{
|
512 |
return 1;
|
513 |
}
|
514 |
else if (i_type == type_district_label_1e0)
|
515 |
{
|
516 |
return 1;
|
517 |
}
|
518 |
else if (i_type == type_district_label_2e0)
|
519 |
{
|
520 |
return 1;
|
521 |
}
|
522 |
else if (i_type == type_district_label_5e0)
|
523 |
{
|
524 |
return 1;
|
525 |
}
|
526 |
else if (i_type == type_district_label_1e1)
|
527 |
{
|
528 |
return 1;
|
529 |
}
|
530 |
else if (i_type == type_district_label_2e1)
|
531 |
{
|
532 |
return 1;
|
533 |
}
|
534 |
else if (i_type == type_district_label_5e1)
|
535 |
{
|
536 |
return 1;
|
537 |
}
|
538 |
else if (i_type == type_district_label_1e2)
|
539 |
{
|
540 |
return 1;
|
541 |
}
|
542 |
else if (i_type == type_district_label_2e2)
|
543 |
{
|
544 |
return 1;
|
545 |
}
|
546 |
else if (i_type == type_district_label_5e2)
|
547 |
{
|
548 |
return 1;
|
549 |
}
|
550 |
else if (i_type == type_district_label_1e3)
|
551 |
{
|
552 |
return 1;
|
553 |
}
|
554 |
else if (i_type == type_district_label_2e3)
|
555 |
{
|
556 |
return 1;
|
557 |
}
|
558 |
else if (i_type == type_district_label_5e3)
|
559 |
{
|
560 |
return 1;
|
561 |
}
|
562 |
else if (i_type == type_district_label_1e4)
|
563 |
{
|
564 |
return 1;
|
565 |
}
|
566 |
else if (i_type == type_district_label_2e4)
|
567 |
{
|
568 |
return 1;
|
569 |
}
|
570 |
else if (i_type == type_district_label_5e4)
|
571 |
{
|
572 |
return 1;
|
573 |
}
|
574 |
else if (i_type == type_district_label_1e5)
|
575 |
{
|
576 |
return 1;
|
577 |
}
|
578 |
else if (i_type == type_district_label_2e5)
|
579 |
{
|
580 |
return 1;
|
581 |
}
|
582 |
else if (i_type == type_district_label_5e5)
|
583 |
{
|
584 |
return 1;
|
585 |
}
|
586 |
else if (i_type == type_district_label_1e6)
|
587 |
{
|
588 |
return 1;
|
589 |
}
|
590 |
else if (i_type == type_district_label_2e6)
|
591 |
{
|
592 |
return 1;
|
593 |
}
|
594 |
else if (i_type == type_district_label_5e6)
|
595 |
{
|
596 |
return 1;
|
597 |
}
|
598 |
else if (i_type == type_district_label_1e7)
|
599 |
{
|
600 |
return 1;
|
601 |
}
|
602 |
else if (i_type == type_district_label)
|
603 |
{
|
604 |
return 1;
|
605 |
}
|
606 |
else
|
607 |
{
|
608 |
return 0;
|
609 |
}
|
610 |
|
611 |
return 0;
|
612 |
}
|
613 |
|
614 |
int item_is_poi(enum item_type i_type)
|
615 |
// int item_is_poi(int item_type i_type)
|
616 |
{
|
617 |
if (i_type == type_poi_lake)
|
618 |
{
|
619 |
return 1;
|
620 |
}
|
621 |
else if (i_type == type_poi_island)
|
622 |
{
|
623 |
return 1;
|
624 |
}
|
625 |
else if (i_type == type_poi_land_feature)
|
626 |
{
|
627 |
return 1;
|
628 |
}
|
629 |
else if (i_type == type_poi_cape)
|
630 |
{
|
631 |
return 1;
|
632 |
}
|
633 |
else if (i_type == type_poi_rock)
|
634 |
{
|
635 |
return 1;
|
636 |
}
|
637 |
else if (i_type == type_poi_airport)
|
638 |
{
|
639 |
return 1;
|
640 |
}
|
641 |
else if (i_type == type_poi_toll_booth)
|
642 |
{
|
643 |
return 1;
|
644 |
}
|
645 |
else if (i_type == type_poi_fuel)
|
646 |
{
|
647 |
return 1;
|
648 |
}
|
649 |
else if (i_type == type_poi_hotel)
|
650 |
{
|
651 |
return 1;
|
652 |
}
|
653 |
else if (i_type == type_poi_camp_rv)
|
654 |
{
|
655 |
return 1;
|
656 |
}
|
657 |
else if (i_type == type_poi_marina)
|
658 |
{
|
659 |
return 1;
|
660 |
}
|
661 |
else if (i_type == type_poi_attraction)
|
662 |
{
|
663 |
return 1;
|
664 |
}
|
665 |
else if (i_type == type_poi_museum_history)
|
666 |
{
|
667 |
return 1;
|
668 |
}
|
669 |
else if (i_type == type_poi_shopping)
|
670 |
{
|
671 |
return 1;
|
672 |
}
|
673 |
else if (i_type == type_poi_car_dealer_parts)
|
674 |
{
|
675 |
return 1;
|
676 |
}
|
677 |
else if (i_type == type_poi_car_parking)
|
678 |
{
|
679 |
return 1;
|
680 |
}
|
681 |
else if (i_type == type_poi_wreck)
|
682 |
{
|
683 |
return 1;
|
684 |
}
|
685 |
else if (i_type == type_poi_building)
|
686 |
{
|
687 |
return 1;
|
688 |
}
|
689 |
else if (i_type == type_poi_bridge)
|
690 |
{
|
691 |
return 1;
|
692 |
}
|
693 |
else if (i_type == type_poi_park)
|
694 |
{
|
695 |
return 1;
|
696 |
}
|
697 |
else if (i_type == type_poi_water_feature)
|
698 |
{
|
699 |
return 1;
|
700 |
}
|
701 |
else if (i_type == type_poi_bar)
|
702 |
{
|
703 |
return 1;
|
704 |
}
|
705 |
else if (i_type == type_poi_picnic)
|
706 |
{
|
707 |
return 1;
|
708 |
}
|
709 |
else if (i_type == type_poi_hospital)
|
710 |
{
|
711 |
return 1;
|
712 |
}
|
713 |
else if (i_type == type_poi_camping)
|
714 |
{
|
715 |
return 1;
|
716 |
}
|
717 |
else if (i_type == type_poi_public_utilities)
|
718 |
{
|
719 |
return 1;
|
720 |
}
|
721 |
else if (i_type == type_poi_burgerking)
|
722 |
{
|
723 |
return 1;
|
724 |
}
|
725 |
else if (i_type == type_poi_kfc)
|
726 |
{
|
727 |
return 1;
|
728 |
}
|
729 |
else if (i_type == type_poi_mcdonalds)
|
730 |
{
|
731 |
return 1;
|
732 |
}
|
733 |
else if (i_type == type_poi_wienerwald)
|
734 |
{
|
735 |
return 1;
|
736 |
}
|
737 |
else if (i_type == type_poi_dining)
|
738 |
{
|
739 |
return 1;
|
740 |
}
|
741 |
else if (i_type == type_poi_fastfood)
|
742 |
{
|
743 |
return 1;
|
744 |
}
|
745 |
else if (i_type == type_poi_police)
|
746 |
{
|
747 |
return 1;
|
748 |
}
|
749 |
else if (i_type == type_poi_auto_club)
|
750 |
{
|
751 |
return 1;
|
752 |
}
|
753 |
else if (i_type == type_poi_autoservice)
|
754 |
{
|
755 |
return 1;
|
756 |
}
|
757 |
else if (i_type == type_poi_bank)
|
758 |
{
|
759 |
return 1;
|
760 |
}
|
761 |
else if (i_type == type_poi_bay)
|
762 |
{
|
763 |
return 1;
|
764 |
}
|
765 |
else if (i_type == type_poi_bend)
|
766 |
{
|
767 |
return 1;
|
768 |
}
|
769 |
else if (i_type == type_poi_boat_ramp)
|
770 |
{
|
771 |
return 1;
|
772 |
}
|
773 |
else if (i_type == type_poi_border_station)
|
774 |
{
|
775 |
return 1;
|
776 |
}
|
777 |
else if (i_type == type_poi_bowling)
|
778 |
{
|
779 |
return 1;
|
780 |
}
|
781 |
else if (i_type == type_poi_bus_station)
|
782 |
{
|
783 |
return 1;
|
784 |
}
|
785 |
else if (i_type == type_poi_bus_stop)
|
786 |
{
|
787 |
return 1;
|
788 |
}
|
789 |
else if (i_type == type_poi_business_service)
|
790 |
{
|
791 |
return 1;
|
792 |
}
|
793 |
else if (i_type == type_poi_car_rent)
|
794 |
{
|
795 |
return 1;
|
796 |
}
|
797 |
else if (i_type == type_poi_car_wash)
|
798 |
{
|
799 |
return 1;
|
800 |
}
|
801 |
else if (i_type == type_poi_casino)
|
802 |
{
|
803 |
return 1;
|
804 |
}
|
805 |
else if (i_type == type_poi_cemetery)
|
806 |
{
|
807 |
return 1;
|
808 |
}
|
809 |
else if (i_type == type_poi_church)
|
810 |
{
|
811 |
return 1;
|
812 |
}
|
813 |
else if (i_type == type_poi_cinema)
|
814 |
{
|
815 |
return 1;
|
816 |
}
|
817 |
else if (i_type == type_poi_civil_removeme)
|
818 |
{
|
819 |
return 1;
|
820 |
}
|
821 |
else if (i_type == type_poi_communication)
|
822 |
{
|
823 |
return 1;
|
824 |
}
|
825 |
else if (i_type == type_poi_concert)
|
826 |
{
|
827 |
return 1;
|
828 |
}
|
829 |
else if (i_type == type_poi_cove)
|
830 |
{
|
831 |
return 1;
|
832 |
}
|
833 |
else if (i_type == type_poi_crossing)
|
834 |
{
|
835 |
return 1;
|
836 |
}
|
837 |
else if (i_type == type_poi_dam)
|
838 |
{
|
839 |
return 1;
|
840 |
}
|
841 |
else if (i_type == type_poi_danger_area)
|
842 |
{
|
843 |
return 1;
|
844 |
}
|
845 |
else if (i_type == type_poi_danger_sea_wreck)
|
846 |
{
|
847 |
return 1;
|
848 |
}
|
849 |
else if (i_type == type_poi_daymark)
|
850 |
{
|
851 |
return 1;
|
852 |
}
|
853 |
else if (i_type == type_poi_diving)
|
854 |
{
|
855 |
return 1;
|
856 |
}
|
857 |
else if (i_type == type_poi_drinking_water)
|
858 |
{
|
859 |
return 1;
|
860 |
}
|
861 |
else if (i_type == type_poi_emergency)
|
862 |
{
|
863 |
return 1;
|
864 |
}
|
865 |
else if (i_type == type_poi_fair)
|
866 |
{
|
867 |
return 1;
|
868 |
}
|
869 |
else if (i_type == type_poi_firebrigade)
|
870 |
{
|
871 |
return 1;
|
872 |
}
|
873 |
else if (i_type == type_poi_fish)
|
874 |
{
|
875 |
return 1;
|
876 |
}
|
877 |
else if (i_type == type_poi_forbidden_area)
|
878 |
{
|
879 |
return 1;
|
880 |
}
|
881 |
else if (i_type == type_poi_shop_gps)
|
882 |
{
|
883 |
return 1;
|
884 |
}
|
885 |
else if (i_type == type_poi_golf)
|
886 |
{
|
887 |
return 1;
|
888 |
}
|
889 |
else if (i_type == type_poi_government_building)
|
890 |
{
|
891 |
return 1;
|
892 |
}
|
893 |
else if (i_type == type_poi_height)
|
894 |
{
|
895 |
return 1;
|
896 |
}
|
897 |
else if (i_type == type_poi_heliport)
|
898 |
{
|
899 |
return 1;
|
900 |
}
|
901 |
else if (i_type == type_poi_hotspring)
|
902 |
{
|
903 |
return 1;
|
904 |
}
|
905 |
else if (i_type == type_poi_icesport)
|
906 |
{
|
907 |
return 1;
|
908 |
}
|
909 |
else if (i_type == type_poi_information)
|
910 |
{
|
911 |
return 1;
|
912 |
}
|
913 |
else if (i_type == type_poi_justice)
|
914 |
{
|
915 |
return 1;
|
916 |
}
|
917 |
else if (i_type == type_poi_landmark)
|
918 |
{
|
919 |
return 1;
|
920 |
}
|
921 |
else if (i_type == type_poi_levee)
|
922 |
{
|
923 |
return 1;
|
924 |
}
|
925 |
else if (i_type == type_poi_library)
|
926 |
{
|
927 |
return 1;
|
928 |
}
|
929 |
else if (i_type == type_poi_locale)
|
930 |
{
|
931 |
return 1;
|
932 |
}
|
933 |
else if (i_type == type_poi_loudspeaker)
|
934 |
{
|
935 |
return 1;
|
936 |
}
|
937 |
else if (i_type == type_poi_mall)
|
938 |
{
|
939 |
return 1;
|
940 |
}
|
941 |
else if (i_type == type_poi_manmade_feature)
|
942 |
{
|
943 |
return 1;
|
944 |
}
|
945 |
else if (i_type == type_poi_marine)
|
946 |
{
|
947 |
return 1;
|
948 |
}
|
949 |
else if (i_type == type_poi_marine_type)
|
950 |
{
|
951 |
return 1;
|
952 |
}
|
953 |
else if (i_type == type_poi_mark)
|
954 |
{
|
955 |
return 1;
|
956 |
}
|
957 |
else if (i_type == type_poi_military)
|
958 |
{
|
959 |
return 1;
|
960 |
}
|
961 |
else if (i_type == type_poi_mine)
|
962 |
{
|
963 |
return 1;
|
964 |
}
|
965 |
else if (i_type == type_poi_nondangerous)
|
966 |
{
|
967 |
return 1;
|
968 |
}
|
969 |
else if (i_type == type_poi_oil_field)
|
970 |
{
|
971 |
return 1;
|
972 |
}
|
973 |
else if (i_type == type_poi_personal_service)
|
974 |
{
|
975 |
return 1;
|
976 |
}
|
977 |
else if (i_type == type_poi_pharmacy)
|
978 |
{
|
979 |
return 1;
|
980 |
}
|
981 |
else if (i_type == type_poi_post_removeme)
|
982 |
{
|
983 |
return 1;
|
984 |
}
|
985 |
else if (i_type == type_poi_public_office)
|
986 |
{
|
987 |
return 1;
|
988 |
}
|
989 |
else if (i_type == type_poi_repair_service)
|
990 |
{
|
991 |
return 1;
|
992 |
}
|
993 |
else if (i_type == type_poi_resort)
|
994 |
{
|
995 |
return 1;
|
996 |
}
|
997 |
else if (i_type == type_poi_rest_room_removeme)
|
998 |
{
|
999 |
return 1;
|
1000 |
}
|
1001 |
else if (i_type == type_poi_restaurant)
|
1002 |
{
|
1003 |
return 1;
|
1004 |
}
|
1005 |
else if (i_type == type_poi_restricted_area)
|
1006 |
{
|
1007 |
return 1;
|
1008 |
}
|
1009 |
else if (i_type == type_poi_restroom)
|
1010 |
{
|
1011 |
return 1;
|
1012 |
}
|
1013 |
else if (i_type == type_poi_sailing)
|
1014 |
{
|
1015 |
return 1;
|
1016 |
}
|
1017 |
else if (i_type == type_poi_scenic_area)
|
1018 |
{
|
1019 |
return 1;
|
1020 |
}
|
1021 |
else if (i_type == type_poi_school)
|
1022 |
{
|
1023 |
return 1;
|
1024 |
}
|
1025 |
else if (i_type == type_poi_service)
|
1026 |
{
|
1027 |
return 1;
|
1028 |
}
|
1029 |
else if (i_type == type_poi_shop_apparel)
|
1030 |
{
|
1031 |
return 1;
|
1032 |
}
|
1033 |
else if (i_type == type_poi_shop_computer)
|
1034 |
{
|
1035 |
return 1;
|
1036 |
}
|
1037 |
else if (i_type == type_poi_shop_department)
|
1038 |
{
|
1039 |
return 1;
|
1040 |
}
|
1041 |
else if (i_type == type_poi_shop_furnish_removeme)
|
1042 |
{
|
1043 |
return 1;
|
1044 |
}
|
1045 |
else if (i_type == type_poi_shop_grocery)
|
1046 |
{
|
1047 |
return 1;
|
1048 |
}
|
1049 |
else if (i_type == type_poi_shop_handg)
|
1050 |
{
|
1051 |
return 1;
|
1052 |
}
|
1053 |
else if (i_type == type_poi_shop_merchandise)
|
1054 |
{
|
1055 |
return 1;
|
1056 |
}
|
1057 |
else if (i_type == type_poi_shop_retail)
|
1058 |
{
|
1059 |
return 1;
|
1060 |
}
|
1061 |
else if (i_type == type_poi_shower)
|
1062 |
{
|
1063 |
return 1;
|
1064 |
}
|
1065 |
else if (i_type == type_poi_skiing)
|
1066 |
{
|
1067 |
return 1;
|
1068 |
}
|
1069 |
else if (i_type == type_poi_social_service)
|
1070 |
{
|
1071 |
return 1;
|
1072 |
}
|
1073 |
else if (i_type == type_poi_sounding)
|
1074 |
{
|
1075 |
return 1;
|
1076 |
}
|
1077 |
else if (i_type == type_poi_sport)
|
1078 |
{
|
1079 |
return 1;
|
1080 |
}
|
1081 |
else if (i_type == type_poi_stadium)
|
1082 |
{
|
1083 |
return 1;
|
1084 |
}
|
1085 |
else if (i_type == type_poi_subdivision_removeme)
|
1086 |
{
|
1087 |
return 1;
|
1088 |
}
|
1089 |
else if (i_type == type_poi_swimming)
|
1090 |
{
|
1091 |
return 1;
|
1092 |
}
|
1093 |
else if (i_type == type_poi_telephone)
|
1094 |
{
|
1095 |
return 1;
|
1096 |
}
|
1097 |
else if (i_type == type_poi_theater)
|
1098 |
{
|
1099 |
return 1;
|
1100 |
}
|
1101 |
else if (i_type == type_poi_tide)
|
1102 |
{
|
1103 |
return 1;
|
1104 |
}
|
1105 |
else if (i_type == type_poi_tower)
|
1106 |
{
|
1107 |
return 1;
|
1108 |
}
|
1109 |
else if (i_type == type_poi_trail)
|
1110 |
{
|
1111 |
return 1;
|
1112 |
}
|
1113 |
else if (i_type == type_poi_truck_stop)
|
1114 |
{
|
1115 |
return 1;
|
1116 |
}
|
1117 |
else if (i_type == type_poi_tunnel)
|
1118 |
{
|
1119 |
return 1;
|
1120 |
}
|
1121 |
else if (i_type == type_poi_wine)
|
1122 |
{
|
1123 |
return 1;
|
1124 |
}
|
1125 |
else if (i_type == type_poi_worship)
|
1126 |
{
|
1127 |
return 1;
|
1128 |
}
|
1129 |
else if (i_type == type_poi_wrecker)
|
1130 |
{
|
1131 |
return 1;
|
1132 |
}
|
1133 |
else if (i_type == type_poi_zoo)
|
1134 |
{
|
1135 |
return 1;
|
1136 |
}
|
1137 |
else if (i_type == type_poi_gc_multi)
|
1138 |
{
|
1139 |
return 1;
|
1140 |
}
|
1141 |
else if (i_type == type_poi_gc_tradi)
|
1142 |
{
|
1143 |
return 1;
|
1144 |
}
|
1145 |
else if (i_type == type_poi_gc_event)
|
1146 |
{
|
1147 |
return 1;
|
1148 |
}
|
1149 |
else if (i_type == type_poi_gc_mystery)
|
1150 |
{
|
1151 |
return 1;
|
1152 |
}
|
1153 |
else if (i_type == type_poi_gc_question)
|
1154 |
{
|
1155 |
return 1;
|
1156 |
}
|
1157 |
else if (i_type == type_poi_gc_stages)
|
1158 |
{
|
1159 |
return 1;
|
1160 |
}
|
1161 |
else if (i_type == type_poi_gc_reference)
|
1162 |
{
|
1163 |
return 1;
|
1164 |
}
|
1165 |
else if (i_type == type_poi_gc_webcam)
|
1166 |
{
|
1167 |
return 1;
|
1168 |
}
|
1169 |
else if (i_type == type_poi_cafe)
|
1170 |
{
|
1171 |
return 1;
|
1172 |
}
|
1173 |
else if (i_type == type_poi_peak)
|
1174 |
{
|
1175 |
return 1;
|
1176 |
}
|
1177 |
else if (i_type == type_poi_rail_station)
|
1178 |
{
|
1179 |
return 1;
|
1180 |
}
|
1181 |
else if (i_type == type_poi_image)
|
1182 |
{
|
1183 |
return 1;
|
1184 |
}
|
1185 |
else if (i_type == type_poi_townhall)
|
1186 |
{
|
1187 |
return 1;
|
1188 |
}
|
1189 |
else if (i_type == type_poi_level_crossing)
|
1190 |
{
|
1191 |
return 1;
|
1192 |
}
|
1193 |
else if (i_type == type_poi_rail_halt)
|
1194 |
{
|
1195 |
return 1;
|
1196 |
}
|
1197 |
else if (i_type == type_poi_rail_tram_stop)
|
1198 |
{
|
1199 |
return 1;
|
1200 |
}
|
1201 |
else if (i_type == type_poi_wifi)
|
1202 |
{
|
1203 |
return 1;
|
1204 |
}
|
1205 |
else if (i_type == type_poi_bench)
|
1206 |
{
|
1207 |
return 1;
|
1208 |
}
|
1209 |
else if (i_type == type_poi_biergarten)
|
1210 |
{
|
1211 |
return 1;
|
1212 |
}
|
1213 |
else if (i_type == type_poi_boundary_stone)
|
1214 |
{
|
1215 |
return 1;
|
1216 |
}
|
1217 |
else if (i_type == type_poi_castle)
|
1218 |
{
|
1219 |
return 1;
|
1220 |
}
|
1221 |
else if (i_type == type_poi_hunting_stand)
|
1222 |
{
|
1223 |
return 1;
|
1224 |
}
|
1225 |
else if (i_type == type_poi_memorial)
|
1226 |
{
|
1227 |
return 1;
|
1228 |
}
|
1229 |
else if (i_type == type_poi_monument)
|
1230 |
{
|
1231 |
return 1;
|
1232 |
}
|
1233 |
else if (i_type == type_poi_shelter)
|
1234 |
{
|
1235 |
return 1;
|
1236 |
}
|
1237 |
else if (i_type == type_poi_fountain)
|
1238 |
{
|
1239 |
return 1;
|
1240 |
}
|
1241 |
else if (i_type == type_poi_potable_water)
|
1242 |
{
|
1243 |
return 1;
|
1244 |
}
|
1245 |
else if (i_type == type_poi_toilets)
|
1246 |
{
|
1247 |
return 1;
|
1248 |
}
|
1249 |
else if (i_type == type_poi_viewpoint)
|
1250 |
{
|
1251 |
return 1;
|
1252 |
}
|
1253 |
else if (i_type == type_poi_ruins)
|
1254 |
{
|
1255 |
return 1;
|
1256 |
}
|
1257 |
else if (i_type == type_poi_post_box)
|
1258 |
{
|
1259 |
return 1;
|
1260 |
}
|
1261 |
else if (i_type == type_poi_post_office)
|
1262 |
{
|
1263 |
return 1;
|
1264 |
}
|
1265 |
else if (i_type == type_poi_school_university)
|
1266 |
{
|
1267 |
return 1;
|
1268 |
}
|
1269 |
else if (i_type == type_poi_school_college)
|
1270 |
{
|
1271 |
return 1;
|
1272 |
}
|
1273 |
else if (i_type == type_poi_motel)
|
1274 |
{
|
1275 |
return 1;
|
1276 |
}
|
1277 |
else if (i_type == type_poi_guesthouse)
|
1278 |
{
|
1279 |
return 1;
|
1280 |
}
|
1281 |
else if (i_type == type_poi_hostel)
|
1282 |
{
|
1283 |
return 1;
|
1284 |
}
|
1285 |
else if (i_type == type_poi_taxi)
|
1286 |
{
|
1287 |
return 1;
|
1288 |
}
|
1289 |
else if (i_type == type_poi_prison)
|
1290 |
{
|
1291 |
return 1;
|
1292 |
}
|
1293 |
else if (i_type == type_poi_kindergarten)
|
1294 |
{
|
1295 |
return 1;
|
1296 |
}
|
1297 |
else if (i_type == type_poi_shop_butcher)
|
1298 |
{
|
1299 |
return 1;
|
1300 |
}
|
1301 |
else if (i_type == type_poi_shop_baker)
|
1302 |
{
|
1303 |
return 1;
|
1304 |
}
|
1305 |
else if (i_type == type_poi_shop_kiosk)
|
1306 |
{
|
1307 |
return 1;
|
1308 |
}
|
1309 |
else if (i_type == type_poi_soccer)
|
1310 |
{
|
1311 |
return 1;
|
1312 |
}
|
1313 |
else if (i_type == type_poi_basketball)
|
1314 |
{
|
1315 |
return 1;
|
1316 |
}
|
1317 |
else if (i_type == type_poi_baseball)
|
1318 |
{
|
1319 |
return 1;
|
1320 |
}
|
1321 |
else if (i_type == type_poi_climbing)
|
1322 |
{
|
1323 |
return 1;
|
1324 |
}
|
1325 |
else if (i_type == type_poi_motor_sport)
|
1326 |
{
|
1327 |
return 1;
|
1328 |
}
|
1329 |
else if (i_type == type_poi_tennis)
|
1330 |
{
|
1331 |
return 1;
|
1332 |
}
|
1333 |
else if (i_type == type_poi_playground)
|
1334 |
{
|
1335 |
return 1;
|
1336 |
}
|
1337 |
else if (i_type == type_poi_vending_machine)
|
1338 |
{
|
1339 |
return 1;
|
1340 |
}
|
1341 |
else if (i_type == type_poi_recycling)
|
1342 |
{
|
1343 |
return 1;
|
1344 |
}
|
1345 |
else if (i_type == type_poi_hairdresser)
|
1346 |
{
|
1347 |
return 1;
|
1348 |
}
|
1349 |
else if (i_type == type_poi_shop_fruit)
|
1350 |
{
|
1351 |
return 1;
|
1352 |
}
|
1353 |
else if (i_type == type_poi_shop_bicycle)
|
1354 |
{
|
1355 |
return 1;
|
1356 |
}
|
1357 |
else if (i_type == type_poi_shop_florist)
|
1358 |
{
|
1359 |
return 1;
|
1360 |
}
|
1361 |
else if (i_type == type_poi_shop_optician)
|
1362 |
{
|
1363 |
return 1;
|
1364 |
}
|
1365 |
else if (i_type == type_poi_shop_beverages)
|
1366 |
{
|
1367 |
return 1;
|
1368 |
}
|
1369 |
else if (i_type == type_poi_nightclub)
|
1370 |
{
|
1371 |
return 1;
|
1372 |
}
|
1373 |
else if (i_type == type_poi_shop_shoes)
|
1374 |
{
|
1375 |
return 1;
|
1376 |
}
|
1377 |
else if (i_type == type_poi_tree)
|
1378 |
{
|
1379 |
return 1;
|
1380 |
}
|
1381 |
else if (i_type == type_poi_shop_furniture)
|
1382 |
{
|
1383 |
return 1;
|
1384 |
}
|
1385 |
else if (i_type == type_poi_shop_parfum)
|
1386 |
{
|
1387 |
return 1;
|
1388 |
}
|
1389 |
else if (i_type == type_poi_shop_drugstore)
|
1390 |
{
|
1391 |
return 1;
|
1392 |
}
|
1393 |
else if (i_type == type_poi_shop_photo)
|
1394 |
{
|
1395 |
return 1;
|
1396 |
}
|
1397 |
else if (i_type == type_poi_atm)
|
1398 |
{
|
1399 |
return 1;
|
1400 |
}
|
1401 |
else if (i_type == type_poi_custom1)
|
1402 |
{
|
1403 |
return 1;
|
1404 |
}
|
1405 |
else if (i_type == type_poi_custom2)
|
1406 |
{
|
1407 |
return 1;
|
1408 |
}
|
1409 |
else if (i_type == type_poi_custom3)
|
1410 |
{
|
1411 |
return 1;
|
1412 |
}
|
1413 |
else if (i_type == type_poi_custom4)
|
1414 |
{
|
1415 |
return 1;
|
1416 |
}
|
1417 |
else if (i_type == type_poi_custom5)
|
1418 |
{
|
1419 |
return 1;
|
1420 |
}
|
1421 |
else if (i_type == type_poi_custom6)
|
1422 |
{
|
1423 |
return 1;
|
1424 |
}
|
1425 |
else if (i_type == type_poi_custom7)
|
1426 |
{
|
1427 |
return 1;
|
1428 |
}
|
1429 |
else if (i_type == type_poi_custom8)
|
1430 |
{
|
1431 |
return 1;
|
1432 |
}
|
1433 |
else if (i_type == type_poi_custom9)
|
1434 |
{
|
1435 |
return 1;
|
1436 |
}
|
1437 |
else if (i_type == type_poi_customa)
|
1438 |
{
|
1439 |
return 1;
|
1440 |
}
|
1441 |
else if (i_type == type_poi_customb)
|
1442 |
{
|
1443 |
return 1;
|
1444 |
}
|
1445 |
else if (i_type == type_poi_customc)
|
1446 |
{
|
1447 |
return 1;
|
1448 |
}
|
1449 |
else if (i_type == type_poi_customd)
|
1450 |
{
|
1451 |
return 1;
|
1452 |
}
|
1453 |
else if (i_type == type_poi_custome)
|
1454 |
{
|
1455 |
return 1;
|
1456 |
}
|
1457 |
else if (i_type == type_poi_customf)
|
1458 |
{
|
1459 |
return 1;
|
1460 |
}
|
1461 |
else
|
1462 |
{
|
1463 |
return 0;
|
1464 |
}
|
1465 |
|
1466 |
return 0;
|
1467 |
}
|
1468 |
|
1469 |
|
1470 |
enum item_type item_from_name(const char *name)
|
1471 |
{
|
1472 |
int i;
|
1473 |
|
1474 |
for (i = 0; i < sizeof(item_names) / sizeof(struct item_name); i++)
|
1475 |
{
|
1476 |
if (!strcmp(item_names[i].name, name))
|
1477 |
return item_names[i].item;
|
1478 |
}
|
1479 |
return type_none;
|
1480 |
}
|
1481 |
|
1482 |
char *
|
1483 |
item_to_name(enum item_type item)
|
1484 |
{
|
1485 |
int i;
|
1486 |
|
1487 |
for (i = 0; i < sizeof(item_names) / sizeof(struct item_name); i++)
|
1488 |
{
|
1489 |
if (item_names[i].item == item)
|
1490 |
{
|
1491 |
return item_names[i].name;
|
1492 |
}
|
1493 |
}
|
1494 |
|
1495 |
return NULL;
|
1496 |
}
|
1497 |
|
1498 |
struct item_hash
|
1499 |
{
|
1500 |
GHashTable *h;
|
1501 |
};
|
1502 |
|
1503 |
static guint item_hash_hash(gconstpointer key)
|
1504 |
{
|
1505 |
const struct item *itm = key;
|
1506 |
gconstpointer hashkey = (gconstpointer) GINT_TO_POINTER(itm->id_hi ^ itm->id_lo ^ (GPOINTER_TO_INT(itm->map)));
|
1507 |
return g_direct_hash(hashkey);
|
1508 |
}
|
1509 |
|
1510 |
static gboolean item_hash_equal(gconstpointer a, gconstpointer b)
|
1511 |
{
|
1512 |
const struct item *itm_a = a;
|
1513 |
const struct item *itm_b = b;
|
1514 |
|
1515 |
if (item_is_equal(*itm_a, *itm_b))
|
1516 |
{
|
1517 |
return TRUE;
|
1518 |
}
|
1519 |
|
1520 |
return FALSE;
|
1521 |
}
|
1522 |
|
1523 |
unsigned int item_id_hash(const void *key)
|
1524 |
{
|
1525 |
const struct item_id *id = key;
|
1526 |
return id->id_hi ^ id->id_lo;
|
1527 |
}
|
1528 |
|
1529 |
int item_id_equal(const void *a, const void *b)
|
1530 |
{
|
1531 |
const struct item_id *id_a = a;
|
1532 |
const struct item_id *id_b = b;
|
1533 |
return (id_a->id_hi == id_b->id_hi && id_a->id_lo == id_b->id_lo);
|
1534 |
}
|
1535 |
|
1536 |
struct item_hash *
|
1537 |
item_hash_new(void)
|
1538 |
{
|
1539 |
struct item_hash *ret=g_new(struct item_hash, 1);
|
1540 |
|
1541 |
ret->h = g_hash_table_new_full(item_hash_hash, item_hash_equal, g_free_func, NULL);
|
1542 |
return ret;
|
1543 |
}
|
1544 |
|
1545 |
void item_hash_insert(struct item_hash *h, struct item *item, void *val)
|
1546 |
{
|
1547 |
struct item *hitem=g_new(struct item, 1);
|
1548 |
*hitem = *item;
|
1549 |
//dbg(2, "inserting (0x%x,0x%x) into %p\n", item->id_hi, item->id_lo, h->h);
|
1550 |
g_hash_table_insert(h->h, hitem, val);
|
1551 |
}
|
1552 |
|
1553 |
int item_hash_remove(struct item_hash *h, struct item *item)
|
1554 |
{
|
1555 |
int ret;
|
1556 |
|
1557 |
//dbg(2, "removing (0x%x,0x%x) from %p\n", item->id_hi, item->id_lo, h->h);
|
1558 |
ret = g_hash_table_remove(h->h, item);
|
1559 |
//dbg(2, "ret=%d\n", ret);
|
1560 |
|
1561 |
return ret;
|
1562 |
}
|
1563 |
|
1564 |
void *
|
1565 |
item_hash_lookup(struct item_hash *h, struct item *item)
|
1566 |
{
|
1567 |
return g_hash_table_lookup(h->h, item);
|
1568 |
}
|
1569 |
|
1570 |
void item_hash_destroy(struct item_hash *h)
|
1571 |
{
|
1572 |
g_hash_table_destroy(h->h);
|
1573 |
g_free(h);
|
1574 |
}
|
1575 |
|
1576 |
int item_range_intersects_range(struct item_range *range1, struct item_range *range2)
|
1577 |
{
|
1578 |
if (range1->max < range2->min)
|
1579 |
return 0;
|
1580 |
if (range1->min > range2->max)
|
1581 |
return 0;
|
1582 |
return 1;
|
1583 |
}
|
1584 |
int item_range_contains_item(struct item_range *range, enum item_type type)
|
1585 |
{
|
1586 |
if (type >= range->min && type <= range->max)
|
1587 |
return 1;
|
1588 |
return 0;
|
1589 |
}
|
1590 |
|
1591 |
void item_dump_attr_stdout(struct item *item, struct map *map)
|
1592 |
{
|
1593 |
struct attr attr;
|
1594 |
dbg(0, "type=%d:%s\n", item->type, item_to_name(item->type));
|
1595 |
while (item_attr_get(item, attr_any, &attr))
|
1596 |
{
|
1597 |
dbg(0, " %d:%s='%s'", attr.type, attr_to_name(attr.type), attr_to_text(&attr, map, 1));
|
1598 |
// dbg(0," %s\n", attr_to_name(attr.type));
|
1599 |
}
|
1600 |
}
|
1601 |
|
1602 |
void item_dump_attr(struct item *item, struct map *map, FILE *out)
|
1603 |
{
|
1604 |
struct attr attr;
|
1605 |
fprintf(out, "type=%s", item_to_name(item->type));
|
1606 |
while (item_attr_get(item, attr_any, &attr))
|
1607 |
{
|
1608 |
fprintf(out, " %s='%s'", attr_to_name(attr.type), attr_to_text(&attr, map, 1));
|
1609 |
}
|
1610 |
}
|
1611 |
|
1612 |
void item_dump_coords(struct item *item, struct map *map)
|
1613 |
{
|
1614 |
|
1615 |
int i, count, max = 16384;
|
1616 |
struct coord *ca = g_alloca(sizeof(struct coord) * max);
|
1617 |
struct coord_geo geo;
|
1618 |
|
1619 |
count = item_coord_get(item, ca, item->type < type_line ? 1 : max);
|
1620 |
if (item->type < type_line)
|
1621 |
{
|
1622 |
dbg(0, "mg:0x%x 0x%x ", ca[0].x, ca[0].y);
|
1623 |
|
1624 |
transform_to_geo(projection_mg, &(ca[0]), &geo);
|
1625 |
dbg(0, "http://maps.google.com/maps/api/staticmap?size=512x512&markers=color:red|label:AA|%4.6f,%4.6f\n", geo.lat, geo.lng);
|
1626 |
|
1627 |
}
|
1628 |
|
1629 |
item_dump_attr_stdout(item, map);
|
1630 |
|
1631 |
dbg(0, "\n");
|
1632 |
|
1633 |
if (item->type >= type_line)
|
1634 |
{
|
1635 |
for (i = 0; i < count; i++)
|
1636 |
{
|
1637 |
dbg(0, "mg:0x%x 0x%x\n", ca[i].x, ca[i].y);
|
1638 |
|
1639 |
transform_to_geo(projection_mg, &(ca[i]), &geo);
|
1640 |
dbg(0, "http://maps.google.com/maps/api/staticmap?size=512x512&markers=color:red|label:AA|%4.6f,%4.6f\n", geo.lat, geo.lng);
|
1641 |
|
1642 |
}
|
1643 |
}
|
1644 |
}
|
1645 |
|
1646 |
|
1647 |
void item_dump_filedesc(struct item *item, struct map *map, FILE *out)
|
1648 |
{
|
1649 |
|
1650 |
int i, count, max = 16384;
|
1651 |
struct coord *ca = g_alloca(sizeof(struct coord) * max);
|
1652 |
|
1653 |
count = item_coord_get(item, ca, item->type < type_line ? 1 : max);
|
1654 |
if (item->type < type_line)
|
1655 |
fprintf(out, "mg:0x%x 0x%x ", ca[0].x, ca[0].y);
|
1656 |
item_dump_attr(item, map, out);
|
1657 |
fprintf(out, "\n");
|
1658 |
if (item->type >= type_line)
|
1659 |
for (i = 0; i < count; i++)
|
1660 |
fprintf(out, "mg:0x%x 0x%x\n", ca[i].x, ca[i].y);
|
1661 |
}
|
1662 |
|
1663 |
|