/[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 40 Revision 41
2565 { 2565 {
2566 graphics_draw_polyline_clipped(gra, gc, pa, count, width, 1, poly, order, oneway, e->u.polyline.dash_num, &e->color, 0); 2566 graphics_draw_polyline_clipped(gra, gc, pa, count, width, 1, poly, order, oneway, e->u.polyline.dash_num, &e->color, 0);
2567 } 2567 }
2568 } 2568 }
2569 // change color of route if in bicycle-route-mode and we want to drive against the oneway street 2569 // change color of route if in bicycle-route-mode and we want to drive against the oneway street
2570 else if ((dc->type == type_street_route) && (global_vehicle_profile == 1) && ((di->col_int_value >> 26) & 3)) 2570 else if ((dc->type == type_street_route || dc->type == type_street_route_waypoint) && (global_vehicle_profile == 1) && ((di->col_int_value >> 26) & 3))
2571 { 2571 {
2572 // if oneway and route goes against it 2572 // if oneway and route goes against it
2573 if ( ((di->col_int_value >> 24) & 2) && ((di->col_int_value >> 26) & 1) ) 2573 if ( ((di->col_int_value >> 24) & 2) && ((di->col_int_value >> 26) & 1) )
2574 { 2574 {
2575 //struct attr attr_98; 2575 //struct attr attr_98;
3233 //} 3233 //}
3234 3234
3235 // dirty hack to draw "waypoint(s)" --------------------------- 3235 // dirty hack to draw "waypoint(s)" ---------------------------
3236 if (strncmp("Internal", lay->name, 8) == 0) 3236 if (strncmp("Internal", lay->name, 8) == 0)
3237 { 3237 {
3238 // if (global_routing_engine != 1)
3239 {
3238 if (global_navit->route) 3240 if (global_navit->route)
3239 {
3240 if (global_navit->destination_valid == 1)
3241 { 3241 {
3242 if (global_navit->destination_valid == 1)
3243 {
3242 int count_ = 0; 3244 int count_ = 0;
3243 int curr_ = 0; 3245 int curr_ = 0;
3244 count_ = g_list_length(global_navit->route->destinations); 3246 count_ = g_list_length(global_navit->route->destinations);
3245 if (count_ > 1) 3247 if (count_ > 1)
3246 {
3247 if (!global_img_waypoint)
3248 { 3248 {
3249 if (!global_img_waypoint)
3250 {
3249 char *path2; 3251 char *path2;
3250 path2 = graphics_icon_path("nav_waypoint_bk_center.png"); 3252 path2 = graphics_icon_path("nav_waypoint_bk_center.png");
3251 global_img_waypoint = graphics_image_new_scaled_rotated(gra, path2, 59, 59, 0); 3253 global_img_waypoint = graphics_image_new_scaled_rotated(gra, path2, 59, 59, 0);
3252 3254
3253 // compensate for streched images on high dpi devices 3255 // compensate for streched images on high dpi devices
3254 global_img_waypoint->hot.x = (int)((float)global_img_waypoint->width / 2.0f / (float)global_dpi_factor); 3256 global_img_waypoint->hot.x = (int)((float)global_img_waypoint->width / 2.0f / (float)global_dpi_factor);
3255 global_img_waypoint->hot.y = (int)((float)global_img_waypoint->height / 2.0f / (float)global_dpi_factor); 3257 global_img_waypoint->hot.y = (int)((float)global_img_waypoint->height / 2.0f / (float)global_dpi_factor);
3256 3258
3257 //dbg(0, "img_factor=%f\n", (float)global_dpi_factor); 3259 //dbg(0, "img_factor=%f\n", (float)global_dpi_factor);
3258 //dbg(0, "img_h=%d\n", global_img_waypoint->height); 3260 //dbg(0, "img_h=%d\n", global_img_waypoint->height);
3259 //dbg(0, "img_w=%d\n", global_img_waypoint->width); 3261 //dbg(0, "img_w=%d\n", global_img_waypoint->width);
3260 //dbg(0, "img_hotx=%d\n", global_img_waypoint->hot.x); 3262 //dbg(0, "img_hotx=%d\n", global_img_waypoint->hot.x);
3261 //dbg(0, "img_hoty=%d\n", global_img_waypoint->hot.y); 3263 //dbg(0, "img_hoty=%d\n", global_img_waypoint->hot.y);
3262 3264
3263 g_free(path2); 3265 g_free(path2);
3266 }
3267
3268 struct point p2;
3269 struct coord pc77;
3270 GList *ldest = global_navit->route->destinations;
3271 while (ldest)
3272 {
3273 curr_++;
3274 if (curr_ < count_)
3275 {
3276 struct route_info *dst = ldest->data;
3277 pc77.x = dst->c.x;
3278 pc77.y = dst->c.y;
3279 //// dbg(0, "draw1 curr=%d x y: %d %d\n", curr_, dst->c.x, dst->c.y);
3280 enum projection pro = transform_get_projection(global_navit->trans_cursor);
3281 transform(global_navit->trans, pro, &pc77, &p2, 1, 0, 0, NULL);
3282 // transform(global_navit->trans, projection_mg, &pc77, &p2, 1, 0, 0, NULL);
3283 p2.x = p2.x - global_img_waypoint->hot.x; // hot = 29
3284 p2.y = p2.y - global_img_waypoint->hot.y; // hot = 29
3285 gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p2, global_img_waypoint->priv);
3286 }
3287 // next dest. / waypoint
3288 ldest = g_list_next(ldest);
3289 }
3264 } 3290 }
3265
3266 struct point p2;
3267 struct coord pc77;
3268 GList *ldest = global_navit->route->destinations;
3269 while (ldest)
3270 {
3271 curr_++;
3272 if (curr_ < count_)
3273 {
3274 struct route_info *dst = ldest->data;
3275 pc77.x = dst->c.x;
3276 pc77.y = dst->c.y;
3277 //// dbg(0, "draw1 curr=%d x y: %d %d\n", curr_, dst->c.x, dst->c.y);
3278 enum projection pro = transform_get_projection(global_navit->trans_cursor);
3279 transform(global_navit->trans, pro, &pc77, &p2, 1, 0, 0, NULL);
3280 // transform(global_navit->trans, projection_mg, &pc77, &p2, 1, 0, 0, NULL);
3281 p2.x = p2.x - global_img_waypoint->hot.x; // hot = 29
3282 p2.y = p2.y - global_img_waypoint->hot.y; // hot = 29
3283 gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p2, global_img_waypoint->priv);
3284 }
3285 // next dest. / waypoint
3286 ldest = g_list_next(ldest);
3287 }
3288 } 3291 }
3289 } 3292 }
3290 } 3293 }
3291 3294
3292 3295
3293
3294#ifdef NAVIT_ROUTING_DEBUG_PRINT 3296#ifdef NAVIT_ROUTING_DEBUG_PRINT
3297 enum projection pro3 = transform_get_projection(global_navit->trans_cursor);
3298 struct point *p_temp = g_alloca(sizeof(struct point) * (2 + 1));
3299#else
3300#ifdef NAVIT_DEBUG_COORD_LIST
3301 enum projection pro3 = transform_get_projection(global_navit->trans_cursor);
3302 struct point *p_temp = g_alloca(sizeof(struct point) * (2 + 1));
3303#endif
3304#endif
3305
3306
3307#ifdef NAVIT_TRACKING_SHOW_REAL_GPS_POS
3308
3309 if (global_tracking_show_real_gps_pos == 1)
3310 {
3311
3295 // -------- DEBUG -------- draw real GPS position --------- 3312 // -------- DEBUG -------- draw real GPS position ---------
3296 // -------- DEBUG -------- draw real GPS position --------- 3313 // -------- DEBUG -------- draw real GPS position ---------
3297 // -------- DEBUG -------- draw real GPS position --------- 3314 // -------- DEBUG -------- draw real GPS position ---------
3298 if (!global_img_waypoint) 3315 if (!global_img_waypoint)
3299 { 3316 {
3338 3355
3339 p_temp3[1].x = p_temp3[1].x + 35 * (navit_cos(temp_4 * M_PI / 180)); 3356 p_temp3[1].x = p_temp3[1].x + 35 * (navit_cos(temp_4 * M_PI / 180));
3340 p_temp3[1].y = p_temp3[1].y + 35 * (navit_sin(temp_4 * M_PI / 180)); 3357 p_temp3[1].y = p_temp3[1].y + 35 * (navit_sin(temp_4 * M_PI / 180));
3341 3358
3342 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp3, 2, 15, 14, 0, &debug_red2, global_clinedrawing_active, 1); 3359 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp3, 2, 15, 14, 0, &debug_red2, global_clinedrawing_active, 1);
3360
3361
3362#if 0
3363 // WINNER Segment on route segment --------------
3364 struct point *p_temp_win_3 = g_alloca(sizeof(struct point) * (2 + 1));
3365 struct color debug_win_blue2 = { 0x0000,0x0000,0xfafa,0xffff }; // RR GG BB AA
3366 struct point p_win2;
3367
3368 transform(global_navit->trans, pro, &global_debug_route_seg_winner_p_start, &p_win2, 1, 0, 0, NULL);
3369 p_temp_win_3[0].x = p_win2.x - 140;
3370 p_temp_win_3[0].y = p_win2.y;
3371
3372 p_temp_win_3[1].x = p_win2.x + 140;
3373 p_temp_win_3[1].y = p_win2.y;
3374
3375 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp_win_3, 2, 15, 4, 0, &debug_win_blue2, global_clinedrawing_active, 1);
3376
3377 p_temp_win_3[0].x = p_win2.x;
3378 p_temp_win_3[0].y = p_win2.y - 140;
3379
3380 p_temp_win_3[1].x = p_win2.x;
3381 p_temp_win_3[1].y = p_win2.y + 140;
3382
3383 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp_win_3, 2, 15, 4, 0, &debug_win_blue2, global_clinedrawing_active, 1);
3384
3385 // WINNER Segment on route segment --------------
3386#endif
3387
3388#if 0
3389 // WINNER route segment direction --------------
3390
3391 struct color debug_win_green2 = { 0x0000,0xfafa,0x0000,0xffff }; // RR GG BB AA
3392
3393 transform(global_navit->trans, pro, &global_debug_route_seg_winner_start, &p_win2, 1, 0, 0, NULL);
3394
3395 p_temp_win_3[0].x = p_win2.x - 90;
3396 p_temp_win_3[0].y = p_win2.y;
3397
3398 p_temp_win_3[1].x = p_win2.x + 90;
3399 p_temp_win_3[1].y = p_win2.y;
3400
3401 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp_win_3, 2, 15, 12, 0, &debug_win_green2, global_clinedrawing_active, 1);
3402
3403
3404
3405 p_temp_win_3[0].x = p_win2.x;
3406 p_temp_win_3[0].y = p_win2.y;
3407
3408 transform(global_navit->trans, pro, &global_debug_route_seg_winner_end, &p_win2, 1, 0, 0, NULL);
3409
3410 p_temp_win_3[1].x = p_win2.x;
3411 p_temp_win_3[1].y = p_win2.y;
3412
3413 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp_win_3, 2, 15, 42, 0, &debug_win_green2, global_clinedrawing_active, 1);
3414
3415 // WINNER route segment direction --------------
3416#endif
3417
3343 3418
3344 3419
3345 // ------ text ------- 3420 // ------ text -------
3346 graphics_gc_set_foreground(gra->gc[0], &debug_red2); 3421 graphics_gc_set_foreground(gra->gc[0], &debug_red2);
3347 graphics_gc_set_linewidth(gra->gc[0], 8); 3422 graphics_gc_set_linewidth(gra->gc[0], 8);
3361 3436
3362 // -------- DEBUG -------- draw real GPS position --------- 3437 // -------- DEBUG -------- draw real GPS position ---------
3363 // -------- DEBUG -------- draw real GPS position --------- 3438 // -------- DEBUG -------- draw real GPS position ---------
3364 // -------- DEBUG -------- draw real GPS position --------- 3439 // -------- DEBUG -------- draw real GPS position ---------
3365 3440
3441 }
3442
3443#endif
3444
3445#ifdef NAVIT_ROUTING_DEBUG_PRINT
3366 3446
3367 // -------- DEBUG -------- draw winner track segment --------- 3447 // -------- DEBUG -------- draw winner track segment ---------
3368 // -------- DEBUG -------- draw winner track segment --------- 3448 // -------- DEBUG -------- draw winner track segment ---------
3369 // -------- DEBUG -------- draw winner track segment --------- 3449 // -------- DEBUG -------- draw winner track segment ---------
3370 struct color debug_orange = { 0xffff,0x4040,0x0000,0xffff }; // RR GG BB AA 3450 struct color debug_orange = { 0xffff,0x4040,0x0000,0xffff }; // RR GG BB AA
3371 struct point *p_temp = g_alloca(sizeof(struct point) * (2 + 1));
3372 enum projection pro3 = transform_get_projection(global_navit->trans_cursor);
3373 3451
3374 if (global_navit->route) 3452 if (global_navit->route)
3375 { 3453 {
3376 if (global_navit->destination_valid == 1) 3454 if (global_navit->destination_valid == 1)
3377 { 3455 {
3414 transform(global_navit->trans, pro3, &global_debug_seg_route_end, &p_temp[1], 1, 0, 0, NULL); 3492 transform(global_navit->trans, pro3, &global_debug_seg_route_end, &p_temp[1], 1, 0, 0, NULL);
3415 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp, 2, 15, 8, 0, &debug_yellow, global_clinedrawing_active, 1); 3493 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp, 2, 15, 8, 0, &debug_yellow, global_clinedrawing_active, 1);
3416 } 3494 }
3417 } 3495 }
3418 3496
3419 3497 // -------- DEBUG -------- draw winner track segment ---------
3420 3498 // -------- DEBUG -------- draw winner track segment ---------
3421 3499 // -------- DEBUG -------- draw winner track segment ---------
3422 3500#endif
3423 3501
3424 3502
3425// ============================== debug lines ============================== 3503// ============================== debug lines ==============================
3426// ============================== debug lines ============================== 3504// ============================== debug lines ==============================
3427// ============================== debug lines ============================== 3505// ============================== debug lines ==============================
3428#if 0 3506#ifdef NAVIT_DEBUG_COORD_LIST
3429 struct color debug_purple = { 0xffff,0x0000,0xffff,0xffff }; // RR GG BB AA 3507 struct color debug_purple = { 0xffff,0x0000,0xffff,0xffff }; // RR GG BB AA
3430 transform(global_navit->trans, pro3, &global_debug_trlast_start, &p_temp[0], 1, 0, 0, NULL); 3508 transform(global_navit->trans, pro3, &global_debug_trlast_start, &p_temp[0], 1, 0, 0, NULL);
3431 transform(global_navit->trans, pro3, &global_debug_trlast_end, &p_temp[1], 1, 0, 0, NULL); 3509 transform(global_navit->trans, pro3, &global_debug_trlast_end, &p_temp[1], 1, 0, 0, NULL);
3432 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp, 2, 15, 18, 0, &debug_purple, global_clinedrawing_active, 1); 3510 gra->meth.draw_lines3(gra->priv, gra->gc[0]->priv, p_temp, 2, 15, 18, 0, &debug_purple, global_clinedrawing_active, 1);
3433 3511
3496#endif 3574#endif
3497// ============================== debug lines ============================== 3575// ============================== debug lines ==============================
3498// ============================== debug lines ============================== 3576// ============================== debug lines ==============================
3499// ============================== debug lines ============================== 3577// ============================== debug lines ==============================
3500 3578
3501
3502
3503
3504
3505
3506 // -------- DEBUG -------- draw winner track segment ---------
3507 // -------- DEBUG -------- draw winner track segment ---------
3508 // -------- DEBUG -------- draw winner track segment ---------
3509#endif
3510 3579
3511 3580
3512 } 3581 }
3513 // dirty hack to draw "waypoint(s)" --------------------------- 3582 // dirty hack to draw "waypoint(s)" ---------------------------
3514 // dirty hack to draw "route arrows" --------------------------- 3583 // dirty hack to draw "route arrows" ---------------------------
3848 3917
3849 // ------ text ------- 3918 // ------ text -------
3850 // graphics_gc_set_foreground(gra->gc[0], &debug_red2); 3919 // graphics_gc_set_foreground(gra->gc[0], &debug_red2);
3851 // graphics_gc_set_linewidth(gra->gc[0], 8); 3920 // graphics_gc_set_linewidth(gra->gc[0], 8);
3852 struct point p7; 3921 struct point p7;
3853 struct graphics_font *font8 = get_font(gra, 21); 3922 struct graphics_font *font8 = get_font(gra, 24);
3854 char *dir_label=g_strdup_printf("%d", global_sharp_turn_list[ij1].angle); 3923 char *dir_label=g_strdup_printf("%d", global_sharp_turn_list[ij1].angle);
3924 // dbg(0, "st.angle(2)=%d\n", global_sharp_turn_list[ij1].angle);
3855 3925
3856 if (global_sharp_turn_list[ij1].angle > 0) 3926 if (global_sharp_turn_list[ij1].angle > 0)
3857 { 3927 {
3858 p7.x = p_temp13->x + 25; // move text label a bit to the right, so it does not overlap the circle 3928 p7.x = p_temp13->x + 25; // move text label a bit to the right, so it does not overlap the circle
3929 p7.y = p_temp13->y + 25;
3859 p7.y = p_temp13->y + 25 + (int)((float)global_sharp_turn_list[ij1].angle / 2.0f); // move label a bit down (y-axis) 3930 // p7.y = p_temp13->y + 25 + (int)((float)global_sharp_turn_list[ij1].angle / 2.0f); // move label a bit down (y-axis)
3860 } 3931 }
3861 else 3932 else
3862 { 3933 {
3863 p7.x = p_temp13->x + 25; // move text label a bit to the right, so it does not overlap the circle 3934 p7.x = p_temp13->x + 25; // move text label a bit to the right, so it does not overlap the circle
3935 p7.y = p_temp13->y + 0;
3864 p7.y = p_temp13->y + 0 + (int)((float)global_sharp_turn_list[ij1].angle / 2.0f); // move label a bit down (y-axis) 3936 // p7.y = p_temp13->y + 0 + (int)((float)global_sharp_turn_list[ij1].angle / 2.0f); // move label a bit down (y-axis)
3865 } 3937 }
3866 gra->meth.draw_text(gra->priv, gra->gc[0]->priv, NULL, font8->priv, dir_label, &p7, 0x10000, 0); 3938 gra->meth.draw_text(gra->priv, gra->gc[0]->priv, NULL, font8->priv, dir_label, &p7, 0x10000, 0);
3867 g_free(dir_label); 3939 g_free(dir_label);
3868 // ------ text ------- 3940 // ------ text -------
3869 3941
4614 col_int_value = 0; 4686 col_int_value = 0;
4615 } 4687 }
4616 4688
4617 4689
4618 struct attr attr_88; 4690 struct attr attr_88;
4619 if (item->type == type_street_route) 4691 if ((item->type == type_street_route) || (item->type == type_street_route_waypoint))
4620 { 4692 {
4621 if (item_attr_get(item, attr_direction, &attr_88)) 4693 if (item_attr_get(item, attr_direction, &attr_88))
4622 { 4694 {
4623 //dbg(0, "direction(1a1)=%d %x\n", attr_88.u.num, col_int_value); 4695 //dbg(0, "direction(1a1)=%d %x\n", attr_88.u.num, col_int_value);
4624 col_int_value = col_int_value & 0xffffff; 4696 col_int_value = col_int_value & 0xffffff;

Legend:
Removed from v.40  
changed lines
  Added in v.41

   
Visit the ZANavi Wiki