/[zanavi_public1]/navit/navit/graphics.c
ZANavi

Diff of /navit/navit/graphics.c

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

Revision 30 Revision 31
78// nothing todo for android 78// nothing todo for android
79#else 79#else
80// linux seems to need this explicitly 80// linux seems to need this explicitly
81#include "pthread.h" 81#include "pthread.h"
82#endif 82#endif
83
84 83
85static pthread_cond_t uiConditionVariable = PTHREAD_COND_INITIALIZER; 84static pthread_cond_t uiConditionVariable = PTHREAD_COND_INITIALIZER;
86static pthread_mutex_t uiConditionMutex = PTHREAD_MUTEX_INITIALIZER; 85static pthread_mutex_t uiConditionMutex = PTHREAD_MUTEX_INITIALIZER;
87 86
88//############################################################################################################## 87//##############################################################################################################
1763 return ret; 1762 return ret;
1764} 1763}
1765 1764
1766static void graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pa, int count, int *width, int step, int poly, int order, int oneway, int dashes, struct color *c) 1765static void graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pa, int count, int *width, int step, int poly, int order, int oneway, int dashes, struct color *c)
1767{ 1766{
1767#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
1768 dbg(0,"+#+:enter\n");
1769#endif
1770
1768 struct point *p = g_alloca(sizeof(struct point) * (count + 1)); 1771 struct point *p = g_alloca(sizeof(struct point) * (count + 1));
1769 struct wpoint p1, p2; 1772 struct wpoint p1, p2;
1770 int i; 1773 int i;
1771 int code; 1774 int code;
1772 int wmax; 1775 int wmax;
2184 return count; 2187 return count;
2185} 2188}
2186 2189
2187static void displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc, int order, int allow_dashed, int run_type) 2190static void displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc, int order, int allow_dashed, int run_type)
2188{ 2191{
2192#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
2193 dbg(0,"+#+:enter\n");
2194#endif
2195
2189 //// dbg(0, "EEnter\n"); 2196 //// dbg(0, "EEnter\n");
2190 2197
2191 int *width = g_alloca(sizeof(int) * dc->maxlen); 2198 int *width = g_alloca(sizeof(int) * dc->maxlen);
2192 struct point *pa = g_alloca(sizeof(struct point) * dc->maxlen); 2199 struct point *pa = g_alloca(sizeof(struct point) * dc->maxlen);
2193 struct graphics *gra = dc->gra; 2200 struct graphics *gra = dc->gra;
2264 2271
2265 if (item_type_is_area(dc->type) && (dc->e->type == element_polyline || dc->e->type == element_text)) 2272 if (item_type_is_area(dc->type) && (dc->e->type == element_polyline || dc->e->type == element_text))
2266 { 2273 {
2267 count = limit_count(di->c, count); 2274 count = limit_count(di->c, count);
2268 } 2275 }
2276
2269 if (dc->type == type_poly_water_tiled) 2277 if (dc->type == type_poly_water_tiled)
2270 { 2278 {
2271 mindist = 0; 2279 mindist = 0;
2272 }
2273 if (dc->type == type_border_country)
2274 {
2275 if (order < 10) 2280 if (order < 10)
2276 { 2281 {
2277 mindist = 3; 2282 mindist = 3;
2278 } 2283 }
2279 } 2284 }
2285 else if (dc->type == type_border_country)
2286 {
2287 if (order < 10)
2288 {
2289 mindist = 3;
2290 }
2291 }
2292 else if (dc->type == type_poly_wood_from_triang)
2293 {
2294 if (order > 4)
2295 {
2296 // always show triangulates triangles normally
2297 mindist = 0;
2298 }
2299 }
2300 else if (dc->type == type_poly_water_from_triang)
2301 {
2302 if (order > 4)
2303 {
2304 // always show triangulates triangles normally
2305 mindist = 0;
2306 }
2307 }
2308
2280 if (dc->e->type == element_polyline) 2309 if (dc->e->type == element_polyline)
2281 { 2310 {
2282 count = transform(dc->trans, dc->pro, di->c, pa, count, mindist, e->u.polyline.width, width); 2311 count = transform(dc->trans, dc->pro, di->c, pa, count, mindist, e->u.polyline.width, width);
2283 } 2312 }
2284 else 2313 else
2522 } 2551 }
2523 2552
2524 dc->type = GPOINTER_TO_INT(types->data); 2553 dc->type = GPOINTER_TO_INT(types->data);
2525 //// dbg(0,"**type=%d\n", dc->type); 2554 //// dbg(0,"**type=%d\n", dc->type);
2526 2555
2556 if (global_draw_multipolygons == 0)
2557 {
2527 if (dc->type == type_poly_water_from_relations) 2558 if (dc->type == type_poly_water_from_relations)
2528 { 2559 {
2529 // ok "poly_water_from_relations" is found, now what? 2560 // ok "poly_water_from_relations" is found, now what?
2530 if (enable_water_from_relations == 0) 2561 draw_it = 0;
2562 }
2563 else if (dc->type == type_poly_water_from_triang)
2564 {
2565 draw_it = 0;
2566 }
2567 else if (dc->type == type_wood_from_relations)
2568 {
2569 draw_it = 0;
2570 }
2571 else if (dc->type == type_poly_wood_from_triang)
2572 {
2573 draw_it = 0;
2574 }
2575 else if (dc->type == type_poly_building_from_triang)
2531 { 2576 {
2532 draw_it = 0; 2577 draw_it = 0;
2533 } 2578 }
2534 } 2579 }
2535 2580
3017 3062
3018static void do_draw(struct displaylist *displaylist, int cancel, int flags) 3063static void do_draw(struct displaylist *displaylist, int cancel, int flags)
3019{ 3064{
3020 3065
3021#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3066#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3022 // dbg(0,"+#+:enter\n"); 3067 dbg(0,"+#+:enter\n");
3023#endif 3068#endif
3024 3069
3025 int rnd = rand(); 3070 // int rnd = rand();
3026
3027 // dbg(0, "DO__DRAW:%d enter\n", rnd); 3071 // dbg(0, "DO__DRAW:%d enter\n", rnd);
3028 3072
3029 // try to cancel any previous drawing that might be going on ... 3073 // try to cancel any previous drawing that might be going on ...
3030 // try to cancel any previous drawing that might be going on ... 3074 // try to cancel any previous drawing that might be going on ...
3031 // try to cancel any previous drawing that might be going on ... 3075 // try to cancel any previous drawing that might be going on ...
3187 // ------ READ all items in this map rectangle --------- 3231 // ------ READ all items in this map rectangle ---------
3188 // ------ READ all items in this map rectangle --------- 3232 // ------ READ all items in this map rectangle ---------
3189 // ------ READ all items in this map rectangle --------- 3233 // ------ READ all items in this map rectangle ---------
3190 // ------ READ all items in this map rectangle --------- 3234 // ------ READ all items in this map rectangle ---------
3191 // ------ READ all items in this map rectangle --------- 3235 // ------ READ all items in this map rectangle ---------
3192 //// dbg(0,"#+* start reading map file #+*\n"); 3236 // dbg(0,"#+* start reading map file #+*\n");
3193 int _item_counter_ = 0; 3237 int _item_counter_ = 0;
3194 while ((item = map_rect_get_item(displaylist->mr))) 3238 while ((item = map_rect_get_item(displaylist->mr)))
3195 { 3239 {
3196 _item_counter_++; 3240 _item_counter_++;
3197 3241
3256 3300
3257 //// dbg(0, "XXXXXYYYYYYY Draw: A.item2\n"); 3301 //// dbg(0, "XXXXXYYYYYYY Draw: A.item2\n");
3258 3302
3259 if (displaylist->dc.pro != pro) 3303 if (displaylist->dc.pro != pro)
3260 { 3304 {
3305 dbg(0,"from to\n");
3261 transform_from_to_count(ca, displaylist->dc.pro, ca, pro, count); 3306 transform_from_to_count(ca, displaylist->dc.pro, ca, pro, count);
3262 } 3307 }
3263 3308
3264 if (count == max) 3309 if (count == max)
3265 { 3310 {
3268 } 3313 }
3269 3314
3270 if (item_is_custom_poi(*item)) 3315 if (item_is_custom_poi(*item))
3271 { 3316 {
3272 if (item_attr_get(item, attr_icon_src, &attr2)) 3317 if (item_attr_get(item, attr_icon_src, &attr2))
3318 {
3273 labels[1] = map_convert_string(displaylist->m, attr2.u.str); 3319 labels[1] = map_convert_string(displaylist->m, attr2.u.str);
3320 }
3274 else 3321 else
3322 {
3275 labels[1] = NULL; 3323 labels[1] = NULL;
3324 }
3276 label_count = 2; 3325 label_count = 2;
3277 } 3326 }
3278 else 3327 else
3279 { 3328 {
3280 labels[1] = NULL; 3329 labels[1] = NULL;
3281 label_count = 0; 3330 label_count = 0;
3282 } 3331 }
3332
3333 // DEBUG -------- zoffzoff
3334 // DEBUG -------- zoffzoff
3335 // DEBUG -------- zoffzoff
3336 // item_dump_attr_stdout(item, displaylist->m);
3337 // DEBUG -------- zoffzoff
3338 // DEBUG -------- zoffzoff
3339 // DEBUG -------- zoffzoff
3283 3340
3284 if (item_attr_get(item, attr_label, &attr)) 3341 if (item_attr_get(item, attr_label, &attr))
3285 { 3342 {
3286 labels[0] = attr.u.str; 3343 labels[0] = attr.u.str;
3287 if (!label_count) 3344 if (!label_count)
3362 3419
3363 // dbg(0,"return 003\n"); 3420 // dbg(0,"return 003\n");
3364 return; 3421 return;
3365 } 3422 }
3366 */ 3423 */
3424
3367 } // while item=map_rect_get_item 3425 } // while item=map_rect_get_item
3368 // ------ READ all items in this map rectangle --------- 3426 // ------ READ all items in this map rectangle ---------
3369 // ------ READ all items in this map rectangle --------- 3427 // ------ READ all items in this map rectangle ---------
3370 // ------ READ all items in this map rectangle --------- 3428 // ------ READ all items in this map rectangle ---------
3371 // ------ READ all items in this map rectangle --------- 3429 // ------ READ all items in this map rectangle ---------
3536 3594
3537 // dbg(0, "DO__DRAW:%d leave\n", rnd); 3595 // dbg(0, "DO__DRAW:%d leave\n", rnd);
3538 // dbg(0, "DO__DRAW:%d __\n", rnd); 3596 // dbg(0, "DO__DRAW:%d __\n", rnd);
3539 3597
3540#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3598#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3541 // dbg(0,"+#+:leave\n"); 3599 dbg(0,"+#+:leave\n");
3542#endif 3600#endif
3543 3601
3544} 3602}
3545 3603
3546/** 3604/**
3550 * @author Martin Schaller (04/2008) 3608 * @author Martin Schaller (04/2008)
3551 */ 3609 */
3552void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags) 3610void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags)
3553{ 3611{
3554#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3612#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3555 // dbg(0,"+#+:enter\n"); 3613 dbg(0,"+#+:enter\n");
3556#endif 3614#endif
3557 3615
3558 // // dbg(0,"ooo enter ooo flags=%d\n", flags); 3616 // // dbg(0,"ooo enter ooo flags=%d\n", flags);
3559 3617
3560 3618
3563 displaylist->dc.gra = gra; 3621 displaylist->dc.gra = gra;
3564 3622
3565 // *********DISABLED******* 3623 // *********DISABLED*******
3566 // *********DISABLED******* 3624 // *********DISABLED*******
3567 // *********DISABLED******* 3625 // *********DISABLED*******
3568 // set min. distanct of 2 points on line at which a point will be left out when zoomed out too much!! 3626 // set min. distancte of 2 points on line at which a point will be left out when zoomed out too much!!
3569 // *********DISABLED******* displaylist->dc.mindist = transform_get_scale(trans) / 2; 3627 // *********DISABLED******* displaylist->dc.mindist = transform_get_scale(trans) / 2;
3570 //// dbg(0,"mindist would be:%d\n", (int)(transform_get_scale(trans) / 2)); 3628 //// dbg(0,"mindist would be:%d\n", (int)(transform_get_scale(trans) / 2));
3571 displaylist->dc.mindist = 0; 3629 displaylist->dc.mindist = 0;
3572 if (order < 13) 3630 if (order < 8)
3631 {
3632 displaylist->dc.mindist = transform_get_scale(trans) * 2;
3633 }
3634 else if (order < 13)
3573 { 3635 {
3574 displaylist->dc.mindist = transform_get_scale(trans); 3636 displaylist->dc.mindist = transform_get_scale(trans);
3575 } 3637 }
3576 // *********DISABLED******* 3638 // *********DISABLED*******
3577 // *********DISABLED******* 3639 // *********DISABLED*******
3616 { 3678 {
3617 gra->meth.draw_mode(gra->priv, draw_mode_end); 3679 gra->meth.draw_mode(gra->priv, draw_mode_end);
3618 } 3680 }
3619 3681
3620#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3682#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3621 // dbg(0,"+#+:leave\n"); 3683 dbg(0,"+#+:leave\n");
3622#endif 3684#endif
3623 3685
3624} 3686}
3625 3687
3626static void graphics_load_mapset(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags) 3688static void graphics_load_mapset(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags)

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

   
Visit the ZANavi Wiki