/[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 28 Revision 29
80//# Authors: Martin Schaller (04/2008) 80//# Authors: Martin Schaller (04/2008)
81//############################################################################################################## 81//##############################################################################################################
82 82
83// above what "order" level to show only prerendered map 83// above what "order" level to show only prerendered map
84#define ORDER_USE_PRERENDERED_MAP 0 84#define ORDER_USE_PRERENDERED_MAP 0
85// minimun (line legth * 32) squared (in pixel) to show text label 85// minimum (line legth * 32) squared (in pixel) to show text label
86#define MIN_LINE_LENGTH_FOR_TEXT_2 409600 86#define MIN_LINE_LENGTH_FOR_TEXT_2 409600
87// minimun (line legth * 32) squared (in pixel) to show text label -> for middle segments of streets 87// minimum (line legth * 32) squared (in pixel) to show text label -> for middle segments of streets
88#define MIN_LINE_LENGTH_FOR_TEXT_MIDDLE_2 1638400 88#define MIN_LINE_LENGTH_FOR_TEXT_MIDDLE_2 1638400
89 89
90#define ORDER_LEVEL_FOR_STREET_SIMPLIFY 9 90#define ORDER_LEVEL_FOR_STREET_SIMPLIFY 9
91#define STREET_SIMPLIFY 24 91#define STREET_SIMPLIFY 24
92 92
1405 res->py = y / 2; 1405 res->py = y / 2;
1406 } 1406 }
1407} 1407}
1408 1408
1409 1409
1410// this func. is not obsolete!! and unused!!!! 1410// this func. is now obsolete!! and unused!!!!
1411// this func. is not obsolete!! and unused!!!! 1411// this func. is now obsolete!! and unused!!!!
1412// this func. is not obsolete!! and unused!!!! 1412// this func. is now obsolete!! and unused!!!!
1413static void graphics_draw_polyline_as_polygon(struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count, int *width, int step, int fill, int order, int oneway) 1413static void graphics_draw_polyline_as_polygon(struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count, int *width, int step, int fill, int order, int oneway)
1414{ 1414{
1415 int maxpoints = 200; 1415 int maxpoints = 200;
1416 struct point *res = g_alloca(sizeof(struct point) * maxpoints); 1416 struct point *res = g_alloca(sizeof(struct point) * maxpoints);
1417 struct point pos, poso, neg, nego; 1417 struct point pos, poso, neg, nego;
1572 dxo = -dx; 1572 dxo = -dx;
1573 dyo = -dy; 1573 dyo = -dy;
1574 fowo = fow; 1574 fowo = fow;
1575 } 1575 }
1576} 1576}
1577// this func. is not obsolete!! and unused!!!! 1577// this func. is now obsolete!! and unused!!!!
1578// this func. is not obsolete!! and unused!!!! 1578// this func. is now obsolete!! and unused!!!!
1579// this func. is not obsolete!! and unused!!!! 1579// this func. is now obsolete!! and unused!!!!
1580 1580
1581 1581
1582 1582
1583struct wpoint 1583struct wpoint
1584{ 1584{
1823 struct wpoint p1, p2; 1823 struct wpoint p1, p2;
1824 int i; 1824 int i;
1825 int code; 1825 int code;
1826 int wmax; 1826 int wmax;
1827 int out = 0; 1827 int out = 0;
1828 const int max_segs = 20; 1828 const int max_segs = 2000;
1829 struct point_rect r = gra->r; 1829 struct point_rect r = gra->r;
1830 1830
1831
1832#if 0
1831 // check if whole line is within a 2x2 pixel square 1833 // check if whole line is within a 2x2 pixel square
1832 if (order < 11) 1834 if (order < 11)
1833 { 1835 {
1834 const int max_dist = 2*2; 1836 const int max_dist = 2*2;
1835 int need_draw = 0; 1837 int need_draw = 0;
1864 { 1866 {
1865 // dont draw this line 1867 // dont draw this line
1866 return; 1868 return;
1867 } 1869 }
1868 } 1870 }
1871#endif
1872
1869 1873
1870 // calc visible area on screen 1874 // calc visible area on screen
1871 wmax=width[0]; 1875 wmax=width[0];
1872 r.lu.x-=wmax; 1876 r.lu.x-=wmax;
1873 r.lu.y-=wmax; 1877 r.lu.y-=wmax;
1882 p1.y = pa[i - 1].y; 1886 p1.y = pa[i - 1].y;
1883 p2.x = pa[i].x; 1887 p2.x = pa[i].x;
1884 p2.y = pa[i].y; 1888 p2.y = pa[i].y;
1885 /* 0 = invisible, 1 = completely visible, 2,3 = at least part of line visible */ 1889 /* 0 = invisible, 1 = completely visible, 2,3 = at least part of line visible */
1886 code=clip_line_aprox(&p1, &p2, &r); 1890 code=clip_line_aprox(&p1, &p2, &r);
1891 // code = 1;
1887 1892
1888 if (code > 0) 1893 if (code > 0)
1889 { 1894 {
1890 if (out == 0) 1895 if (out == 0)
1891 { 1896 {
2569 if (draw_it == 1) 2574 if (draw_it == 1)
2570 { 2575 {
2571 entry = get_hash_entry(display_list, dc->type); 2576 entry = get_hash_entry(display_list, dc->type);
2572 if (entry && entry->di) 2577 if (entry && entry->di)
2573 { 2578 {
2574 //dbg(0,"++type=%s\n", item_to_name(dc->type)); 2579 // dbg(0,"++type=%s\n", item_to_name(dc->type));
2575 //if (!strcmp(item_to_name(dc->type), "border_country")) 2580 //if (!strcmp(item_to_name(dc->type), "border_country"))
2576 //{ 2581 //{
2577 // displayitem_draw(entry->di, NULL, dc, display_list->order, 1, 101); 2582 // displayitem_draw(entry->di, NULL, dc, display_list->order, 1, 101);
2578 //} 2583 //}
2579 //else 2584 //else
2580 //{ 2585 //{
2581 displayitem_draw(entry->di, NULL, dc, display_list->order, 1, run_type); 2586 displayitem_draw(entry->di, NULL, dc, display_list->order, 1, run_type);
2582 //} 2587 //}
2583 //dbg(0,"**+gc free\n"); 2588 // dbg(0,"**+gc free\n");
2584 display_context_free(dc); 2589 display_context_free(dc);
2585 } 2590 }
2586 } 2591 }
2587 types = g_list_next(types); 2592 types = g_list_next(types);
2588 draw_it = 1; 2593 draw_it = 1;
2667 int run_type = 0; // 99 -> normal 2672 int run_type = 0; // 99 -> normal
2668 // 1 -> normal streets (except tunnels and bridges) 2673 // 1 -> normal streets (except tunnels and bridges)
2669 // 2 -> tunnel 2674 // 2 -> tunnel
2670 // 3 -> bridge 2675 // 3 -> bridge
2671 2676
2677 int send_refresh = 0;
2678
2672 int order_corrected = order + shift_order; 2679 int order_corrected = order + shift_order;
2673 if (order_corrected < limit_order_corrected) 2680 if (order_corrected < limit_order_corrected)
2674 { 2681 {
2675 order_corrected = limit_order_corrected; 2682 order_corrected = limit_order_corrected;
2676 } 2683 }
2687 { 2694 {
2688 //dbg(0,"MT:7.3.1 - tunnel start\n"); 2695 //dbg(0,"MT:7.3.1 - tunnel start\n");
2689 //draw_lines_count_2 = 0; 2696 //draw_lines_count_2 = 0;
2690 //draw_lines_count_3 = 0; 2697 //draw_lines_count_3 = 0;
2691 //draw_lines_count_4 = 0; 2698 //draw_lines_count_4 = 0;
2699
2700 send_refresh = 1;
2692 2701
2693 run_type = 2; 2702 run_type = 2;
2694 itms = lay->itemgras; 2703 itms = lay->itemgras;
2695 while (itms) 2704 while (itms)
2696 { 2705 {
2854 } 2863 }
2855 } 2864 }
2856 } 2865 }
2857 } 2866 }
2858 // dirty hack to draw "waypoint(s)" --------------------------- 2867 // dirty hack to draw "waypoint(s)" ---------------------------
2868
2869
2870 if (send_refresh == 1)
2871 {
2872 // dummy "ready" signal ------------------------------------------
2873 dbg(0,"dummy \"ready\" signal (layers)\n");
2874 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 96);
2875 // dummy "ready" signal ------------------------------------------
2876 }
2877
2859} 2878}
2860 2879
2861/** 2880/**
2862 * FIXME 2881 * FIXME
2863 * @param <> 2882 * @param <>
2969 } 2988 }
2970 } 2989 }
2971 2990
2972 // reset value; 2991 // reset value;
2973 cancel_drawing_global = 0; 2992 cancel_drawing_global = 0;
2993
2994 // dummy "start" signal ------------------------------------------
2995 dbg(0,"dummy \"start\" signal\n");
2996 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 97);
2997 // dummy "start" signal ------------------------------------------
2998
2999
3000 // dummy "ready" signal ------------------------------------------
3001 dbg(0,"dummy \"ready\" signal\n");
3002 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 99);
3003 // dummy "ready" signal ------------------------------------------
3004
3005
2974 3006
2975#ifdef HAVE_API_ANDROID 3007#ifdef HAVE_API_ANDROID
2976 android_return_generic_int(2, 1); 3008 android_return_generic_int(2, 1);
2977#endif 3009#endif
2978 3010
3377 debug_mrp("do_draw:load", debug_measure_end(s_)); 3409 debug_mrp("do_draw:load", debug_measure_end(s_));
3378#endif 3410#endif
3379 s_ = debug_measure_start(); 3411 s_ = debug_measure_start();
3380 3412
3381 3413
3414 // remove the "wait" screen
3415#ifdef HAVE_API_ANDROID
3416 android_return_generic_int(2, 0);
3417#endif
3418
3419
3382 //DBG dbg(0, "XXXXXYYYYYYY Draw: 004\n"); 3420 //DBG dbg(0, "XXXXXYYYYYYY Draw: 004\n");
3383 3421
3384 // reset value; 3422 // reset value;
3385 cancel_drawing_global = 0; 3423 cancel_drawing_global = 0;
3386 3424
3387 // restore order :-) 3425 // restore order :-)
3388 displaylist->order = saved; 3426 displaylist->order = saved;
3389 3427
3390 // profile(1,"process_selection\n"); 3428 // profile(1,"process_selection\n");
3391 3429
3392 //DBG dbg(0,"ee s\n");
3393 if (displaylist->idle_ev) 3430 if (displaylist->idle_ev)
3394 { 3431 {
3395 event_remove_idle(displaylist->idle_ev); 3432 event_remove_idle(displaylist->idle_ev);
3396 } 3433 }
3397 //DBG dbg(0,"ee e\n"); 3434
3398 displaylist->idle_ev = NULL; 3435 displaylist->idle_ev = NULL;
3399 callback_destroy(displaylist->idle_cb); 3436 callback_destroy(displaylist->idle_cb);
3400 displaylist->idle_cb = NULL; 3437 displaylist->idle_cb = NULL;
3401 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy); 3438 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy);
3402 //displaylist->busy = 0; 3439 //displaylist->busy = 0;
3452 3489
3453 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy); 3490 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy);
3454 displaylist->busy = 0; 3491 displaylist->busy = 0;
3455 3492
3456 //DBG dbg(0, "XXXXXYYYYYYY Draw: 006\n"); 3493 //DBG dbg(0, "XXXXXYYYYYYY Draw: 006\n");
3457
3458#ifdef HAVE_API_ANDROID
3459 android_return_generic_int(2, 0);
3460#endif
3461 3494
3462 map_rect_destroy(displaylist->mr); 3495 map_rect_destroy(displaylist->mr);
3463 if (!route_selection) 3496 if (!route_selection)
3464 { 3497 {
3465 map_selection_destroy(displaylist->sel); 3498 map_selection_destroy(displaylist->sel);
3531 callback_list_call_attr_0(gra->cbl, attr_predraw); 3564 callback_list_call_attr_0(gra->cbl, attr_predraw);
3532 } 3565 }
3533 gra->meth.draw_mode(gra->priv, (flags & 8) ? draw_mode_begin_clear : draw_mode_begin); 3566 gra->meth.draw_mode(gra->priv, (flags & 8) ? draw_mode_begin_clear : draw_mode_begin);
3534 if (!(flags & 2)) 3567 if (!(flags & 2))
3535 { 3568 {
3569 // clear the gfx object pipeline ------------------------------
3570 dbg(0,"clear the gfx object pipeline\n");
3571 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 98);
3572
3536 // clear the display/screen/whatever here 3573 // clear the display/screen/whatever here
3537 gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &gra->r.lu, gra->r.rl.x - gra->r.lu.x, gra->r.rl.y - gra->r.lu.y); 3574 gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &gra->r.lu, gra->r.rl.x - gra->r.lu.x, gra->r.rl.y - gra->r.lu.y);
3538 } 3575 }
3539 if (l) 3576 if (l)
3540 { 3577 {
3621 //dbg(0,"**draw 2.b1\n"); 3658 //dbg(0,"**draw 2.b1\n");
3622 displaylist->idle_cb=callback_new_3(callback_cast(do_draw), displaylist, 0, flags); 3659 displaylist->idle_cb=callback_new_3(callback_cast(do_draw), displaylist, 0, flags);
3623 //dbg(0,"**draw 2.b2\n"); 3660 //dbg(0,"**draw 2.b2\n");
3624 } 3661 }
3625 //dbg(0,"**draw 2.b3\n"); 3662 //dbg(0,"**draw 2.b3\n");
3626 // displaylist->idle_ev=
3627 event_add_idle(1000, displaylist->idle_cb); 3663 displaylist->idle_ev = event_add_idle(1000, displaylist->idle_cb);
3628 //dbg(0,"**draw 2.b4\n"); 3664 dbg(0,"**draw 2.b4 %p\n", displaylist->idle_ev);
3629 } 3665 }
3630 else 3666 else
3631 { 3667 {
3632 //dbg(0,"**draw 2.b5\n"); 3668 //dbg(0,"**draw 2.b5\n");
3633 do_draw(displaylist, 0, flags); 3669 do_draw(displaylist, 0, flags);

Legend:
Removed from v.28  
changed lines
  Added in v.29

   
Visit the ZANavi Wiki